home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Internet Tools 1993 July / Internet Tools.iso / RockRidge / mail / metamail / contrib / amiga / AmigaSrc / ilbmToGIF.c < prev    next >
Encoding:
C/C++ Source or Header  |  1992-05-05  |  1.0 KB  |  42 lines

  1. /* Create a GIF image from an IFF ILBM file.
  2.  * Ask the user to name an ILBM. We then call programs that do the actual
  3.  * conversion. The GIF image will be given the name provided as the first
  4.  * (and only) argument.
  5.  *
  6.  * Usage:
  7.  *  ilbmToGIF temp_file_name
  8.  */
  9.  
  10. #include <stdio.h>
  11. #include <string.h>
  12.  
  13. main(argc, argv)
  14. int argc;
  15. char **argv;
  16. {
  17.     char lineBuf[200];
  18.     char command[250];
  19.     int i;
  20.  
  21.     if (argc != 2) {
  22.         fprintf(stderr, "Usage: %s temp_file_name\n", argv[0]);
  23.         exit(10);
  24.     }
  25.  
  26.     printf("Enter the name of an ILBM IFF file: ");
  27.     fgets(lineBuf, sizeof(lineBuf), stdin);
  28.     i = strlen(lineBuf);
  29.     if (i > 0 && lineBuf[i - 1] == '\n') {
  30.         lineBuf[i - 1] = 0;
  31.         i--;
  32.     }
  33.     if (i == 0 || access(lineBuf, 4)) {
  34.         fprintf(stderr, "%s: Unable to access file '%s'\n", argv[0], lineBuf);
  35.         exit(10);
  36.     }
  37.  
  38. /*    sprintf(command, "ilbmtoppm %s | ppmtogif >%s", lineBuf, argv[1]); */
  39.     sprintf(command, "fbcat -G <%s >%s", lineBuf, argv[1]);
  40.     exit(system(command));
  41. }
  42.