home *** CD-ROM | disk | FTP | other *** search
/ rtsi.com / 2014.01.www.rtsi.com.tar / www.rtsi.com / OS9 / OSK / EFFO / forum5.lzh / SPRACHEN / C / GSHELL / editor.c < prev    next >
C/C++ Source or Header  |  1988-04-20  |  689b  |  39 lines

  1. #include <stdio.h>
  2. #include "selectfile.h"
  3.  
  4. #define EDITOR "umacs"
  5.  
  6. usage()
  7. {
  8.     fprintf(stderr,"Syntax: editor [<path>]\n");
  9.     fprintf(stderr,"Function: a menue driven umacs shell\n");
  10.     fprintf(stderr,"Options: none\n");
  11.     exit(1);
  12. }
  13.  
  14.  
  15. main(argc,argv)
  16. int argc;
  17. char *argv[];
  18. {
  19.     char prog[100],dir[100],h[100];
  20.     if(argc==2) {
  21.         if(strcmp(argv[1],"-?")==0) usage();
  22.         strcpy(dir,argv[1]);
  23.     } else strcpy(dir,".");
  24.     while(select_file("UMACS-SHELL  V1.0           Uwe Simon  1988",
  25.             "Edit what File ?",dir,CHD,"*",prog)) {
  26.         strcpy(h,EDITOR);
  27.         strcat(h," ");
  28.         if(strcmp(dir,".")&&(prog[0]!='/')) {
  29.             strcat(h,dir); strcat(h,"/");
  30.         }
  31.         strcat(h,prog);
  32.         system(h);
  33.     }
  34.     printf("\n\n");
  35. }
  36.  
  37.  
  38.  
  39.