home *** CD-ROM | disk | FTP | other *** search
- /****************************************************************************/
- /** C System Environment **/
- /** Turbo-Pascal aehnliche Benutzeroberflaeche **/
- /** (C) 1987 Martin Schloeter & PASCAL International **/
- /****************************************************************************/
-
- int _okbigbuf = 0; /* Platz fuer Tochterprozess freihalten !!! */
-
- #include <stdio.h>
- #include <ctype.h> /* Beinhaltet die Typpruefungsfunktionen (z.B. isascii) */
- #include <my-h.h>
- #define ZORLAND 1 /* I/O soll ueber Zorland-eigene Routinen laufen */
- #include <MC.H> /* Vereinbarung der systemabhaengigen I/O-Routinen */
-
- #define MAXL1 24 /* Anzahl Bildschirmzeilen minus 1 */
- #define MAXOPTIONS 13 /* Anzahl Optionen */
- #define OPTIONL 3 /* Laenge der Optionsstring */
- #define MEMMODNR 10 /* Anzahl Speichermodelle */
- #define MEMMODL 4 /* Laenge der Speichermodell-Optionsstrings */
- #define MAXINCLUDEPATH 10 /* Anzahl der bei Aufruf angebbaren Suchpfade */
- #define MAXARGUMENTE (MAXOPTIONS+MAXINCLUDEPATH+10)
- /* ...+5 wuerde auch reichen, so hat man aber fuer andere Compiler, */
- /* die vielleicht mehr Standardoptionen haben, Spielraum. */
-
- /* Defaulteinstellungen fuer Filenamen und PATHes. */
- /* Werden in init() ggf geaendert. */
- char editorname[81] = "B:MY-ED";
- char compiler_name[81] = "A:ZC";
- string logged_drive = "B:";
- char path[41] = "\\";
- char workfile[81] = "";
- char mainfile[81] = "";
- char out_file[81] = "";
- int mem_mod_nr = 0; /* Nummer des zu verwendenden Memory-Modells. */
- int int_only = FALSE;
- int lst_exist = FALSE; /* Soll Listfile erzeugt worden ? */
- int run_possible = FALSE; /* Schon compiliert ? */
- int com = FALSE; /* COM- oder EXE-File erzeugen ? */
- char macro[127] = ""; /* Bei Compileraufruf zu uebergebendes Macro. */
-
- /* Felder werden in init() initialisiert */
- int option_flag[MAXOPTIONS]; /* Option n verwenden ? */
- char option_str[MAXOPTIONS][OPTIONL+1]; /* String zu Option n. */
- char mem_mod_str[MEMMODNR][MEMMODL+1]; /* Strings zu Memory-Modellen. */
- int include_path_flag[MAXINCLUDEPATH]; /* Existiert Includepath n ? */
- char include_path[MAXINCLUDEPATH][127]; /* Tabelle der Include-Pathes */
- /* fuer Compileraufruf. */
-
- /***** FUNCTION-PROTOTYPING der benutzerdefinierten Funktionen von MC.C *****/
- void get_mainfile(void), get_path(string), show_copyright(void);
- void get_workfile(void), get_drive(void), edit(void), get_off(void);
- void compile(void), ed_lst(void), run(void), file_manager(void);
- void init(void), options(void), get_mask(string), exit(int);
- void my_getstr(int,string), fit_files(void), missing_file(string);
- void dir(void), erase(void), copy(void), my_rename(void);
- int mark_print(string,int), ja_nein(string);
- char hauptmenu(void), *strupr(string), *index(string,char);
-
- main()
-
- begin
- char wahl;
-
- init_device();
- init();
-
- repeat
- wahl = hauptmenu();
- switch (wahl) begin
- case 'l':
- case 'L': get_drive();
- break;
- case 'a':
- case 'A': get_path(path);
- break;
- case 'w':
- case 'W': get_workfile();
- break;
- case 'm':
- case 'M': get_mainfile();
- break;
- case 'e':
- case 'E': edit();
- break;
- case 's':
- case 'S': ed_lst();
- break;
- case 'c':
- case 'C': compile();
- break;
- case 'r':
- case 'R': run();
- break;
- case 'f':
- case 'F': file_manager();
- break;
- case 'o':
- case 'O': options();
- break;
- case 'q':
- case 'Q': get_off();
- break;
- end
- until (FALSE); /* Endlosschleife, Ausgang in get_off */
- end
-
-
- /* Hier werden die Initialisierungen der Felder der Compileroptionen */
- /* vorgenommen, und ggf. Defaultwerte fuer Filenamen PATHes und Laufwerke */
- /* neu eingelesen und geaendert. */
- void init(void)
-
- begin
- FILE *f;
- int i;
-
- /* Einlesen der Dateien mit den Optionen */
- f = fopen("defaults.dfl","r");
- if (f != NULL) begin
- fscanf(f,"%80s",editorname);
- fscanf(f,"%80s",compiler_name);
- fscanf(f,"%2s",logged_drive);
- fscanf(f,"%40s",path)
- end
- else
- missing_file("DEFAULTS.DFL");
- fclose(f);
-
- /* Compiler-Optionen einlesen */
- f = fopen("coptions.opt","r");
- if (f != NULL) begin
- int i;
-
- for (i = 0; i < MAXOPTIONS; i++)
- fscanf(f,"%s",option_str[i]);
- end
- else
- missing_file("COPTIONS.OPT");
- fclose(f);
-
- /* Speichermodelle einlesen */
- f = fopen("memmods.mmd","r");
- if (f != NULL) begin
- int i;
-
- for (i = 0; i < MEMMODNR; i++)
- fscanf(f,"%s",mem_mod_str[i]);
- end
- else
- missing_file("MEMMODS.MMD");
- fclose(f);
-
- /* Initialisierung der Felder */
- for(i = 0; i < MAXOPTIONS; i++)
- option_flag[i] = FALSE;
- for(i = 0; i < MAXINCLUDEPATH; i++) begin
- strcpy(include_path[i],"");
- include_path_flag[i] = FALSE
- end
- end
-
-
- void show_copyright(void)
-
- begin
-
- inverse();
- setyx(0,0);
- printf( "============================================================");
- printf("\n* C - System - Environment *");
- printf("\n* (C) 1987 by Martin Schloeter & PASCAL International *");
- printf("\n============================================================");
- normal()
- end
-
-
- char hauptmenu(void)
-
- begin
- string valid_keys = "lLaAmMwWeEsScCrRdFfQqoO";
- char wahl;
-
- cls();
- show_copyright();
- setyx(6,4); mark_print("Logged drive: ",1); printf("%s",logged_drive);
- setyx(7,4); mark_print("Active directory: ",1); printf("%s",path);
- setyx(9,4); mark_print("Workfile: ",1); printf("%s",workfile);
- setyx(10,4); mark_print("Mainfile: ",1); printf("%s",mainfile);
- setyx(15,4); mark_print("Edit",1);
- setyx(15,14); mark_print("LST-file",2);
- setyx(15,24); mark_print("Compile",1);
- setyx(15,34); mark_print("Run",1);
- setyx(17,4); mark_print("Files",1);
- setyx(17,14); mark_print("Quit",1);
- setyx(17,24); mark_print("compiler Options",10);
- setyx(18,1); update(); /* Falls Systemmeldungen durchkommen, */
- /* scrollen verhindern ! */
- repeat
- wahl = getch(); /* Keyboard ohne Echo lesen */
- until(member(wahl,valid_keys));
- return(wahl)
- end;
-
-
- void get_drive(void)
-
- begin
- char wahl;
-
- setyx(MAXL1,0);
- inverse(); printf("Drive:"); setyx(MAXL1,7); update(); wahl = getch();
- if (member(wahl,"aAbBcCdD")) /* Wer mehr Laufwerke hat --> anpassen !!! */
- logged_drive[0] = (char)toupper(wahl);
- normal();
- end;
-
-
- void get_workfile(void)
-
- begin
- string trim_filestr(string);
- char filename[15];
-
- setyx(MAXL1-1,0); inverse();
- printf("WORKFILE:"); setyx(MAXL1-1,10); normal(); update();
- filename[0] = '\0'; my_getstr(14,filename);
- strcpy(workfile,trim_filestr(filename));
- end;
-
-
- void get_mainfile(void)
-
- begin
- string trim_filestr(string);
- char filename[15];
-
- setyx(MAXL1-1,0); inverse();
- printf("MAINFILE:"); setyx(MAXL1-1,10); normal(); update();
- filename[0] = '\0'; my_getstr(14,filename);
- strcpy(mainfile,trim_filestr(filename));
- end;
-
-
- void get_path(Str)
- string Str;
-
- begin
- char inp[66];
-
- setyx(MAXL1-1,0); inverse();
- printf("PATH:"); setyx(MAXL1-1,6); normal(); update();
- my_getstr(65,inp);
- strcpy(Str,strupr(inp));
- end;
-
-
- void compile(void)
-
- begin
- char *argumente[MAXARGUMENTE];
- int i, j, res;
-
- fit_files();
- cls();
- if (not((*mainfile == '\0') || (*mainfile == ' '))) begin
- /* nicht leerer String */
- for(i = 0; i < MAXARGUMENTE; i++)
- argumente[i] = NULL;
- argumente[0] = "dummy";
- argumente[1] = mainfile;
- for (i = 0, j = 2; i < MAXOPTIONS; i++) begin
- switch (i) begin
- case 2: if (option_flag[2]) /* Macro anhaengen */
- argumente[j++] = macro;
- break;
- case 7: if (option_flag[8]) /* Outputname angeben */
- argumente[j++] = out_file;
- break;
- default: if (option_flag[i])
- argumente[j++] = option_str[i];
- break;
- end;
- end;
- run_possible = (not(option_flag[1]));
- lst_exist = (option_flag[6]);
- argumente[j++] = mem_mod_str[mem_mod_nr];
- for(i = 0; i < MAXINCLUDEPATH; i++)
- if (include_path_flag[i])
- argumente[j++] = include_path[i];
- argumente[j] = NULL;
- res = subprozess(1,compiler_name,argumente);
- end;
- if (res) begin /* Fehler beim Compilieren */
- run_possible = FALSE;
- setyx(MAXL1,0);
- if (ja_nein("\n\n Fehler beim Compilieren. Listing erzeugen ? (j/n)"))
- begin
- normal(); update(); printf("\n");
- argumente[j++] = "-l";
- argumente[j] = NULL;
-
- subprozess(1,compiler_name,argumente);
- lst_exist = TRUE
- end
- end;
- normal(); update();
- end
-
-
- void run(void)
-
- begin
- char *argumente[2];
-
- if (not(run_possible))
- compile();
-
- if (run_possible) begin
- char runname[81], *zeiger;
-
- strcpy(runname,mainfile);
- zeiger = index(runname,'.');
- if (com)
- strcpy(zeiger,".COM");
- else
- strcpy(zeiger,".EXE");
- argumente[0] = "dummy";
- argumente[1] = NULL;
- subprozess(1,runname,argumente);
- end
- end
-
-
- void edit(void)
-
- begin
- char *argumente[3];
-
- fit_files();
- argumente[0] = "dummy";
- argumente[1] = workfile;
- argumente[2] = NULL;
- ende_device(); /* Auf normalen Bildschirm I/O umschalten */
- subprozess(1,editorname,argumente);
- init_device();/* Wieder spezieller Bildschirm I/O */
- end;
-
-
- void ed_lst(void)
-
- begin
- char *argumente[3];
-
- if (lst_exist) begin
- char *zeiger, errorname[81];
- strcpy(errorname,mainfile);
- zeiger = index(errorname,'.');
- strcpy(zeiger,".LST");
- argumente[0] = "dummy";
- argumente[1] = errorname;
- argumente[2] = NULL;
- ende_device(); /* Auf normalen Bildschirm I/O umschalten */
- subprozess(1,editorname,argumente);
- init_device();/* Wieder spezieller Bildschirm I/O */
- end
- end;
-
-
- void options(void)
-
- begin
- char wahl, wahl2, ein[127];
- char *valid_keys = "aAcCdDeEgGiIlLmMoOrRsSuUwWxXqQ";
-
- repeat
- cls();
- inverse();
- printf( "********************************");
- printf("\n* *");
- printf("\n* Compiler Options *");
- printf("\n* *");
- printf("\n********************************");
- normal();
- setyx(6,0); mark_print("Alignment of structure-elements",1);
- setyx(8,0); mark_print("Compile only",1);
- setyx(8,20); mark_print("Define macro",1);
- setyx(8,40); mark_print("PrEprocessor results",3);
- setyx(10,0); mark_print("Generate debugging informations",1);
- setyx(12,0); mark_print("Include path",1);
- setyx(12,20); mark_print("List file",1);
- setyx(12,40); mark_print("Memory model",1);
- setyx(14,0); mark_print("Output file",1);
- setyx(14,20); mark_print("ROMable code",1);
- setyx(14,40); mark_print("Stack checking",1);
- setyx(16,0); mark_print("sUpress predef. macros",2);
- setyx(18,0); mark_print("no Warnings",4);
- setyx(18,20); mark_print("no error maXimum",12);
- setyx(18,40); mark_print("Quit",1);
- setyx(MAXL1,79); update(); /* Cursor aus dem Weg raeumen */
- repeat
- wahl = getch();
- until(member(wahl,valid_keys));
- switch (wahl) begin
- case 'a':
- case 'A': setyx(MAXL1-1,0); inverse(); printf("Byte/Word (b/w) ?");
- normal();
- setyx(MAXL1-1,18); update();
- repeat
- wahl2 = getch();
- until(member(wahl2,"bBwW"));
- option_flag[0] = (member(wahl2,"bB"));
- break;
- case 'c':
- case 'C': setyx(MAXL1-1,0);
- option_flag[1] = ja_nein("Nur Compilieren (j/n) ?");
- break;
- case 'd':
- case 'D': setyx(MAXL1-1,0); inverse(); printf("Macro:");
- normal(); setyx(MAXL1-1,7); update(); my_getstr(126,ein);
- strcpy(macro,option_str[2]); strcat(macro,ein);
- option_flag[2] = (strlen(ein) != 0);
- break;
- case 'e':
- case 'E': setyx(MAXL1-1,0);
- option_flag[3] =
- ja_nein("Preprozessorresultate im LST-File zeigen ? (j/n)");
- break;
- case 'g':
- case 'G': setyx(MAXL1-1,0);
- option_flag[4] =
- ja_nein("Debugging-Informationen erzeugen (j/n) ?");
- break;
- case 'i':
- case 'I': setyx(MAXL1-2,0); inverse();
- printf("Include-Path Nr. (0..9) ?");
- normal(); setyx(MAXL1-2,26); update();
- repeat
- wahl2 = getch();
- until(member(wahl2,"0123456789"));
- setyx(MAXL1-1,0); inverse(); printf("PATH:"); normal();
- setyx(MAXL1-1,6); update(); my_getstr(126,ein);
- if (strlen(ein) > 0) begin
- include_path_flag[wahl2-'0'] = TRUE;
- strcpy(include_path[wahl2-'0'],option_str[5]);
- strcat(include_path[wahl2-'0'],ein)
- end;
- break;
- case 'l':
- case 'L': setyx(MAXL1-1,0);
- option_flag[6] = ja_nein("List-File erzeugen (j/n) ?");
- break;
- case 'm':
- case 'M': begin
- char wahl3;
-
- repeat
- setyx(6,0); etoeos();
- setyx(8,0); mark_print("Small code & small data",1);
- setyx(8,40); mark_print("small code & large Data",20);
- setyx(10,0);
- mark_print("large Programcode & small Data",7);
- setyx(10,40); mark_print("Large code & large data",1);
- setyx(12,20); mark_print("COM-File",1);
- setyx(16,20); mark_print("only Integer-Arithmetik",6);
- setyx(20,0); mark_print("Quit",1);
- setyx(MAXL1,79); update();
- repeat
- wahl3 = getch();
- until(member(wahl3,"sSdDpPlLcCiIqQ"));
- if (not(member(wahl3,"qQ")))
- run_possible = FALSE;
- begin
- char *lvalid_key = "sdplc";
- char *uvalid_key = "SDPLC";
- if (member(wahl3,lvalid_key))
- mem_mod_nr =
- (int)(index(lvalid_key,wahl3)-lvalid_key);
- if (member(wahl3,uvalid_key))
- mem_mod_nr =
- (int)(index(uvalid_key,wahl3)-uvalid_key);
- end;
- if (member(wahl3,"cC"))
- com = TRUE;
- if ((not(member(wahl3,"cCiIqQ"))) && com)
- com = FALSE;
- if (member(wahl3,"iI")) begin
- setyx(MAXL1,0);
- int_only = ja_nein("Nur Integerarithmetik (j/n) ?");
- end;
- if ((int_only) && (mem_mod_nr < MEMMODNR / 2))
- mem_mod_nr += MEMMODNR / 2;
- if ((not(int_only)) && (mem_mod_nr >= MEMMODNR / 2))
- mem_mod_nr -= MEMMODNR / 2;
- until(member(wahl3,"qQ"));
- break;
- end;
- break;
- case 'o':
- case 'O': setyx(MAXL1-1,0); inverse(); printf("Output-File:");
- normal(); setyx(MAXL1-1,13); update(); my_getstr(65,ein);
- strcpy(out_file,option_str[7]); strcat(out_file,ein);
- option_flag[7] = (strlen(ein) != 0);
- break;
- case 'r':
- case 'R': setyx(MAXL1-1,0);
- option_flag[8] = ja_nein("ROM-faehigen Code (j/n) ?");
- break;
- case 's':
- case 'S': setyx(MAXL1-1,0);
- option_flag[9] = ja_nein("Stack Ueberpruefung (j/n) ?");
- break;
- case 'u':
- case 'U': setyx(MAXL1-1,0);
- option_flag[10] =
- ja_nein("Vordefinierte Macros unterdruecken (j/n) ?");
- break;
- case 'w':
- case 'W': setyx(MAXL1-1,0);
- option_flag[11] = ja_nein("Keine Warnings (j/n) ?");
- break;
- case 'x':
- case 'X': setyx(MAXL1-1,0);
- option_flag[12] = ja_nein("Kein Fehlermaximum (j/n) ?");
- break;
-
- end
- until(member(wahl,"qQ"))
- end
-
-
- void file_manager(void)
-
- begin
- char wahl;
- string valid_keys = "dDeEcCrRqQ";
-
- repeat
- cls(); inverse(); update();
- printf( "*****************************************");
- printf("\n* *");
- printf("\n* FILE *");
- printf("\n* *");
- printf("\n* MANAGER *");
- printf("\n* *");
- printf("\n*****************************************");
- normal();
- setyx(10,4); mark_print("Dir",1);
- setyx(10,14); mark_print("Erase",1);
- setyx(10,24); mark_print("Copy",1);
- setyx(10,34); mark_print("Rename",1);
- setyx(12,4); mark_print("Quit",1);
- setyx(MAXL1,0); update();
-
- repeat
- wahl = getch(); /* Keyboard ohne Echo lesen */
- until(member(wahl,valid_keys));
-
- switch (wahl) begin
- case 'd':
- case 'D': dir();
- break;
- case 'e':
- case 'E': erase();
- break;
- case 'c':
- case 'C': copy();
- break;
- case 'r':
- case 'R': my_rename();
- break;
- end
- until(member(wahl,"qQ"))
- end;
-
-
- void dir(void)
-
- begin
- char mask[61], sysline[80];
-
- strcpy(sysline,"DIR ");
- get_mask(mask); strcat(sysline,mask);
- cls(); setyx(0,0); call_system(sysline);
- setyx(MAXL1-1,0); wait_key()
- end;
-
-
- void erase(void)
-
- begin
- char mask[61], sysline[80];
-
- strcpy(sysline,"ERASE ");
- get_mask(mask);
- if (strlen(mask) != 0) begin
- strcat(sysline,mask);
- setyx(15,0);
- call_system(sysline);
- setyx(MAXL1-1,0); wait_key();
- end
- end;
-
-
- void copy(void)
-
- begin
- char sysline[127], sourcepath[61], destinationpath[61];
-
- strcpy(sysline,"COPY ");
- setyx(MAXL1-2,5); inverse();
- printf("Sourcepath:"); normal();
- setyx(MAXL1-2,17); update(); my_getstr(60,sourcepath);
- if (strlen(sourcepath) > 0) begin
- setyx(MAXL1-1,0); inverse();
- printf("Destinationpath:"); normal();
- setyx(MAXL1-1,17); update(); my_getstr(60,destinationpath);
- if (strlen(destinationpath) > 0) begin
- strcat(sysline,sourcepath); strcat(sysline," ");
- strcat(sysline,destinationpath);
- setyx(MAXL1-2,0); etoeos();
- setyx(15,0); update();
- system(sysline); wait_key();
- end
- end
- end
-
-
- void my_rename(void)
-
- begin
- char sysline[127], sourcepath[61], destinationpath[61];
-
- strcpy(sysline,"RENAME ");
- setyx(MAXL1-2,5); inverse();
- printf("Sourcepath:"); normal();
- setyx(MAXL1-2,17); update(); my_getstr(60,sourcepath);
- if (strlen(sourcepath) > 0) begin
- setyx(MAXL1-1,0); inverse();
- printf("Destinationpath:"); normal();
- setyx(MAXL1-1,17); update(); my_getstr(60,destinationpath);
- if (strlen(destinationpath) > 0) begin
- strcat(sysline,sourcepath); strcat(sysline," ");
- strcat(sysline,destinationpath);
- setyx(MAXL1-2,0); etoeos();
- setyx(15,0); update();
- system(sysline); wait_key();
- end
- end
- end
-
-
- void get_mask(mask)
- string mask;
-
- begin
-
- setyx(MAXL1-1,0); inverse();
- printf("MASK:"); normal(); setyx(MAXL1-1,6); update();
- *mask = '\0'; my_getstr(60,mask);
- setyx(MAXL1-1,0); etoeoln(); /* Unterste Zeilen loeschen */
- end;
-
-
- void get_off(void)
-
- begin
-
- setyx(MAXL1,0);
- if (ja_nein("Sie wollen das System verlassen ? (j/n):")) begin
- cls();
- ende_device();
- exit(0) /* Ende und aus ! */
- end
- end
-
-
- int mark_print(strp,pos) /* Gibt String mit einem inversen Buchstabe an der */
- string strp; /* Stelle pos aus */
- int pos;
-
- begin
- char front[81],sign[2];
-
- if (pos > strlen(strp)) return(-1); /* Bockmist */
-
- strncpy(front,strp,(pos-1));
- front[pos-1] = '\0'; /* String abschliessen */
- printf(front);
-
- strp += (pos-1); /* Zeiger auf das markierte Zeichen ruecken */
- strncpy(sign,strp,1);
- sign[1] = '\0'; /* String abschliessen */
- inverse(); printf(sign); normal(); /* Zeichen invers drucken */
-
- strp++; /* Nun zeigt strp auf den Rest nach dem markierten Zeichen */
- printf(strp);
- return(0) /* Alles OK */
- end
-
-
- void fit_files(void) /* Faengt leeres Work- oder Mainfile ab */
-
- begin
- if ((*mainfile == '\0') || (*mainfile == ' ')) /* leerer String */
- strcpy(mainfile,workfile);
- if ((*workfile == '\0') || (*workfile == ' ')) /* leerer String */
- strcpy(workfile,mainfile);
- if ((*workfile == '\0') || (*workfile == ' ')) /* immer noch Leerstring */
- strcpy(workfile,"WORK.C");
- if ((*mainfile == '\0') || (*mainfile == ' ')) /* immer noch Leerstring */
- strcpy(mainfile,"WORK.C");
- end
-
-
- int ja_nein(Str)
- string Str;
-
- begin
- char wahl;
- string valid_keys = "jJnN";
-
- inverse(); printf(Str); normal(); printf(" "); update();
- repeat
- wahl = getch()
- until(member(wahl,valid_keys));
- return(member(wahl,"jJ"));
- end
-
-
- string trim_filestr(filename) /* Macht einen Filenamen verarbeitungsfertig */
- string filename;
-
- begin
- char res[14], drive[3], name[9], ext[4];
-
- *res = '\0'; /* Resultat ist leer */
- /* path fertigmachen */
- *index(path,' ') = '\0'; /* Falls Leerzeichen in path, Rest raus */
- /* Laufwerk extrahieren */
- if (member(':',filename)) begin
- char *zeiger;
- zeiger = index(filename,':');
- strncpy(drive,--zeiger,1); /* Hoechstens 1 Characters kopieren */
- drive[1] = ':';
- drive[2] = '\0';
- filename = zeiger + 2; /* Jetzt zeigt filename auf den Dateinamen */
- end
- else
- strcpy(drive,logged_drive);
- /* Extension extrahieren */
- if (member('.',filename)) begin /* Wenn Extension vorhanden */
- char *zeiger;
- int i;
-
- zeiger = index(filename,'.');
- zeiger++;
- strncpy(ext,zeiger,3); /* Hoechstens 3 Characters kopieren */
- if (strlen(ext) < 3 ) /* Extension ggf. mit Blanks auffuellen */
- for(i = strlen(ext); i < 3; ext[i++] = ' ');
- ext[3] = '\0'; /* Sauber abschliessen */
- zeiger--;
- *zeiger = '\0'; /* Originalextension von Eingang-String abhaengen */
- end
- else /* Sonst C anhaengen */
- strcpy(ext,"C ");
- /* Nun den Dateiname fertigmachen */
- strncpy(name,filename,8); /* Maximal 8 Charakters kopieren */;
- name[8] = '\0';
- if ((strlen(name) == 0) || (name[0] == ' '))
- strcpy(name,"WORK");
- /* Rueckgabestring zusammenpuzzlen */
- strcat(res,drive);
- strcat(res,path);
- strcat(res,name);
- strcat(res,".");
- strcat(res,ext);
- /* String bis Ende auffuellen */
- if (strlen(res) < 14) begin
- int i, len;
- len = strlen(res);
- for(i = len; i < 14; res[i++] = ' ');
- res[14] = '\0'
- end;
- return(strupr(res));
-
- end;
-
-
- /* Diese String-Eingabefunktion akzeptiert keine Leerzeichen und */
- /* ermoeglicht mit <RETURN> eine "leere" Eingabe. Editiermoeglickkeit mit */
- /* <BACKSPACE>. */
- void my_getstr(nr,Str)
- int nr;
- char *Str;
- begin
- int zeichen;
- char *base;
-
- base = Str;
- repeat
- zeichen = getch();
- *Str++ = zeichen;
- if (zeichen != ' ') /* Echo produzieren */
- putchar(zeichen);
- if ((zeichen == BACKSPACE) && ((Str - base) > 1)) begin
- Str -= 2;
- putchar(' '); /* Letztes Zeichen ueberschreiben und */
- putchar(zeichen) /* wieder auf Position zurueck */
- end;
- if (zeichen == ' ')
- Str--;
- until ((zeichen == LF) || (zeichen == CR) || ((Str - base) == nr));
- if ((zeichen == LF) || (zeichen == CR)) begin
- Str--;
- end;
- *Str = '\0';
- end
-
-
- void missing_file(Str)
- string Str;
-
- begin
- printf("\n+++++++++++++++++++++++++++++++++++++++++++++");
- printf("\n+ FEHLER: +");
- printf("\n+ Datei %12s fehlt !!! +",Str);
- printf("\n+ Vergewissern Sie sich, dass sich die +");
- printf("\n+ Datei im Default-Directory befindet. +");
- printf("\n+++++++++++++++++++++++++++++++++++++++++++++\n\n");
- wait_key()
- end