home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / unix / volume10 / lemming / part02 / lemstart.c < prev    next >
Encoding:
C/C++ Source or Header  |  1987-08-05  |  1.2 KB  |  67 lines

  1. /*
  2.  * lemstart.c - check command line, plus some housecleaning
  3.  *
  4.  * copyright (c) by Alan W. Paeth, 1987. All rights reserved.
  5.  */
  6.  
  7. #include "lem.h"
  8.  
  9. startup(argc, argv)
  10.     char **argv;
  11.     {
  12.     int i, plotmode;
  13.     plotmode = 0;
  14. /*
  15.  * initialize based on probable .rc file
  16.  */
  17.     leminit();
  18. /*
  19.  * set up object defaults
  20.  */
  21.     lastobj = 1;        /* no objects */
  22.     setattr('0');        /* default attr's (as if '0' typed) */
  23.     gtype = LINE;        /* draw lines by default */
  24.     undo = UNDONONE;        /* no operation to undo */
  25. /*
  26.  * start user code and refresh the display
  27.  */
  28.     start();    
  29.     redraw();
  30. /*
  31.  * command line prompt
  32.  */
  33.     msgpost("lemming ver 1 -- 'ctrl ^' for help");
  34. /*
  35.  * possible file name on cmd line
  36.  */
  37.     changes = 0;    /* no changes at present */
  38. /*
  39.  * do all command line parsing
  40.  */
  41.     for(i=1; i<argc; i++)
  42.         {
  43.     if (argv[i][0] == '-')
  44.         {
  45.         switch(argv[i][1])
  46.         {
  47.         case 'p':
  48.         case 'P': plotmode = 1; break;
  49.         default: err("unknown command line flag"); break;
  50.         }
  51.         }
  52.     else
  53.         {
  54.         if (!firstfile) firstfile = argv[i]; /* record first input file */
  55.         readfileint(argv[i]);
  56.         }
  57.     }
  58.     if (plotmode)
  59.     {
  60.     char outname[80];
  61.     sprintf(outname, "%s.pic", firstfile);
  62.     writepicint(outname);
  63.     stop();
  64.     exit(0);
  65.     }
  66.     }
  67.