aboutsummaryrefslogtreecommitdiff
path: root/7.8/main.c
blob: 02799a1c2f2718de3673d4cef0704b8125c91222 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include <stdio.h>
#include <stdlib.h>
#include "fileprint.h"

int main(int argc, char *argv[])
{
	FILE *fp;

	if (argc == 1) {
		fileprint(stdin, "");
	} else {
		while (--argc > 0 ) {
			if (!(fp = fopen(*++argv, "r"))) {
				fprintf(stderr, "print: can't open %s\n", *argv);
				exit(1);
			} else {
				fileprint(fp, *argv);
				fclose(fp);
			}
		}
	}
}