nightmaremail

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

getln.c (442B)


      1 #include "getln.h"
      2 
      3 #include "byte.h"
      4 #include "substdio.h"
      5 #ifdef USING_SKALIBS
      6 //#include <skalibs/buffer.h>
      7 #include <skalibs/stralloc.h>
      8 #else
      9 #include "stralloc.h"
     10 #endif
     11 
     12 int getln(substdio *ss, stralloc *sa, int *match, int sep)
     13 {
     14   char *cont;
     15   unsigned int clen;
     16 
     17   if (getln2(ss,sa,&cont,&clen,sep) == -1) return -1;
     18   if (!clen) { *match = 0; return 0; }
     19   if (!stralloc_catb(sa,cont,clen)) return -1;
     20   *match = 1;
     21   return 0;
     22 }