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

  1. /*****************************************************************
  2.  * pbmtitle.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.  * pbmtitle.c: Add a title to a pbm bitmap
  11.  *
  12.  * USAGE
  13.  *    % pbmtitle [ flags ] arguments
  14.  *
  15.  * EDITLOG
  16.  *    LastEditDate = Mon Jun 25 00:18:32 1990 - Michael Mauldin
  17.  *    LastFileName = /usr2/mlm/src/misc/fbm/pbmtitle.c
  18.  *
  19.  * HISTORY
  20.  * 25-Jun-90  Michael Mauldin (mlm@cs.cmu.edu) Carnegie Mellon
  21.  *    Package for Release 1.0
  22.  *
  23.  * 07-Mar-89  Michael Mauldin (mlm) at Carnegie Mellon University
  24.  *    Beta release (version 0.9) mlm@cs.cmu.edu
  25.  *
  26.  * 23-Sep-88  Michael Mauldin (mlm) at Carnegie-Mellon University
  27.  *    Created.
  28.  *****************************************************************/
  29.  
  30. # include <stdio.h>
  31.  
  32. # define USAGE "Usage: pbmtitle 'new title' < pbm > pbm"
  33.  
  34. #ifndef lint
  35. static char *fbmid =
  36. "$FBM pbmtitle.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. char *argv[];
  42. { char buf[BUFSIZ];
  43.   int lines=0;
  44.  
  45.   if (argc != 2 || argv[1][0] == '-')
  46.   { fprintf (stderr, "%s\n", USAGE);
  47.     exit (1);
  48.   }
  49.   
  50.   while (fgets (buf, BUFSIZ, stdin))
  51.   { if (buf[0] != '#') { printf ("%s", buf); lines++; }
  52.     else if (strncmp (buf, "# Title: ", 9)) printf ("%s", buf);
  53.     
  54.     if (lines == 2) printf ("# Title: %s\n", argv[1]);
  55.   }
  56.   
  57.   exit (0);
  58. }
  59.