summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbcallah <bcallah@openbsd.org>2015-03-19 21:22:15 +0000
committerbcallah <bcallah@openbsd.org>2015-03-19 21:22:15 +0000
commitcc6738c50fd0f08863caaa11712e0a253a3e4ca6 (patch)
tree2b08d9db8a9d98b86884a090f8e07f15e52ae481
parentClean up the includes in mg. (diff)
downloadwireguard-openbsd-cc6738c50fd0f08863caaa11712e0a253a3e4ca6.tar.xz
wireguard-openbsd-cc6738c50fd0f08863caaa11712e0a253a3e4ca6.zip
Clean up the includes in mg.
This does the following: Moves all POSIX headers from sysdef.h into the individual .c files so that each file now only includes what it needs. All headers are properly sorted. Moves the remainder of sysdef.h to other files (mostly def.h) and deletes sysdef.h now that it's no longer contains anything. Tweak a comment that references sysdef.h so that it no longer does that. ok florian@
-rw-r--r--usr.bin/mg/autoexec.c11
-rw-r--r--usr.bin/mg/basic.c9
-rw-r--r--usr.bin/mg/bell.c7
-rw-r--r--usr.bin/mg/buffer.c15
-rw-r--r--usr.bin/mg/chrdef.h5
-rw-r--r--usr.bin/mg/cinfo.c10
-rw-r--r--usr.bin/mg/cmode.c8
-rw-r--r--usr.bin/mg/cscope.c10
-rw-r--r--usr.bin/mg/def.h22
-rw-r--r--usr.bin/mg/dir.c7
-rw-r--r--usr.bin/mg/dired.c26
-rw-r--r--usr.bin/mg/display.c12
-rw-r--r--usr.bin/mg/echo.c16
-rw-r--r--usr.bin/mg/extend.c17
-rw-r--r--usr.bin/mg/file.c14
-rw-r--r--usr.bin/mg/fileio.c16
-rw-r--r--usr.bin/mg/funmap.c10
-rw-r--r--usr.bin/mg/grep.c16
-rw-r--r--usr.bin/mg/help.c8
-rw-r--r--usr.bin/mg/kbd.c6
-rw-r--r--usr.bin/mg/keymap.c8
-rw-r--r--usr.bin/mg/line.c9
-rw-r--r--usr.bin/mg/macro.c7
-rw-r--r--usr.bin/mg/main.c16
-rw-r--r--usr.bin/mg/match.c6
-rw-r--r--usr.bin/mg/modes.c7
-rw-r--r--usr.bin/mg/paragraph.c6
-rw-r--r--usr.bin/mg/random.c9
-rw-r--r--usr.bin/mg/re_search.c9
-rw-r--r--usr.bin/mg/region.c10
-rw-r--r--usr.bin/mg/search.c9
-rw-r--r--usr.bin/mg/spawn.c11
-rw-r--r--usr.bin/mg/sysdef.h28
-rw-r--r--usr.bin/mg/tags.c8
-rw-r--r--usr.bin/mg/tty.c12
-rw-r--r--usr.bin/mg/ttyio.c18
-rw-r--r--usr.bin/mg/ttykbd.c10
-rw-r--r--usr.bin/mg/undo.c8
-rw-r--r--usr.bin/mg/util.c9
-rw-r--r--usr.bin/mg/version.c6
-rw-r--r--usr.bin/mg/window.c7
-rw-r--r--usr.bin/mg/word.c6
-rw-r--r--usr.bin/mg/yank.c14
43 files changed, 321 insertions, 157 deletions
diff --git a/usr.bin/mg/autoexec.c b/usr.bin/mg/autoexec.c
index 49a9f6e6f27..43d52182d44 100644
--- a/usr.bin/mg/autoexec.c
+++ b/usr.bin/mg/autoexec.c
@@ -1,12 +1,17 @@
-/* $OpenBSD: autoexec.c,v 1.15 2014/10/11 03:03:44 doug Exp $ */
+/* $OpenBSD: autoexec.c,v 1.16 2015/03/19 21:22:15 bcallah Exp $ */
/* this file is in the public domain */
/* Author: Vincent Labrecque <vincent@openbsd.org> April 2002 */
+#include <sys/queue.h>
+#include <fnmatch.h>
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
#include "def.h"
#include "funmap.h"
-#include <fnmatch.h>
-
struct autoexec {
SLIST_ENTRY(autoexec) next; /* link in the linked list */
const char *pattern; /* Pattern to match to filenames */
diff --git a/usr.bin/mg/basic.c b/usr.bin/mg/basic.c
index 841f3215dc2..fdbb3646309 100644
--- a/usr.bin/mg/basic.c
+++ b/usr.bin/mg/basic.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: basic.c,v 1.43 2014/11/16 04:16:41 guenther Exp $ */
+/* $OpenBSD: basic.c,v 1.44 2015/03/19 21:22:15 bcallah Exp $ */
/* This file is in the public domain */
@@ -11,10 +11,15 @@
* mark. Only moves between lines, which might make the
* current buffer framing bad, are hard.
*/
-#include "def.h"
+#include <sys/queue.h>
#include <ctype.h>
#include <limits.h>
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "def.h"
/*
* Go to beginning of line.
diff --git a/usr.bin/mg/bell.c b/usr.bin/mg/bell.c
index 7e20466de82..3ee30cf1fe2 100644
--- a/usr.bin/mg/bell.c
+++ b/usr.bin/mg/bell.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bell.c,v 1.2 2014/03/22 11:05:37 lum Exp $ */
+/* $OpenBSD: bell.c,v 1.3 2015/03/19 21:22:15 bcallah Exp $ */
/*
* This file is in the public domain.
@@ -11,6 +11,11 @@
* Control how mg communicates with the user.
*/
+#include <sys/queue.h>
+#include <signal.h>
+#include <stdio.h>
+#include <unistd.h>
+
#include "def.h"
void
diff --git a/usr.bin/mg/buffer.c b/usr.bin/mg/buffer.c
index ba5a11dd1f8..33e00d517e2 100644
--- a/usr.bin/mg/buffer.c
+++ b/usr.bin/mg/buffer.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: buffer.c,v 1.95 2015/03/16 13:47:48 bcallah Exp $ */
+/* $OpenBSD: buffer.c,v 1.96 2015/03/19 21:22:15 bcallah Exp $ */
/* This file is in the public domain. */
@@ -6,11 +6,18 @@
* Buffer handling.
*/
-#include "def.h"
-#include "kbd.h" /* needed for modes */
-
+#include <sys/queue.h>
+#include <errno.h>
#include <libgen.h>
+#include <signal.h>
#include <stdarg.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "def.h"
+#include "kbd.h" /* needed for modes */
#ifndef DIFFTOOL
#define DIFFTOOL "/usr/bin/diff"
diff --git a/usr.bin/mg/chrdef.h b/usr.bin/mg/chrdef.h
index 5160151f171..ce9dc316e7e 100644
--- a/usr.bin/mg/chrdef.h
+++ b/usr.bin/mg/chrdef.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: chrdef.h,v 1.8 2015/03/17 18:08:52 bcallah Exp $ */
+/* $OpenBSD: chrdef.h,v 1.9 2015/03/19 21:22:15 bcallah Exp $ */
/* This file is in the public domain. */
@@ -9,8 +9,7 @@
/*
* Casting should be at least as efficient as anding with 0xff,
- * and won't have the size problems. Override in sysdef.h if no
- * unsigned char type.
+ * and won't have the size problems.
*/
#define CHARMASK(c) ((unsigned char) (c))
diff --git a/usr.bin/mg/cinfo.c b/usr.bin/mg/cinfo.c
index f5ca23fec64..d4e30cf5ca7 100644
--- a/usr.bin/mg/cinfo.c
+++ b/usr.bin/mg/cinfo.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cinfo.c,v 1.17 2015/03/17 18:08:52 bcallah Exp $ */
+/* $OpenBSD: cinfo.c,v 1.18 2015/03/19 21:22:15 bcallah Exp $ */
/* This file is in the public domain. */
@@ -9,7 +9,13 @@
* and let me ask some questions the standard macros (in
* ctype.h) don't let you ask.
*/
-#include "def.h"
+
+#include <sys/queue.h>
+#include <signal.h>
+#include <stdio.h>
+#include <string.h>
+
+#include "def.h"
/*
* This table, indexed by a character drawn
diff --git a/usr.bin/mg/cmode.c b/usr.bin/mg/cmode.c
index 4cc4d8774bd..5f880eb4218 100644
--- a/usr.bin/mg/cmode.c
+++ b/usr.bin/mg/cmode.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmode.c,v 1.13 2015/03/16 13:47:48 bcallah Exp $ */
+/* $OpenBSD: cmode.c,v 1.14 2015/03/19 21:22:15 bcallah Exp $ */
/*
* This file is in the public domain.
*
@@ -9,11 +9,15 @@
* Implement an non-irritating KNF-compliant mode for editing
* C code.
*/
+
+#include <sys/queue.h>
#include <ctype.h>
+#include <signal.h>
+#include <stdio.h>
#include "def.h"
-#include "kbd.h"
#include "funmap.h"
+#include "kbd.h"
/* Pull in from modes.c */
extern int changemode(int, int, char *);
diff --git a/usr.bin/mg/cscope.c b/usr.bin/mg/cscope.c
index 12ab06cad4f..5446860785f 100644
--- a/usr.bin/mg/cscope.c
+++ b/usr.bin/mg/cscope.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cscope.c,v 1.8 2014/11/16 04:16:41 guenther Exp $ */
+/* $OpenBSD: cscope.c,v 1.9 2015/03/19 21:22:15 bcallah Exp $ */
/*
* This file is in the public domain.
@@ -6,17 +6,19 @@
* Author: Sunil Nimmagadda <sunil@sunilnimmagadda.com>
*/
-#include <sys/types.h>
-#include <sys/stat.h>
#include <sys/queue.h>
-
+#include <sys/stat.h>
+#include <sys/types.h>
#include <ctype.h>
+#include <errno.h>
#include <fcntl.h>
#include <fnmatch.h>
#include <limits.h>
+#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <unistd.h>
#include "def.h"
diff --git a/usr.bin/mg/def.h b/usr.bin/mg/def.h
index 1e07cf1697c..567fec5c63c 100644
--- a/usr.bin/mg/def.h
+++ b/usr.bin/mg/def.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: def.h,v 1.142 2015/03/16 13:47:48 bcallah Exp $ */
+/* $OpenBSD: def.h,v 1.143 2015/03/19 21:22:15 bcallah Exp $ */
/* This file is in the public domain. */
@@ -10,9 +10,8 @@
* per-terminal definitions are in special header files.
*/
-#include "sysdef.h" /* Order is critical. */
-#include "ttydef.h"
#include "chrdef.h"
+#include "ttydef.h"
typedef int (*PF)(int, int); /* generally useful type */
@@ -108,6 +107,12 @@ typedef int (*PF)(int, int); /* generally useful type */
#define MAX_TOKEN 64
/*
+ * Previously from sysdef.h
+ */
+typedef int RSIZE; /* Type for file/region sizes */
+typedef short KCHAR; /* Type for internal keystrokes */
+
+/*
* This structure holds the starting position
* (as a line/offset pair) and the number of characters in a
* region of a buffer. This makes passing the specification
@@ -235,6 +240,17 @@ struct undo_rec;
TAILQ_HEAD(undoq, undo_rec);
/*
+ * Previously from sysdef.h
+ * Only used in struct buffer.
+ */
+struct fileinfo {
+ uid_t fi_uid;
+ gid_t fi_gid;
+ mode_t fi_mode;
+ struct timespec fi_mtime; /* Last modified time */
+};
+
+/*
* Text is kept in buffers. A buffer header, described
* below, exists for every buffer in the system. The buffers are
* kept in a big list, so that commands that search for a buffer by
diff --git a/usr.bin/mg/dir.c b/usr.bin/mg/dir.c
index dbe68e06619..5960b909f3d 100644
--- a/usr.bin/mg/dir.c
+++ b/usr.bin/mg/dir.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dir.c,v 1.27 2014/04/03 20:17:12 lum Exp $ */
+/* $OpenBSD: dir.c,v 1.28 2015/03/19 21:22:15 bcallah Exp $ */
/* This file is in the public domain. */
@@ -9,7 +9,12 @@
* Modified for MG 2a by Mic Kaczmarczik 03-Aug-1987
*/
+#include <sys/queue.h>
#include <sys/stat.h>
+#include <signal.h>
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
#include "def.h"
diff --git a/usr.bin/mg/dired.c b/usr.bin/mg/dired.c
index 581ae3d7a01..24d26ce61fa 100644
--- a/usr.bin/mg/dired.c
+++ b/usr.bin/mg/dired.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dired.c,v 1.69 2014/12/30 22:05:32 bcallah Exp $ */
+/* $OpenBSD: dired.c,v 1.70 2015/03/19 21:22:15 bcallah Exp $ */
/* This file is in the public domain. */
@@ -6,24 +6,28 @@
* by Robert A. Larson
*/
-#include "def.h"
-#include "funmap.h"
-#include "kbd.h"
-
-#include <sys/types.h>
+#include <sys/queue.h>
+#include <sys/resource.h>
#include <sys/stat.h>
#include <sys/time.h>
-#include <sys/resource.h>
+#include <sys/types.h>
#include <sys/wait.h>
-
#include <ctype.h>
-#include <limits.h>
-#include <signal.h>
-#include <fcntl.h>
#include <err.h>
#include <errno.h>
+#include <fcntl.h>
#include <libgen.h>
+#include <limits.h>
+#include <signal.h>
#include <stdarg.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "def.h"
+#include "funmap.h"
+#include "kbd.h"
void dired_init(void);
static int dired(int, int);
diff --git a/usr.bin/mg/display.c b/usr.bin/mg/display.c
index 84208238755..0780a7469c8 100644
--- a/usr.bin/mg/display.c
+++ b/usr.bin/mg/display.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: display.c,v 1.44 2015/02/17 00:34:33 tedu Exp $ */
+/* $OpenBSD: display.c,v 1.45 2015/03/19 21:22:15 bcallah Exp $ */
/* This file is in the public domain. */
@@ -10,10 +10,16 @@
* that can be done; the "vtputc" interface is a real
* pig.
*/
-#include "def.h"
-#include "kbd.h"
+#include <sys/queue.h>
#include <ctype.h>
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "def.h"
+#include "kbd.h"
/*
* You can change these back to the types
diff --git a/usr.bin/mg/echo.c b/usr.bin/mg/echo.c
index 7d6927dd3e7..a2b361d7633 100644
--- a/usr.bin/mg/echo.c
+++ b/usr.bin/mg/echo.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: echo.c,v 1.57 2014/11/16 04:16:41 guenther Exp $ */
+/* $OpenBSD: echo.c,v 1.58 2015/03/19 21:22:15 bcallah Exp $ */
/* This file is in the public domain. */
@@ -9,15 +9,19 @@
* of the display screen. Used by the entire known universe.
*/
+#include <sys/queue.h>
+#include <signal.h>
+#include <stdarg.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <term.h>
+
#include "def.h"
+#include "funmap.h"
#include "key.h"
#include "macro.h"
-#include "funmap.h"
-
-#include <stdarg.h>
-#include <term.h>
-
static char *veread(const char *, char *, size_t, int, va_list);
static int complt(int, int, char *, size_t, int, int *);
static int complt_list(int, char *, int);
diff --git a/usr.bin/mg/extend.c b/usr.bin/mg/extend.c
index d60d2c1c258..bf7545d1e56 100644
--- a/usr.bin/mg/extend.c
+++ b/usr.bin/mg/extend.c
@@ -1,22 +1,27 @@
-/* $OpenBSD: extend.c,v 1.59 2015/03/17 18:08:52 bcallah Exp $ */
+/* $OpenBSD: extend.c,v 1.60 2015/03/19 21:22:15 bcallah Exp $ */
/* This file is in the public domain. */
/*
* Extended (M-X) commands, rebinding, and startup file processing.
*/
-#include "chrdef.h"
-#include "def.h"
-#include "kbd.h"
-#include "funmap.h"
+#include <sys/queue.h>
#include <sys/types.h>
#include <ctype.h>
#include <limits.h>
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "chrdef.h"
+#include "def.h"
+#include "funmap.h"
+#include "kbd.h"
+#include "key.h"
#include "macro.h"
-#include "key.h"
#ifndef BINDKEY
#define BINDKEY /* bindkey is used by FKEYS startup code */
#endif /* !BINDKEY */
diff --git a/usr.bin/mg/file.c b/usr.bin/mg/file.c
index f67596b40f6..c68d1f67b11 100644
--- a/usr.bin/mg/file.c
+++ b/usr.bin/mg/file.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: file.c,v 1.95 2014/04/09 20:50:03 florian Exp $ */
+/* $OpenBSD: file.c,v 1.96 2015/03/19 21:22:15 bcallah Exp $ */
/* This file is in the public domain. */
@@ -6,11 +6,17 @@
* File commands.
*/
-#include "def.h"
-
+#include <sys/queue.h>
#include <sys/stat.h>
-
+#include <errno.h>
#include <libgen.h>
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "def.h"
size_t xdirname(char *, const char *, size_t);
diff --git a/usr.bin/mg/fileio.c b/usr.bin/mg/fileio.c
index ec34bda55c5..bc392dc3006 100644
--- a/usr.bin/mg/fileio.c
+++ b/usr.bin/mg/fileio.c
@@ -1,25 +1,29 @@
-/* $OpenBSD: fileio.c,v 1.98 2014/11/16 04:16:41 guenther Exp $ */
+/* $OpenBSD: fileio.c,v 1.99 2015/03/19 21:22:15 bcallah Exp $ */
/* This file is in the public domain. */
/*
* POSIX fileio.c
*/
-#include "def.h"
-#include <sys/types.h>
+#include <sys/queue.h>
+#include <sys/resource.h>
#include <sys/stat.h>
#include <sys/time.h>
-#include <sys/resource.h>
+#include <sys/types.h>
#include <sys/wait.h>
-
+#include <dirent.h>
+#include <errno.h>
#include <fcntl.h>
#include <limits.h>
-#include <dirent.h>
#include <pwd.h>
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include "def.h"
#include "kbd.h"
#include "pathnames.h"
diff --git a/usr.bin/mg/funmap.c b/usr.bin/mg/funmap.c
index ea5afa02559..c4e8303d858 100644
--- a/usr.bin/mg/funmap.c
+++ b/usr.bin/mg/funmap.c
@@ -1,10 +1,16 @@
-/* $OpenBSD: funmap.c,v 1.48 2015/03/16 13:47:48 bcallah Exp $ */
+/* $OpenBSD: funmap.c,v 1.49 2015/03/19 21:22:15 bcallah Exp $ */
/* This file is in the public domain */
+#include <sys/queue.h>
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
#include "def.h"
-#include "kbd.h"
#include "funmap.h"
+#include "kbd.h"
/*
* If the function is NULL, it must be listed with the
diff --git a/usr.bin/mg/grep.c b/usr.bin/mg/grep.c
index 0af9b6b0504..cde858db38c 100644
--- a/usr.bin/mg/grep.c
+++ b/usr.bin/mg/grep.c
@@ -1,16 +1,22 @@
-/* $OpenBSD: grep.c,v 1.42 2014/11/16 04:16:41 guenther Exp $ */
+/* $OpenBSD: grep.c,v 1.43 2015/03/19 21:22:15 bcallah Exp $ */
/* This file is in the public domain */
-#include "def.h"
-#include "kbd.h"
-#include "funmap.h"
-
+#include <sys/queue.h>
#include <sys/types.h>
#include <ctype.h>
#include <libgen.h>
#include <limits.h>
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
#include <time.h>
+#include <unistd.h>
+
+#include "def.h"
+#include "kbd.h"
+#include "funmap.h"
int globalwd = FALSE;
static int compile_goto_error(int, int);
diff --git a/usr.bin/mg/help.c b/usr.bin/mg/help.c
index 938f813d402..cd983a3df2c 100644
--- a/usr.bin/mg/help.c
+++ b/usr.bin/mg/help.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: help.c,v 1.34 2012/04/12 04:47:59 lum Exp $ */
+/* $OpenBSD: help.c,v 1.35 2015/03/19 21:22:15 bcallah Exp $ */
/* This file is in the public domain. */
@@ -6,9 +6,13 @@
* Help functions for Mg 2
*/
+#include <sys/queue.h>
+#include <signal.h>
+#include <stdio.h>
+#include <string.h>
+
#include "def.h"
#include "funmap.h"
-
#include "kbd.h"
#include "key.h"
#include "macro.h"
diff --git a/usr.bin/mg/kbd.c b/usr.bin/mg/kbd.c
index 2c2803952e1..82026696db6 100644
--- a/usr.bin/mg/kbd.c
+++ b/usr.bin/mg/kbd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kbd.c,v 1.26 2013/05/31 18:03:44 lum Exp $ */
+/* $OpenBSD: kbd.c,v 1.27 2015/03/19 21:22:15 bcallah Exp $ */
/* This file is in the public domain. */
@@ -6,6 +6,10 @@
* Terminal independent keyboard handling.
*/
+#include <sys/queue.h>
+#include <signal.h>
+#include <stdio.h>
+
#include "def.h"
#include "kbd.h"
#include "key.h"
diff --git a/usr.bin/mg/keymap.c b/usr.bin/mg/keymap.c
index 12c33859670..fae030244a3 100644
--- a/usr.bin/mg/keymap.c
+++ b/usr.bin/mg/keymap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: keymap.c,v 1.53 2015/03/16 13:47:48 bcallah Exp $ */
+/* $OpenBSD: keymap.c,v 1.54 2015/03/19 21:22:15 bcallah Exp $ */
/* This file is in the public domain. */
@@ -7,6 +7,12 @@
* parts of building the keymap has been moved to a better place.
*/
+#include <sys/queue.h>
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
#include "def.h"
#include "kbd.h"
diff --git a/usr.bin/mg/line.c b/usr.bin/mg/line.c
index 056073e2679..81a28e5b72a 100644
--- a/usr.bin/mg/line.c
+++ b/usr.bin/mg/line.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: line.c,v 1.54 2014/11/16 04:16:41 guenther Exp $ */
+/* $OpenBSD: line.c,v 1.55 2015/03/19 21:22:15 bcallah Exp $ */
/* This file is in the public domain. */
@@ -17,12 +17,15 @@
* nonsense.
*/
-#include "def.h"
-
+#include <sys/queue.h>
#include <limits.h>
+#include <signal.h>
+#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include "def.h"
+
/*
* Allocate a new line of size `used'. lrealloc() can be called if the line
* ever needs to grow beyond that.
diff --git a/usr.bin/mg/macro.c b/usr.bin/mg/macro.c
index 1f9bce8e352..984f6140450 100644
--- a/usr.bin/mg/macro.c
+++ b/usr.bin/mg/macro.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: macro.c,v 1.15 2014/03/20 07:47:29 lum Exp $ */
+/* $OpenBSD: macro.c,v 1.16 2015/03/19 21:22:15 bcallah Exp $ */
/* This file is in the public domain. */
@@ -6,6 +6,11 @@
* Keyboard macros.
*/
+#include <sys/queue.h>
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+
#include "def.h"
#include "key.h"
#include "macro.h"
diff --git a/usr.bin/mg/main.c b/usr.bin/mg/main.c
index c6718ca71d9..52fb39e81ba 100644
--- a/usr.bin/mg/main.c
+++ b/usr.bin/mg/main.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: main.c,v 1.74 2014/11/16 04:16:41 guenther Exp $ */
+/* $OpenBSD: main.c,v 1.75 2015/03/19 21:22:15 bcallah Exp $ */
/* This file is in the public domain. */
@@ -6,15 +6,21 @@
* Mainline.
*/
+#include <sys/queue.h>
+#include <err.h>
+#include <limits.h>
+#include <locale.h>
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
#include "def.h"
#include "kbd.h"
#include "funmap.h"
#include "macro.h"
-#include <err.h>
-#include <limits.h>
-#include <locale.h>
-
int thisflag; /* flags, this command */
int lastflag; /* flags, last command */
int curgoal; /* goal column */
diff --git a/usr.bin/mg/match.c b/usr.bin/mg/match.c
index 448679fa074..ea961d56382 100644
--- a/usr.bin/mg/match.c
+++ b/usr.bin/mg/match.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: match.c,v 1.17 2013/05/31 18:03:44 lum Exp $ */
+/* $OpenBSD: match.c,v 1.18 2015/03/19 21:22:15 bcallah Exp $ */
/* This file is in the public domain. */
@@ -10,6 +10,10 @@
* but there's enough overhead in the editor as it is.
*/
+#include <sys/queue.h>
+#include <signal.h>
+#include <stdio.h>
+
#include "def.h"
#include "key.h"
diff --git a/usr.bin/mg/modes.c b/usr.bin/mg/modes.c
index 02c2c898fa4..027a5cd8f65 100644
--- a/usr.bin/mg/modes.c
+++ b/usr.bin/mg/modes.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: modes.c,v 1.19 2014/03/20 07:47:29 lum Exp $ */
+/* $OpenBSD: modes.c,v 1.20 2015/03/19 21:22:15 bcallah Exp $ */
/* This file is in the public domain. */
@@ -8,6 +8,11 @@
* off. A positive argument will turn the mode on.
*/
+#include <sys/queue.h>
+#include <signal.h>
+#include <stdio.h>
+#include <string.h>
+
#include "def.h"
#include "kbd.h"
diff --git a/usr.bin/mg/paragraph.c b/usr.bin/mg/paragraph.c
index 7696277a835..cf24ca0833a 100644
--- a/usr.bin/mg/paragraph.c
+++ b/usr.bin/mg/paragraph.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: paragraph.c,v 1.35 2014/11/16 04:16:41 guenther Exp $ */
+/* $OpenBSD: paragraph.c,v 1.36 2015/03/19 21:22:15 bcallah Exp $ */
/* This file is in the public domain. */
@@ -7,8 +7,12 @@
* and GNU-ified by mwm@ucbvax. Several bug fixes by blarson@usc-oberon.
*/
+#include <sys/queue.h>
#include <ctype.h>
#include <limits.h>
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
#include "def.h"
diff --git a/usr.bin/mg/random.c b/usr.bin/mg/random.c
index 1a7eeb7fabe..cbcd248ceca 100644
--- a/usr.bin/mg/random.c
+++ b/usr.bin/mg/random.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: random.c,v 1.34 2015/03/16 13:47:48 bcallah Exp $ */
+/* $OpenBSD: random.c,v 1.35 2015/03/19 21:22:15 bcallah Exp $ */
/* This file is in the public domain. */
@@ -9,9 +9,12 @@
* are all command processors.
*/
-#include "def.h"
-
+#include <sys/queue.h>
#include <ctype.h>
+#include <signal.h>
+#include <stdio.h>
+
+#include "def.h"
/*
* Display a bunch of useful information about the current location of dot.
diff --git a/usr.bin/mg/re_search.c b/usr.bin/mg/re_search.c
index 7e5d989e5f2..287030ad820 100644
--- a/usr.bin/mg/re_search.c
+++ b/usr.bin/mg/re_search.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: re_search.c,v 1.30 2014/03/20 07:47:29 lum Exp $ */
+/* $OpenBSD: re_search.c,v 1.31 2015/03/19 21:22:15 bcallah Exp $ */
/* This file is in the public domain. */
@@ -14,11 +14,14 @@
*/
#ifdef REGEX
-#include "def.h"
-
+#include <sys/queue.h>
#include <sys/types.h>
#include <regex.h>
+#include <signal.h>
+#include <stdio.h>
+#include <string.h>
+#include "def.h"
#include "macro.h"
#define SRCH_BEGIN (0) /* search sub-codes */
diff --git a/usr.bin/mg/region.c b/usr.bin/mg/region.c
index dfdd0e982e9..560a608cc91 100644
--- a/usr.bin/mg/region.c
+++ b/usr.bin/mg/region.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: region.c,v 1.34 2014/03/20 07:47:29 lum Exp $ */
+/* $OpenBSD: region.c,v 1.35 2015/03/19 21:22:15 bcallah Exp $ */
/* This file is in the public domain. */
@@ -9,11 +9,15 @@
* internal use.
*/
-#include <sys/types.h>
+#include <sys/queue.h>
#include <sys/socket.h>
-
+#include <sys/types.h>
+#include <errno.h>
#include <fcntl.h>
#include <poll.h>
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
#include <string.h>
#include <unistd.h>
diff --git a/usr.bin/mg/search.c b/usr.bin/mg/search.c
index c3b350aa00c..161435e88d3 100644
--- a/usr.bin/mg/search.c
+++ b/usr.bin/mg/search.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: search.c,v 1.43 2014/03/20 07:47:29 lum Exp $ */
+/* $OpenBSD: search.c,v 1.44 2015/03/19 21:22:15 bcallah Exp $ */
/* This file is in the public domain. */
@@ -11,10 +11,13 @@
* The incremental search code and the query-replace code is by Rich Ellison.
*/
-#include "def.h"
-
+#include <sys/queue.h>
#include <ctype.h>
+#include <signal.h>
+#include <stdio.h>
+#include <string.h>
+#include "def.h"
#include "macro.h"
#define SRCH_BEGIN (0) /* Search sub-codes. */
diff --git a/usr.bin/mg/spawn.c b/usr.bin/mg/spawn.c
index 13fd9853035..3d9ee95aec5 100644
--- a/usr.bin/mg/spawn.c
+++ b/usr.bin/mg/spawn.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: spawn.c,v 1.11 2006/08/01 22:16:03 jason Exp $ */
+/* $OpenBSD: spawn.c,v 1.12 2015/03/19 21:22:15 bcallah Exp $ */
/* This file is in the public domain. */
@@ -7,10 +7,13 @@
* Assumes POSIX job control.
*/
-#include "def.h"
-
-#include <termios.h>
+#include <sys/queue.h>
+#include <signal.h>
+#include <stdio.h>
#include <term.h>
+#include <termios.h>
+
+#include "def.h"
/*
* This causes mg to send itself a stop signal. It assumes the parent
diff --git a/usr.bin/mg/sysdef.h b/usr.bin/mg/sysdef.h
deleted file mode 100644
index 6152e64c2b5..00000000000
--- a/usr.bin/mg/sysdef.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/* $OpenBSD: sysdef.h,v 1.19 2014/11/16 04:16:41 guenther Exp $ */
-
-/* This file is in the public domain. */
-
-/*
- * POSIX system header file
- */
-#include <sys/types.h>
-#include <sys/queue.h>
-#include <stdio.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-#include <signal.h>
-#include <time.h> /* for struct timespec */
-
-#define KBLOCK 8192 /* Kill grow. */
-
-typedef int RSIZE; /* Type for file/region sizes */
-typedef short KCHAR; /* Type for internal keystrokes */
-
-struct fileinfo {
- uid_t fi_uid;
- gid_t fi_gid;
- mode_t fi_mode;
- struct timespec fi_mtime; /* Last modified time */
-};
diff --git a/usr.bin/mg/tags.c b/usr.bin/mg/tags.c
index 94a9c300559..f24aa385b2d 100644
--- a/usr.bin/mg/tags.c
+++ b/usr.bin/mg/tags.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tags.c,v 1.10 2014/11/16 00:59:25 guenther Exp $ */
+/* $OpenBSD: tags.c,v 1.11 2015/03/19 21:22:15 bcallah Exp $ */
/*
* This file is in the public domain.
@@ -10,12 +10,14 @@
#include <sys/stat.h>
#include <sys/tree.h>
#include <sys/types.h>
-
#include <ctype.h>
#include <err.h>
+#include <errno.h>
+#include <signal.h>
+#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <stdio.h>
+#include <unistd.h>
#include <util.h>
#include "def.h"
diff --git a/usr.bin/mg/tty.c b/usr.bin/mg/tty.c
index ffabd11153d..666d44ce64d 100644
--- a/usr.bin/mg/tty.c
+++ b/usr.bin/mg/tty.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tty.c,v 1.33 2015/03/17 18:08:52 bcallah Exp $ */
+/* $OpenBSD: tty.c,v 1.34 2015/03/19 21:22:15 bcallah Exp $ */
/* This file is in the public domain. */
@@ -27,14 +27,16 @@
* rather than the assumption that scrolling region operations look better.
*/
-#include "def.h"
-
+#include <sys/ioctl.h>
+#include <sys/queue.h>
#include <sys/types.h>
#include <sys/time.h>
-#include <sys/ioctl.h>
-
+#include <signal.h>
+#include <stdio.h>
#include <term.h>
+#include "def.h"
+
static int charcost(const char *);
static int cci;
diff --git a/usr.bin/mg/ttyio.c b/usr.bin/mg/ttyio.c
index e3def5bd388..512ae354d2e 100644
--- a/usr.bin/mg/ttyio.c
+++ b/usr.bin/mg/ttyio.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ttyio.c,v 1.35 2014/03/20 07:47:29 lum Exp $ */
+/* $OpenBSD: ttyio.c,v 1.36 2015/03/19 21:22:15 bcallah Exp $ */
/* This file is in the public domain. */
@@ -9,15 +9,23 @@
* keyboard characters, and write characters to the display in a barely
* buffered fashion.
*/
-#include "def.h"
-#include <sys/types.h>
-#include <sys/time.h>
#include <sys/ioctl.h>
+#include <sys/queue.h>
+#include <sys/time.h>
+#include <sys/types.h>
+#include <errno.h>
#include <fcntl.h>
#include <poll.h>
-#include <termios.h>
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
#include <term.h>
+#include <termios.h>
+#include <unistd.h>
+
+#include "def.h"
#define NOBUF 512 /* Output buffer size. */
diff --git a/usr.bin/mg/ttykbd.c b/usr.bin/mg/ttykbd.c
index 15437dab95c..67bc8e4bdd9 100644
--- a/usr.bin/mg/ttykbd.c
+++ b/usr.bin/mg/ttykbd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ttykbd.c,v 1.17 2015/03/17 18:08:52 bcallah Exp $ */
+/* $OpenBSD: ttykbd.c,v 1.18 2015/03/19 21:22:15 bcallah Exp $ */
/* This file is in the public domain. */
@@ -8,11 +8,15 @@
* Created: 22-Nov-1987 Mic Kaczmarczik (mic@emx.cc.utexas.edu)
*/
+#include <sys/queue.h>
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <term.h>
+
#include "def.h"
#include "kbd.h"
-#include <term.h>
-
/*
* Get keyboard character. Very simple if you use keymaps and keys files.
*/
diff --git a/usr.bin/mg/undo.c b/usr.bin/mg/undo.c
index b8a4e88bf77..246e898f1ac 100644
--- a/usr.bin/mg/undo.c
+++ b/usr.bin/mg/undo.c
@@ -1,8 +1,14 @@
-/* $OpenBSD: undo.c,v 1.55 2014/03/20 07:47:29 lum Exp $ */
+/* $OpenBSD: undo.c,v 1.56 2015/03/19 21:22:15 bcallah Exp $ */
/*
* This file is in the public domain
*/
+#include <sys/queue.h>
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
#include "def.h"
#include "kbd.h"
diff --git a/usr.bin/mg/util.c b/usr.bin/mg/util.c
index 01176a6eb28..519fba8cb46 100644
--- a/usr.bin/mg/util.c
+++ b/usr.bin/mg/util.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: util.c,v 1.34 2015/03/16 13:47:48 bcallah Exp $ */
+/* $OpenBSD: util.c,v 1.35 2015/03/19 21:22:15 bcallah Exp $ */
/* This file is in the public domain. */
@@ -9,9 +9,12 @@
* are all command processors.
*/
-#include "def.h"
-
+#include <sys/queue.h>
#include <ctype.h>
+#include <signal.h>
+#include <stdio.h>
+
+#include "def.h"
/*
* Display a bunch of useful information about the current location of dot.
diff --git a/usr.bin/mg/version.c b/usr.bin/mg/version.c
index 2dc08cd21dd..b3af8701cda 100644
--- a/usr.bin/mg/version.c
+++ b/usr.bin/mg/version.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: version.c,v 1.9 2005/06/14 18:14:40 kjell Exp $ */
+/* $OpenBSD: version.c,v 1.10 2015/03/19 21:22:15 bcallah Exp $ */
/* This file is in the public domain. */
@@ -7,6 +7,10 @@
* out by the emacs-version command.
*/
+#include <sys/queue.h>
+#include <signal.h>
+#include <stdio.h>
+
#include "def.h"
const char version[] = "Mg 2a";
diff --git a/usr.bin/mg/window.c b/usr.bin/mg/window.c
index e62de11570f..cc040274c3f 100644
--- a/usr.bin/mg/window.c
+++ b/usr.bin/mg/window.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: window.c,v 1.31 2014/05/28 07:59:36 florian Exp $ */
+/* $OpenBSD: window.c,v 1.32 2015/03/19 21:22:15 bcallah Exp $ */
/* This file is in the public domain. */
@@ -6,6 +6,11 @@
* Window handling.
*/
+#include <sys/queue.h>
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+
#include "def.h"
struct mgwin *
diff --git a/usr.bin/mg/word.c b/usr.bin/mg/word.c
index f79dcf4c2c0..fdcfa42f16b 100644
--- a/usr.bin/mg/word.c
+++ b/usr.bin/mg/word.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: word.c,v 1.16 2014/03/20 07:47:29 lum Exp $ */
+/* $OpenBSD: word.c,v 1.17 2015/03/19 21:22:15 bcallah Exp $ */
/* This file is in the public domain. */
@@ -8,6 +8,10 @@
* There are all sorts of word mode commands.
*/
+#include <sys/queue.h>
+#include <signal.h>
+#include <stdio.h>
+
#include "def.h"
RSIZE countfword(void);
diff --git a/usr.bin/mg/yank.c b/usr.bin/mg/yank.c
index cba0a7b65cf..4d390120f84 100644
--- a/usr.bin/mg/yank.c
+++ b/usr.bin/mg/yank.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: yank.c,v 1.12 2015/03/16 13:47:48 bcallah Exp $ */
+/* $OpenBSD: yank.c,v 1.13 2015/03/19 21:22:15 bcallah Exp $ */
/* This file is in the public domain. */
@@ -6,13 +6,15 @@
* kill ring functions
*/
-#include "def.h"
-
+#include <sys/queue.h>
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
#include <string.h>
-#ifndef KBLOCK
-#define KBLOCK 256 /* Kill buffer block size. */
-#endif
+#include "def.h"
+
+#define KBLOCK 8192 /* Kill grow. */
static char *kbufp = NULL; /* Kill buffer data. */
static RSIZE kused = 0; /* # of bytes used in KB. */