home *** CD-ROM | disk | FTP | other *** search
/ Photo CD Demo 1 / Demo.bin / fbm / src / tga2fbm.c < prev    next >
C/C++ Source or Header  |  1990-06-24  |  2KB  |  63 lines

  1. /*****************************************************************
  2.  * tga2fbm.c: FBM Release 1.0 25-Feb-90 Michael Mauldin
  3.  *
  4.  * Copyright (C) 1989,1990 by Michael Mauldin.  Permission is granted
  5.  * to use this file in whole or in part for any purpose, educational,
  6.  * recreational or commercial, provided that this copyright notice
  7.  * is retained unchanged.  This software is available to all free of
  8.  * charge by anonymous FTP and in the UUNET archives.
  9.  *
  10.  * tga2fbm.c: convert a bitmap to Targa format
  11.  *
  12.  * USAGE
  13.  *    % tga2fbm [ image ] > image.tga
  14.  *
  15.  * EDITLOG
  16.  *    LastEditDate = Mon Jun 25 00:23:06 1990 - Michael Mauldin
  17.  *    LastFileName = /usr2/mlm/src/misc/fbm/tga2fbm.c
  18.  *
  19.  * HISTORY
  20.  * 25-Jun-90  Michael Mauldin (mlm@cs.cmu.edu) Carnegie Mellon
  21.  *    Package for Release 1.0
  22.  *
  23.  * 03-May-89  Michael Mauldin (mlm) at Carnegie Mellon University
  24.  *    Beta release (version 0.93) mlm@cs.cmu.edu
  25.  *****************************************************************/
  26.  
  27. # include <stdio.h>
  28. # include <math.h>
  29. # include "fbm.h"
  30.  
  31. # define USAGE\
  32. "Usage: tga2fbm [ image ] > image.tga"
  33.  
  34. #ifndef lint
  35. static char *fbmid =
  36. "$FBM tga2fbm.c <1.0> 25-Jun-90  (C) 1989,1990 by Michael Mauldin, source \
  37. code available free from MLM@CS.CMU.EDU and from UUNET archives$";
  38. #endif
  39.  
  40. main (argc, argv)
  41. int argc;
  42. char *argv[];
  43. { FBM image;
  44.  
  45.   /* Clear pointers */
  46.   image.cm = image.bm = (unsigned char *) NULL;
  47.  
  48.   /* Open input if given */
  49.   if (argc > 1)
  50.   { if (freopen (argv[1], "r", stdin) != stdin)
  51.     { perror (argv[1]);
  52.       exit(1);
  53.     }
  54.   }
  55.  
  56.   if (read_tga (&image, stdin, "", 0) &&
  57.        write_fbm (&image, stdout))
  58.   { exit(0); }
  59.   else
  60.   { exit (1); }
  61. }
  62.  
  63.