File: cvt-help.c

package info (click to toggle)
nn 6.7.3-2
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 2,480 kB
  • ctags: 3,198
  • sloc: ansic: 32,028; sh: 1,491; awk: 138; makefile: 96
file content (39 lines) | stat: -rw-r--r-- 631 bytes parent folder | download | duplicates (9)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/*
 *	(c) Copyright 1990, Kim Fabricius Storm.  All rights reserved.
 *      Copyright (c) 1996-2003 Michael T Pins.  All rights reserved.
 *
 *	Convert help-files to binary.
 *	;:X	->	^X (control X)
 */

#include <stdio.h>
#include <stdlib.h>

int
main(void)
{
    register int    c;

    while ((c = getchar()) != EOF) {
	if (c == ';') {
	    c = getchar();
	    if (c == ':') {
		c = getchar();
		putchar(c & 0xf);
		continue;
	    }
	    putchar(';');
	    putchar(c);
	    continue;
	}
	if (c >= 1 && c <= 7) {
	    putchar(';');
	    putchar(':');
	    putchar(c | 0x40);
	    continue;
	}
	putchar(c);
    }

    exit(0);
}