|
|
1.1 root 1: #include <stdio.h>
2: #include "config.h"
3: char code[256];
4: #define FIRST 3
5: #define FOLLOW 2
6: #define ZERO 6
7: #define next() (((c = getc(si))==EOF)? exit(0):0)
8: #define copy() putc(c,so)
9: #define type() code[(unsigned char)c]
10: #if os_unix_ts
11: #define index strchr
12: #endif
13:
14: init() {
15: doit(FIRST,"ABCDEFGHIJKLMNOPQRSTUVWXYZ_");
16: doit(FIRST,"0abcdefghijklmnopqrstuvwxyz_");
17: doit(FOLLOW,"123456789");
18: }
19: doit(act,list)
20: register unsigned char *list;
21: {
22: while(*list) {code[*list++]=act;}
23: }
24: main( )
25: {
26: register FILE *si = stdin, *so = stdout;
27: register c, count;
28:
29: init();
30: copying:
31: do { next(); copy();} while(type()!=FIRST);
32: hexnum:
33: if(c=='0') {
34: next();
35: if(c=='X'||c=='x') {
36: do { copy(); next();}
37: while (index("0123456789abcdefABCDEF",c&0x7f)>0);
38: }
39: ungetc(c,si); goto copying;
40: }
41: counting:
42: for(count = 0; count < 7; count++) {
43: next();
44: copy();
45: if(!(type()&FOLLOW)) goto copying;
46: }
47: squelch:
48: do { next(); } while (type()&FOLLOW);
49: copy();
50: goto copying;
51: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.