File: splitmem.c

package info (click to toggle)
ngetty 1.1-3.1
  • links: PTS
  • area: main
  • in suites: buster
  • size: 392 kB
  • sloc: ansic: 1,588; makefile: 206; sh: 193; asm: 100
file content (16 lines) | stat: -rw-r--r-- 265 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
unsigned int splitmem(char **v, char *s, char c) /*EXTRACT_INCL*/ {
  char **w=v;
  unsigned int n=1;

  if (w) *w++=s;
  while (*s) {
    ++s;
    if (s[-1] != c) continue;
    ++n;
    if (w==0) continue;
    *w++=s;
    s[-1]=0;
  }
  if (w) *w=0;
  return n;
}