home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / netpbma.zip / ppm / ppmmerge.c < prev    next >
C/C++ Source or Header  |  1994-01-31  |  3KB  |  105 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.     goto again;
  33.     }
  34.  
  35. #define TRY(s,m) { if ( strcmp( cp, s ) == 0 ) exit( m( argc, argv ) ); }
  36.  
  37.     TRY("bmptoppm", bmptoppm_main);
  38.     TRY("gouldtoppm", gouldtoppm_main);
  39.     TRY("ilbmtoppm", ilbmtoppm_main);
  40.     TRY("imgtoppm", imgtoppm_main);
  41.     TRY("hpcdtoppm", hpcdtoppm_main);
  42.     TRY("mtvtoppm", mtvtoppm_main);
  43.     TRY("pcxtoppm", pcxtoppm_main);
  44.     TRY("pgmtoppm", pgmtoppm_main);
  45.     TRY("pi1toppm", pi1toppm_main);
  46.     TRY("picttoppm", picttoppm_main);
  47.     TRY("pjtoppm", pjtoppm_main);
  48.     TRY("ppm3d", ppm3d_main);
  49.     TRY("ppmbrighten", ppmbrighten_main);
  50.     TRY("ppmchange", ppmchange_main);
  51.     TRY("ppmdim", ppmdim_main);
  52.     TRY("ppmdist", ppmdist_main);
  53.     TRY("ppmdither", ppmdither_main);
  54.     TRY("ppmflash", ppmflash_main);
  55.     TRY("ppmforge", ppmforge_main);
  56.     TRY("ppmhist", ppmhist_main);
  57.     TRY("ppmmake", ppmmake_main);
  58.     TRY("ppmmix", ppmmix_main);
  59.     TRY("ppmnorm", ppmnorm_main);
  60.     TRY("ppmntsc", ppmntsc_main);
  61.     TRY("ppmpat", ppmpat_main);
  62.     TRY("ppmquant", ppmquant_main);
  63.     TRY("ppmqvga", ppmqvga_main);
  64.     TRY("ppmrelief", ppmrelief_main);
  65.     TRY("ppmshift", ppmshift_main);
  66.     TRY("ppmspread", ppmspread_main);
  67.     TRY("ppmtoacad", ppmtoacad_main);
  68.     TRY("ppmtobmp", ppmtobmp_main);
  69.     TRY("ppmtogif", ppmtogif_main);
  70.     TRY("ppmtoicr", ppmtoicr_main);
  71.     TRY("ppmtoilbm", ppmtoilbm_main);
  72.     TRY("ppmtomap", ppmtomap_main);
  73.     TRY("ppmtomitsu", ppmtomitsu_main);
  74.     TRY("ppmtopcx", ppmtopcx_main);
  75.     TRY("ppmtopgm", ppmtopgm_main);
  76.     TRY("ppmtopi1", ppmtopi1_main);
  77.     TRY("ppmtopict", ppmtopict_main);
  78.     TRY("ppmtopj", ppmtopj_main);
  79.     TRY("ppmtopjxl", ppmtopjxl_main);
  80.     TRY("ppmtopuzz", ppmtopuzz_main);
  81.     TRY("ppmtorgb3", ppmtorgb3_main);
  82.     TRY("ppmtosixel", ppmtosixel_main);
  83.     TRY("ppmtotga", ppmtotga_main);
  84.     TRY("ppmtouil", ppmtouil_main);
  85.     TRY("ppmtoxpm", ppmtoxpm_main);
  86.     TRY("ppmtoyuv", ppmtoyuv_main);
  87.     TRY("ppmtoyuvsplit", ppmtoyuvsplit_main);
  88.     TRY("qrttoppm", qrttoppm_main);
  89.     TRY("rawtoppm", rawtoppm_main);
  90.     TRY("rgb3toppm", rgb3toppm_main);
  91.     TRY("sldtoppm", sldtoppm_main);
  92.     TRY("spctoppm", spctoppm_main);
  93.     TRY("sputoppm", sputoppm_main);
  94.     TRY("tgatoppm", tgatoppm_main);
  95.     TRY("ximtoppm", ximtoppm_main);
  96.     TRY("xpmtoppm", xpmtoppm_main);
  97.     TRY("xvminitoppm", xvminitoppm_main);
  98.     TRY("yuvtoppm", yuvtoppm_main);
  99.     TRY("yuvsplittoppm", yuvsplittoppm_main);
  100.  
  101.     (void) fprintf(
  102.     stderr, "ppmmerge: \"%s\" is an unknown PPM program!\n", cp );
  103.     exit( 1 );
  104.     }
  105.