summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2012-12-04 02:40:49 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2012-12-04 02:40:49 +0000
commit148b5363c4a00bb62f1c3dfa8706a6ce45c44d2f (patch)
tree71c4b7839e33b4ec28e9a173382be336672dc7ab /bin
parenteee0e689e9639ae0916aa15636959ad9584e203e (diff)
remove sunos backwards compat
ok guenther
Diffstat (limited to 'bin')
-rw-r--r--bin/ed/ed.h49
-rw-r--r--bin/ed/glbl.c28
-rw-r--r--bin/ed/undo.c10
3 files changed, 11 insertions, 76 deletions
diff --git a/bin/ed/ed.h b/bin/ed/ed.h
index 76b47e4b0c1..5328cd9db45 100644
--- a/bin/ed/ed.h
+++ b/bin/ed/ed.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: ed.h,v 1.11 2007/02/24 13:24:47 millert Exp $ */
+/* $OpenBSD: ed.h,v 1.12 2012/12/04 02:40:47 deraadt Exp $ */
/* $NetBSD: ed.h,v 1.23 1995/03/21 09:04:40 cgd Exp $ */
/* ed.h: type and constant definitions for the ed editor. */
@@ -31,13 +31,9 @@
*/
#include <sys/types.h>
-#if defined(BSD) && BSD >= 199103 || defined(__386BSD__)
-# include <sys/param.h> /* for MAXPATHLEN */
-#endif
+#include <sys/param.h> /* for MAXPATHLEN */
#include <errno.h>
-#if defined(sun) || defined(__NetBSD__) || defined(__OpenBSD__)
-# include <limits.h>
-#endif
+#include <limits.h>
#include <regex.h>
#include <signal.h>
#include <stdio.h>
@@ -49,10 +45,6 @@
#define EMOD (-3)
#define FATAL (-4)
-#ifndef MAXPATHLEN
-# define MAXPATHLEN 255 /* _POSIX_PATH_MAX */
-#endif
-
#define MINBUFSZ 512 /* minimum buffer size - must be > 0 */
#define SE_MAX 30 /* max subexpressions in a regular expression */
#ifdef INT_MAX
@@ -123,33 +115,6 @@ if (--mutex == 0) { \
i = (int)l; \
}
-#if defined(sun) || defined(NO_REALLOC_NULL)
-/* REALLOC: assure at least a minimum size for buffer b */
-#define REALLOC(b,n,i,err) \
-if ((i) > (n)) { \
- int ti = (n); \
- char *ts; \
- SPL1(); \
- if ((b) != NULL) { \
- if ((ts = (char *) realloc((b), ti += max((i), MINBUFSZ))) == NULL) { \
- perror(NULL); \
- seterrmsg("out of memory"); \
- SPL0(); \
- return err; \
- } \
- } else { \
- if ((ts = (char *) malloc(ti += max((i), MINBUFSZ))) == NULL) { \
- perror(NULL); \
- seterrmsg("out of memory"); \
- SPL0(); \
- return err; \
- } \
- } \
- (n) = ti; \
- (b) = ts; \
- SPL0(); \
-}
-#else /* NO_REALLOC_NULL */
/* REALLOC: assure at least a minimum size for buffer b */
#define REALLOC(b,n,i,err) \
if ((i) > (n)) { \
@@ -166,7 +131,6 @@ if ((i) > (n)) { \
(b) = ts; \
SPL0(); \
}
-#endif /* NO_REALLOC_NULL */
/* REQUE: link pred before succ */
#define REQUE(pred, succ) (pred)->q_forw = (succ), (succ)->q_back = (pred)
@@ -187,10 +151,6 @@ if ((i) > (n)) { \
/* NEWLINE_TO_NUL: overwrite newlines with ASCII NULs */
#define NEWLINE_TO_NUL(s, l) translit_text(s, l, '\n', '\0')
-#ifdef sun
-# define strerror(n) sys_errlist[n]
-#endif
-
/* Local Function Declarations */
void add_line_node(line_t *);
int append_lines(int);
@@ -286,6 +246,3 @@ extern char errmsg[MAXPATHLEN + 40];
extern int first_addr;
extern int lineno;
extern int second_addr;
-#ifdef sun
-extern char *sys_errlist[];
-#endif
diff --git a/bin/ed/glbl.c b/bin/ed/glbl.c
index e2a4bca5045..122e9c4038c 100644
--- a/bin/ed/glbl.c
+++ b/bin/ed/glbl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: glbl.c,v 1.12 2009/10/27 23:59:21 deraadt Exp $ */
+/* $OpenBSD: glbl.c,v 1.13 2012/12/04 02:40:48 deraadt Exp $ */
/* $NetBSD: glbl.c,v 1.2 1995/03/21 09:04:41 cgd Exp $ */
/* glob.c: This file contains the global command routines for the ed line
@@ -149,27 +149,13 @@ set_active_node(line_t *lp)
int ti = active_size;
line_t **ts;
SPL1();
-#if defined(sun) || defined(NO_REALLOC_NULL)
- if (active_list != NULL) {
-#endif
- if ((ts = (line_t **) realloc(active_list,
- (ti += MINBUFSZ) * sizeof(line_t **))) == NULL) {
- perror(NULL);
- seterrmsg("out of memory");
- SPL0();
- return ERR;
- }
-#if defined(sun) || defined(NO_REALLOC_NULL)
- } else {
- if ((ts = (line_t **) calloc(ti += MINBUFSZ,
- sizeof(line_t **))) == NULL) {
- perror(NULL);
- seterrmsg("out of memory");
- SPL0();
- return ERR;
- }
+ if ((ts = (line_t **) realloc(active_list,
+ (ti += MINBUFSZ) * sizeof(line_t **))) == NULL) {
+ perror(NULL);
+ seterrmsg("out of memory");
+ SPL0();
+ return ERR;
}
-#endif
active_size = ti;
active_list = ts;
SPL0();
diff --git a/bin/ed/undo.c b/bin/ed/undo.c
index 487df5156a8..e827d3eb976 100644
--- a/bin/ed/undo.c
+++ b/bin/ed/undo.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: undo.c,v 1.10 2009/10/27 23:59:21 deraadt Exp $ */
+/* $OpenBSD: undo.c,v 1.11 2012/12/04 02:40:48 deraadt Exp $ */
/* $NetBSD: undo.c,v 1.2 1995/03/21 09:04:52 cgd Exp $ */
/* undo.c: This file contains the undo routines for the ed line editor */
@@ -42,14 +42,6 @@ push_undo_stack(int type, int from, int to)
{
undo_t *t;
-#if defined(sun) || defined(NO_REALLOC_NULL)
- if (ustack == NULL &&
- (ustack = (undo_t *) calloc((usize = USIZE), sizeof(undo_t))) == NULL) {
- perror(NULL);
- seterrmsg("out of memory");
- return NULL;
- }
-#endif
t = ustack;
if (u_p < usize ||
(t = (undo_t *) realloc(ustack, (usize += USIZE) * sizeof(undo_t))) != NULL) {