|
|
1.1 ! root 1: extern char *__modemcap; ! 2: ! 3: mgetnum (id) ! 4: register char *id; ! 5: { ! 6: register char *cp = __modemcap; ! 7: ! 8: if (__modemcap == (char *) 0) /* has mgetent() been called? ... */ ! 9: return (-1); /* ... no, can't find number */ ! 10: ! 11: while (*cp != ':' && *cp != 0) /* find first entry in cap */ ! 12: cp++; ! 13: ! 14: if (*cp == 0) /* empty entry??? */ ! 15: return (-1); /* ... yes, bad modemcap entry */ ! 16: else ! 17: cp++; /* point to first character in next */ ! 18: ! 19: while (*cp != 0) { /* until entry found or end of entry */ ! 20: if (cp[0] == id[0] && cp[1] == id[1]) {/* found entry!!! */ ! 21: if (cp[2] != '#')/* is it a numeric value??? */ ! 22: return (-1);/* no, something else */ ! 23: ! 24: return (atoi (&cp[3]));/* return value (just after #) */ ! 25: } ! 26: else { /* not entry, skip this entire entry */ ! 27: while (*cp != ':' && *cp != 0) ! 28: cp++; /* search for end of current entry */ ! 29: ! 30: if (*cp != 0) ! 31: cp++; /* skip terminating character */ ! 32: } ! 33: } ! 34: return (-1); ! 35: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.