getln.c
author tomas@localhost
Thu, 01 Nov 2007 14:46:11 +0100
changeset 0 c045670f36e9
permissions -rw-r--r--
Imported queue-fix-1.4
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
c045670f36e9 Imported queue-fix-1.4
tomas@localhost
parents:
diff changeset
     1
#include "substdio.h"
c045670f36e9 Imported queue-fix-1.4
tomas@localhost
parents:
diff changeset
     2
#include "byte.h"
c045670f36e9 Imported queue-fix-1.4
tomas@localhost
parents:
diff changeset
     3
#include "stralloc.h"
c045670f36e9 Imported queue-fix-1.4
tomas@localhost
parents:
diff changeset
     4
#include "getln.h"
c045670f36e9 Imported queue-fix-1.4
tomas@localhost
parents:
diff changeset
     5
c045670f36e9 Imported queue-fix-1.4
tomas@localhost
parents:
diff changeset
     6
int getln(ss,sa,match,sep)
c045670f36e9 Imported queue-fix-1.4
tomas@localhost
parents:
diff changeset
     7
register substdio *ss;
c045670f36e9 Imported queue-fix-1.4
tomas@localhost
parents:
diff changeset
     8
register stralloc *sa;
c045670f36e9 Imported queue-fix-1.4
tomas@localhost
parents:
diff changeset
     9
int *match;
c045670f36e9 Imported queue-fix-1.4
tomas@localhost
parents:
diff changeset
    10
int sep;
c045670f36e9 Imported queue-fix-1.4
tomas@localhost
parents:
diff changeset
    11
{
c045670f36e9 Imported queue-fix-1.4
tomas@localhost
parents:
diff changeset
    12
  char *cont;
c045670f36e9 Imported queue-fix-1.4
tomas@localhost
parents:
diff changeset
    13
  unsigned int clen;
c045670f36e9 Imported queue-fix-1.4
tomas@localhost
parents:
diff changeset
    14
c045670f36e9 Imported queue-fix-1.4
tomas@localhost
parents:
diff changeset
    15
  if (getln2(ss,sa,&cont,&clen,sep) == -1) return -1;
c045670f36e9 Imported queue-fix-1.4
tomas@localhost
parents:
diff changeset
    16
  if (!clen) { *match = 0; return 0; }
c045670f36e9 Imported queue-fix-1.4
tomas@localhost
parents:
diff changeset
    17
  if (!stralloc_catb(sa,cont,clen)) return -1;
c045670f36e9 Imported queue-fix-1.4
tomas@localhost
parents:
diff changeset
    18
  *match = 1;
c045670f36e9 Imported queue-fix-1.4
tomas@localhost
parents:
diff changeset
    19
  return 0;
c045670f36e9 Imported queue-fix-1.4
tomas@localhost
parents:
diff changeset
    20
}