chenr@tilt.FUN (Ray Chen) (11/30/84)
File: (whatever)/rcs/src/rcs/ci.c Description: ci allows names following -[nN] to have name delimiter characters such as white space in them. This results in later operations on the file producing errors. Repeat-by: ci -n"test 1" file ci -Ntest2 file Fix: The problem results from the fact the routine checkid() checks a symbol for validity but stops on symbol delimiting characters, the set of which which includes characters other than \0. ci, however, assumes that the entire name string is a valid symbol if no error occurs, so it installs the entire string as the name. This results in a situation where a name could be installed consisting of one valid symbol and an arbitrary number of possibly invalid symbols. The fix is simply to make ci use the information that checkid() returns -- a pointer to the character it stopped on, and to exit with a fatal error (and error message) if the delimiting character was a non-NULL one. Ray Chen princeton!tilt!chenr ----------Diffs follow------------------------------- RCS file: RCS/ci.c,v retrieving revision 3.9 retrieving revision 3.10 diff -c -r3.9 -r3.10 *** /tmp/,RCSt1011713 Fri Nov 30 01:54:16 1984 --- /tmp/,RCSt2011713 Fri Nov 30 01:54:24 1984 *************** *** 2,8 * RCS checkin operation */ static char rcsid[]= ! "$Header: ci.c,v 3.9 83/02/15 15:25:44 wft Exp $ Purdue CS"; /******************************************************************* * check revisions into RCS files ******************************************************************* --- 2,8 ----- * RCS checkin operation */ static char rcsid[]= ! "$Header: ci.c,v 3.10 84/11/30 01:23:01 chenr Exp $ Purdue CS"; /******************************************************************* * check revisions into RCS files ******************************************************************* *************** *** 21,26 /* $Log: ci.c,v $ * Revision 3.9 83/02/15 15:25:44 wft * original ci.c * --- 21,32 ----- /* $Log: ci.c,v $ + * Revision 3.10 84/11/30 01:23:01 chenr + * Added char *nametest to force name in -[nN]name to be a one word + * symbol. If this isn't the case, then ci aborts with a fatal error. + * A quick and dirty fix to prevent names from being placed into the + * delta files that won't be properly handled later. + * * Revision 3.9 83/02/15 15:25:44 wft * original ci.c * *************** *** 126,131 { register int i; register char * sp, *tp; char * cmdusage; /* holds command format */ char command[NCPPN+50]; /* holds diff commands */ char curdate[datelength];/* date for new delta */ --- 132,138 ----- { register int i; register char * sp, *tp; + char *nametest; char * cmdusage; /* holds command format */ char command[NCPPN+50]; /* holds diff commands */ char curdate[datelength];/* date for new delta */ *************** *** 197,203 if ((*argv)[2]!='\0'){ if (symbol!=nil)warn("Redefinition of symbolic name"); symbol = (*argv)+2; ! checkid(symbol,' '); } else warn("Missing name for -n option"); break; --- 204,212 ----- if ((*argv)[2]!='\0'){ if (symbol!=nil)warn("Redefinition of symbolic name"); symbol = (*argv)+2; ! if ((nametest = checkid(symbol,' ')) != NULL) ! faterror("Name %s must be one word", ! symbol); } else warn("Missing name for -n option"); break; *************** *** 206,212 if ((*argv)[2]!='\0'){ if (symbol!=nil)warn("Redefinition of symbolic name"); symbol = (*argv)+2; ! checkid(symbol,' '); } else warn("Missing name for -N option"); break; --- 215,223 ----- if ((*argv)[2]!='\0'){ if (symbol!=nil)warn("Redefinition of symbolic name"); symbol = (*argv)+2; ! if ((nametest = checkid(symbol,' ')) != NULL) ! faterror("Name %s must be one word", ! symbol); } else warn("Missing name for -N option"); break;