home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Source Code / Add-Ons / MPW / MPW noweb 2.7 / src / c / main.c < prev    next >
Encoding:
C/C++ Source or Header  |  1995-09-06  |  1.6 KB  |  67 lines  |  [TEXT/MPS ]

  1. #line 14 "main.nw"
  2. #include <stdio.h>
  3. #include <string.h>
  4. #include <stdlib.h>
  5. #include <ctype.h>
  6. #include "notangle.h"
  7. #include "errors.h"
  8. #include "columns.h"
  9.  
  10. #ifdef macintosh
  11. #include <QuickDraw.h>
  12. #endif
  13.  
  14. main(int argc, char **argv) {
  15.     int i;
  16.     char *rootname = "*";       /* name of the root module */
  17.     char *locformat = "";
  18.     char *Clocformat = "#line %L \"%F\"%N";
  19.  
  20. #ifdef macintosh
  21.     InitGraf(&qd.thePort);
  22. #endif
  23.  
  24.     tabsize = 0;  /* default for nt is not to use tabs */
  25.  
  26.     for (i=1; i<argc; i++) {
  27.         
  28. #line 40 "main.nw"
  29. if (*argv[i]=='-') {
  30.     
  31. #line 47 "main.nw"
  32.     switch (*++argv[i]) {
  33.         case 't': /* set tab size or turn off */
  34.             if (isdigit(argv[i][1]))
  35.                 tabsize = atoi(argv[i]+1);
  36.             else if (argv[i][1]==0)
  37.                 tabsize = 0;            /* no tabs */
  38.             else 
  39.                 errormsg(Error, "%s: ill-formed option %s\n", argv[0], argv[i]);
  40.             break;          
  41.         case 'R': /* change name of root module */
  42.             rootname = ++argv[i];
  43.             break;
  44.         case 'L': /* have a #line number format */
  45.             locformat = ++argv[i];
  46.             if (!*locformat) locformat = Clocformat;
  47.             break;
  48.         default:
  49.             errormsg(Warning, "Ignoring unknown option -%s", argv[i]);
  50.      }
  51. #line 42 "main.nw"
  52. } else {
  53.     
  54. #line 68 "main.nw"
  55. errormsg(Warning,
  56.     "I can't handle arguments yet, so I'll just ignore `%s'",argv[i]);
  57.  
  58. #line 44 "main.nw"
  59. }
  60. #line 32 "main.nw"
  61.     }
  62.  
  63.     notangle(stdin, stdout, rootname, locformat);
  64.     exit(errorlevel);
  65.     return errorlevel;  /* slay warning */
  66. }
  67.