/* * Execute a GEM program. */ static void exec_prg(mask,params) char *mask; int params; { static char pathname[NFILEN]; static char filename[13]; static char args[128]; char path[NFILEN]; char cmd[NFILEN+128]; char current_path[NFILEN]; char ch; char *pch; int current_drive; if (params) { if (options_dialog(args)) return; } if (!pathname[0]) { pathname[0] = Dgetdrv() + 'A'; pathname[1] = ':'; Dgetpath(&pathname[2],0); strcat(pathname,"\\"); strcat(pathname,mask); } else strcpy(strrchr(pathname,'\\') + 1, mask); if (!file_select(path,"Execute a GEM application",pathname,filename)) return; ttclose(); graf_mouse(M_OFF,NULL); Dgetpath(current_path,0); current_drive = Dgetdrv(); Dsetdrv(toupper(path[0]) - 'A'); pch = strrchr(path,'\\'); ch = *++pch; *pch = '\0'; Dsetpath(path + 2); #if 0 puts(path); getchar(); #endif *pch = ch; if (params) { strcpy(cmd,path); strcat(cmd," "); strcat(cmd,args); system(cmd); } else system(path); Dsetdrv(current_drive); Dsetpath(current_path); redraw_screen(); graf_mouse(M_ON,NULL); ttopen(); }