3 static int bquote(Biobuf*, Bufblock*);
6 * Assemble a line skipping blank lines, comments, and eliding
10 assline(Biobuf *bp, Bufblock *buf)
15 buf->current=buf->start;
16 while ((c = nextrune(bp, 1)) >= 0){
19 case '\r': /* consumes CRs for Win95 */
22 if (buf->current != buf->start) {
26 break; /* skip empty lines */
31 if (escapetoken(bp, buf, 1, c) == 0)
35 if (bquote(bp, buf) == 0)
40 while ((c = Bgetc(bp)) != '\n') {
48 break; /* propagate escaped newlines??*/
49 if (buf->current != buf->start) {
61 return *buf->start != 0;
65 * assemble a back-quoted shell command into a buffer
68 bquote(Biobuf *bp, Bufblock *buf)
74 while((c = Bgetrune(bp)) == ' ' || c == '\t')
77 term = '}'; /* rc style */
78 while((c = Bgetrune(bp)) == ' ' || c == '\t')
81 term = '`'; /* sh style */
83 start = buf->current-buf->start;
84 for(;c > 0; c = nextrune(bp, 0)){
88 buf->current = buf->start+start;
90 execsh(0, buf->current, buf, envy);
95 if(c == '\'' || c == '"' || c == '\\'){
97 if(!escapetoken(bp, buf, 1, c))
104 fprint(2, "missing closing %c after `\n", term);
109 * get next character stripping escaped newlines
110 * the flag specifies whether escaped newlines are to be elided or
111 * replaced with a blank.
114 nextrune(Biobuf *bp, int elide)
121 if (Bgetrune(bp) == '\n') {