From ffd56febcd70e72e29c1367e57a885768c0eea9e Mon Sep 17 00:00:00 2001 From: alm Date: Fri, 2 Jul 1993 06:16:28 +0000 Subject: Consolidate mark code - no functional changes or fixes. --- bin/ed/buf.c | 38 +++++++++++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) (limited to 'bin/ed/buf.c') diff --git a/bin/ed/buf.c b/bin/ed/buf.c index 1d74cb8..7c92e55 100644 --- a/bin/ed/buf.c +++ b/bin/ed/buf.c @@ -49,13 +49,13 @@ static char sccsid[] = "@(#)buf.c 5.5 (Berkeley) 3/28/93"; #include "ed.h" extern char errmsg[]; -extern line_t line0; FILE *sfp; /* scratch file pointer */ char *sfbuf = NULL; /* scratch file input buffer */ int sfbufsz = 0; /* scratch file input buffer size */ off_t sfseek; /* scratch file position */ int seek_write; /* seek before writing */ +line_t line0; /* initial node of line queue */ /* gettxt: get a line of text from the scratch file; return pointer to the text */ @@ -248,3 +248,39 @@ quit(n) } exit(n); } + + +unsigned char ctab[256]; /* character translation table */ + +/* init_buf: open scratch buffer; initialize line queue */ +void +init_buf() +{ + int i = 0; + + if (sbopen() < 0) + quit(2); + requeue(&line0, &line0); + for (i = 0; i < 256; i++) + ctab[i] = i; +} + + +/* translit: translate characters in a string */ +char * +translit(s, len, from, to) + char *s; + int len; + int from; + int to; +{ + static int i = 0; + + unsigned char *us; + + ctab[i] = i; /* restore table to initial state */ + ctab[i = from] = to; + for (us = (unsigned char *) s; len-- > 0; us++) + *us = ctab[*us]; + return s; +} -- cgit v1.1