home *** CD-ROM | disk | FTP | other *** search
/ rtsi.com / 2014.01.www.rtsi.com.tar / www.rtsi.com / OS9 / OSK / NETWORK / netpbm_src.lzh / NETPBM / PPM / ppmmerge.c < prev    next >
C/C++ Source or Header  |  1996-11-18  |  3KB  |  109 lines

  1. /* ppmmerge.c - wrapper program for PPM
  2. **
  3. ** Copyright (C) 1991 by Jef Poskanzer.
  4. **
  5. ** Permission to use, copy, modify, and distribute this software and its
  6. ** documentation for any purpose and without fee is hereby granted, provided
  7. ** that the above copyright notice appear in all copies and that both that
  8. ** copyright notice and this permission notice appear in supporting
  9. ** documentation.  This software is provided "as is" without express or
  10. ** implied warranty.
  11. */
  12.  
  13. #include <stdio.h>
  14. #include "ppm.h"
  15.  
  16. int
  17. main( argc, argv )
  18.     int argc;
  19.     char* argv[];
  20.     {
  21.     register char* cp;
  22.  
  23. again:
  24.     if ( ( cp = rindex( argv[0], '/' ) ) != (char*) 0 )
  25.     ++cp;
  26.     else
  27.     cp = argv[0];
  28.     if ( strcmp( cp, "ppmmerge" ) == 0 )
  29.     {
  30.     ++argv;
  31.     --argc;
  32.     if(!*argv)    {
  33.         fprintf(stderr, "Usage: ppmmerge ppm_program_name [args ...]\n");
  34.         exit(1);
  35.         }
  36.     goto again;
  37.     }
  38.  
  39. #define TRY(s,m) { if ( strcmp( cp, s ) == 0 ) exit( m( argc, argv ) ); }
  40.  
  41.     TRY("bmptoppm", bmptoppm_main);
  42.     TRY("gouldtoppm", gouldtoppm_main);
  43.     TRY("ilbmtoppm", ilbmtoppm_main);
  44.     TRY("imgtoppm", imgtoppm_main);
  45.     TRY("hpcdtoppm", hpcdtoppm_main);
  46.     TRY("mtvtoppm", mtvtoppm_main);
  47.     TRY("pcxtoppm", pcxtoppm_main);
  48.     TRY("pgmtoppm", pgmtoppm_main);
  49.     TRY("pi1toppm", pi1toppm_main);
  50.     TRY("picttoppm", picttoppm_main);
  51.     TRY("pjtoppm", pjtoppm_main);
  52.     TRY("ppm3d", ppm3d_main);
  53.     TRY("ppmbrighten", ppmbrighten_main);
  54.     TRY("ppmchange", ppmchange_main);
  55.     TRY("ppmdim", ppmdim_main);
  56.     TRY("ppmdist", ppmdist_main);
  57.     TRY("ppmdither", ppmdither_main);
  58.     TRY("ppmflash", ppmflash_main);
  59.     TRY("ppmforge", ppmforge_main);
  60.     TRY("ppmhist", ppmhist_main);
  61.     TRY("ppmmake", ppmmake_main);
  62.     TRY("ppmmix", ppmmix_main);
  63.     TRY("ppmnorm", ppmnorm_main);
  64.     TRY("ppmntsc", ppmntsc_main);
  65.     TRY("ppmpat", ppmpat_main);
  66.     TRY("ppmquant", ppmquant_main);
  67.     TRY("ppmqvga", ppmqvga_main);
  68.     TRY("ppmrelief", ppmrelief_main);
  69.     TRY("ppmshift", ppmshift_main);
  70.     TRY("ppmspread", ppmspread_main);
  71.     TRY("ppmtoacad", ppmtoacad_main);
  72.     TRY("ppmtobmp", ppmtobmp_main);
  73.     TRY("ppmtogif", ppmtogif_main);
  74.     TRY("ppmtoicr", ppmtoicr_main);
  75.     TRY("ppmtoilbm", ppmtoilbm_main);
  76.     TRY("ppmtomap", ppmtomap_main);
  77.     TRY("ppmtomitsu", ppmtomitsu_main);
  78.     TRY("ppmtopcx", ppmtopcx_main);
  79.     TRY("ppmtopgm", ppmtopgm_main);
  80.     TRY("ppmtopi1", ppmtopi1_main);
  81.     TRY("ppmtopict", ppmtopict_main);
  82.     TRY("ppmtopj", ppmtopj_main);
  83.     TRY("ppmtopjxl", ppmtopjxl_main);
  84.     TRY("ppmtopuzz", ppmtopuzz_main);
  85.     TRY("ppmtorgb3", ppmtorgb3_main);
  86.     TRY("ppmtosixel", ppmtosixel_main);
  87.     TRY("ppmtotga", ppmtotga_main);
  88.     TRY("ppmtouil", ppmtouil_main);
  89.     TRY("ppmtoxpm", ppmtoxpm_main);
  90.     TRY("ppmtoyuv", ppmtoyuv_main);
  91.     TRY("ppmtoyuvsplit", ppmtoyuvsplit_main);
  92.     TRY("qrttoppm", qrttoppm_main);
  93.     TRY("rawtoppm", rawtoppm_main);
  94.     TRY("rgb3toppm", rgb3toppm_main);
  95.     TRY("sldtoppm", sldtoppm_main);
  96.     TRY("spctoppm", spctoppm_main);
  97.     TRY("sputoppm", sputoppm_main);
  98.     TRY("tgatoppm", tgatoppm_main);
  99.     TRY("ximtoppm", ximtoppm_main);
  100.     TRY("xpmtoppm", xpmtoppm_main);
  101.     TRY("xvminitoppm", xvminitoppm_main);
  102.     TRY("yuvtoppm", yuvtoppm_main);
  103.     TRY("yuvsplittoppm", yuvsplittoppm_main);
  104.  
  105.     (void) fprintf(
  106.     stderr, "ppmmerge: \"%s\" is an unknown PPM program!\n", cp );
  107.     exit( 1 );
  108.     }
  109.