Annotation of researchv10no/cmd/spitbol/arg2scb.c, revision 1.1

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

unix.superglobalmegacorp.com

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