lib{F,I,U}77/mkvers hangs if no sccs id string is found. +Fix
Gary Winiger
gww at beatnix.UUCP
Sun Mar 13 06:16:06 AEST 1988
Subject: lib{F,I,U}77/mkvers hangs if no sccs id is found +Fix
Index: lib{F,I,U}77/mkvers.c 4.3BSD +Fix
Description:
Mkvers will hang in an infinite loop if a file being scanned does not
contain an sccs ``what'' string but does contain the character '@'.
Repeat-By:
Create a file with the character '@' in it, but with no ``what''
string.
Run mkvers on that file.
Fix:
There are really two problems to be fixed.
First, if a '@' is found by the index(3) call, but the remainder of
a ``what'' string is not found, mkvers will continually loop on
that '@' character. Advance the pointer ``s''.
Second, the end of file condition on stdin is never cleared when
a file is read to EOF. Clear the EOF.
The attached code solves this problem at Elxsi.
Gary..
{ucbvax!sun,lll-lcc!lll-tis,amdahl!altos86,bridge2}!elxsi!gww
--------- cut --------- snip --------- :.,$w diff -------------
*** mkvers.c Tue Oct 20 10:33:25 1987
--- newmkvers.c Tue Oct 20 10:35:44 1987
***************
*** 67,72 ****
--- 67,74 ----
while(s = index(s, '@'))
if (strncmp(s, SCCS_ID, 4) == 0)
break;
+ else
+ ++s;
if (s)
{
e = index(s, '"');
***************
*** 77,83 ****
--- 79,88 ----
}
}
if (feof(stdin))
+ {
fprintf(stderr, "%s: no sccs id string\n", *argv);
+ clearerr(stdin);
+ }
}
fprintf(V, "};\n");
fclose(V);
More information about the Comp.bugs.4bsd.ucb-fixes
mailing list