|
|
DataMuseum.dkPresents historical artifacts from the history of: DKUUG/EUUG Conference tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about DKUUG/EUUG Conference tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - downloadIndex: T c
Length: 833 (0x341)
Types: TextFile
Names: »cnvtnum.c«
└─⟦87ddcff64⟧ Bits:30001253 CPHDIST85 Tape, 1985 Autumn Conference Copenhagen
└─⟦this⟧ »cph85dist/wirewrap/cnvtnum.c«
#include <ctype.h>
char *cnvtnump; /* Pointer to next character to process. */
int cnvtnumv; /* 1 if valid number, 0 otherwise. */
/*************************************/
/* cnvtnum - convert ascii to int. */
/* Works like atoi() except that it */
/* leaves the externel variables set*/
/* to help in error recovery. */
/*************************************/
cnvtnum(str)
char *str;
{
int sign=1;
int result=0;
cnvtnump = str;
cnvtnumv=0;
/* Skip leading blanks. */
while(*cnvtnump == ' ' || *cnvtnump == '\t')cnvtnump++;
/* Pick up leading sign. */
if(*cnvtnump == '+')
{
sign = 1;
*cnvtnump++;
}
else if(*cnvtnump == '-')
{
sign = -1;
*cnvtnump++;
}
/* Pick up digits. */
while(isdigit(*cnvtnump))
{
result=10*result+ (*cnvtnump-'0');
cnvtnump++;
cnvtnumv=1;
}
return(sign*result);
}