5 struct here *here, **ehere;
7 char tmp[]="/tmp/here0000.0000";
8 char hex[]="0123456789abcdef";
10 void psubst(io*, uchar*);
11 void pstrs(io*, word*);
14 hexnum(char *p, int n)
16 *p++=hex[(n>>12)&0xF];
25 struct here *h = new(struct here);
27 yyerror("Bad here tag");
35 hexnum(&tmp[9], getpid());
36 hexnum(&tmp[14], ser++);
37 h->name = strdup(tmp);
38 return token(tmp, WORD);
41 * bug: lines longer than NLINE get split -- this can cause spurious
42 * missubstitution, or a misrecognized EOF marker.
49 struct here *h, *nexth;
54 for(h = here;h;h = nexth){
55 subst=!h->tag->quoted;
59 yyerror("can't create here document");
63 while((c = rchr(runq->cmdfd))!=EOF){
64 if(c=='\n' || s==&line[NLINE]){
66 if(tag && strcmp(line, tag)==0) break;
68 psubst(f, (uchar *)line);
91 psubst(io *f, uchar *s)
98 if(0xa0 <= *s && *s <= 0xf5){
103 else if(0xf6 <= *s && *s <= 0xf7){
118 while(*t && idchr(*t)) t++;
122 for(u = s;*u && '0'<=*u && *u<='9';u++) n = n*10+*u-'0';
124 star = vlook("*")->val;
125 if(star && 1<=n && n<=count(star)){
126 while(--n) star = star->next;
131 pstrs(f, vlook((char *)s)->val);
142 pstrs(io *f, word *a)
145 while(a->next && a->next->word){