diff options
Diffstat (limited to 'riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/x_atoi.c')
| -rw-r--r-- | riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/x_atoi.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/x_atoi.c b/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/x_atoi.c new file mode 100644 index 0000000..d45282e --- /dev/null +++ b/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/x_atoi.c @@ -0,0 +1,12 @@ + +int x_atoi(const char *src) /*EXTRACT_INCL*/ { + register const char *s; + register int dest=0; + register unsigned char c; + + s=src; + if (*s=='-' || *s=='+') ++s; + + while ((c=*s-'0')<10) { ++s; dest=dest*10 + c; } + return (*src=='-') ? -dest : dest; +} |
