1: /*
   2: **  CAT -- "cat" a file
   3: **
   4: **	This function is essentially identical to the UNIX cat(I).
   5: **
   6: **	Parameters:
   7: **		file -- the name of the file to be cat'ed
   8: **
   9: **	Returns:
  10: **		zero -- success
  11: **		else -- failure (could not open file)
  12: **
  13: **	Side Effects:
  14: **		"file" is open and read once through; a copy is made
  15: **			to the standard output.
  16: **
  17: **	Requires:
  18: **		read, write, open
  19: **
  20: **	Called By:
  21: **		ingres.c
  22: **		USER
  23: **
  24: **	Diagnostics:
  25: **		none
  26: **
  27: **	Syserrs:
  28: **		none
  29: **
  30: **	History:
  31: **		1/29/78 -- written by eric
  32: */
  33: 
  34: cat(file)
  35: char    *file;
  36: {
  37:     char        buf[512];
  38:     register int    i;
  39:     register int    fd;
  40: 
  41:     fd = open(file, 0);
  42:     if (fd < 0)
  43:         return (1);
  44: 
  45:     while ((i = read(fd, buf, 512)) > 0)
  46:     {
  47:         write(1, buf, i);
  48:     }
  49: 
  50:     return (0);
  51: }

Defined functions

cat defined in line 34; used 1 times
Last modified: 1980-12-17
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 1868
Valid CSS Valid XHTML 1.0 Strict