home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / unix / volume19 / fbm / part01 / tga2fbm.c < prev   
Encoding:
C/C++ Source or Header  |  1989-06-08  |  1.3 KB  |  57 lines

  1. /*****************************************************************
  2.  * tga2fbm.c: FBM Library 0.93 (Beta test) 03-May-89  Michael Mauldin
  3.  *
  4.  * Copyright (C) 1989 by Michael Mauldin.  Permission is granted to
  5.  * use this file in whole or in part provided that you do not sell it
  6.  * for profit and that this copyright notice is retained unchanged.
  7.  *
  8.  * tga2fbm.c: convert a bitmap to Targa format
  9.  *
  10.  * USAGE
  11.  *    % tga2fbm [ image ] > image.tga
  12.  *
  13.  * EDITLOG
  14.  *    LastEditDate = Wed May  3 21:50:43 1989 - Michael Mauldin
  15.  *    LastFileName = /usr2/mlm/src/misc/fbm/tga2fbm.c
  16.  *
  17.  * HISTORY
  18.  * 03-May-89  Michael Mauldin (mlm) at Carnegie Mellon University
  19.  *    Beta release (version 0.93) mlm@cs.cmu.edu
  20.  *****************************************************************/
  21.  
  22. # include <stdio.h>
  23. # include <math.h>
  24. # include "fbm.h"
  25.  
  26. # define USAGE\
  27. "Usage: tga2fbm [ image ] > image.tga"
  28.  
  29. #ifndef lint
  30. static char *fbmid =
  31.     "$FBM tga2fbm.c <0.93> 03-May-89  (C) 1989 by Michael Mauldin$";
  32. #endif
  33.  
  34. main (argc, argv)
  35. int argc;
  36. char *argv[];
  37. { FBM image;
  38.  
  39.   /* Clear pointers */
  40.   image.cm = image.bm = (unsigned char *) NULL;
  41.  
  42.   /* Open input if given */
  43.   if (argc > 1)
  44.   { if (freopen (argv[1], "r", stdin) != stdin)
  45.     { perror (argv[1]);
  46.       exit(1);
  47.     }
  48.   }
  49.  
  50.   if (read_tga (&image, stdin, "", 0) &&
  51.        write_fbm (&image, stdout))
  52.   { exit(0); }
  53.   else
  54.   { exit (1); }
  55. }
  56.  
  57.