|
|
1.1 root 1: /* Copyright Bell Telephone Laboratories Whippany, N.J.
2:
3: * ***********************************
4: * ***********************************
5: * ******* LINE NUMBER PARSER ********
6: * *** R. B. Drake WH 8C-005 X4163 ***
7: * **** Sun Aug 26 10:46:06 1979 *****
8: * ***********************************
9: * ***********************************
10:
11: */
12: /* "@(#) lnpars.c: V 1.1 12/21/80" */
13:
14: /*mini parser to handle expressions of the form
15: * "line number" - "line number"
16: */
17: #include "bas.h"
18: extern int start,finish;
19: lnpars()
20: {
21: char as[2][10];
22: int i,j,k;
23: char c;
24: /* zero the ascii txtbuf */
25: for(j=0;j<2;j++)
26: for(k=0;k<10;k++)
27: as[j][k] = '\0';
28: /* separate the line into two parts */
29:
30: for(i=0,j=0,k=0;expr[i] != 0; i++,k++)
31: {
32: if((c = expr[i])== '-' || c==',' || c== ' ')
33: {
34: j++;
35: k= -1;
36: continue;
37: }
38: if(j >1 || k > 9)
39: {
40: error(inst.thing.linno,0);
41: return(-1);
42: }
43: as[j][k]=expr[i];
44: }
45: /* convert ascii strings to int */
46: start=atoi(&as[0][0]);
47: finish=atoi(&as[1][0]);
48: if(j !=0 && finish == 0)
49: finish=32767;
50: return 0;
51: }
52:
53:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.