-static unsigned int get_number(FILE *fp)
-{
- int c, val;
-
- /* Skip leading whitespace */
- do {
- c = fgetc(fp);
- if (c == EOF)
- die("%s: end of file\n", filename);
- if (c == '#') {
- /* Ignore comments 'till end of line */
- do {
- c = fgetc(fp);
- if (c == EOF)
- die("%s: end of file\n", filename);
- } while (c != '\n');
- }
- } while (isspace(c));
-
- /* Parse decimal number */
- val = 0;
- while (isdigit(c)) {
- val = 10*val+c-'0';
- c = fgetc(fp);
- if (c == EOF)
- die("%s: end of file\n", filename);
- }
- return val;
-}
-
-static unsigned int get_number255(FILE *fp, unsigned int maxval)
-{
- unsigned int val = get_number(fp);
- return (255*val+maxval/2)/maxval;
-}
-