Annotation of researchv10no/cmd/mk/src/expand.c, revision 1.1.1.1

1.1       root        1: #include       "mk.h"
                      2: #include       <ctype.h>
                      3: 
                      4: static Word *bollard;
                      5: 
                      6: static void
                      7: append(s)
                      8:        char *s;
                      9: {
                     10:        register Word *w;
                     11:        register char *p;
                     12: 
                     13:        if(bollard){
                     14:                for(w = bollard; w->next; w = w->next)
                     15:                        ;
                     16:                w = w->next = stow(s);
                     17:        } else
                     18:                w = bollard = stow(s);
                     19:        if(w)   /* if we got a word */
                     20:                for(p = w->s; *p;)
                     21:                        *p++ &= ~EBIT;
                     22: }
                     23: 
                     24: Word *
                     25: expand(s)
                     26:        register char *s;
                     27: {
                     28:        char save;
                     29:        register char *t;
                     30:        Word *head, *w;
                     31: 
                     32:        w = head = newword("");
                     33:        while(*s){
                     34:                while(SEP(*s))
                     35:                        s++;
                     36:                if(*s == 0) break;
                     37:                for(t = s+1; *t && !SEP(*t); t++)
                     38:                        ;
                     39:                save = *t;
                     40:                *t = 0;
                     41:                bollard = 0;
                     42:                glob(s, append);
                     43:                w->next = bollard;
                     44:                while(w->next)
                     45:                        w = w->next;
                     46:                *t = save;
                     47:                s = t;
                     48:        }
                     49:        w = head->next;
                     50:        delword(head);
                     51:        return(w);
                     52: }

unix.superglobalmegacorp.com

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