chiark / gitweb /
send voting url to admin not to voters
[modbot-mtm.git] / stump / c / cuthead.c
1 /* cuthead.c
2
3    This program simply ignires first line, or if argc == 2, first
4    lines specified by argv[1].
5
6    I am not responsible for any damages, GNU copyright applies.
7 */
8
9 #include <stdio.h>
10
11 #define MAX_BUF 4096
12
13 const char * Usage = "Usage: %s [number-of-lines]\n";
14
15 char buf[MAX_BUF];
16
17 int main( int argc, char **argv )
18 {
19   int first;
20
21   if( argc == 1 ) first = 1;
22   else if( argc == 2 ) {
23     if( (first = atoi( argv[1] ) ) <= 0 ) {
24       fprintf( stderr, Usage, argv[0] );
25       exit( 1 );
26     }
27   } else {
28     fprintf( stderr, Usage, argv[0] );
29     exit( 1 );
30   }
31
32   while( fgets( buf, sizeof( buf ), stdin ) ) {
33     if( first )
34       first--;
35     else
36       fputs( buf, stdout );
37   }
38 }