Subversion Repositories wimsdev

Rev

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

Rev 11129 Rev 12047
Line 1080... Line 1080...
1080
    }
1080
    }
1081
    wrapexec=1;
1081
    wrapexec=1;
1082
    call_sh("ls %s >%s/ls.out 2>%s/ls.err",
1082
    call_sh("ls %s >%s/ls.out 2>%s/ls.err",
1083
         p,tmp_dir,tmp_dir);
1083
         p,tmp_dir,tmp_dir);
1084
    read_tmp_file(p,"ls.out");
1084
    read_tmp_file(p,"ls.out");
-
 
1085
}
-
 
1086
 
-
 
1087
void calc_fileexists(char *p)
-
 
1088
{
-
 
1089
    char *pp, *fname;
-
 
1090
/* security measures. */
-
 
1091
    for(pp=p;*pp;pp++) if(isspace(*pp) || *pp==';') *pp=' ';
-
 
1092
    if(strstr(p,parent_dir_string)!=NULL) {
-
 
1093
     setvar(error_data_string,p);
-
 
1094
     module_error("illegal_fname"); return mystrncpy(p,"no",MAX_LINELEN);
-
 
1095
    }
-
 
1096
    if(strncmp(p,"wimshome/",9)==0){
-
 
1097
      if(robot_access || !trusted_module() || is_class_module){
-
 
1098
         module_error("illegal_fname"); return mystrncpy(p,"no",MAX_LINELEN);
-
 
1099
      }
-
 
1100
      else
-
 
1101
       {
-
 
1102
       fname=strchr(p,'/');
-
 
1103
       if(ftest(mkfname(NULL,"%s/%s",getvar("wims_home"),fname))==is_file)
-
 
1104
        return mystrncpy(p,"1",MAX_LINELEN);
-
 
1105
       }
-
 
1106
    }
-
 
1107
    if(ftest(mkfname(NULL,"%s",p))==is_file) return mystrncpy(p,"yes",MAX_LINELEN);
-
 
1108
    else return mystrncpy(p,"no",MAX_LINELEN);
1085
}
1109
}
1086
 
1110
 
1087
/* instex static: static tex inserts */
1111
/* instex static: static tex inserts */
1088
void calc_instexst(char *p)
1112
void calc_instexst(char *p)
1089
{
1113
{
Line 2112... Line 2136...
2112
      {"evaluesubstitute",1, calc_evalsubst},
2136
      {"evaluesubstitute",1, calc_evalsubst},
2113
      {"examdep", 0, calc_examdep},
2137
      {"examdep", 0, calc_examdep},
2114
      {"examscore", 0, calc_examscore},
2138
      {"examscore", 0, calc_examscore},
2115
      {"exec",   0, calc_exec},
2139
      {"exec",   0, calc_exec},
2116
      {"execute", 0, calc_exec},
2140
      {"execute", 0, calc_exec},
-
 
2141
      {"fileexists", 0, calc_fileexists},
2117
      {"filelist", 0, calc_listfile},
2142
      {"filelist", 0, calc_listfile},
-
 
2143
      {"filexists", 0, calc_fileexists},
2118
      {"getdef", 1, calc_defof},
2144
      {"getdef", 1, calc_defof},
2119
      {"getopt", 1, calc_getopt},
2145
      {"getopt", 1, calc_getopt},
2120
      {"getscore", 0, calc_getscore},
2146
      {"getscore", 0, calc_getscore},
2121
      {"getscorebest", 0, calc_getscorebest},
2147
      {"getscorebest", 0, calc_getscorebest},
2122
      {"getscorelast", 0, calc_getscorelast},
2148
      {"getscorelast", 0, calc_getscorelast},