/*
* Copyright (c) 1980 Regents of the University of California.
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
*/
#ifndef lint
char copyright[] =
"@(#) Copyright (c) 1980 Regents of the University of California.\n\
All rights reserved.\n";
#endif not lint
#include <stdio.h>
/*
* csfix - fix constant spacing for error message flags in troff
*
* Bill Joy UCB September 11, 1977
*
* This would be better written in snobol!
*
* Normally fixes error flags in a pi listing
* Optional - causes fixing of '---' and initial blank widthin a pxp profile.
*/
char flag, dflag;
main(argc, argv)
int argc;
char *argv[];
{
argc--, argv++;
if (argc > 0 && argv[0][0] == '-' && argv[0][1] == 'd')
dflag++, argc--, argv++;
if (argc > 0 && argv[0][0] == '-')
flag++, argc--, argv++;
if (argc != 0) {
write(2, "Usage: csfix\n", 13);
exit(1);
}
while (getline()) {
if (errline()) {
flag ? fixpxp() : reformat();
continue;
}
if (flag) {
fixdigits();
continue;
}
if (spwarn())
continue;
if (nontriv())
save();
if (dflag)
fixdigits();
else
putline();
}
exit(0);
}
char line[160], flagee[160], *digitty();
getline()
{
register char *cp, c;
for (cp = line, c = getchar(); c != '\n' && c != EOF; c = getchar())
*cp++ = c;
if (c == EOF)
return (0);
*cp = 0;
return (1);
}