Annotation of 41BSD/libc/gen/rin.c, revision 1.1.1.1

1.1       root        1: #include <stdio.h>
                      2: 
                      3: rin()
                      4: {
                      5:        double d;
                      6:        register n, c, f;
                      7: 
                      8:        d = 0.;
                      9:        f = 0;
                     10:        n = 0;
                     11: loop:
                     12:        c = getchar();
                     13:        if(c == EOF)
                     14:                exit();
                     15:        if(c == '-') {
                     16:                f++;
                     17:                goto loop;
                     18:        }
                     19:        if(c == '.') {
                     20:                n++;
                     21:                goto loop;
                     22:        }
                     23:        if(isdigit(c)) {
                     24:                if(n)
                     25:                        n++;
                     26:                d = d*10.+c-'0';
                     27:                goto loop;
                     28:        }
                     29:        if(f)
                     30:                d = -d;
                     31:        for(f=1; f<n; f++)
                     32:                d /= 10.;
                     33:        n = d;
                     34:        return(n);
                     35: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.