plan9port

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

Strgets.c (204B)


      1 #include "std.h"
      2 
      3 int
      4 Strgets(String *p, Biobuf *b)
      5 {
      6 	char *s;
      7 	ulong n;
      8 
      9 	Strzero(p);
     10 	s = Brdstr(b, '\n', '\n');
     11 	if (!s)
     12 		return 0;
     13 	n = Blinelen(b);
     14 	Stradds(p, Strn(s, n));
     15 	free(s);
     16 	return n;
     17 }
     18