GCOS field

Guy Harris guy at auspex.UUCP
Sun Dec 4 18:06:55 AEST 1988


>I'm not sure what you mean by "sets them both to point..." but if you
>try putpwent on Ultrix, Xenix, or V/386 it seems to use the GCOS field
>and ignore the comment field.

It can't choose both, so it has to ignore one; the code that sets the
"comment" field may be a recent innovation antedating "putpwent" (I lack
access to sources of sufficiently old releases to check this), so for
historical reasons "putpwent" would use the "gecos" field.

It is probably not a *good* innovation; it might be nice if the field
had been named "comment", but it's probably not worth fixing now (it may
be too late to fix it anyway).  If somebody wants to fix names, perhaps
they should think about changing "creat" to "create" :-) :-) :-) :-). 
(I seem to remember a comment along the lines of either "if I did UNIX
again, the only thing I'd change is that I'd call 'creat' 'create" or
"if I did UNIX again, I'd have called 'creat' 'create'" being ascribed
to Ken Thomson; did he actually say something like either of those, and
what did he actually say?)

Basically, programmers should pretend the "pw_comment" field is a filler
field, not containing anything and not used.

By "sets them both to point" I meant "sets them both to point";
"getpwent" implementations generally read a line from the password file
into a buffer, stuff '\0's into the buffer to cut it into fields, and
set the "char *" members of the "struct passwd" structure to point into
that buffer; the S5R3 implementation sets both "pw_comment" and
"pw_gecos" to point to the same place in the buffer, namely the
beginning of the GCOS field.



More information about the Comp.unix.questions mailing list