home *** CD-ROM | disk | FTP | other *** search
/ Unix System Administration Handbook 1997 October / usah_oct97.iso / news / nn.tar / nn-6.5.1 / cvt-help.c < prev    next >
C/C++ Source or Header  |  1995-04-29  |  530b  |  37 lines

  1. /*
  2.  *    (c) Copyright 1990, Kim Fabricius Storm.  All rights reserved.
  3.  *
  4.  *    Convert help-files to binary.
  5.  *    ;:X    ->    ^X (control X)
  6.  */
  7.  
  8. #include <stdio.h>
  9.  
  10. main()
  11. {
  12.     register int c;
  13.  
  14.     while ((c = getchar()) != EOF) {
  15.     if (c == ';') {
  16.         c = getchar();
  17.         if (c == ':') {
  18.         c = getchar();
  19.         putchar(c & 0xf);
  20.         continue;
  21.         }
  22.         putchar(';');
  23.         putchar(c);
  24.         continue;
  25.     }
  26.     if (c >= 1 && c <= 7) {
  27.         putchar(';');
  28.         putchar(':');
  29.         putchar(c | 0x40);
  30.         continue;
  31.     }
  32.     putchar(c);
  33.     }
  34.  
  35.     exit(0);
  36. }
  37.