Subversion Repositories wimsdev

Rev

Rev 10 | Rev 7673 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 10 Rev 3718
Line 24... Line 24...
24
    char *p1;
24
    char *p1;
25
    char lbuf[MAX_LINELEN+1], obuf[MAX_LINELEN+1];
25
    char lbuf[MAX_LINELEN+1], obuf[MAX_LINELEN+1];
26
    int n, i, c=0, change=0;
26
    int n, i, c=0, change=0;
27
 
27
 
28
    obuf[0]=0;
28
    obuf[0]=0;
29
    p1=find_word_start(p); if(p1>p) strcpy(p,p1);
29
    p1=find_word_start(p); if(p1>p) ovlstrcpy(p,p1);
30
    strip_enclosing_par(p); strip_trailing_spaces(p);
30
    strip_enclosing_par(p); strip_trailing_spaces(p);
31
    if(*p==0) return;
31
    if(*p==0) return;
32
    rows2lines(p); n=linenum(p);
32
    rows2lines(p); n=linenum(p);
33
    if(itemnum(p)<=1 && wordnum(p)>=2*n) change=1;
33
    if(itemnum(p)<=1 && wordnum(p)>=2*n) change=1;
34
    for(i=1;i<=n;i++) {
34
    for(i=1;i<=n;i++) {
35
        fnd_line(p,i,lbuf);
35
        fnd_line(p,i,lbuf);
36
        p1=find_word_start(lbuf); if(p1>lbuf) strcpy(lbuf,p1);
36
        p1=find_word_start(lbuf); if(p1>lbuf) ovlstrcpy(lbuf,p1);
37
        strip_enclosing_par(lbuf);
37
        strip_enclosing_par(lbuf);
38
        if(lbuf[0]==0) continue;
38
        if(lbuf[0]==0) continue;
39
                /* Uniformize column separator to comma */
39
                /* Uniformize column separator to comma */
40
        if(change) words2items(lbuf);
40
        if(change) words2items(lbuf);
41
        rawmath(lbuf);
41
        rawmath(lbuf);
42
        if(i==1) {
42
        if(i==1) {
43
            strcpy(obuf,lbuf);
43
            ovlstrcpy(obuf,lbuf);
44
            c=itemnum(lbuf);
44
            c=itemnum(lbuf);
45
        }
45
        }
46
        else {
46
        else {
47
            if(strlen(obuf)+strlen(lbuf)>=MAX_LINELEN-1)
47
            if(strlen(obuf)+strlen(lbuf)>=MAX_LINELEN-1)
48
              user_error("cmd_output_too_long");
48
              user_error("cmd_output_too_long");
Line 52... Line 52...
52
            }
52
            }
53
            snprintf(obuf+strlen(obuf),sizeof(obuf)-strlen(obuf),
53
            snprintf(obuf+strlen(obuf),sizeof(obuf)-strlen(obuf),
54
                     "\n%s",lbuf);
54
                     "\n%s",lbuf);
55
        }
55
        }
56
    }
56
    }
57
    strcpy(p,obuf);
57
    ovlstrcpy(p,obuf);
58
}
58
}
59
 
59