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

  1. /*****************************************************************
  2.  * idiff.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.  * idiff.c: 
  11.  *
  12.  * USAGE
  13.  *    % idiff [ flags ] arguments
  14.  *
  15.  * EDITLOG
  16.  *    LastEditDate = Mon Jun 25 00:18:20 1990 - Michael Mauldin
  17.  *    LastFileName = /usr2/mlm/src/misc/fbm/idiff.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.  * 18-Aug-88  Michael Mauldin (mlm) at Carnegie-Mellon University
  27.  *    Created.
  28.  *****************************************************************/
  29.  
  30. # include <stdio.h>
  31.  
  32. # define USAGE \
  33. "Usage: idiff < original > delta\n       udiff < delta > original"
  34.  
  35. #ifndef lint
  36. static char *fbmid =
  37. "$FBM idiff.c <1.0> 25-Jun-90  (C) 1989,1990 by Michael Mauldin, source \
  38. code available free from MLM@CS.CMU.EDU and from UUNET archives$";
  39. #endif
  40.  
  41. main (argc, argv)
  42. char *argv[];
  43. { register int ch, lastch=0;
  44.  
  45.   if (argc > 1 || !strcmp (argv[0] + strlen (argv[0]) - 5, "udiff"))
  46.   { while ((ch = getchar ()) != EOF)
  47.     { putchar (lastch = ((ch+lastch) & 255)); }
  48.   }
  49.   else
  50.   { while ((ch = getchar ()) != EOF)
  51.     { putchar ((ch-lastch) & 255);
  52.       lastch = ch;
  53.     }
  54.   }
  55. }
  56.