File: ibuf_getu.c

package info (click to toggle)
bglibs 2.04%2Bdfsg-8
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,468 kB
  • sloc: ansic: 15,821; perl: 674; sh: 63; makefile: 29
file content (17 lines) | stat: -rw-r--r-- 320 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#include "ibuf.h"

/** Read an unsigned long from the \c ibuf */
int ibuf_getu(ibuf* in, unsigned long* data)
{
  char ch;
  int chars;
  
  *data = 0;
  chars = 0;
  while (ibuf_peek(in, &ch) && ch >= '0' && ch <= '9') {
    *data = (*data * 10) + ch - '0';
    ibuf_getc(in, &ch);
    chars = 1;
  }
  return chars;
}