Avoid various name clashes with curses and termcap headers

This allows us to include the proper headers, instead of declaring
things (badly) by hand.
This commit is contained in:
Linus Torvalds 2005-10-01 00:22:55 -07:00
parent d66d329986
commit 12cb79ceb4
12 changed files with 47 additions and 56 deletions

6
bind.c
View File

@ -105,7 +105,7 @@ int bindtokey(int f, int n)
ostring(" ");
/* get the command sequence to bind */
c = getckey((kfunc == meta) || (kfunc == cex) ||
c = getckey((kfunc == metafn) || (kfunc == cex) ||
(kfunc == unarg) || (kfunc == ctrlg));
/* change it to something we can print as well */
@ -115,7 +115,7 @@ int bindtokey(int f, int n)
ostring(outseq);
/* if the function is a prefix key */
if (kfunc == meta || kfunc == cex ||
if (kfunc == metafn || kfunc == cex ||
kfunc == unarg || kfunc == ctrlg) {
/* search for an existing binding for the prefix key */
@ -128,7 +128,7 @@ int bindtokey(int f, int n)
}
/* reset the appropriate global prefix variable */
if (kfunc == meta)
if (kfunc == metafn)
metac = c;
if (kfunc == cex)
ctlxc = c;

12
ebind.h
View File

@ -28,15 +28,15 @@ KEYTAB keytab[NBINDS] = {
,
{CONTROL | 'H', backdel}
,
{CONTROL | 'I', tab}
{CONTROL | 'I', insert_tab}
,
{CONTROL | 'J', indent}
,
{CONTROL | 'K', killtext}
,
{CONTROL | 'L', refresh}
{CONTROL | 'L', redraw}
,
{CONTROL | 'M', newline}
{CONTROL | 'M', insert_newline}
,
{CONTROL | 'N', forwline}
,
@ -64,7 +64,7 @@ KEYTAB keytab[NBINDS] = {
,
{CONTROL | 'Z', backpage}
,
{CONTROL | ']', meta}
{CONTROL | ']', metafn}
,
{CTLX | CONTROL | 'B', listbuffers}
,
@ -125,7 +125,7 @@ KEYTAB keytab[NBINDS] = {
,
{CTLX | '@', pipecmd}
,
{CTLX | '#', filter}
{CTLX | '#', filter_buffer}
,
{CTLX | '$', execprg}
,
@ -391,7 +391,7 @@ KEYTAB keytab[NBINDS] = {
,
{SPEC | 'D', backchar}
,
{SPEC | 'c', meta}
{SPEC | 'c', metafn}
,
{SPEC | 'd', backchar}
,

17
efunc.h
View File

@ -28,8 +28,8 @@ extern int killpara(int f, int n);
extern int wordcount(int f, int n);
/* line.c */
extern int lfree(LINE *lp);
extern int lchange(int flag);
extern void lfree(LINE *lp);
extern void lchange(int flag);
extern int insspace(int f, int n);
extern int linstr(char *instr);
extern int linsert(int n, int c);
@ -40,13 +40,13 @@ extern int ldelete(long n, int kflag);
extern char *getctext(void);
extern int putctext(char *iline);
extern int ldelnewline(void);
extern int kdelete(void);
extern void kdelete(void);
extern int kinsert(int c);
extern int yank(int f, int n);
/* window.c */
extern int reposition(int f, int n);
extern int refresh(int f, int n);
extern int redraw(int f, int n);
extern int nextwind(int f, int n);
extern int prevwind(int f, int n);
extern int mvdnwind(int f, int n);
@ -93,12 +93,12 @@ extern int getccol(int bflg);
extern int setccol(int pos);
extern int twiddle(int f, int n);
extern int quote(int f, int n);
extern int tab(int f, int n);
extern int insert_tab(int f, int n);
extern int detab(int f, int n);
extern int entab(int f, int n);
extern int trim(int f, int n);
extern int openline(int f, int n);
extern int newline(int f, int n);
extern int insert_newline(int f, int n);
extern int cinsert(void);
extern int insbrace(int n, int c);
extern int inspound(void);
@ -131,7 +131,7 @@ extern int ctrlg(int f, int n);
extern int rdonly(void);
extern int resterr(void);
extern int nullproc(int f, int n);
extern int meta(int f, int n);
extern int metafn(int f, int n);
extern int cex(int f, int n);
extern int unarg(int f, int n);
extern int cexit(int status);
@ -325,7 +325,7 @@ extern void rtfrmshell(void);
extern int spawn(int f, int n);
extern int execprg(int f, int n);
extern int pipecmd(int f, int n);
extern int filter(int f, int n);
extern int filter_buffer(int f, int n);
extern int sys(char *cmd);
extern int shellprog(char *cmd);
extern int execprog(char *cmd);
@ -356,7 +356,6 @@ extern int checknext(char chr, char *patrn, int dir);
extern int scanmore(char *patrn, int dir);
extern int match_pat(char *patrn);
extern int promptpattern(char *prompt);
extern int echochar(int c, int col);
extern int get_char(void);
extern int uneat(void);
extern int reeat(int c);

View File

@ -29,6 +29,8 @@
#if ISRCH
static int echo_char(int c, int col);
/* A couple of "own" variables for re-eat */
int (*saved_get_char) (); /* Get character routine */
@ -172,7 +174,7 @@ int isearch(int f, int n)
c = ectoc(expc = get_char()); /* Get the first character */
if ((c == IS_FORWARD) || (c == IS_REVERSE) || (c == IS_VMSFORW)) { /* Reuse old search string? */
for (cpos = 0; pat[cpos] != 0; cpos++) /* Yup, find the length */
col = echochar(pat[cpos], col); /* and re-echo the string */
col = echo_char(pat[cpos], col); /* and re-echo the string */
if (c == IS_REVERSE) { /* forward search? */
n = -1; /* No, search in reverse */
backchar(TRUE, 1); /* Be defensive about EOB */
@ -248,7 +250,7 @@ int isearch(int f, int n)
return (TRUE); /* Return an error */
}
pat[cpos] = 0; /* null terminate the buffer */
col = echochar(c, col); /* Echo the character */
col = echo_char(c, col); /* Echo the character */
if (!status) { /* If we lost last time */
TTputc(BELL); /* Feep again */
TTflush(); /* see that the feep feeps */
@ -399,7 +401,7 @@ int promptpattern(char *prompt)
* int c; character to be echoed
* int col; column to be echoed in
*/
int echochar(int c, int col)
static int echo_char(int c, int col)
{
movecursor(term.t_nrow, col); /* Position the cursor */
if ((c < ' ') || (c == 0x7F)) { /* Control character? */

7
line.c
View File

@ -50,7 +50,7 @@ LINE *lalloc(int used)
* might be in. Release the memory. The buffers are updated too; the magic
* conditions described in the above comments don't hold here.
*/
int lfree(LINE *lp)
void lfree(LINE *lp)
{
register BUFFER *bp;
register window_t *wp;
@ -95,7 +95,7 @@ int lfree(LINE *lp)
* displayed in more than 1 window we change EDIT t HARD. Set MODE if the
* mode line needs to be updated (the "*" has to be set).
*/
int lchange(int flag)
void lchange(int flag)
{
register window_t *wp;
@ -122,6 +122,7 @@ int insspace(int f, int n)
{
linsert(n, ' ');
backchar(f, n);
return (TRUE);
}
/*
@ -551,7 +552,7 @@ int ldelnewline(void)
* new kill context is being created. The kill buffer array is released, just
* in case the buffer has grown to immense size. No errors.
*/
int kdelete(void)
void kdelete(void)
{
KILL *kp; /* ptr to scan kill buffer chunk list */

5
main.c
View File

@ -309,7 +309,8 @@ int main(int argc, char **argv)
fn_t execfunc;
if (c == newc && (execfunc = getbind(c)) != NULL
&& execfunc != newline && execfunc != tab)
&& execfunc != insert_newline
&& execfunc != insert_tab)
newc = getcmd();
else
break;
@ -712,7 +713,7 @@ int nullproc(int f, int n)
}
/* dummy function for binding to meta prefix */
int meta(int f, int n)
int metafn(int f, int n)
{
return (TRUE);
}

10
names.c
View File

@ -30,7 +30,7 @@ NBIND names[] = {
{"change-file-name", filename},
{"change-screen-size", newsize},
{"change-screen-width", newwidth},
{"clear-and-redraw", refresh},
{"clear-and-redraw", redraw},
{"clear-message-line", clrmes},
{"copy-region", copyregion},
#if WORDPRO
@ -112,7 +112,7 @@ NBIND names[] = {
#if WORDPRO
{"fill-paragraph", fillpara},
#endif
{"filter-buffer", filter},
{"filter-buffer", filter_buffer},
{"find-file", filefind},
{"forward-character", forwchar},
{"goto-line", gotoline},
@ -120,7 +120,7 @@ NBIND names[] = {
{"goto-matching-fence", getfence},
#endif
{"grow-window", enlargewind},
{"handle-tab", tab},
{"handle-tab", insert_tab},
{"hunt-forward", forwhunt},
{"hunt-backward", backhunt},
{"help", help},
@ -143,11 +143,11 @@ NBIND names[] = {
{"label-function-key", fnclabel},
#endif
{"list-buffers", listbuffers},
{"meta-prefix", meta},
{"meta-prefix", metafn},
{"move-window-down", mvdnwind},
{"move-window-up", mvupwind},
{"name-buffer", namebuffer},
{"newline", newline},
{"newline", insert_newline},
{"newline-and-indent", indent},
{"next-buffer", nextbuffer},
{"next-line", forwline},

View File

@ -42,7 +42,7 @@ int gethostname(char *name, int namelen)
char *dolock(fname)
char *fname;
{
int fd, lk, n;
int fd, n;
static char lname[MAXLOCK], locker[MAXNAME + 1];
int mask;
struct stat sbuf;
@ -104,7 +104,6 @@ char *fname;
char *undolock(fname)
char *fname;
{
int fd, lk;
static char lname[MAXLOCK];
strcat(strcpy(lname, fname), ".lock~");

View File

@ -235,7 +235,7 @@ int quote(int f, int n)
* done in this slightly funny way because the tab (in ASCII) has been turned
* into "C-I" (in 10 bit code) already. Bound to "C-I".
*/
int tab(int f, int n)
int insert_tab(int f, int n)
{
if (n < 0)
return (FALSE);
@ -438,7 +438,7 @@ int openline(int f, int n)
* Insert a newline. Bound to "C-M". If we are in CMODE, do automatic
* indentation as specified.
*/
int newline(int f, int n)
int insert_newline(int f, int n)
{
register int s;
@ -506,7 +506,7 @@ int cinsert(void)
/* and one more tab for a brace */
if (bracef)
tab(FALSE, 1);
insert_tab(FALSE, 1);
#if SCROLLCODE
curwp->w_flag |= WFINS;

View File

@ -379,7 +379,7 @@ int pipecmd(int f, int n)
* filter a buffer through an external DOS program
* Bound to ^X #
*/
int filter(int f, int n)
int filter_buffer(int f, int n)
{
register int s; /* return status from CLI */
register BUFFER *bp; /* pointer to buffer to zot */

25
tcap.c
View File

@ -14,6 +14,8 @@
#define termdef 1 /* don't define "term" external */
#include <stdio.h>
#include <curses.h>
#include <term.h>
#include "estruct.h"
#include "edef.h"
@ -32,12 +34,6 @@
#define BEL 0x07
#define ESC 0x1B
/* FIXME! termcap */
extern int tgetnum(char *);
extern char *tgetstr(char *id, char **area);
extern int tputs(const char *str, int affcnt, int (*putc)(int));
extern char *tgoto(const char *cap, int col, int row);
static void tcapkopen(void);
static void tcapkclose(void);
static void tcapmove(int, int);
@ -53,15 +49,14 @@ static void tcapopen(void);
#if PKCODE
static void tcapclose(void);
#endif
extern int tput();
extern char *tgoto();
#if COLOR
extern int tcapfcol();
extern int tcapbcol();
static void tcapfcol(void);
static void tcapbcol(void);
#endif
#if SCROLLCODE
static void tcapscroll_reg(int from, int to, int lines);
static void tcapscroll_delins(int from, int to, int lines);
static void tcapscroll_reg(int from, int to, int linestoscroll);
static void tcapscroll_delins(int from, int to, int linestoscroll);
#endif
@ -357,12 +352,6 @@ static void putpad(char *str)
tputs(str, 1, ttputc);
}
static void putnpad(char *str, int n)
{
tputs(str, n, ttputc);
}
#if FNLABEL
/*
* label a function key

View File

@ -29,7 +29,7 @@ int reposition(int f, int n)
* Refresh the screen. With no argument, it just does the refresh. With an
* argument it recenters "." in the current window. Bound to "C-L".
*/
int refresh(int f, int n)
int redraw(int f, int n)
{
if (f == FALSE)
sgarbf = TRUE;