ING_DB
This commit is contained in:
parent
22dba5398b
commit
29b027d4f4
|
|
@ -0,0 +1,30 @@
|
||||||
|
# include <stdio.h>
|
||||||
|
|
||||||
|
/*
|
||||||
|
** CAT -- "cat" a file
|
||||||
|
**
|
||||||
|
** This function is essentially identical to the cat(1).
|
||||||
|
**
|
||||||
|
** Parameters:
|
||||||
|
** file -- the name of the file to be cat'ed
|
||||||
|
**
|
||||||
|
** Returns:
|
||||||
|
** zero -- success
|
||||||
|
** else -- failure (could not open file)
|
||||||
|
*/
|
||||||
|
AAcat(file)
|
||||||
|
register char *file;
|
||||||
|
{
|
||||||
|
register int i;
|
||||||
|
register int fd;
|
||||||
|
char buf[BUFSIZ];
|
||||||
|
|
||||||
|
if ((fd = open(file, 0)) < 0)
|
||||||
|
return (1);
|
||||||
|
|
||||||
|
while ((i = read(fd, buf, BUFSIZ)) > 0)
|
||||||
|
write(1, buf, i);
|
||||||
|
|
||||||
|
close(fd);
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue