diff options
Diffstat (limited to 'bin/ed')
| -rw-r--r-- | bin/ed/Makefile | 2 | ||||
| -rw-r--r-- | bin/ed/buf.c | 10 | ||||
| -rw-r--r-- | bin/ed/cbc.c | 2 | ||||
| -rw-r--r-- | bin/ed/ed.h | 17 | ||||
| -rw-r--r-- | bin/ed/glbl.c (renamed from bin/ed/glob.c) | 2 | ||||
| -rw-r--r-- | bin/ed/io.c | 2 | ||||
| -rw-r--r-- | bin/ed/main.c | 2 | ||||
| -rw-r--r-- | bin/ed/re.c | 2 | ||||
| -rw-r--r-- | bin/ed/sub.c | 2 | ||||
| -rw-r--r-- | bin/ed/undo.c | 2 |
10 files changed, 24 insertions, 19 deletions
diff --git a/bin/ed/Makefile b/bin/ed/Makefile index a99763cc9202..7ecca79081d9 100644 --- a/bin/ed/Makefile +++ b/bin/ed/Makefile @@ -1,5 +1,5 @@ PROG= ed -SRCS= buf.c cbc.c glob.c io.c main.c re.c sub.c undo.c +SRCS= buf.c cbc.c glbl.c io.c main.c re.c sub.c undo.c LINKS= ${BINDIR}/ed ${BINDIR}/red MLINKS= ed.1 red.1 diff --git a/bin/ed/buf.c b/bin/ed/buf.c index f5b8045ebb3b..70275990c9ae 100644 --- a/bin/ed/buf.c +++ b/bin/ed/buf.c @@ -26,10 +26,11 @@ * SUCH DAMAGE. */ #ifndef lint -static char *rcsid = "@(#)$Id: buf.c,v 1.4 1994/02/01 00:34:35 alm Exp $"; +static char *rcsid = "@(#)buf.c,v 1.4 1994/02/01 00:34:35 alm Exp"; #endif /* not lint */ #include <sys/file.h> +#include <sys/stat.h> #include "ed.h" @@ -131,7 +132,7 @@ add_line_node(lp) line_t *cp; cp = get_addressed_line_node(current_addr); /* this get_addressed_line_node last! */ - insque(lp, cp); + INSQUE(lp, cp); addr_last++; current_addr++; } @@ -195,13 +196,18 @@ char sfn[15] = ""; /* scratch file name */ int open_sbuf() { + int u; + isbinary = newline_added = 0; + u = umask(077); strcpy(sfn, "/tmp/ed.XXXXXX"); if (mktemp(sfn) == NULL || (sfp = fopen(sfn, "w+")) == NULL) { fprintf(stderr, "%s: %s\n", sfn, strerror(errno)); sprintf(errmsg, "cannot open temp file"); + umask(u); return ERR; } + umask(u); return 0; } diff --git a/bin/ed/cbc.c b/bin/ed/cbc.c index 9d1d9894583e..ee5285cdd0ec 100644 --- a/bin/ed/cbc.c +++ b/bin/ed/cbc.c @@ -38,7 +38,7 @@ */ #ifndef lint -static char *rcsid = "@(#)$Id: cbc.c,v 1.2 1994/02/01 00:34:36 alm Exp $"; +static char *rcsid = "@(#)cbc.c,v 1.2 1994/02/01 00:34:36 alm Exp"; #endif /* not lint */ #include <sys/types.h> diff --git a/bin/ed/ed.h b/bin/ed/ed.h index 1f61428eb73a..dd638806c470 100644 --- a/bin/ed/ed.h +++ b/bin/ed/ed.h @@ -24,14 +24,15 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * @(#)$Id: ed.h,v 1.5 1994/02/01 00:34:39 alm Exp $ + * @(#)ed.h,v 1.5 1994/02/01 00:34:39 alm Exp */ +#include <sys/types.h> #if defined(BSD) && BSD >= 199103 || defined(__386BSD__) # include <sys/param.h> /* for MAXPATHLEN */ #endif #include <errno.h> -#ifdef sun +#if defined(sun) || defined(__NetBSD__) # include <limits.h> #endif #include <regex.h> @@ -166,17 +167,15 @@ if ((i) > (n)) { \ /* REQUE: link pred before succ */ #define REQUE(pred, succ) (pred)->q_forw = (succ), (succ)->q_back = (pred) -#ifdef NEED_INSQUE -/* insque: insert elem in circular queue after pred */ -#define insque(elem, pred) \ +/* INSQUE: insert elem in circular queue after pred */ +#define INSQUE(elem, pred) \ { \ REQUE((elem), (pred)->q_forw); \ REQUE((pred), elem); \ } -/* remque: remove_lines elem from circular queue */ -#define remque(elem) REQUE((elem)->q_back, (elem)->q_forw); -#endif /* NEED_INSQUE */ +/* REMQUE: remove_lines elem from circular queue */ +#define REMQUE(elem) REQUE((elem)->q_back, (elem)->q_forw); /* NUL_TO_NEWLINE: overwrite ASCII NULs with newlines */ #define NUL_TO_NEWLINE(s, l) translit_text(s, l, '\0', '\n') @@ -184,7 +183,7 @@ if ((i) > (n)) { \ /* NEWLINE_TO_NUL: overwrite newlines with ASCII NULs */ #define NEWLINE_TO_NUL(s, l) translit_text(s, l, '\n', '\0') -#ifndef strerror +#ifdef sun # define strerror(n) sys_errlist[n] #endif diff --git a/bin/ed/glob.c b/bin/ed/glbl.c index 5c77d224cdff..1e21d99d2876 100644 --- a/bin/ed/glob.c +++ b/bin/ed/glbl.c @@ -27,7 +27,7 @@ */ #ifndef lint -static char *rcsid = "@(#)$Id: glob.c,v 1.1 1994/02/01 00:34:40 alm Exp $"; +static char *rcsid = "@(#)glob.c,v 1.1 1994/02/01 00:34:40 alm Exp"; #endif /* not lint */ #include <sys/ioctl.h> diff --git a/bin/ed/io.c b/bin/ed/io.c index 0c63f3dc77fb..2187cb999415 100644 --- a/bin/ed/io.c +++ b/bin/ed/io.c @@ -26,7 +26,7 @@ */ #ifndef lint -static char *rcsid = "@(#)$Id: io.c,v 1.1 1994/02/01 00:34:41 alm Exp $"; +static char *rcsid = "@(#)io.c,v 1.1 1994/02/01 00:34:41 alm Exp"; #endif /* not lint */ #include "ed.h" diff --git a/bin/ed/main.c b/bin/ed/main.c index ddaf513f4337..f177b86ecd9d 100644 --- a/bin/ed/main.c +++ b/bin/ed/main.c @@ -33,7 +33,7 @@ char *copyright = #endif /* not lint */ #ifndef lint -static char *rcsid = "@(#)$Id: main.c,v 1.1 1994/02/01 00:34:42 alm Exp $"; +static char *rcsid = "@(#)main.c,v 1.1 1994/02/01 00:34:42 alm Exp"; #endif /* not lint */ /* diff --git a/bin/ed/re.c b/bin/ed/re.c index f4b9f292944b..0e04dd83dd9f 100644 --- a/bin/ed/re.c +++ b/bin/ed/re.c @@ -27,7 +27,7 @@ */ #ifndef lint -static char *rcsid = "@(#)$Id: re.c,v 1.6 1994/02/01 00:34:43 alm Exp $"; +static char *rcsid = "@(#)re.c,v 1.6 1994/02/01 00:34:43 alm Exp"; #endif /* not lint */ #include "ed.h" diff --git a/bin/ed/sub.c b/bin/ed/sub.c index c93d258c8cd2..9d46a7ca3d2e 100644 --- a/bin/ed/sub.c +++ b/bin/ed/sub.c @@ -27,7 +27,7 @@ */ #ifndef lint -static char *rcsid = "@(#)$Id: sub.c,v 1.1 1994/02/01 00:34:44 alm Exp $"; +static char *rcsid = "@(#)sub.c,v 1.1 1994/02/01 00:34:44 alm Exp"; #endif /* not lint */ #include "ed.h" diff --git a/bin/ed/undo.c b/bin/ed/undo.c index a12e1c48e753..a686d14c1b36 100644 --- a/bin/ed/undo.c +++ b/bin/ed/undo.c @@ -26,7 +26,7 @@ */ #ifndef lint -static char *rcsid = "@(#)$Id: undo.c,v 1.1 1994/02/01 00:34:44 alm Exp $"; +static char *rcsid = "@(#)undo.c,v 1.1 1994/02/01 00:34:44 alm Exp"; #endif /* not lint */ #include "ed.h" |
