home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / unix / volume19 / fbm / part01 / pic2fbm.c < prev    next >
C/C++ Source or Header  |  1989-06-08  |  1KB  |  54 lines

  1. /*****************************************************************
  2.  * pic2fbm.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.  * pic2fbm.c: convert a bitmap to Targa format
  9.  *
  10.  * USAGE
  11.  *    % pic2fbm [ image.pic ] > image.fbm
  12.  *
  13.  * EDITLOG
  14.  *    LastEditDate = Wed May  3 21:50:43 1989 - Michael Mauldin
  15.  *    LastFileName = /usr2/mlm/src/misc/fbm/pic2fbm.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: pic2fbm [ image.pic ] > image.fbm"
  28.  
  29. #ifndef lint
  30. static char *fbmid =
  31.     "$FBM pic2fbm.c <0.93> 03-May-89  (C) 1989 by Michael Mauldin$";
  32. #endif
  33. main(argc,argv)
  34. int argc; char *argv[];
  35. { FBM image;
  36.  
  37.   /* Clear pointers */
  38.   image.cm = image.bm = (unsigned char *) NULL;
  39.  
  40.   /* Open input if given */
  41.   if (argc > 1)
  42.   { if (freopen (argv[1], "r", stdin) != stdin)
  43.     { perror (argv[1]);
  44.       exit(1);
  45.     }
  46.   }
  47.  
  48.   if (read_pic (&image, stdin, "", 0) &&
  49.        write_fbm (&image, stdout))
  50.   { exit(0); }
  51.   else
  52.   { exit (1); }
  53. }
  54.