home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fish 'n' More 2
/
fishmore-publicdomainlibraryvol.ii1991xetec.iso
/
fish
/
languages
/
dice_466
/
dice206b.lzh
/
netdcc
/
examples
/
cat.c
< prev
next >
Wrap
C/C++ Source or Header
|
1991-01-13
|
526b
|
44 lines
/*
* CAT.C
*/
#include <stdio.h>
#include <stdlib.h>
int
brk()
{
puts("Well, if you insist...");
return(1);
}
main(ac, av)
char *av[];
{
short i;
char buf[256];
if (ac == 1) {
puts("cat <file>");
exit(1);
}
onbreak(brk);
for (i = 1; i < ac; ++i) {
char *fileName = av[i];
FILE *fi;
if (fi = fopen(fileName, "r")) {
while (fgets(buf, sizeof(buf), fi))
fputs(buf, stdout);
fclose(fi);
} else {
printf("Unable to open %s\n", fileName);
}
}
return(0);
}