Annotation of researchv10no/cmd/town/fastown.c, revision 1.1.1.1

1.1       root        1: # include "stdio.h"
                      2: # include "math.h"
                      3: # include "assert.h"
                      4: # define radp  57.2957795
                      5: main()
                      6: {
                      7: /* reads ascii patch file; converts to binary and does cosine conversion. */
                      8: char line[100], *s, opat[10];
                      9: long pos;
                     10: int k;
                     11: float a[2];
                     12: double correct;
                     13: opat[0]=0;
                     14: pos=0;
                     15: correct = cos(40.0/radp);
                     16: while (gets(line))
                     17:        {
                     18:        if (strncmp(opat, line, 5))
                     19:                fprintf(stderr, "%.5s %ld\n", line, pos);
                     20:        strncpy(opat, line, 5);
                     21:        for(s=line; *s && *s!='\t'; s++)
                     22:                ;
                     23:        sscanf(s, "%lf %lf", a+0, a+1);
                     24:        /* need to multiply longitudes by cosine of latitude */
                     25:        a[1] = a[1]*correct;
                     26:        write (1, a, 2*sizeof(float));
                     27:        for(s=line; *s; s++)
                     28:                ;
                     29:        s -= 3;
                     30:        write (1, s, 1);
                     31:        for(s=line; *s && *s!=','; s++)
                     32:                ;
                     33:        *s=0;
                     34:        k = s-(line+6);
                     35:        if (k<0) k=0;
                     36:        write (1, line+6, k);
                     37:        write (1, "\n", 1);
                     38:        pos+= 2*sizeof(float);
                     39:        pos += k+2;
                     40:        }
                     41: fprintf(stderr, "ENDED %ld\n", pos);
                     42: }

unix.superglobalmegacorp.com

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