[comp.unix.questions] RCS problem

bbh@whizz.uucp (Bud Hovell) (01/12/90)

Well, I guess I must be suffering terminal stupidity, but I *cannot*
figure out what I'm doing wrong here. The mystery is that the problem
only happens *sometimes* - rarely, actually. It is the fact that it
seems to work fine most of the time that is particularly maddening.
:-)

I 'ci' an original document having the following heading:

# $Id$
#
# $Log$
#

............but when I 'co' it thereafter, it comes back:

# $Id: Pnews.header,v 1.1 90/01/11 14:52:00 bbh Exp Locker: bbh $
#
# $Log:	Pnews.header,v $
Revision 1.1  90/01/11  14:52:00  bbh
Initial revision

#

For some reason, the log comments are not preceeded by a "#".

I know I am doing *something* wrong. Can someone explain what it is?
 
                                 Bud
________________________________________________________________________
UUCP: ...{tektronix|sun}!nosun!whizz!bbh       (Just another pilgrim :-)
MOTD: "Tuva or Bust!" - Richard Fehnman

jik@athena.mit.edu (Jonathan I. Kamens) (01/15/90)

In article <1000@whizz.uucp>, bbh@whizz.uucp (Bud Hovell) asks why log
comments are not preceded by "# " when he checks in the file
Pnews.header and then checks it out again.

From the man page for rcs(1):

     -cstring   sets the comment leader to string. The comment
                leader is printed before every log message line
                generated by the keyword $Log$  during checkout
                (see co). This is useful for programming
                languages without multi-line comments. During rcs
                                                       ^^^^^^^^^^
                -i or initial ci, the comment leader is guessed
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                from the suffix of the working file.
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

It pretty much sucks that the man page does not elaborate on how the
"guessing" is done.  The file rcsfnms.c in the sources contains the
following table:

struct compair comtable[] = {
/* comtable pairs each filename suffix with a comment leader. The comment   */
/* leader is placed before each line generated by the $Log keyword. This    */
/* table is used to guess the proper comment leader from the working file's */
/* suffix during initial ci (see InitAdmin()). Comment leaders are needed   */
/* for languages without multiline comments; for others they are optional.  */
        "c",   " * ",   /* C           */
	"csh", "# ",    /* shell       */
        "e",   "# ",    /* efl         */
        "f",   "c ",    /* fortran     */
        "h",   " * ",   /* C-header    */
        "l",   " * ",   /* lex         NOTE: conflict between lex and
franzlisp*/
        "mac", "; ",    /* macro       vms or dec-20 or pdp-11 macro */
        "me",  "\\\" ", /* me-macros   t/nroff*/
	"mm",  "\\\" ", /* mm-macros   t/nroff*/
        "ms",  "\\\" ", /* ms-macros   t/nroff*/
        "p",   " * ",   /* pascal      */
        "r",   "# ",    /* ratfor      */
        "red", "% ",    /* psl/rlisp   */

#ifdef sparc
        "s",   "! ",    /* assembler   */
#endif
#ifdef mc68000
        "s",   "| ",    /* assembler   */
#endif
#ifdef pdp11
        "s",   "/ ",    /* assembler   */
#endif
#ifdef vax
        "s",   "# ",    /* assembler   */
#endif

        "sh",  "# ",    /* shell       */
        "sl",  "% ",    /* psl         */
        "red", "% ",    /* psl/rlisp   */
        "cl",  ";;; ",  /* common lisp   */
        "ml",  "; ",    /* mocklisp    */
        "el",  "; ",    /* gnulisp     */
	"tex", "% ",	/* tex	       */
        "y",   " * ",   /* yacc        */
        "ye",  " * ",   /* yacc-efl    */
        "yr",  " * ",   /* yacc-ratfor */
        "",    "# ",    /* default for empty suffix */
        nil,   ""       /* default for unknown suffix; must always be last */
};

  What you need to do is first check in the file, then use the -c option
of the rcs command to change the comment leader, then check it out, and
you should be OK.

  The other thing you can do is create an empty rcs file with the
correct comment leader using "rcs -i -c'# ' Pnews.header", then actually
check in the first revision of the file.

Jonathan Kamens			              USnail:
MIT Project Athena				11 Ashford Terrace
jik@Athena.MIT.EDU				Allston, MA  02134
Office: 617-253-8495			      Home: 617-782-0710

lwall@jpl-devvax.JPL.NASA.GOV (Larry Wall) (01/16/90)

In article <1990Jan15.043956.21644@athena.mit.edu> jik@athena.mit.edu (Jonathan I. Kamens) writes:
: 
: In article <1000@whizz.uucp>, bbh@whizz.uucp (Bud Hovell) asks why log
: comments are not preceded by "# " when he checks in the file
: Pnews.header and then checks it out again.
: 
: From the man page for rcs(1):
: 
:      -cstring   sets the comment leader to string. The comment
:                 leader is printed before every log message line
:                 generated by the keyword $Log$  during checkout
:                 (see co). This is useful for programming
:                 languages without multi-line comments. During rcs
:                                                        ^^^^^^^^^^
:                 -i or initial ci, the comment leader is guessed
:                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
:                 from the suffix of the working file.
:                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
: 
: It pretty much sucks that the man page does not elaborate on how the
: "guessing" is done.  The file rcsfnms.c in the sources contains the
: following table:
:
: [table deleted]

While rcs has a lot to be said in its favor, I've always thought it was
Really Silly that rcs doesn't just go out and look to see how $Log$ is
commented already, and use that for the default.  It's almost always
perfectly obvious from that line what the comment leader should be.
Of course, you don't necessarily have the file at rcs -i time, but you
certainly have it before you really need to know the comment leader.

This solution would be space efficient, more portable, more succinct,
more upwardly comptible with new filename conventions, and more often right.

Larry Wall
lwall@jpl-devvax.jpl.nasa.gov