summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorKjell Wooding <kjell@cvs.openbsd.org>2005-11-07 23:32:21 +0000
committerKjell Wooding <kjell@cvs.openbsd.org>2005-11-07 23:32:21 +0000
commit14028dead959ae4e80c60ba9b9ed61018701ea26 (patch)
treeeabcaf921ccce36a8aba03c7fcf0112b06192d8e /usr.bin
parentbbca3f8dfc4e566d751eef237942eeaa5577eca2 (diff)
Move most of the dired hooks into dired.c. While here, enable some
dired functions that were written, but not bound to keys. No other functional change. Tested by Han Boetes.
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/mg/def.h14
-rw-r--r--usr.bin/mg/dired.c42
-rw-r--r--usr.bin/mg/funmap.c14
-rw-r--r--usr.bin/mg/keymap.c6
4 files changed, 42 insertions, 34 deletions
diff --git a/usr.bin/mg/def.h b/usr.bin/mg/def.h
index aa12298e260..db57dea3568 100644
--- a/usr.bin/mg/def.h
+++ b/usr.bin/mg/def.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: def.h,v 1.71 2005/10/14 06:41:47 kjell Exp $ */
+/* $OpenBSD: def.h,v 1.72 2005/11/07 23:32:20 kjell Exp $ */
/* This file is in the public domain. */
@@ -323,18 +323,6 @@ int showcwdir(int, int);
#ifndef NO_DIRED
/* dired.c */
-int dired(int, int);
-int d_otherwindow(int, int);
-int d_undel(int, int);
-int d_undelbak(int, int);
-int d_findfile(int, int);
-int d_ffotherwindow(int, int);
-int d_expunge(int, int);
-int d_copy(int, int);
-int d_del(int, int);
-int d_rename(int, int);
-int d_shell_command(int, int);
-int d_create_directory(int, int);
BUFFER *dired_(char *);
#endif /* !NO_DIRED */
diff --git a/usr.bin/mg/dired.c b/usr.bin/mg/dired.c
index 1b0cc58d27c..02a6b06a0d7 100644
--- a/usr.bin/mg/dired.c
+++ b/usr.bin/mg/dired.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dired.c,v 1.26 2005/10/14 19:46:46 kjell Exp $ */
+/* $OpenBSD: dired.c,v 1.27 2005/11/07 23:32:20 kjell Exp $ */
/* This file is in the public domain. */
@@ -8,6 +8,8 @@
#include "def.h"
#include "kbd.h"
+#include "funmap.h"
+
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/time.h>
@@ -23,6 +25,18 @@
#ifndef NO_DIRED
void dired_init(void);
+static int dired(int, int);
+static int d_otherwindow(int, int);
+static int d_undel(int, int);
+static int d_undelbak(int, int);
+static int d_findfile(int, int);
+static int d_ffotherwindow(int, int);
+static int d_expunge(int, int);
+static int d_copy(int, int);
+static int d_del(int, int);
+static int d_rename(int, int);
+static int d_shell_command(int, int);
+static int d_create_directory(int, int);
static int d_makename(LINE *, char *, int);
extern struct keymap_s helpmap, cXmap, metamap;
@@ -64,7 +78,18 @@ static PF diredcz[] = {
rescan, /* ^] */
rescan, /* ^^ */
rescan, /* ^_ */
- forwline /* SP */
+ forwline, /* SP */
+ d_shell_command, /* ! */
+ rescan, /* " */
+ rescan, /* # */
+ rescan, /* $ */
+ rescan, /* % */
+ rescan, /* & */
+ rescan, /* ' */
+ rescan, /* ( */
+ rescan, /* ) */
+ rescan, /* * */
+ d_create_directory /* + */
};
static PF diredc[] = {
@@ -114,7 +139,7 @@ static struct KEYMAPE (6 + NDIRED_XMAPS + IMAPEXT) diredmap = {
CCHR('L'), CCHR('X'), diredcl, (KEYMAP *) & cXmap
},
{
- CCHR('Z'), ' ', diredcz, (KEYMAP *) & metamap
+ CCHR('Z'), '+', diredcz, (KEYMAP *) & metamap
},
{
'c', 'f', diredc, NULL
@@ -134,7 +159,18 @@ static struct KEYMAPE (6 + NDIRED_XMAPS + IMAPEXT) diredmap = {
void
dired_init(void)
{
+ funmap_add(dired, "dired");
+ funmap_add(d_undelbak, "dired-backup-unflag");
+ funmap_add(d_copy, "dired-copy-file");
+ funmap_add(d_expunge, "dired-do-deletions");
+ funmap_add(d_findfile, "dired-find-file");
+ funmap_add(d_ffotherwindow, "dired-find-file-other-window");
+ funmap_add(d_del, "dired-flag-file-deleted");
+ funmap_add(d_otherwindow, "dired-other-window");
+ funmap_add(d_rename, "dired-rename-file");
+ funmap_add(d_undel, "dired-unflag");
maps_add((KEYMAP *)&diredmap, "dired");
+ dobindkey(fundamental_map, "dired", "^Xd");
}
/* ARGSUSED */
diff --git a/usr.bin/mg/funmap.c b/usr.bin/mg/funmap.c
index 657422b2c86..7a7469b638e 100644
--- a/usr.bin/mg/funmap.c
+++ b/usr.bin/mg/funmap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: funmap.c,v 1.15 2005/10/14 15:45:38 deraadt Exp $ */
+/* $OpenBSD: funmap.c,v 1.16 2005/11/07 23:32:20 kjell Exp $ */
/*
* Copyright (c) 2001 Artur Grabowski <art@openbsd.org>. All rights reserved.
*
@@ -87,18 +87,6 @@ static struct funmap functnames[] = {
{desckey, "describe-key-briefly",},
#endif /* !NO_HELP */
{digit_argument, "digit-argument",},
-#ifndef NO_DIRED
- {dired, "dired",},
- {d_undelbak, "dired-backup-unflag",},
- {d_copy, "dired-copy-file",},
- {d_expunge, "dired-do-deletions",},
- {d_findfile, "dired-find-file",},
- {d_ffotherwindow, "dired-find-file-other-window",},
- {d_del, "dired-flag-file-deleted",},
- {d_otherwindow, "dired-other-window",},
- {d_rename, "dired-rename-file",},
- {d_undel, "dired-unflag",},
-#endif /* !NO_DIRED */
{lowerregion, "downcase-region",},
{lowerword, "downcase-word",},
{showversion, "emacs-version",},
diff --git a/usr.bin/mg/keymap.c b/usr.bin/mg/keymap.c
index 5e0b4e933a5..babdd4731e7 100644
--- a/usr.bin/mg/keymap.c
+++ b/usr.bin/mg/keymap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: keymap.c,v 1.35 2005/10/13 20:28:49 deraadt Exp $ */
+/* $OpenBSD: keymap.c,v 1.36 2005/11/07 23:32:20 kjell Exp $ */
/* This file is in the public domain. */
@@ -117,11 +117,7 @@ static PF cXcar[] = {
rescan, /* a */
usebuffer, /* b */
rescan, /* c */
-#ifndef NO_DIRED
- dired, /* d */
-#else /* !NO_DIRED */
rescan, /* d */
-#endif /* !NO_DIRED */
#ifndef NO_MACRO
executemacro, /* e */
#else /* !NO_MACRO */