1: #if !defined(lint) && defined(DOSCCS)
2: static char *sccsid = "@(#)num.c 4.2.1 (2.11BSD) 1997/7/29";
3: #endif
4:
5: #include <stdio.h>
6: #define formfeed 0xc
7:
8: /*
9: * number - a cat like program which prints a file with line
10: * numbers. Printing of numbers is suppressed on blank
11: * lines.
12: *
13: * Original Version by William Joy, June 1977
14: * Updated October 1979 by M. Kirk McKusick
15: * Updated to version 4.2 10/13/82
16: */
17: main(ac, av)
18: int ac;
19: char *av[];
20: {
21: register int argc = ac;
22: register char **argv = av;
23: register int lino;
24: register char *lineptr;
25: register FILE *STDOUT = stdout;
26: register FILE *STDIN = stdin;
27: char line[512];
28: char stdobuf[BUFSIZ], stdibuf[BUFSIZ];
29:
30: argv++;
31: argc--;
32: lino = 1;
33: setbuf(STDIN,stdibuf);
34: setbuf(STDOUT,stdobuf);
35: do
36: {
37: if (argc)
38: if (freopen(*argv++, "r", STDIN) == NULL)
39: {
40: perror(*--argv);
41: exit(1);
42: }
43: for(;;)
44: {
45: lineptr = line;
46: *lineptr = 0;
47: fscanf(STDIN,"%[^\n]",lineptr);
48: if (feof(STDIN))
49: break;
50: if (*lineptr == formfeed)
51: putc(*lineptr++,STDOUT);
52: if (!*lineptr)
53: putc('\n',STDOUT);
54: else
55: fprintf(STDOUT,"%6d %s\n",lino,lineptr);
56: lino++;
57: getc(STDIN);
58: }
59: }
60: while (--argc > 0);
61: exit();
62: }
Defined functions
main
defined in line
17;
never used
Defined variables
sccsid
defined in line
2;
never used
Defined macros