From 5e0e9b99dc3fc0ecd49d929db0d57c784b66f481 Mon Sep 17 00:00:00 2001 From: svn2git Date: Fri, 1 Jul 1994 00:00:00 -0800 Subject: Release FreeBSD 1.1.5.1 This commit was manufactured to restore the state of the 1.1.5.1-RELEASE image. Releases prior to 5.3-RELEASE are omitting the secure/ and crypto/ subdirs. --- bin/cp/cp.c | 4 +- bin/cp/path.c | 2 +- bin/csh/char.c | 4 +- bin/csh/char.h | 2 +- bin/csh/dol.c | 4 +- bin/csh/lex.c | 6 +- bin/df/df.c | 2 +- bin/ed/Makefile | 2 +- bin/ed/buf.c | 10 ++- bin/ed/cbc.c | 2 +- bin/ed/ed.h | 17 ++-- bin/ed/glbl.c | 223 +++++++++++++++++++++++++++++++++++++++++++++++++++++ bin/ed/glob.c | 223 ----------------------------------------------------- bin/ed/io.c | 2 +- bin/ed/main.c | 2 +- bin/ed/re.c | 2 +- bin/ed/sub.c | 2 +- bin/ed/undo.c | 2 +- bin/expr/expr.1 | 2 +- bin/ls/ls.1 | 2 +- bin/mkdir/mkdir.1 | 2 +- bin/mkdir/mkdir.c | 4 +- bin/mv/mv.c | 4 +- bin/rcp/Makefile | 10 +-- bin/rm/rm.c | 2 +- bin/rmail/rmail.c | 1 - bin/rmdir/rmdir.c | 4 +- bin/sh/builtins | 2 +- bin/sh/cd.c | 2 +- bin/sh/expand.c | 8 +- bin/sh/miscbltin.c | 4 +- bin/stty/cchar.c | 10 +-- bin/stty/gfmt.c | 4 +- bin/stty/key.c | 2 +- bin/stty/print.c | 10 ++- 35 files changed, 296 insertions(+), 288 deletions(-) create mode 100644 bin/ed/glbl.c delete mode 100644 bin/ed/glob.c (limited to 'bin') diff --git a/bin/cp/cp.c b/bin/cp/cp.c index e21bba631e9d..97375b17d1a1 100644 --- a/bin/cp/cp.c +++ b/bin/cp/cp.c @@ -299,7 +299,7 @@ copy_file(fs, dne) struct stat *fs; int dne; { - static char buf[MAXBSIZE]; + static char buf[MAXBSIZE * 4]; register int from_fd, to_fd, rcount, wcount; struct stat to_stat; char *p; @@ -358,7 +358,7 @@ copy_file(fs, dne) if (munmap((caddr_t) p, fs->st_size) < 0) err("%s: %s", from.p_path, strerror(errno)); } else { - while ((rcount = read(from_fd, buf, MAXBSIZE)) > 0) { + while ((rcount = read(from_fd, buf, sizeof(buf))) > 0) { wcount = write(to_fd, buf, rcount); if (rcount != wcount || wcount == -1) { err("%s: %s", to.p_path, strerror(errno)); diff --git a/bin/cp/path.c b/bin/cp/path.c index a84892193554..170460283522 100644 --- a/bin/cp/path.c +++ b/bin/cp/path.c @@ -50,7 +50,7 @@ static char sccsid[] = "@(#)path.c 5.2 (Berkeley) 10/27/91"; */ #define STRIP_TRAILING_SLASH(p) { \ - while ((p)->p_end > (p)->p_path && (p)->p_end[-1] == '/') \ + while ((p)->p_end > ((p)->p_path + 1) && (p)->p_end[-1] == '/') \ *--(p)->p_end = 0; \ } diff --git a/bin/csh/char.c b/bin/csh/char.c index f552a28684a5..eb2dab68bf10 100644 --- a/bin/csh/char.c +++ b/bin/csh/char.c @@ -63,10 +63,10 @@ unsigned short _cmap[256] = { _CTR, _CTR, _CTR, _CTR, /* sp ! " # */ - _SP|_META, 0, _Q, _META, + _SP|_META, 0, _Q2, _META, /* $ % & ' */ - _DOL, 0, _META|_CMD, _Q, + _DOL, 0, _META|_CMD, _Q2, /* ( ) * + */ _META|_CMD, _META, _GLOB, 0, diff --git a/bin/csh/char.h b/bin/csh/char.h index 297a6ee8e1e2..475436879180 100644 --- a/bin/csh/char.h +++ b/bin/csh/char.h @@ -42,7 +42,7 @@ extern unsigned char _cmap_lower[], _cmap_upper[]; #endif -#define _Q 0x0001 /* '" */ +#define _Q2 0x0001 /* '" */ #define _Q1 0x0002 /* ` */ #define _SP 0x0004 /* space and tab */ #define _NL 0x0008 /* \n */ diff --git a/bin/csh/dol.c b/bin/csh/dol.c index d2b28f5433b1..816b45840664 100644 --- a/bin/csh/dol.c +++ b/bin/csh/dol.c @@ -66,7 +66,7 @@ static Char *Dcp, **Dvp; /* Input vector for Dreadc */ #define unDgetC(c) Dpeekc = c -#define QUOTES (_Q|_Q1|_ESC) /* \ ' " ` */ +#define QUOTES (_Q2|_Q1|_ESC) /* \ ' " ` */ /* * The following variables give the information about the current @@ -192,7 +192,7 @@ Dpack(wbuf, wp) Gcat(STRNULL, wbuf); return (NULL); } - if (cmap(c, _SP | _NL | _Q | _Q1)) { /* sp \t\n'"` */ + if (cmap(c, _SP | _NL | _Q2 | _Q1)) { /* sp \t\n'"` */ unDgetC(c); if (cmap(c, QUOTES)) return (wp); diff --git a/bin/csh/lex.c b/bin/csh/lex.c index 63af5da774a4..75fb7e3a7f70 100644 --- a/bin/csh/lex.c +++ b/bin/csh/lex.c @@ -315,7 +315,7 @@ loop: break; } } - else if (cmap(c, _META | _Q | _Q1 | _ESC)) { + else if (cmap(c, _META | _Q2 | _Q1 | _ESC)) { if (c == '\\') { c = getC(0); if (c == '\n') { @@ -327,7 +327,7 @@ loop: *wp++ = '\\', --i; c |= QUOTE; } - else if (cmap(c, _Q | _Q1)) { /* '"` */ + else if (cmap(c, _Q2 | _Q1)) { /* '"` */ c1 = c; dolflg = c == '"' ? DOALL : DOEXCL; } @@ -366,7 +366,7 @@ getC1(flag) if ((c = *lap++) == 0) lap = 0; else { - if (cmap(c, _META | _Q | _Q1)) + if (cmap(c, _META | _Q2 | _Q1)) c |= QUOTE; return (c); } diff --git a/bin/df/df.c b/bin/df/df.c index a28a862cc09b..ecebfe85baac 100644 --- a/bin/df/df.c +++ b/bin/df/df.c @@ -5,7 +5,7 @@ * or UNIX System Laboratories, Inc. and are reproduced herein with * the permission of UNIX System Laboratories, Inc. * - * $Id: df.c,v 1.3.2.2 1994/05/04 07:35:01 rgrimes Exp $ + * $Id: df.c,v 1.5 1994/05/04 08:04:22 rgrimes Exp $ */ /* * Copyright (c) 1980, 1990 The Regents of the University of California. 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 +#include #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 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 #if defined(BSD) && BSD >= 199103 || defined(__386BSD__) # include /* for MAXPATHLEN */ #endif #include -#ifdef sun +#if defined(sun) || defined(__NetBSD__) # include #endif #include @@ -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/glbl.c b/bin/ed/glbl.c new file mode 100644 index 000000000000..1e21d99d2876 --- /dev/null +++ b/bin/ed/glbl.c @@ -0,0 +1,223 @@ +/* glob.c: This file contains the global command routines for the ed line + editor */ +/*- + * Copyright (c) 1993 Andrew Moore, Talke Studio. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#ifndef lint +static char *rcsid = "@(#)glob.c,v 1.1 1994/02/01 00:34:40 alm Exp"; +#endif /* not lint */ + +#include +#include + +#include "ed.h" + + +/* build_active_list: add line matching a pattern to the global-active list */ +int +build_active_list(isgcmd) + int isgcmd; +{ + pattern_t *pat; + line_t *lp; + long n; + char *s; + char delimiter; + + if ((delimiter = *ibufp) == ' ' || delimiter == '\n') { + sprintf(errmsg, "invalid pattern delimiter"); + return ERR; + } else if ((pat = get_compiled_pattern()) == NULL) + return ERR; + else if (*ibufp == delimiter) + ibufp++; + clear_active_list(); + lp = get_addressed_line_node(first_addr); + for (n = first_addr; n <= second_addr; n++, lp = lp->q_forw) { + if ((s = get_sbuf_line(lp)) == NULL) + return ERR; + if (isbinary) + NUL_TO_NEWLINE(s, lp->len); + if (!regexec(pat, s, 0, NULL, 0) == isgcmd && + set_active_node(lp) < 0) + return ERR; + } + return 0; +} + + +/* exec_global: apply command list in the command buffer to the active + lines in a range; return command status */ +long +exec_global(interact, gflag) + int interact; + int gflag; +{ + static char *ocmd = NULL; + static int ocmdsz = 0; + + line_t *lp = NULL; + int status; + int n; + char *cmd = NULL; + +#ifdef BACKWARDS + if (!interact) + if (!strcmp(ibufp, "\n")) + cmd = "p\n"; /* null cmd-list == `p' */ + else if ((cmd = get_extended_line(&n, 0)) == NULL) + return ERR; +#else + if (!interact && (cmd = get_extended_line(&n, 0)) == NULL) + return ERR; +#endif + clear_undo_stack(); + while ((lp = next_active_node()) != NULL) { + if ((current_addr = get_line_node_addr(lp)) < 0) + return ERR; + if (interact) { + /* print current_addr; get a command in global syntax */ + if (display_lines(current_addr, current_addr, gflag) < 0) + return ERR; + while ((n = get_tty_line()) > 0 && + ibuf[n - 1] != '\n') + clearerr(stdin); + if (n < 0) + return ERR; + else if (n == 0) { + sprintf(errmsg, "unexpected end-of-file"); + return ERR; + } else if (n == 1 && !strcmp(ibuf, "\n")) + continue; + else if (n == 2 && !strcmp(ibuf, "&\n")) { + if (cmd == NULL) { + sprintf(errmsg, "no previous command"); + return ERR; + } else cmd = ocmd; + } else if ((cmd = get_extended_line(&n, 0)) == NULL) + return ERR; + else { + REALLOC(ocmd, ocmdsz, n + 1, ERR); + memcpy(ocmd, cmd, n + 1); + cmd = ocmd; + } + + } + ibufp = cmd; + for (; *ibufp;) + if ((status = extract_addr_range()) < 0 || + (status = exec_command()) < 0 || + status > 0 && (status = display_lines( + current_addr, current_addr, status)) < 0) + return status; + } + return 0; +} + + +line_t **active_list; /* list of lines active in a global command */ +long active_last; /* index of last active line in active_list */ +long active_size; /* size of active_list */ +long active_ptr; /* active_list index (non-decreasing) */ +long active_ndx; /* active_list index (modulo active_last) */ + +/* set_active_node: add a line node to the global-active list */ +int +set_active_node(lp) + line_t *lp; +{ + if (active_last + 1 > active_size) { + 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) { + fprintf(stderr, "%s\n", strerror(errno)); + sprintf(errmsg, "out of memory"); + SPL0(); + return ERR; + } +#if defined(sun) || defined(NO_REALLOC_NULL) + } else { + if ((ts = (line_t **) malloc((ti += MINBUFSZ) * + sizeof(line_t **))) == NULL) { + fprintf(stderr, "%s\n", strerror(errno)); + sprintf(errmsg, "out of memory"); + SPL0(); + return ERR; + } + } +#endif + active_size = ti; + active_list = ts; + SPL0(); + } + active_list[active_last++] = lp; + return 0; +} + + +/* unset_active_nodes: remove a range of lines from the global-active list */ +void +unset_active_nodes(np, mp) + line_t *np, *mp; +{ + line_t *lp; + long i; + + for (lp = np; lp != mp; lp = lp->q_forw) + for (i = 0; i < active_last; i++) + if (active_list[active_ndx] == lp) { + active_list[active_ndx] = NULL; + active_ndx = INC_MOD(active_ndx, active_last - 1); + break; + } else active_ndx = INC_MOD(active_ndx, active_last - 1); +} + + +/* next_active_node: return the next global-active line node */ +line_t * +next_active_node() +{ + while (active_ptr < active_last && active_list[active_ptr] == NULL) + active_ptr++; + return (active_ptr < active_last) ? active_list[active_ptr++] : NULL; +} + + +/* clear_active_list: clear the global-active list */ +void +clear_active_list() +{ + SPL1(); + active_size = active_last = active_ptr = active_ndx = 0; + free(active_list); + active_list = NULL; + SPL0(); +} diff --git a/bin/ed/glob.c b/bin/ed/glob.c deleted file mode 100644 index 5c77d224cdff..000000000000 --- a/bin/ed/glob.c +++ /dev/null @@ -1,223 +0,0 @@ -/* glob.c: This file contains the global command routines for the ed line - editor */ -/*- - * Copyright (c) 1993 Andrew Moore, Talke Studio. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#ifndef lint -static char *rcsid = "@(#)$Id: glob.c,v 1.1 1994/02/01 00:34:40 alm Exp $"; -#endif /* not lint */ - -#include -#include - -#include "ed.h" - - -/* build_active_list: add line matching a pattern to the global-active list */ -int -build_active_list(isgcmd) - int isgcmd; -{ - pattern_t *pat; - line_t *lp; - long n; - char *s; - char delimiter; - - if ((delimiter = *ibufp) == ' ' || delimiter == '\n') { - sprintf(errmsg, "invalid pattern delimiter"); - return ERR; - } else if ((pat = get_compiled_pattern()) == NULL) - return ERR; - else if (*ibufp == delimiter) - ibufp++; - clear_active_list(); - lp = get_addressed_line_node(first_addr); - for (n = first_addr; n <= second_addr; n++, lp = lp->q_forw) { - if ((s = get_sbuf_line(lp)) == NULL) - return ERR; - if (isbinary) - NUL_TO_NEWLINE(s, lp->len); - if (!regexec(pat, s, 0, NULL, 0) == isgcmd && - set_active_node(lp) < 0) - return ERR; - } - return 0; -} - - -/* exec_global: apply command list in the command buffer to the active - lines in a range; return command status */ -long -exec_global(interact, gflag) - int interact; - int gflag; -{ - static char *ocmd = NULL; - static int ocmdsz = 0; - - line_t *lp = NULL; - int status; - int n; - char *cmd = NULL; - -#ifdef BACKWARDS - if (!interact) - if (!strcmp(ibufp, "\n")) - cmd = "p\n"; /* null cmd-list == `p' */ - else if ((cmd = get_extended_line(&n, 0)) == NULL) - return ERR; -#else - if (!interact && (cmd = get_extended_line(&n, 0)) == NULL) - return ERR; -#endif - clear_undo_stack(); - while ((lp = next_active_node()) != NULL) { - if ((current_addr = get_line_node_addr(lp)) < 0) - return ERR; - if (interact) { - /* print current_addr; get a command in global syntax */ - if (display_lines(current_addr, current_addr, gflag) < 0) - return ERR; - while ((n = get_tty_line()) > 0 && - ibuf[n - 1] != '\n') - clearerr(stdin); - if (n < 0) - return ERR; - else if (n == 0) { - sprintf(errmsg, "unexpected end-of-file"); - return ERR; - } else if (n == 1 && !strcmp(ibuf, "\n")) - continue; - else if (n == 2 && !strcmp(ibuf, "&\n")) { - if (cmd == NULL) { - sprintf(errmsg, "no previous command"); - return ERR; - } else cmd = ocmd; - } else if ((cmd = get_extended_line(&n, 0)) == NULL) - return ERR; - else { - REALLOC(ocmd, ocmdsz, n + 1, ERR); - memcpy(ocmd, cmd, n + 1); - cmd = ocmd; - } - - } - ibufp = cmd; - for (; *ibufp;) - if ((status = extract_addr_range()) < 0 || - (status = exec_command()) < 0 || - status > 0 && (status = display_lines( - current_addr, current_addr, status)) < 0) - return status; - } - return 0; -} - - -line_t **active_list; /* list of lines active in a global command */ -long active_last; /* index of last active line in active_list */ -long active_size; /* size of active_list */ -long active_ptr; /* active_list index (non-decreasing) */ -long active_ndx; /* active_list index (modulo active_last) */ - -/* set_active_node: add a line node to the global-active list */ -int -set_active_node(lp) - line_t *lp; -{ - if (active_last + 1 > active_size) { - 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) { - fprintf(stderr, "%s\n", strerror(errno)); - sprintf(errmsg, "out of memory"); - SPL0(); - return ERR; - } -#if defined(sun) || defined(NO_REALLOC_NULL) - } else { - if ((ts = (line_t **) malloc((ti += MINBUFSZ) * - sizeof(line_t **))) == NULL) { - fprintf(stderr, "%s\n", strerror(errno)); - sprintf(errmsg, "out of memory"); - SPL0(); - return ERR; - } - } -#endif - active_size = ti; - active_list = ts; - SPL0(); - } - active_list[active_last++] = lp; - return 0; -} - - -/* unset_active_nodes: remove a range of lines from the global-active list */ -void -unset_active_nodes(np, mp) - line_t *np, *mp; -{ - line_t *lp; - long i; - - for (lp = np; lp != mp; lp = lp->q_forw) - for (i = 0; i < active_last; i++) - if (active_list[active_ndx] == lp) { - active_list[active_ndx] = NULL; - active_ndx = INC_MOD(active_ndx, active_last - 1); - break; - } else active_ndx = INC_MOD(active_ndx, active_last - 1); -} - - -/* next_active_node: return the next global-active line node */ -line_t * -next_active_node() -{ - while (active_ptr < active_last && active_list[active_ptr] == NULL) - active_ptr++; - return (active_ptr < active_last) ? active_list[active_ptr++] : NULL; -} - - -/* clear_active_list: clear the global-active list */ -void -clear_active_list() -{ - SPL1(); - active_size = active_last = active_ptr = active_ndx = 0; - free(active_list); - active_list = NULL; - SPL0(); -} 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" diff --git a/bin/expr/expr.1 b/bin/expr/expr.1 index 3cfa19b8f589..e6af35a40b17 100644 --- a/bin/expr/expr.1 +++ b/bin/expr/expr.1 @@ -28,7 +28,7 @@ .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" -.\" $Id: expr.1,v 1.2.2.1 1994/05/01 15:59:55 jkh Exp $ +.\" $Id: expr.1,v 1.3 1994/04/24 01:18:46 jkh Exp $ .\" .Dd July 3, 1993 .Dt EXPR 1 diff --git a/bin/ls/ls.1 b/bin/ls/ls.1 index 1363d00f80ae..cfcd293a6474 100644 --- a/bin/ls/ls.1 +++ b/bin/ls/ls.1 @@ -34,7 +34,7 @@ .\" .\" @(#)ls.1 6.18 (Berkeley) 6/27/91 .\" -.\" $Header: /home/cvs/386BSD/src/bin/ls/ls.1,v 1.2.2.1 1994/05/01 16:00:04 jkh Exp $ +.\" $Header: /home/cvs/386BSD/src/bin/ls/ls.1,v 1.3 1994/04/24 01:18:52 jkh Exp $ .\" .Dd June 27, 1991 .Dt LS 1 diff --git a/bin/mkdir/mkdir.1 b/bin/mkdir/mkdir.1 index d8d598e4b4d2..85d2387fddcc 100644 --- a/bin/mkdir/mkdir.1 +++ b/bin/mkdir/mkdir.1 @@ -34,7 +34,7 @@ .\" .\" @(#)mkdir.1 6.9 (Berkeley) 6/27/91 .\" -.\" $Header: /home/cvs/386BSD/src/bin/mkdir/mkdir.1,v 1.2.2.1 1994/05/01 16:00:13 jkh Exp $ +.\" $Header: /home/cvs/386BSD/src/bin/mkdir/mkdir.1,v 1.2 1993/07/21 22:54:08 conklin Exp $ .\" .Dd June 27, 1991 .Dt MKDIR 1 diff --git a/bin/mkdir/mkdir.c b/bin/mkdir/mkdir.c index b4ec95857c9e..4f59865a8e94 100644 --- a/bin/mkdir/mkdir.c +++ b/bin/mkdir/mkdir.c @@ -39,7 +39,7 @@ char copyright[] = #ifndef lint static char sccsid[] = "@(#)mkdir.c 5.7 (Berkeley) 5/31/90"; -static char rcsid[] = "$Header: /home/cvs/386BSD/src/bin/mkdir/mkdir.c,v 1.2 1993/07/21 22:54:09 conklin Exp $"; +static char rcsid[] = "$Header: /home/cvs/386BSD/src/bin/mkdir/mkdir.c,v 1.3 1994/05/23 01:15:19 ache Exp $"; #endif /* not lint */ #include @@ -118,7 +118,7 @@ build(path, mode, dir_mode) int ch; for (p = path;; ++p) { - if (!*p || *p == '/') { + if (!*p || *p == '/' && p != path) { ch = *p; *p = '\0'; if (stat(path, &sb)) { diff --git a/bin/mv/mv.c b/bin/mv/mv.c index aa37d0229f72..8fa66bb78f17 100644 --- a/bin/mv/mv.c +++ b/bin/mv/mv.c @@ -42,7 +42,7 @@ char copyright[] = #ifndef lint /*static char sccsid[] = "from: @(#)mv.c 5.11 (Berkeley) 4/3/91";*/ -static char rcsid[] = "$Id: mv.c,v 1.2 1993/11/22 23:54:24 jtc Exp $"; +static char rcsid[] = "$Id: mv.c,v 1.3 1994/04/16 00:51:13 davidg Exp $"; #endif /* not lint */ #include @@ -229,7 +229,7 @@ fastcopy(from, to, sbp) (void)close(from_fd); return(1); } - if (!blen && !(bp = malloc(blen = sbp->st_blksize))) { + if (!blen && !(bp = malloc(blen = sbp->st_blksize * 4))) { error(NULL); return(1); } diff --git a/bin/rcp/Makefile b/bin/rcp/Makefile index e8cac815eb55..aea1fdd7ba92 100644 --- a/bin/rcp/Makefile +++ b/bin/rcp/Makefile @@ -1,15 +1,15 @@ # @(#)Makefile 5.4 (Berkeley) 10/21/90 PROG= rcp -SRCS= rcp.c +SRCS= rcp.c krcmd.c kcmd.c BINOWN= root BINMODE=4555 .PATH: ${.CURDIR}/../../usr.bin/rlogin -.if exists(/usr/lib/libcrypt.a) -#CFLAGS+=-DCRYPT -DKERBEROS -#DPADD+= ${LIBCRYPT} ${LIBKRB} -#LDADD+= -lcrypt -lkrb +.if exists(${DESTDIR}/usr/lib/libkrb.a) +CFLAGS+=-DCRYPT -DKERBEROS +DPADD+= ${LIBKRB} ${LIBDES} +LDADD+= -lkrb -ldes .endif .include diff --git a/bin/rm/rm.c b/bin/rm/rm.c index 45d74488b7fd..d0cf0d2b7bfd 100644 --- a/bin/rm/rm.c +++ b/bin/rm/rm.c @@ -39,7 +39,7 @@ char copyright[] = #ifndef lint /*static char sccsid[] = "from: @(#)rm.c 4.26 (Berkeley) 3/10/91";*/ -static char rcsid[] = "$Id: rm.c,v 1.6.2.1 1994/03/07 02:25:28 rgrimes Exp $"; +static char rcsid[] = "$Id: rm.c,v 1.7 1994/03/05 16:12:06 ats Exp $"; #endif /* not lint */ #include diff --git a/bin/rmail/rmail.c b/bin/rmail/rmail.c index 40e16887d7c9..7672cbfc44c1 100644 --- a/bin/rmail/rmail.c +++ b/bin/rmail/rmail.c @@ -163,7 +163,6 @@ main(argc, argv) i = 0; args[i++] = _PATH_SENDMAIL; args[i++] = "-oee"; /* no errors, just status */ - args[i++] = "-odq"; /* queue it, don't try to deliver */ args[i++] = "-oi"; /* ignore '.' on a line by itself */ if (fsys[0] != '\0') { /* set sender's host name */ static char junk2[512]; diff --git a/bin/rmdir/rmdir.c b/bin/rmdir/rmdir.c index b67393827094..b39e4e45e82d 100644 --- a/bin/rmdir/rmdir.c +++ b/bin/rmdir/rmdir.c @@ -39,7 +39,7 @@ char copyright[] = #ifndef lint /*static char sccsid[] = "from: @(#)rmdir.c 5.3 (Berkeley) 5/31/90";*/ -static char rcsid[] = "$Id: rmdir.c,v 1.3 1993/11/23 00:13:55 jtc Exp $"; +static char rcsid[] = "$Id: rmdir.c,v 1.4 1994/05/23 01:41:06 ache Exp $"; #endif /* not lint */ /* @@ -117,6 +117,8 @@ rmdirp (path) /* skip trailing slash characters */ while (slash > path && *slash == '/') slash--; + if (*slash == '/') /* don't attempt to remove root */ + return 0; *++slash = '\0'; if (rmdir (path)) { diff --git a/bin/sh/builtins b/bin/sh/builtins index b605bd890533..a08020a82430 100644 --- a/bin/sh/builtins +++ b/bin/sh/builtins @@ -50,7 +50,7 @@ # This file is part of ash, which is distributed under the terms specified # by the Ash General Public License. See the file named LICENSE. -bltincmd command +bltincmd bltin #alloccmd alloc bgcmd -j bg breakcmd break continue diff --git a/bin/sh/cd.c b/bin/sh/cd.c index e458c1f0ae20..615ac7a38fd2 100644 --- a/bin/sh/cd.c +++ b/bin/sh/cd.c @@ -217,7 +217,7 @@ top: STPUTC('\0', p); p = grabstackstr(p); INTOFF; - if (chdir(p) < 0) { + if (chdir(*p ? p : ".") < 0) { INTON; return -1; } diff --git a/bin/sh/expand.c b/bin/sh/expand.c index 95d2e504cd70..c350eae3ee7f 100644 --- a/bin/sh/expand.c +++ b/bin/sh/expand.c @@ -403,7 +403,7 @@ again: /* jump here after setting a variable with ${var=text} */ if ((c = *p++) == CTLESC) p++; else if (c == CTLBACKQ || c == (CTLBACKQ|CTLQUOTE)) { - if (set) + if (set && argbackq) argbackq = argbackq->next; } else if (c == CTLVAR) { if ((*p++ & VSTYPE) != VSNORMAL) @@ -664,10 +664,10 @@ expandmeta(str) savelastp = exparg.lastp; INTOFF; if (expdir == NULL) - expdir = ckmalloc(8192); /* I hope this is big enough */ + expdir = ckmalloc(16384); /* I hope this is big enough */ expmeta(expdir, str->text); - if(strlen(expdir) >= 8192) - error("malloc overflow in sh:expand.c in ckmalloc(8192)\n"); + if(strlen(expdir) >= 16384) + error("malloc overflow in sh:expand.c in ckmalloc(16384)\n"); ckfree(expdir); expdir = NULL; INTON; diff --git a/bin/sh/miscbltin.c b/bin/sh/miscbltin.c index b14da674a166..3384cd5c8341 100644 --- a/bin/sh/miscbltin.c +++ b/bin/sh/miscbltin.c @@ -89,8 +89,8 @@ readcmd(argc, argv) char **argv; { out2str(prompt); flushall(); } - if ((ap = argptr) == NULL) - error("arg count"); + if (*(ap = argptr) == NULL) + error("bad argument/arg count"); if ((ifs = bltinlookup("IFS", 1)) == NULL) ifs = nullstr; status = 0; diff --git a/bin/stty/cchar.c b/bin/stty/cchar.c index b8e6206cfa59..c105f96c2081 100644 --- a/bin/stty/cchar.c +++ b/bin/stty/cchar.c @@ -60,12 +60,14 @@ struct cchar cchars1[] = { "intr", VINTR, CINTR, "kill", VKILL, CKILL, "lnext", VLNEXT, CLNEXT, + "min", VMIN, CMIN, "quit", VQUIT, CQUIT, "reprint", VREPRINT, CREPRINT, "start", VSTART, CSTART, "status", VSTATUS, CSTATUS, "stop", VSTOP, CSTOP, "susp", VSUSP, CSUSP, + "time", VTIME, CTIME, "werase", VWERASE, CWERASE, NULL, }; @@ -95,8 +97,8 @@ csearch(argvp, ip) tmp.name = name; if (!(cp = (struct cchar *)bsearch(&tmp, cchars1, sizeof(cchars1)/sizeof(struct cchar) - 1, sizeof(struct cchar), - c_cchar)) && !(cp = (struct cchar *)bsearch(&tmp, cchars1, - sizeof(cchars1)/sizeof(struct cchar) - 1, sizeof(struct cchar), + c_cchar)) && !(cp = (struct cchar *)bsearch(&tmp, cchars2, + sizeof(cchars2)/sizeof(struct cchar) - 1, sizeof(struct cchar), c_cchar))) return(0); @@ -109,10 +111,6 @@ csearch(argvp, ip) ip->t.c_cc[cp->sub] = _POSIX_VDISABLE; else if (cp->sub == VMIN || cp->sub == VTIME) { val = strtol(arg, &ep, 10); - if (val == _POSIX_VDISABLE) { - warnx("value of %ld would disable the option -- %s", - val, name); - } if (val > UCHAR_MAX) { warnx("maximum option value is %d -- %s", UCHAR_MAX, name); diff --git a/bin/stty/gfmt.c b/bin/stty/gfmt.c index d909131ee32c..97021bb31ba3 100644 --- a/bin/stty/gfmt.c +++ b/bin/stty/gfmt.c @@ -163,12 +163,12 @@ gread(tp, s) tp->c_cc[VSUSP] = tmp; continue; } - if (CHK("vmin")) { + if (CHK("min")) { (void)sscanf(ep, "%ld", &tmp); tp->c_cc[VMIN] = tmp; continue; } - if (CHK("vtime")) { + if (CHK("time")) { (void)sscanf(ep, "%ld", &tmp); tp->c_cc[VTIME] = tmp; continue; diff --git a/bin/stty/key.c b/bin/stty/key.c index 6a7aeca935e2..1f7114864058 100644 --- a/bin/stty/key.c +++ b/bin/stty/key.c @@ -276,6 +276,6 @@ f_tty(ip) int tmp; tmp = TTYDISC; - if (ioctl(0, TIOCSETD, &tmp) < 0) + if (ioctl(ip->fd, TIOCSETD, &tmp) < 0) err("TIOCSETD: %s", strerror(errno)); } diff --git a/bin/stty/print.c b/bin/stty/print.c index a3ef040efbec..fdd2f72c406d 100644 --- a/bin/stty/print.c +++ b/bin/stty/print.c @@ -74,6 +74,9 @@ print(tp, wp, ldisc, fmt) case NTTYDISC: cnt += printf("new tty disc; "); break; + case PPPDISC: + cnt += printf("ppp disc; "); + break; default: cnt += printf("#%d disc; ", ldisc); break; @@ -250,13 +253,14 @@ ccval(p, c) static char buf[5]; char *bp; - if (c == _POSIX_VDISABLE) - return(""); - if (p->sub == VMIN || p->sub == VTIME) { (void)snprintf(buf, sizeof(buf), "%d", c); return (buf); } + + if (c == _POSIX_VDISABLE) + return(""); + bp = buf; if (c & 0200) { *bp++ = 'M'; -- cgit v1.3