home *** CD-ROM | disk | FTP | other *** search
/ Dream 45 / Amiga_Dream_45.iso / Amiga / Magazine / Dossier-LaTeX / AmiWeb2C.lha / source / web2c-6.1 / web2c / mpware / mptotex.ch < prev    next >
Text File  |  1995-03-26  |  2KB  |  97 lines

  1. Changes for MPTOTEX.C by Andreas Scherer, March 26, 1995.
  2.  
  3. @x l.31
  4. #include <stdio.h>
  5. @y
  6. #include <stdio.h>
  7. #include <stdlib.h>
  8. #include <string.h>
  9.  
  10. #ifdef _AMIGA
  11. const unsigned char Version[] =
  12.   "$VER: MPtoTeX 0.60 ("__DATE__", "__TIME__")\n";
  13. #endif
  14.  
  15. void usage(char *);
  16. void err(char *);
  17. char *getline(void);
  18. int match_str(char *, char *);
  19. int getbta(char *);
  20. void copytex(void);
  21. void do_line(void);
  22. @z
  23.  
  24. @x l.52
  25.     fprintf(stderr, "Usage: %s <mp-file>\n", nam);
  26. @y
  27. #ifdef _AMIGA
  28.     fprintf(stderr, "Usage: %s <mp-file> [-E<errlog-file>]\n", nam);
  29. #else /* _AMIGA */
  30.     fprintf(stderr, "Usage: %s <mp-file>\n", nam);
  31. #endif /* _AMIGA */
  32. @z
  33.  
  34. The Amiga CLI doesn't provide the redirection of STDERR like UNIX /bin/sh.
  35. For use of `MPtoTeX' in `makempx.rexx', the standard error channel can be
  36. reopened to the file specified in the third argument after the `-E' option.
  37.  
  38. There is a BUG in the original version.
  39.  
  40. @x l.212
  41. void main(argc, argv)
  42.     char *argv[];
  43. {
  44.     if (argc!=2) usage(argv[0]);
  45.     mpname = argv[1];
  46.     mpfile = fopen(mpname, "r");
  47.     if (mpname==NULL) usage(argv[0]);
  48.     printf("%s",predoc);
  49.     while (getline()!=NULL)
  50.         do_line();
  51.     printf("%s",postdoc);
  52.     exit(0);
  53. }
  54. @y
  55. #ifdef _AMIGA
  56. void main(argc, argv)
  57.     char *argv[];
  58. {
  59.     switch(argc) {
  60.     case 3:
  61.         if (strncmp(argv[2], "-E", 2) || (argv[2]+2 == NULL))
  62.             usage(argv[0]);
  63.         else
  64.             freopen(argv[2]+2, "w", stderr);
  65.         /* Fall through. */
  66.     case 2:
  67.         break; /* Continue. */
  68.     default:
  69.         usage(argv[0]);
  70.     }
  71.  
  72.     mpname = argv[1];
  73.     mpfile = fopen(mpname, "r");
  74.     if (mpfile==NULL) usage(argv[0]); /* BUG fixed */
  75.     printf("%s",predoc);
  76.     while (getline()!=NULL)
  77.         do_line();
  78.     printf("%s",postdoc);
  79.     exit(0);
  80. }
  81. #else /* _AMIGA */
  82. void main(argc, argv)
  83.     char *argv[];
  84. {
  85.     if (argc!=2) usage(argv[0]);
  86.     mpname = argv[1];
  87.     mpfile = fopen(mpname, "r");
  88.     if (mpfile==NULL) usage(argv[0]); /* BUG fixed anyway */
  89.     printf("%s",predoc);
  90.     while (getline()!=NULL)
  91.         do_line();
  92.     printf("%s",postdoc);
  93.     exit(0);
  94. }
  95. #endif /* _AMIGA */
  96. @z
  97.