C
Charles Ulrich
Greetings,
I hope my greenness isn't showing too bad by asking this, but I ran across
this trivial program today that left me flabbergasted:
#define MESSAGE "This account is currently not available.\n"
int
main(int argc, char *argv[])
{
write(STDOUT_FILENO, MESSAGE, sizeof(MESSAGE));
_exit(1);
}
This is an excerpt from the newly-rewritten nologin(8) in FreeBSD. I am
not willing to accept that the person who committed this code is a fool,
thus I have to conclude that I just don't understand why exactly the
following isn't good enough for such a trivial program:
puts("This account is currently not available.");
Perhaps write() would be appropriate in a program which did intensive
amounts of output, but the meat of this program is literally 1 line long.
I tried doing a Google search, but as you can imagine, the commonality of
the "write" keyword throws off any results that might be useful, so I was
wondering some kind, generous person here could clue me in on what's going
on here. I'd greatly appreciate it.
Charles Ulrich
I hope my greenness isn't showing too bad by asking this, but I ran across
this trivial program today that left me flabbergasted:
#define MESSAGE "This account is currently not available.\n"
int
main(int argc, char *argv[])
{
write(STDOUT_FILENO, MESSAGE, sizeof(MESSAGE));
_exit(1);
}
This is an excerpt from the newly-rewritten nologin(8) in FreeBSD. I am
not willing to accept that the person who committed this code is a fool,
thus I have to conclude that I just don't understand why exactly the
following isn't good enough for such a trivial program:
puts("This account is currently not available.");
Perhaps write() would be appropriate in a program which did intensive
amounts of output, but the meat of this program is literally 1 line long.
I tried doing a Google search, but as you can imagine, the commonality of
the "write" keyword throws off any results that might be useful, so I was
wondering some kind, generous person here could clue me in on what's going
on here. I'd greatly appreciate it.
Charles Ulrich