summaryrefslogtreecommitdiff
path: root/Build/source/texk/web2c/lib/inputint.c
blob: d27bb6a148c83fd16d29867256195d6a0ecae121 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
/* inputint.c: read integers from text files.  These routines are only
   used for debugging and such, so perfect error checking isn't
   necessary.  Public domain. */

#include <w2c/config.h>
#include "lib.h"

/* Read an integer from the file F, reading past the subsequent end of
   line.  */

integer
inputint (FILE *f)
{
  char buffer[MAX_INT_LENGTH]; /* Long enough for anything reasonable.  */

  return
    fgets (buffer, sizeof (buffer), f)
    ? atoi (buffer)
    : 0;
}