home *** CD-ROM | disk | FTP | other *** search
/ Geek Gadgets 1 / ADE-1.bin / ade-dist / fontutils-0.6-base.tgz / fontutils-0.6-base.tar / fsf / fontutils / pbm / pbmascii.c < prev    next >
C/C++ Source or Header  |  1992-10-23  |  665b  |  38 lines

  1. /* pbmascii -- dump a PBM file (from stdin) on stdout.  */
  2.  
  3. #include <stdio.h>
  4. #include <stdlib.h>
  5.  
  6. int
  7. main (int argc, char *argv[])
  8. {
  9.   int width, height, format;
  10.   unsigned row;
  11.   unsigned char *image_row;
  12.   
  13.   pbm_readpbminit (stdin, &width, &height, &format);
  14.   
  15.   image_row = malloc (width);
  16.   
  17.   for (row = 0; row < height; row++)
  18.     {
  19.       int c;
  20.  
  21.       pbm_readpbmrow (stdin, image_row, width, format);
  22.       
  23.       printf ("%5d:", row);
  24.       for (c = 0; c < width; c++)
  25.         putchar (image_row[c] ? '*' : ' ');
  26.       putchar ('\n');
  27.     }
  28.   
  29.   return 0;
  30. }
  31.  
  32.  
  33. /*
  34. Local variables:
  35. compile-command: "gcc -g -posix -o pbmascii pbmascii.c pbm.a"
  36. End:
  37. */
  38.