output). Minor whitespace cleanup.
SCCS-vsn: usr.bin/locate/code/locate.code.c 4.9
#endif /* not lint */
#ifndef lint
#endif /* not lint */
#ifndef lint
-static char sccsid[] = "@(#)locate.code.c 4.8 (Berkeley) %G%";
+static char sccsid[] = "@(#)locate.code.c 4.9 (Berkeley) %G%";
* /usr/src/cmd/armadillo.c 14 armadillo.c
* /usr/tmp/zoo 5 tmp/zoo
*
* /usr/src/cmd/armadillo.c 14 armadillo.c
* /usr/tmp/zoo 5 tmp/zoo
*
- * 0-28 likeliest differential counts + offset to make nonnegative
+ * 0-28 likeliest differential counts + offset to make nonnegative
* 30 switch code for out-of-range count to follow in next word
* 128-255 bigram codes (128 most common, as determined by 'updatedb')
* 32-127 single character (printable) ascii residue (ie, literal)
*
* SEE ALSO: updatedb.csh, bigram.c, find.c
* 30 switch code for out-of-range count to follow in next word
* 128-255 bigram codes (128 most common, as determined by 'updatedb')
* 32-127 single character (printable) ascii residue (ie, literal)
*
* SEE ALSO: updatedb.csh, bigram.c, find.c
* AUTHOR: James A. Woods, Informatics General Corp.,
* NASA Ames Research Center, 10/82
*/
* AUTHOR: James A. Woods, Informatics General Corp.,
* NASA Ames Research Center, 10/82
*/
int argc; char *argv[];
{
register char *cp, *oldpath = buf1, *path = buf2;
int argc; char *argv[];
{
register char *cp, *oldpath = buf1, *path = buf2;
- int code, count, diffcount, oldcount = 0;
+ int code, count, diffcount, oldcount = 0;
FILE *fp;
if ((fp = fopen(argv[1], "r")) == NULL) {
FILE *fp;
if ((fp = fopen(argv[1], "r")) == NULL) {
fwrite ( bigrams, 1, BGBUFSIZE, stdout );
fclose( fp );
fwrite ( bigrams, 1, BGBUFSIZE, stdout );
fclose( fp );
- while ( fgets ( path, sizeof(buf2), stdin ) != NULL ) {
+ while ( fgets ( path, sizeof(buf2), stdin ) != NULL ) {
/* truncate newline */
cp = path + strlen(path) - 1;
if (cp > path && *cp == '\n')
/* truncate newline */
cp = path + strlen(path) - 1;
if (cp > path && *cp == '\n')
path = buf2, oldpath = buf1;
else
path = buf1, oldpath = buf2;
path = buf2, oldpath = buf1;
else
path = buf1, oldpath = buf2;
+
+ /* Non-zero status if there were errors */
+ if (fflush(stdout) != 0 || ferror(stdout))
+ exit(1);
+ exit(0);