plan9port

fork of plan9port with libvec, libstr and libsdb
Log | Files | Refs | README | LICENSE

Strgets.c (195B)


      1 #include "std.h"
      2 
      3 int
      4 Strgets(String *p, int fd)
      5 {
      6 	long n;
      7 	char c;
      8 
      9 	Strzero(p);
     10 	for (n = 0; read(fd, &c, 1); ++n) {
     11 		if (c == '\n') {
     12 			++n;
     13 			break;
     14 		}
     15 		Straddc(p, c);
     16 	}
     17 	return n;
     18 }
     19