Changeset 11575


Ignore:
Timestamp:
Jan 5, 2009, 5:26:03 AM (11 years ago)
Author:
gb
Message:

Don't ignore the return value from fgets() (to keep some versions of gcc
quiet), but don't really expect to handle a NULL, either.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/lisp-kernel/lisp-debug.c

    r11501 r11575  
    557557{
    558558  static char buf[128];
    559   char *p;
     559  char *p, *res;
    560560
    561561  do {
     
    563563    fprintf(stderr, "\n %s :",prompt);
    564564    buf[0] = 0;
    565     fgets(buf, sizeof(buf)-1, stdin);
     565    res = fgets(buf, sizeof(buf), stdin);
    566566  } while (0);
    567   p = strchr(buf, '\n');
     567  p = strchr(res, '\n');
    568568  if (p) {
    569569    *p = 0;
     
    576576debug_get_natural_value(char *prompt)
    577577{
    578   char s[32];
     578  char s[32], *res;
    579579  int n;
    580580  natural val;
     
    583583    fpurge(stdin);
    584584    fprintf(stderr, "\n  %s :", prompt);
    585     fgets(s, 24, stdin);
     585    s[0]=0;
     586    res = fgets(s, 24, stdin);
    586587    n = sscanf(s, "%lu", &val);
    587588  } while (n != 1);
     
    592593debug_get_u5_value(char *prompt)
    593594{
    594   char s[32];
     595  char s[32], *res;
    595596  int n;
    596597  unsigned val;
     
    599600    fpurge(stdin);
    600601    fprintf(stderr, "\n  %s :", prompt);
    601     fgets(s, 24, stdin);
    602     n = sscanf(s, "%i", &val);
     602    res = fgets(s, 24, stdin);
     603    n = sscanf(res, "%i", &val);
    603604  } while ((n != 1) || (val > 31));
    604605  return val;
Note: See TracChangeset for help on using the changeset viewer.