void BindExec() { int n; char temppath[128]; // passed as *path argument char tempname[128]; // passed as *argv[0] char tempparm[128]; // -UN name of file char tempparm2[128]; // -BN name of file char temptype[8]; // action type, either "-R" or "-RS" const char *path=temppath; const char *arg0=bindname; const char *arg1=temptype; const char *arg2="/S"; const char *arg3=tempparm; const char *arg4=tempparm2; const char *arg5=tempname2; if(bindtype==0) strcpy(temptype,"/R"); else if(bindtype==1) strcpy(temptype,"/RS"); else if(bindtype==2) strcpy(temptype,"/RC"); strcpy(temppath,bindname); strcpy(tempname,bindname); strcpy(tempparm,"/UN"); strcat(tempparm,tempname2); strcpy(tempparm2,"/BN"); strcat(tempparm2,newfilename); n=spawnle(P_WAIT, path, arg0,arg1,arg2,arg3,arg4,arg5, NULL, NULL); if(n==-1) { GetDOS32APath(); strcpy(temppath,dos32apath); strcat(temppath,bindname); strcpy(tempname,dos32apath); strcat(tempname,bindname); n=spawnle(P_WAIT, path, arg0,arg1,arg2,arg3,arg4,arg5, NULL, NULL); if(n==-1) { strcpy(temppath,bindname); strcpy(tempname,bindname); n=spawnlpe(P_WAIT, path, arg0,arg1,arg2,arg3,arg4,arg5, NULL, NULL); if(n==-1) err_nosb(); } } if(n!=0) { if(n==127) err_support(tempname2); else { DeleteTempFiles(); exit(1); } } }
void UnbindExec() { int n; char temppath[128]; // passed as *path argument char tempname[128]; // passed as *argv[0] char tempparm[128]; // name of file to be processed const char *path=temppath; const char *arg0=bindname; const char *arg1="/U"; const char *arg2="/O"; const char *arg3="/S"; const char *arg4=tempparm; const char *arg5=oldfilename; strcpy(temppath,bindname); strcpy(tempname,bindname); strcpy(tempparm,"/UN"); strcat(tempparm,tempname1); n=spawnle(P_WAIT, path, arg0,arg1,arg2,arg3,arg4,arg5, NULL, NULL); if(n==-1) { GetDOS32APath(); strcpy(temppath,dos32apath); strcat(temppath,bindname); strcpy(tempname,dos32apath); strcat(tempname,bindname); n=spawnle(P_WAIT, path, arg0,arg1,arg2,arg3,arg4,arg5, NULL, NULL); if(n==-1) { strcpy(temppath,bindname); strcpy(tempname,bindname); n=spawnlpe(P_WAIT, path, arg0,arg1,arg2,arg3,arg4,arg5, NULL, NULL); if(n==-1) err_nosb(); } } if(n!=0) { if(n==127) err_support(oldfilename); else { DeleteTempFiles(); exit(1); } } }