Consolidate mark code - no functional changes or fixes.

This commit is contained in:
Andrew Moore 1993-07-02 06:16:28 +00:00
parent 24cd262d1a
commit 95c745afb2
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=87
2 changed files with 41 additions and 2 deletions

View File

@ -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;
}

View File

@ -206,6 +206,7 @@ int desputc __P((int, FILE *));
int docmd __P((int));
void err __P((char *));
char *ccl __P((char *));
void clrmark __P((line_t *));
void cvtkey __P((char *, char *));
long doglob __P((int));
void dohup __P((int));
@ -223,6 +224,7 @@ int getkey __P((void));
char *getlhs __P((int));
int getline __P((void));
int getlist __P((void));
long getmark __P((int));
long getnum __P((int));
long getone __P((void));
line_t *getlp __P((long));
@ -236,12 +238,12 @@ line_t *lpdup __P((line_t *));
void lpqueue __P((line_t *));
void makekey __P((char *));
char *makesub __P((int));
char *translit __P((char *, int, int, int));
int move __P((long, int));
int oddesc __P((char *, char *));
void onhup __P((int));
void onintr __P((int));
pattern_t *optpat __P((void));
int putmark __P((int, line_t *));
void putstr __P((char *, int, long, int));
char *puttxt __P((char *));
void quit __P((int));
@ -253,6 +255,7 @@ int catsub __P((char *, regmatch_t *, int));
int subst __P((pattern_t *, int));
int tobinhex __P((int, int));
int transfer __P((long));
char *translit __P((char *, int, int, int));
int undo __P((int));
undo_t *upush __P((int, long, long));
void ureset __P((void));