[771] in Moira

home help back first fref pref prev next nref lref last post

Re: com_err shouldn't print '\r' after '\n' when printing errors

daemon@ATHENA.MIT.EDU (Theodore Ts'o)
Thu Sep 8 13:05:36 1994

Date: Thu, 8 Sep 1994 13:05:24 +0500
From: Theodore Ts'o <tytso@MIT.EDU>
To: "Jonathan I. Kamens" <jik@cam.ov.com>
Cc: tytso@MIT.EDU, krb5-bugs@MIT.EDU, bug-zephyr@MIT.EDU, bugs@MIT.EDU,
        bug-moira@MIT.EDU
In-Reply-To: [717]

   I often use com_err programs in "terminals" that display control
   characters, e.g., in Emacs shell windows and while running "script".
   The extra ^M's printed by com_err programs clutter up the output in
   such cases and are ugly to boot.

... sounds to me like this is something which Emacs shell and script
should filter out....

   I understand your argument that com_err should print the ^M's so that
   the right thing happens whenever possible, but I disagree with it,
   because it's a gross hack which is not, in my opinion, consistent with
   the UNIX philosophy.  Tools should do their own jobs, and nothing
   else.  There are a slew of other standard UNIX programs which arguably
   should print ^M's if com_err does, and they don't.  Can you name *one*
   other UNIX program which prints "\r\n" or "\n\r" instead of just "\n"
   for the reason you described?

com_err isn't a program; it's a subroutine package, and it simply
doesn't know how its caller might have set up the terminal modes.

   It seems to me that applications which are overly concerned about the
   possibility that they might screw up the tty (and applications which
   mess with the tty usually know that they do) should put "\r\n" instead
   of "\n" in their com_err messages themselves.

The problem is that applications don't put the "\n" into the com_err
messages; both the \n and \r are printed by the com_err routine itself.

   Incidentally, \n\r vs. \r\n does make a difference, in my opinion,
   because at least when it's \r\n like it's supposed to be, all the ^M's
   are at the end of lines and easily ignored.  When it's \n\r, ^M's end
   up at beginnings of lines, which looks really gross when they're
   visible.

I have no objections to reversing the order which \n and \r are printed.

							- Ted


home help back first fref pref prev next nref lref last post