Mercurial > hg > Members > kono > nitros9-code
comparison 3rdparty/packages/cc/sources/line.c @ 867:0198655f2552
Added sources
author | boisy |
---|---|
date | Thu, 16 Jan 2003 19:54:21 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
866:157ddcf642b2 | 867:0198655f2552 |
---|---|
1 /* line: list lines of file with numbers */ | |
2 | |
3 #include <stdio.h> | |
4 | |
5 main(argc,argv) | |
6 char **argv; | |
7 { | |
8 char line[256]; | |
9 register int count = 0; | |
10 | |
11 if(--argc) | |
12 if(freopen(*++argv,"r",stdin) == NULL) { | |
13 fprintf(stderr,"can't open file: %s\n",*argv); | |
14 exit(errno); | |
15 } | |
16 | |
17 while(gets(line)) | |
18 printf("%5d %s\n",++count,line); | |
19 } |