|
|
1.1 root 1:
2:
3: /*
4: arg2scb( req,argc,argv,scptr ) returns the req-th argument pointed
5: to by the argv array in the scblk provided. if req is out of range
6: -1 is returned; otherwise the argument's length is returned.
7: */
8:
9: #include "spitblks.h"
10:
11: int arg2scb( req,argc,argv,scptr )
12:
13: int req;
14: int argc;
15: char *argv[];
16: struct scblk *scptr;
17:
18: {
19: int ch, i = 0, maxlen;
20: register char *argcp, *scbcp;
21:
22: if ( (req < 0) || (req >= argc) )
23: return -1;
24:
25: argcp = argv[req];
26: maxlen = scptr->len - 1;
27: scbcp = scptr->str;
28: while ( i < maxlen ) {
29: ch = *argcp++;
30: if (ch == 0)
31: break;
32: *scbcp++ = ch;
33: i++;
34: }
35: scptr->len = i;
36: return i;
37: }
38:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.