summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbcallah <bcallah@openbsd.org>2015-03-17 18:08:52 +0000
committerbcallah <bcallah@openbsd.org>2015-03-17 18:08:52 +0000
commit547745240b173ac7523578752faeaedc41c6d013 (patch)
tree9cdc55b0374748b3862ed991bdd177ce50030fad
parentAdd sort_calloc() and use it. (diff)
downloadwireguard-openbsd-547745240b173ac7523578752faeaedc41c6d013.tar.xz
wireguard-openbsd-547745240b173ac7523578752faeaedc41c6d013.zip
It is impossible to build mg without both -DFKEYS and -DXKEYS. So let's
enforce that and remove the options. Mostly mechanical diff from unifdef with bonus removal of comments that no longer have any relevance. ok florian@
-rw-r--r--usr.bin/mg/Makefile9
-rw-r--r--usr.bin/mg/chrdef.h4
-rw-r--r--usr.bin/mg/cinfo.c4
-rw-r--r--usr.bin/mg/extend.c34
-rw-r--r--usr.bin/mg/tty.c4
-rw-r--r--usr.bin/mg/ttykbd.c18
6 files changed, 9 insertions, 64 deletions
diff --git a/usr.bin/mg/Makefile b/usr.bin/mg/Makefile
index 255a4ef2905..8ef343f79fb 100644
--- a/usr.bin/mg/Makefile
+++ b/usr.bin/mg/Makefile
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile,v 1.29 2015/01/05 21:45:10 lum Exp $
+# $OpenBSD: Makefile,v 1.30 2015/03/17 18:08:52 bcallah Exp $
PROG= mg
@@ -7,13 +7,10 @@ DPADD+= ${LIBCURSES} ${LIBUTIL}
# (Common) compile-time options:
#
-# FKEYS -- add support for function key sequences.
# REGEX -- create regular expression functions.
-# STARTUPFILE -- look for and handle initialization file.
-# XKEYS -- use termcap function key definitions.
-# note: XKEYS and bsmap mode do _not_ get along.
+# STARTUPFILE -- look for and handle initialization file.
#
-CFLAGS+=-Wall -DFKEYS -DREGEX -DXKEYS
+CFLAGS+=-Wall -DREGEX
SRCS= autoexec.c basic.c bell.c buffer.c cinfo.c dir.c display.c \
echo.c extend.c file.c fileio.c funmap.c help.c kbd.c keymap.c \
diff --git a/usr.bin/mg/chrdef.h b/usr.bin/mg/chrdef.h
index ed94098d5ad..5160151f171 100644
--- a/usr.bin/mg/chrdef.h
+++ b/usr.bin/mg/chrdef.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: chrdef.h,v 1.7 2005/06/14 18:14:40 kjell Exp $ */
+/* $OpenBSD: chrdef.h,v 1.8 2015/03/17 18:08:52 bcallah Exp $ */
/* This file is in the public domain. */
@@ -45,7 +45,6 @@
#define METACH CCHR('[')
#endif
-#ifdef XKEYS
#define K00 256
#define K01 257
#define K02 258
@@ -78,4 +77,3 @@
#define K1D 285
#define K1E 286
#define K1F 287
-#endif
diff --git a/usr.bin/mg/cinfo.c b/usr.bin/mg/cinfo.c
index f5688975851..f5ca23fec64 100644
--- a/usr.bin/mg/cinfo.c
+++ b/usr.bin/mg/cinfo.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cinfo.c,v 1.16 2011/11/28 04:41:39 lum Exp $ */
+/* $OpenBSD: cinfo.c,v 1.17 2015/03/17 18:08:52 bcallah Exp $ */
/* This file is in the public domain. */
@@ -124,11 +124,9 @@ getkeyname(char *cp, size_t len, int k)
np = "DEL";
break;
default:
-#ifdef FKEYS
if (k >= KFIRST && k <= KLAST &&
(np = keystrings[k - KFIRST]) != NULL)
break;
-#endif
if (k > CCHR('?')) {
*cp++ = '0';
*cp++ = ((k >> 6) & 7) + '0';
diff --git a/usr.bin/mg/extend.c b/usr.bin/mg/extend.c
index 547b83719e8..d60d2c1c258 100644
--- a/usr.bin/mg/extend.c
+++ b/usr.bin/mg/extend.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: extend.c,v 1.58 2014/12/06 23:20:17 krw Exp $ */
+/* $OpenBSD: extend.c,v 1.59 2015/03/17 18:08:52 bcallah Exp $ */
/* This file is in the public domain. */
@@ -16,12 +16,10 @@
#include "macro.h"
-#ifdef FKEYS
#include "key.h"
#ifndef BINDKEY
#define BINDKEY /* bindkey is used by FKEYS startup code */
#endif /* !BINDKEY */
-#endif /* FKEYS */
static int remap(KEYMAP *, int, PF, KEYMAP *);
static KEYMAP *reallocmap(KEYMAP *);
@@ -433,7 +431,6 @@ bindkey(KEYMAP **mapp, const char *fname, KCHAR *keys, int kcount)
return (remap(curmap, c, funct, pref_map));
}
-#ifdef FKEYS
/*
* Wrapper for bindkey() that converts escapes.
*/
@@ -478,7 +475,6 @@ dobindkey(KEYMAP *map, const char *func, const char *str)
key.k_count = i;
return (bindkey(&map, func, key.k_chars, key.k_count));
}
-#endif /* FKEYS */
#endif /* BINDKEY */
/*
@@ -694,9 +690,7 @@ load(const char *fname)
}
/*
- * excline - run a line from a load file or eval-expression. If FKEYS is
- * defined, duplicate functionality of dobind so function key values don't
- * have to fit in type char.
+ * excline - run a line from a load file or eval-expression.
*/
int
excline(char *line)
@@ -707,7 +701,6 @@ excline(char *line)
char *funcp, *tmp;
char *argp = NULL;
long nl;
-#ifdef FKEYS
int bind;
KEYMAP *curmap;
#define BINDARG 0 /* this arg is key to bind (local/global set key) */
@@ -715,9 +708,6 @@ excline(char *line)
#define BINDNEXT 2 /* next arg " (define-key) */
#define BINDDO 3 /* already found key to bind */
#define BINDEXT 1 /* space for trailing \0 */
-#else /* FKEYS */
-#define BINDEXT 0
-#endif /* FKEYS */
lp = NULL;
@@ -754,7 +744,6 @@ excline(char *line)
ewprintf("Unknown function: %s", funcp);
return (FALSE);
}
-#ifdef FKEYS
if (fp == bindtokey || fp == unbindtokey) {
bind = BINDARG;
curmap = fundamental_map;
@@ -765,7 +754,6 @@ excline(char *line)
bind = BINDNEXT;
else
bind = BINDNO;
-#endif /* FKEYS */
/* Pack away all the args now... */
if ((np = lalloc(0)) == FALSE)
return (FALSE);
@@ -784,28 +772,22 @@ excline(char *line)
goto cleanup;
}
bcopy(argp, ltext(lp), (int)(line - argp));
-#ifdef FKEYS
/* don't count BINDEXT */
lp->l_used--;
if (bind == BINDARG)
bind = BINDNO;
-#endif /* FKEYS */
} else {
/* quoted strings are special */
++argp;
-#ifdef FKEYS
if (bind != BINDARG) {
-#endif /* FKEYS */
lp = lalloc((int)(line - argp) + BINDEXT);
if (lp == NULL) {
status = FALSE;
goto cleanup;
}
lp->l_used = 0;
-#ifdef FKEYS
} else
key.k_count = 0;
-#endif /* FKEYS */
while (*argp != '"' && *argp != '\0') {
if (*argp != '\\')
c = *argp++;
@@ -857,7 +839,6 @@ excline(char *line)
}
}
break;
-#ifdef FKEYS
case 'f':
case 'F':
c = *++argp - '0';
@@ -867,24 +848,20 @@ excline(char *line)
}
c += KFIRST;
break;
-#endif /* FKEYS */
default:
c = CHARMASK(*argp);
break;
}
argp++;
}
-#ifdef FKEYS
if (bind == BINDARG)
key.k_chars[key.k_count++] = c;
else
-#endif /* FKEYS */
lp->l_text[lp->l_used++] = c;
}
if (*line)
line++;
}
-#ifdef FKEYS
switch (bind) {
case BINDARG:
bind = BINDDO;
@@ -902,16 +879,12 @@ excline(char *line)
bind = BINDARG;
break;
default:
-#endif /* FKEYS */
lp->l_fp = np->l_fp;
lp->l_bp = np;
np->l_fp = lp;
np = lp;
-#ifdef FKEYS
}
-#endif /* FKEYS */
}
-#ifdef FKEYS
switch (bind) {
default:
dobeep();
@@ -928,14 +901,11 @@ excline(char *line)
key.k_count);
break;
case BINDNO:
-#endif /* FKEYS */
inmacro = TRUE;
maclcur = maclcur->l_fp;
status = (*fp)(f, n);
inmacro = FALSE;
-#ifdef FKEYS
}
-#endif /* FKEYS */
cleanup:
lp = maclcur->l_fp;
while (lp != maclcur) {
diff --git a/usr.bin/mg/tty.c b/usr.bin/mg/tty.c
index e2a4ce403a3..ffabd11153d 100644
--- a/usr.bin/mg/tty.c
+++ b/usr.bin/mg/tty.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tty.c,v 1.32 2014/11/16 00:50:00 guenther Exp $ */
+/* $OpenBSD: tty.c,v 1.33 2015/03/17 18:08:52 bcallah Exp $ */
/* This file is in the public domain. */
@@ -152,9 +152,7 @@ ttreinit(void)
void
tttidy(void)
{
-#ifdef XKEYS
ttykeymaptidy();
-#endif /* XKEYS */
/* set the term back to normal mode */
if (exit_ca_mode)
diff --git a/usr.bin/mg/ttykbd.c b/usr.bin/mg/ttykbd.c
index a160a3ef896..15437dab95c 100644
--- a/usr.bin/mg/ttykbd.c
+++ b/usr.bin/mg/ttykbd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ttykbd.c,v 1.16 2012/04/12 04:47:59 lum Exp $ */
+/* $OpenBSD: ttykbd.c,v 1.17 2015/03/17 18:08:52 bcallah Exp $ */
/* This file is in the public domain. */
@@ -11,19 +11,13 @@
#include "def.h"
#include "kbd.h"
-#ifdef XKEYS
#include <term.h>
-#ifdef FKEYS
/*
* Get keyboard character. Very simple if you use keymaps and keys files.
- * Bob was right -- the old XKEYS code is not the right solution.
- * FKEYS code is not useful other than to help debug FKEYS code in
- * extend.c.
*/
char *keystrings[] = {NULL};
-#endif /* FKEYS */
/*
* Turn on function keys using keypad_xmit, then load a keys file, if
@@ -35,7 +29,6 @@ ttykeymapinit(void)
{
char *cp;
-#ifdef FKEYS
/* Bind keypad function keys. */
if (key_left)
dobindkey(fundamental_map, "backward-char", key_left);
@@ -57,7 +50,6 @@ ttykeymapinit(void)
dobindkey(fundamental_map, "scroll-down", key_ppage);
if (key_dc)
dobindkey(fundamental_map, "delete-char", key_dc);
-#endif /* FKEYS */
if ((cp = getenv("TERM"))) {
if (((cp = startupfile(cp)) != NULL) && (load(cp) != TRUE))
@@ -79,11 +71,3 @@ ttykeymaptidy(void)
putpad(keypad_local, 1);
}
-#else
-
-void
-ttykeymapinit(void)
-{
-}
-
-#endif /* XKEYS */