home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Internet Tools 1993 July / Internet Tools.iso / RockRidge / mail / pp / pp-6.0 / Format / rfc1148 / t-RFCtoP2.c < prev    next >
Encoding:
C/C++ Source or Header  |  1991-12-18  |  2.0 KB  |  118 lines

  1. /* t-RFCtoP2.c: 822 -> P2 test program */
  2.  
  3. # ifndef lint
  4. static char Rcsid[] = "@(#)$Header: /xtel/pp/pp-beta/Format/rfc1148/RCS/t-RFCtoP2.c,v 6.0 1991/12/18 20:20:34 jpo Rel $";
  5. # endif
  6.  
  7. /*
  8.  * $Header: /xtel/pp/pp-beta/Format/rfc1148/RCS/t-RFCtoP2.c,v 6.0 1991/12/18 20:20:34 jpo Rel $
  9.  *
  10.  * $Log: t-RFCtoP2.c,v $
  11.  * Revision 6.0  1991/12/18  20:20:34  jpo
  12.  * Release 6.0
  13.  *
  14.  */
  15.  
  16.  
  17.  
  18. #include "head.h"
  19. #include "util.h"
  20.  
  21. extern void    or_myinit(), sys_init();
  22.  
  23. char    *usage = "t-822toP2 <822> <P2> [<extfile>]\n" ;
  24.  
  25. char  *rfc_in;
  26. char  *P2_out;
  27. char  *P2_ext_out;
  28.  
  29. main(argc, argv)
  30. char    **argv;
  31. int     argc;
  32. {
  33.     extern int optind, opterr;
  34.     extern char     *optarg;
  35.     int     opt;
  36.     char    *error = NULLCP;
  37.     sys_init(argv[0]);
  38.     or_myinit ();
  39.  
  40.     fprintf (stderr, "Welcome to RFC 822 -> P2\n");
  41.  
  42.     opterr = 0;
  43.     while((opt = getopt(argc, argv, "d:s:")) != EOF)
  44.         switch(opt)
  45.         {
  46.             case 'd': 
  47.                     break;
  48.             default:
  49.                 fprintf(stderr, "Unknown option %c\n", opt);
  50.                 fputs(usage, stderr);
  51.                 exit(1);
  52.         }
  53.  
  54.     if (argc - optind < 2 ||
  55.         argc - optind > 3)
  56.     {
  57.         fprintf (stderr, usage);
  58.         exit (1);
  59.     }
  60.     rfc_in = argv[optind++];
  61.     P2_out = argv[optind++];
  62.     if (argc > optind)
  63.         P2_ext_out = argv[optind];
  64.  
  65.     fprintf (stderr, "Initialised\n");
  66.  
  67.     RFCtoP2 (rfc_in, P2_out, P2_ext_out, &error, 1);
  68.  
  69. }
  70.  
  71.  
  72.  
  73. void    advise (what, fmt, a, b, c, d, e, f, g, h, i, j)
  74. char   *what,
  75.        *fmt,
  76.        *a,
  77.        *b,
  78.        *c,
  79.        *d,
  80.        *e,
  81.        *f,
  82.        *g,
  83.        *h,
  84.        *i,
  85.        *j;
  86. {
  87.     (void) fflush (stdout);
  88.  
  89.     fprintf (stderr, "RFCtoP2 test");
  90.     fprintf (stderr, fmt, a, b, c, d, e, f, g, h, i, j);
  91.     if (what)
  92.     (void) fputc (' ', stderr), perror (what);
  93.     else
  94.     (void) fputc ('\n', stderr);
  95.  
  96.     (void) fflush (stderr);
  97. }
  98.  
  99.  
  100. /* VARARGS 2 */
  101. void    adios (what, fmt, a, b, c, d, e, f, g, h, i, j)
  102. char   *what,
  103.        *fmt,
  104.        *a,
  105.        *b,
  106.        *c,
  107.        *d,
  108.        *e,
  109.        *f,
  110.        *g,
  111.        *h,
  112.        *i,
  113.        *j;
  114. {
  115.     advise (what, fmt, a, b, c, d, e, f, g, h, i, j);
  116.     _exit (1);
  117. }
  118.