File: fmt_nmb_.c

package info (click to toggle)
ngetty 1.0-1
  • links: PTS
  • area: main
  • in suites: squeeze, wheezy
  • size: 304 kB
  • ctags: 207
  • sloc: ansic: 1,503; makefile: 236; sh: 109; asm: 100
file content (12 lines) | stat: -rw-r--r-- 269 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
unsigned int fmt_nmb_(char *b, unsigned long u, char len, char fill) /*EXTRACT_INCL*/ {
  unsigned char k=len;
  char ch = (fill)?'0':' ';
  do {
    if (k == 0) break;
    b[--k] = '0' + u%10;
    u /= 10;
  } while (u);
  while (k) 
    b[--k] = ch;
  return len;
}