Subversion Repositories wimsdev

Rev

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

Rev 8185 Rev 8213
Line 20... Line 20...
20
 */
20
 */
21
#include "wims.h"
21
#include "wims.h"
22
 
22
 
23
static void _skip_contents(int isif);
23
static void _skip_contents(int isif);
24
 
24
 
25
    /* common routine for the two if's. */
25
/* common routine for the two if's. */
26
static void _exec_if_while(char *p, int numerical, int isif)
26
static void _exec_if_while(char *p, int numerical, int isif)
27
{
27
{
28
    if(compare(p,numerical,0)==0) _skip_contents(isif); /* skip if false */
28
    if(compare(p,numerical,0)==0) _skip_contents(isif); /* skip if false */
29
    else if(!isif) m_file.for_idx++;
29
    else if(!isif) m_file.for_idx++;
30
    return;
30
    return;
Line 34... Line 34...
34
void exec_if(char *p)
34
void exec_if(char *p)
35
{
35
{
36
    _exec_if_while(p,0,1);
36
    _exec_if_while(p,0,1);
37
}
37
}
38
 
38
 
39
    /* 'if' numerical. */
39
/* 'if' numerical. */
40
void exec_ifval(char *p)
40
void exec_ifval(char *p)
41
{
41
{
42
    _exec_if_while(p,1,1);
42
    _exec_if_while(p,1,1);
43
}
43
}
44
 
44
 
Line 50... Line 50...
50
    stk->lineno=m_file.l;
50
    stk->lineno=m_file.l;
51
    memmove(stk->varname,"?",2);
51
    memmove(stk->varname,"?",2);
52
    _exec_if_while(p,numerical,0);
52
    _exec_if_while(p,numerical,0);
53
}
53
}
54
 
54
 
55
    /* 'while' non-numerical (unless comparisons are < or >, etc.) */
55
/* 'while' non-numerical (unless comparisons are < or >, etc.) */
56
void exec_while(char *p)
56
void exec_while(char *p)
57
{
57
{
58
    _exec_while(p,0);
58
    _exec_while(p,0);
59
}
59
}
60
 
60
 
61
    /* 'while' numerical. */
61
/* 'while' numerical. */
62
void exec_whileval(char *p)
62
void exec_whileval(char *p)
63
{
63
{
64
    _exec_while(p,1);
64
    _exec_while(p,1);
65
}
65
}
66
 
66
 
Line 74... Line 74...
74
    m_file.linepointer=stk->lineno;
74
    m_file.linepointer=stk->lineno;
75
    executed_gotos++;
75
    executed_gotos++;
76
    if(executed_gotos>=GOTO_LIMIT) module_error("too_many_gotos");
76
    if(executed_gotos>=GOTO_LIMIT) module_error("too_many_gotos");
77
}
77
}
78
 
78
 
79
    /* Should provide a method to stop infinite loop. */
79
/* Should provide a method to stop infinite loop. */
80
void exec_goto(char *p)
80
void exec_goto(char *p)
81
{
81
{
82
    char lbuf[MAX_NAMELEN+17];
82
    char lbuf[MAX_NAMELEN+17];
83
    char *label_start, *line_start;
83
    char *label_start, *line_start;
84
    int old_line;
84
    int old_line;
Line 106... Line 106...
106
    setvar(error_data_string,label_start); module_error("label_not_found");
106
    setvar(error_data_string,label_start); module_error("label_not_found");
107
/*    m_file.linepointer=m_file.linecnt; *p=0;
107
/*    m_file.linepointer=m_file.linecnt; *p=0;
108
    return;
108
    return;
109
*/}
109
*/}
110
 
110
 
111
    /* 'else' with or without 'if'.
111
/* 'else' with or without 'if'.
112
     * Philosophy: we implement a loosely checked grammar.
112
 * Philosophy: we implement a loosely checked grammar.
113
     * We cannot check 'if' grammar if we want to use 'goto'
113
 * We cannot check 'if' grammar if we want to use 'goto'
114
     * together with 'if'. */
114
 * together with 'if'.
-
 
115
 */
115
void exec_else(char *p)
116
void exec_else(char *p)
116
{
117
{
117
    _skip_contents(1); return;
118
    _skip_contents(1); return;
118
}
119
}
119
 
120
 
120
    /* 'endif': nothing needs to be done here. */
121
/* 'endif': nothing needs to be done here. */
121
void exec_endif(char *p)
122
void exec_endif(char *p)
122
{
123
{
123
    return;
124
    return;
124
}
125
}
125
 
126
 
126
    /* find out the end of a for loop */
127
/* find out the end of a for loop */
127
void goto_for_end(void)
128
void goto_for_end(void)
128
{
129
{
129
    int inner;
130
    int inner;
130
    char buf[16];
131
    char buf[16];
131
    inner=0;
132
    inner=0;
Line 145... Line 146...
145
        else break;
146
        else break;
146
      }
147
      }
147
    }
148
    }
148
}
149
}
149
 
150
 
150
    /* for */
151
/* for */
151
void exec_for(char *p)
152
void exec_for(char *p)
152
{
153
{
153
    char *p1, *p2, *p3;
154
    char *p1, *p2, *p3;
154
    double v1, v2, step;
155
    double v1, v2, step;
155
    char buf[MAX_LINELEN+1];
156
    char buf[MAX_LINELEN+1];
Line 212... Line 213...
212
      strip_trailing_spaces(p2); setvar(stk->varname,p2);
213
      strip_trailing_spaces(p2); setvar(stk->varname,p2);
213
      stk->lineno=m_file.linepointer;
214
      stk->lineno=m_file.linepointer;
214
      m_file.for_idx++; *p=0; return;
215
      m_file.for_idx++; *p=0; return;
215
    }
216
    }
216
    goto syntax;
217
    goto syntax;
217
}
218
}
218
 
219
 
219
    /* break a for loop */
220
/* break a for loop */
220
void exec_break(char *p)
221
void exec_break(char *p)
221
{
222
{
222
    FOR_STACK *stk;
223
    FOR_STACK *stk;
223
    if(m_file.for_idx>0) {
224
    if(m_file.for_idx>0) {
224
      stk=&(m_file.for_stack[m_file.for_idx-1]);
225
      stk=&(m_file.for_stack[m_file.for_idx-1]);
225
      if(stk->varname[0]=='?') _skip_contents(0);
226
      if(stk->varname[0]=='?') _skip_contents(0);
226
      else goto_for_end();
227
      else goto_for_end();
227
      m_file.for_idx--;
228
      m_file.for_idx--;
228
    }
229
    }
229
    *p=0; return;
230
    *p=0; return;
230
}
231
}
231
 
232
 
232
    /* next */
233
/* next */
233
void exec_next(char *p)
234
void exec_next(char *p)
234
{
235
{
235
    double v1, v2, step;
236
    double v1, v2, step;
236
    char *p1, *p2;
237
    char *p1, *p2;
237
    char buf[MAX_LINELEN+1];
238
    char buf[MAX_LINELEN+1];
Line 266... Line 267...
266
    }
267
    }
267
    else m_file.for_idx--;
268
    else m_file.for_idx--;
268
    *p=0; return;
269
    *p=0; return;
269
}
270
}
270
 
271
 
271
    /* Execution of a file in the module directory,
272
/* Execution of a file in the module directory,
272
     * only for trusted modules. */
273
 * only for trusted modules.
-
 
274
 */
273
void exec_mexec(char *p)
275
void exec_mexec(char *p)
274
{
276
{
275
    direct_exec=1;
277
    direct_exec=1;
276
    calc_mexec(p);
278
    calc_mexec(p);
277
    direct_exec=0;
279
    direct_exec=0;
278
}
280
}
279
 
281
 
280
    /* call shell. */
282
/* call shell. */
281
void _exec_ex(char *p, char *arg0, char *arg1, int n)
283
void _exec_ex(char *p, char *arg0, char *arg1, int n)
282
{
284
{
283
    char *abuf[8];
285
    char *abuf[8];
284
    char errorfname[MAX_FNAME+1];
286
    char errorfname[MAX_FNAME+1];
285
 
287
 
Line 294... Line 296...
294
    abuf[0]=arg0; abuf[1]=arg1; abuf[n]=p; abuf[n+1]=NULL;
296
    abuf[0]=arg0; abuf[1]=arg1; abuf[n]=p; abuf[n+1]=NULL;
295
    wrapexec=1; exportall();
297
    wrapexec=1; exportall();
296
    execredirected(abuf[0],NULL,NULL,errorfname,abuf);
298
    execredirected(abuf[0],NULL,NULL,errorfname,abuf);
297
}
299
}
298
 
300
 
299
    /* call shell. */
301
/* call shell. */
300
void exec_sh(char *p)
302
void exec_sh(char *p)
301
{
303
{
302
    _exec_ex(p,"sh","-c",2);
304
    _exec_ex(p,"sh","-c",2);
303
}
305
}
304
 
306
 
305
    /* call perl. */
307
/* call perl. */
306
void exec_perl(char *p)
308
void exec_perl(char *p)
307
{
309
{
308
    _exec_ex(p,"perl","-e",2);
310
    _exec_ex(p,"perl","-e",2);
309
}
311
}
310
 
312
 
311
    /* file should not be cached */
313
/* file should not be cached */
312
void exec_nocache(char *p)
314
void exec_nocache(char *p)
313
{    m_file.nocache|=1; *p=0; }
315
{    m_file.nocache|=1; *p=0; }
314
 
316
 
315
    /* Read another file. */
317
/* Read another file. */
316
void exec_read(char *p)
318
void exec_read(char *p)
317
{
319
{
318
    WORKING_FILE save;
320
    WORKING_FILE save;
319
    char parmsave[MAX_LINELEN+1];
321
    char parmsave[MAX_LINELEN+1];
320
    char *pp,*ps;
322
    char *pp,*ps;
Line 346... Line 348...
346
    readnest--; untrust=t;
348
    readnest--; untrust=t;
347
    memmove(&m_file,&save,sizeof(WORKING_FILE));
349
    memmove(&m_file,&save,sizeof(WORKING_FILE));
348
    setvar("wims_read_parm",parmsave);
350
    setvar("wims_read_parm",parmsave);
349
}
351
}
350
 
352
 
351
    /* read a variable processing file */
353
/* read a variable processing file */
352
void exec_readproc(char *p)
354
void exec_readproc(char *p)
353
{
355
{
354
    int o=outputing; outputing=0; exec_read(p); outputing=o;
356
    int o=outputing; outputing=0; exec_read(p); outputing=o;
355
}
357
}
356
 
358
 
Line 361... Line 363...
361
    t=untrust; untrust|=0x400;
363
    t=untrust; untrust|=0x400;
362
    o=outputing; outputing=0;
364
    o=outputing; outputing=0;
363
    exec_read(p); untrust=t; outputing=o;
365
    exec_read(p); untrust=t; outputing=o;
364
}
366
}
365
 
367
 
366
    /* Change to another file (no return) */
368
/* Change to another file (no return) */
367
void exec_changeto(char *p)
369
void exec_changeto(char *p)
368
{
370
{
369
    m_file.linepointer=m_file.linecnt;
371
    m_file.linepointer=m_file.linecnt;
370
    exec_read(p);
372
    exec_read(p);
371
}
373
}
372
 
374
 
373
int header_executed=0, tail_executed=0;
375
int header_executed=0, tail_executed=0;
374
 
376
 
375
    /* internal routine: get other language versions */
377
/* internal routine: get other language versions */
376
void other_langs(void)
378
void other_langs(void)
377
{
379
{
378
    int i,j,k;
380
    int i,j,k;
379
    char *p, lbuf[4], pbuf[MAX_FNAME+1], *phtml;
381
    char *p, lbuf[4], pbuf[MAX_FNAME+1], *phtml;
380
    char namebuf[MAX_FNAME+1], listbuf[4*MAX_LANGUAGES];
382
    char namebuf[MAX_FNAME+1], listbuf[4*MAX_LANGUAGES];
Line 420... Line 422...
420
      }
422
      }
421
    }
423
    }
422
    end: setvar("wims_otherlangs",listbuf); otherlangs_got=1;
424
    end: setvar("wims_otherlangs",listbuf); otherlangs_got=1;
423
}
425
}
424
 
426
 
425
    /* Standardised reference to wims home */
427
/* Standardised reference to wims home */
426
void exec_homeref(char *p)
428
void exec_homeref(char *p)
427
{
429
{
428
    char *ref, *user;
430
    char *ref, *user;
429
 
431
 
430
    if(ismhelp || tail_executed) return;
432
    if(ismhelp || tail_executed) return;
431
    setvar("wims_homeref_parm",p); *p=0;
433
    setvar("wims_homeref_parm",p); *p=0;
432
    user=getvar("wims_user");
434
    user=getvar("wims_user");
433
    if(user==NULL) user="";
435
    if(user==NULL) user="";
434
    if(*user==0 || robot_access) ref=home_referer;
436
    if(*user==0 || robot_access) ref=home_referer;
Line 438... Line 440...
438
    }
440
    }
439
    if(user[0]==0 && !robot_access) other_langs();
441
    if(user[0]==0 && !robot_access) other_langs();
440
    phtml_put_base(ref,0); tail_executed=1;
442
    phtml_put_base(ref,0); tail_executed=1;
441
}
443
}
442
 
444
 
443
    /* Standardised header menu */
445
/* Standardised header menu */
444
void exec_headmenu(char *p)
446
void exec_headmenu(char *p)
445
{
447
{
446
    char *ref, *user;
448
    char *ref, *user;
447
 
449
 
448
    if(header_executed) return;
450
    if(header_executed) return;
Line 456... Line 458...
456
    }
458
    }
457
    if(user[0]==0 && !robot_access) other_langs();
459
    if(user[0]==0 && !robot_access) other_langs();
458
    phtml_put_base(ref,0); header_executed=1;
460
    phtml_put_base(ref,0); header_executed=1;
459
}
461
}
460
 
462
 
461
    /* uniformized title */
463
/* uniformized title */
462
void exec_title(char *p)
464
void exec_title(char *p)
463
{
465
{
464
    char *s;
466
    char *s;
465
    *p=0;
467
    *p=0;
466
    if(!outputing) return;
468
    if(!outputing) return;
Line 471... Line 473...
471
      force_setvar("wims_title_title",s);
473
      force_setvar("wims_title_title",s);
472
    }
474
    }
473
    phtml_put_base(title_page,0);
475
    phtml_put_base(title_page,0);
474
}
476
}
475
 
477
 
476
    /* standardized html tail */
478
/* standardized html tail */
477
void exec_tail(char *p)
479
void exec_tail(char *p)
478
{
480
{
479
    if(!outputing || tail_executed) {
481
    if(!outputing || tail_executed) {
480
      *p=0; return;
482
      *p=0; return;
481
    }
483
    }
Line 502... Line 504...
502
script.src  = \"scripts/js/mathjax/MathJax.js?config=MML_HTMLorMML-full.js\";\
504
script.src  = \"scripts/js/mathjax/MathJax.js?config=MML_HTMLorMML-full.js\";\
503
document.body.appendChild(script);\
505
document.body.appendChild(script);\
504
}/*]]>*/</script>\n");
506
}/*]]>*/</script>\n");
505
}
507
}
506
 
508
 
507
   /* standardized header */
509
/* standardized header */
508
void _header(char *p, int option)
510
void _header(char *p, int option)
509
{
511
{
510
    char *s1, *s2, hbuf[MAX_LINELEN+1], *ws="", *ws2="", *bo, *ol;
512
    char *s1, *s2, hbuf[MAX_LINELEN+1], *ws="", *ws2="", *bo, *ol;
511
    char wsbuf[MAX_LINELEN+1],wsbuf2[MAX_LINELEN+1];
513
    char wsbuf[MAX_LINELEN+1],wsbuf2[MAX_LINELEN+1];
512
    setvar("wims_header_parm",p); *p=0;
514
    setvar("wims_header_parm",p); *p=0;
Line 662... Line 664...
662
      }
664
      }
663
    }
665
    }
664
    mystrncpy(b1,qbuf,MAX_LINELEN);
666
    mystrncpy(b1,qbuf,MAX_LINELEN);
665
}
667
}
666
 
668
 
667
    /* Restart with a new module, using http code 302. */
669
/* Restart with a new module, using http code 302. */
668
void exec_restart(char *p)
670
void exec_restart(char *p)
669
{
671
{
670
    char buf[MAX_LINELEN+1], *rfn, buf2[MAX_LINELEN+1];
672
    char buf[MAX_LINELEN+1], *rfn, buf2[MAX_LINELEN+1];
671
/*    long int t; */
673
/*    long int t; */
672
 
674
 
Line 695... Line 697...
695
    snprintf(buf,sizeof(buf),"%ld",nowtime);
697
    snprintf(buf,sizeof(buf),"%ld",nowtime);
696
/*    accessfile(buf,"w","%s/restart.time",s2_prefix);
698
/*    accessfile(buf,"w","%s/restart.time",s2_prefix);
697
*/    delete_pid(); exit(0);
699
*/    delete_pid(); exit(0);
698
}
700
}
699
 
701
 
700
    /* extract target tag from parm string. */
702
/* extract target tag from parm string. */
701
void href_find_target(char *p)
703
void href_find_target(char *p)
702
{
704
{
703
    char *pp, *pe,buf1[MAX_LINELEN+1];
705
    char *pp, *pe,buf1[MAX_LINELEN+1];
704
    href_target[0]=0; jsbuf[0]=0; ref_mhelp=0;
706
    href_target[0]=0; jsbuf[0]=0; ref_mhelp=0;
705
    for(pp=find_word_start(p);*pp!=0;pp=find_word_start(pe)) {
707
    for(pp=find_word_start(p);*pp!=0;pp=find_word_start(pe)) {
Line 738... Line 740...
738
      if(p3-p2>=buflen) return; /* too long */
740
      if(p3-p2>=buflen) return; /* too long */
739
      memmove(buf,p2, p3-p2); buf[p3-p2]=0; return;
741
      memmove(buf,p2, p3-p2); buf[p3-p2]=0; return;
740
    }
742
    }
741
}
743
}
742
 
744
 
743
 
-
 
744
    /* Create href to wims requests. subst() is not done. */
745
/* Create href to wims requests. subst() is not done. */
745
void exec_href(char *p)
746
void exec_href(char *p)
746
{
747
{
747
    char *s, st[128], sti[128], stc[128], stt[128], *p1, *p2, *p3, *wn="";
748
    char *s, st[128], sti[128], stc[128], stt[128], *p1, *p2, *p3, *wn="";
748
    char *U="<span style=\"color:#A0A0C0;text-decoration:underline;\">%s</span>";
749
    char *U="<span style=\"color:#A0A0C0;text-decoration:underline;\">%s</span>";
749
    char b1[MAX_LINELEN+1], b2[MAX_LINELEN+1];
750
    char b1[MAX_LINELEN+1], b2[MAX_LINELEN+1];
Line 855... Line 856...
855
    setvar("wims_ref_id","");
856
    setvar("wims_ref_id","");
856
    setvar("wims_ref_class","");
857
    setvar("wims_ref_class","");
857
    setvar("wims_ref_title","");
858
    setvar("wims_ref_title","");
858
}
859
}
859
 
860
 
860
    /* Create form refering to the page. */
861
/* Create form refering to the page. */
861
void exec_form(char *p)
862
void exec_form(char *p)
862
{
863
{
863
    char *s, *p1, *p2, *a, *m, *opt, st[128], *wn="";
864
    char *s, *p1, *p2, *a, *m, *opt, st[128], *wn="";
864
    char abuf[128];
865
    char abuf[128];
865
    int i, new=0;
866
    int i, new=0;
Line 930... Line 931...
930
             getvar(ro_name[ro_module]));
931
             getvar(ro_name[ro_module]));
931
      }
932
      }
932
   }
933
   }
933
}
934
}
934
 
935
 
935
    /* Creat link to trap robot access, an internal command
936
/* Creat link to trap robot access, an internal command
936
     * which should not be documented */
937
 * which should not be documented
-
 
938
 */
937
void exec_robottrap(char *p)
939
void exec_robottrap(char *p)
938
{
940
{
939
    char buf[MAX_LINELEN+1];
941
    char buf[MAX_LINELEN+1];
940
    if(robot_access) return;
942
    if(robot_access) return;
941
    ovlstrcpy(buf,"session=$wims_session.1&module=adm/trap");
943
    ovlstrcpy(buf,"session=$wims_session.1&module=adm/trap");
942
    _output_("<!-- "); exec_href(buf);_output_("Robot trapper, do not click!</a> -->");
944
    _output_("<!-- "); exec_href(buf);_output_("Robot trapper, do not click!</a> -->");
943
    _output_("<div class='wimstrap'>");exec_href(buf); _output_("<span></span></a></div>");
945
    _output_("<div class='wimstrap'>");exec_href(buf); _output_("<span></span></a></div>");
944
}
946
}
945
 
947
 
946
    /* set definitions in a file. Trusted modules only. */
948
/* set definitions in a file. Trusted modules only. */
947
void exec_setdef(char *p)
949
void exec_setdef(char *p)
948
{
950
{
949
    char *p1, *pp;
951
    char *p1, *pp;
950
    char nbuf[MAX_LINELEN+1], fbuf[MAX_LINELEN+1], tbuf[MAX_LINELEN+1];
952
    char nbuf[MAX_LINELEN+1], fbuf[MAX_LINELEN+1], tbuf[MAX_LINELEN+1];
951
    if(robot_access || !trusted_module() || is_class_module) return;
953
    if(robot_access || !trusted_module() || is_class_module) return;
Line 958... Line 960...
958
    pp=find_word_start(nbuf); p1=find_word_start(fbuf); *find_word_end(p1)=0;
960
    pp=find_word_start(nbuf); p1=find_word_start(fbuf); *find_word_end(p1)=0;
959
    strip_trailing_spaces(pp);
961
    strip_trailing_spaces(pp);
960
    setdef(p1,pp);
962
    setdef(p1,pp);
961
}
963
}
962
 
964
 
963
    /* Set a variable. */
965
/* Set a variable. */
964
void exec_set(char *name)
966
void exec_set(char *name)
965
{
967
{
966
    char *p, *defn, *parm;
968
    char *p, *defn, *parm;
967
    char tbuf2[MAX_LINELEN+1], namebuf[MAX_LINELEN+1];
969
    char tbuf2[MAX_LINELEN+1], namebuf[MAX_LINELEN+1];
968
    int i;
970
    int i;
Line 970... Line 972...
970
    p=strchr(name,'=');
972
    p=strchr(name,'=');
971
    if(p==NULL) return; /* warning or error! */
973
    if(p==NULL) return; /* warning or error! */
972
    *p=0; defn=find_word_start(p+1);
974
    *p=0; defn=find_word_start(p+1);
973
    *find_word_end(name)=0;
975
    *find_word_end(name)=0;
974
    mystrncpy(namebuf,find_word_start(name),sizeof(namebuf));
976
    mystrncpy(namebuf,find_word_start(name),sizeof(namebuf));
975
        /* we allow substit in names, to implement array */
977
    /* we allow substit in names, to implement array */
976
    substit(namebuf); *find_word_end(namebuf)=0;
978
    substit(namebuf); *find_word_end(namebuf)=0;
977
    if(*defn!=calc_prefix_char) {
979
    if(*defn!=calc_prefix_char) {
978
    /* substitute by default */
980
    /* substitute by default */
979
      mystrncpy(tbuf2,defn,sizeof(tbuf2));
981
      mystrncpy(tbuf2,defn,sizeof(tbuf2));
980
      substit(tbuf2); setvar(namebuf,tbuf2); return;
982
      substit(tbuf2); setvar(namebuf,tbuf2); return;
Line 1001... Line 1003...
1001
    tbuf2[sizeof(tbuf2)-1]=0;
1003
    tbuf2[sizeof(tbuf2)-1]=0;
1002
    if(tbuf2[strlen(tbuf2)-1]=='\n') tbuf2[strlen(tbuf2)-1]=0;
1004
    if(tbuf2[strlen(tbuf2)-1]=='\n') tbuf2[strlen(tbuf2)-1]=0;
1003
    setvar(namebuf,tbuf2);
1005
    setvar(namebuf,tbuf2);
1004
}
1006
}
1005
 
1007
 
1006
    /* set but do not overwrite. */
1008
/* set but do not overwrite. */
1007
void exec_default(char *p)
1009
void exec_default(char *p)
1008
{
1010
{
1009
    char *start, *end, c, *pp;
1011
    char *start, *end, c, *pp;
1010
    char namebuf[MAX_LINELEN+1];
1012
    char namebuf[MAX_LINELEN+1];
1011
    start=find_word_start(p);
1013
    start=find_word_start(p);
Line 1017... Line 1019...
1017
      if(pp!=NULL && *pp!=0) return;
1019
      if(pp!=NULL && *pp!=0) return;
1018
    }
1020
    }
1019
    *end=c; exec_set(p);
1021
    *end=c; exec_set(p);
1020
}
1022
}
1021
 
1023
 
1022
    /* Does nothing; just a comment. */
1024
/* Does nothing; just a comment. */
1023
void exec_comment(char *p)
1025
void exec_comment(char *p)
1024
{
1026
{
1025
    return;
1027
    return;
1026
}
1028
}
1027
 
1029
 
1028
    /* Exit the file under interpretation */
1030
/* Exit the file under interpretation */
1029
void exec_exit(char *p)
1031
void exec_exit(char *p)
1030
{
1032
{
1031
    m_file.linepointer=m_file.linecnt;
1033
    m_file.linepointer=m_file.linecnt;
1032
    return;
1034
    return;
1033
}
1035
}
1034
 
1036
 
1035
    /* output a file. Undocumented. Aliases:
1037
/* output a file. Undocumented. Aliases:
1036
     * getfile, outfile, fileout */
1038
     * getfile, outfile, fileout */
1037
void exec_getfile(char *p)
1039
void exec_getfile(char *p)
1038
{
1040
{
1039
    char *s, *p1, url[MAX_LINELEN+1];
1041
    char *s, *p1, url[MAX_LINELEN+1];
1040
    char *prompt;
1042
    char *prompt;
Line 1057... Line 1059...
1057
    snprintf(jsbuf,sizeof(jsbuf),jsstr,"wims_file","wims_file");
1059
    snprintf(jsbuf,sizeof(jsbuf),jsstr,"wims_file","wims_file");
1058
    if(*prompt) output("<a href=\"%s\">%s</a>\n", url,prompt);
1060
    if(*prompt) output("<a href=\"%s\">%s</a>\n", url,prompt);
1059
    else output("<a href=\"%s\"></a>",url);
1061
    else output("<a href=\"%s\"></a>",url);
1060
}
1062
}
1061
 
1063
 
1062
    /* internal */
1064
/* internal */
1063
void count_insert(void)
1065
void count_insert(void)
1064
{
1066
{
1065
    insert_no++;
1067
    insert_no++;
1066
    if(insert_no>=INS_LIMIT) module_error("too_many_ins");
1068
    if(insert_no>=INS_LIMIT) module_error("too_many_ins");
1067
}
1069
}
Line 1337... Line 1339...
1337
    wrapexec=1;
1339
    wrapexec=1;
1338
/*    call_ssh("mv %s/insplot_cmd %s 2>/dev/null",tmp_dir,s2_prefix); */
1340
/*    call_ssh("mv %s/insplot_cmd %s 2>/dev/null",tmp_dir,s2_prefix); */
1339
    unsetenv("multiplot"); setvar("insplot_split","");
1341
    unsetenv("multiplot"); setvar("insplot_split","");
1340
}
1342
}
1341
 
1343
 
1342
    /* Insert dynamic 3d plot */
1344
/* Insert dynamic 3d plot */
1343
void exec_insplot3d(char *p)
1345
void exec_insplot3d(char *p)
1344
{
1346
{
1345
    char *fmt;
1347
    char *fmt;
1346
    if(robot_access) {
1348
    if(robot_access) {
1347
     *p=0; return;
1349
     *p=0; return;