diff options
author | Kiyoshi Aman <kiyoshi.aman+adelie@gmail.com> | 2019-06-04 23:47:29 -0500 |
---|---|---|
committer | Kiyoshi Aman <kiyoshi.aman+adelie@gmail.com> | 2019-06-04 23:47:29 -0500 |
commit | 781dfa351934e5c0f6927456458a9f1a19442107 (patch) | |
tree | 67b33f6068204621d67c4d39afefd8c3356ec5d6 | |
parent | f7b566bd6bf844b0c53abdb86ae235cac1012cb1 (diff) | |
download | userland-781dfa351934e5c0f6927456458a9f1a19442107.tar.gz userland-781dfa351934e5c0f6927456458a9f1a19442107.tar.bz2 userland-781dfa351934e5c0f6927456458a9f1a19442107.tar.xz userland-781dfa351934e5c0f6927456458a9f1a19442107.zip |
usr.bin/sed: make buildable
-rw-r--r-- | usr.bin/sed/compile.c | 15 | ||||
-rw-r--r-- | usr.bin/sed/defs.h | 8 | ||||
-rw-r--r-- | usr.bin/sed/extern.h | 6 | ||||
-rw-r--r-- | usr.bin/sed/main.c | 37 | ||||
-rw-r--r-- | usr.bin/sed/misc.c | 14 | ||||
-rw-r--r-- | usr.bin/sed/process.c | 14 |
6 files changed, 16 insertions, 78 deletions
diff --git a/usr.bin/sed/compile.c b/usr.bin/sed/compile.c index 300a77f..9e7dadb 100644 --- a/usr.bin/sed/compile.c +++ b/usr.bin/sed/compile.c @@ -33,25 +33,12 @@ * SUCH DAMAGE. */ -#if HAVE_NBTOOL_CONFIG_H -#include "nbtool_config.h" -#endif - -#include <sys/cdefs.h> -__RCSID("$NetBSD: compile.c,v 1.47 2016/04/05 00:13:03 christos Exp $"); -#ifdef __FBSDID -__FBSDID("$FreeBSD: head/usr.bin/sed/compile.c 259132 2013-12-09 18:57:20Z eadler $"); -#endif - -#if 0 -static const char sccsid[] = "@(#)compile.c 8.1 (Berkeley) 6/6/93"; -#endif - #include <sys/types.h> #include <sys/stat.h> #include <ctype.h> #include <err.h> +#include <bsd/err.h> #include <errno.h> #include <fcntl.h> #include <limits.h> diff --git a/usr.bin/sed/defs.h b/usr.bin/sed/defs.h index b564115..d2f7157 100644 --- a/usr.bin/sed/defs.h +++ b/usr.bin/sed/defs.h @@ -36,6 +36,8 @@ * $FreeBSD: head/usr.bin/sed/defs.h 192732 2009-05-25 06:45:33Z brian $ */ +#include <stdbool.h> + /* * Types of address specifications */ @@ -68,7 +70,7 @@ struct s_subst { int wfd; /* Cached file descriptor */ regex_t *re; /* Regular expression */ unsigned int maxbref; /* Largest backreference. */ - u_long linenum; /* Line number. */ + unsigned long linenum; /* Line number. */ char *new; /* Replacement text */ }; @@ -94,7 +96,7 @@ struct s_tr { struct s_command { struct s_command *next; /* Pointer to next command */ struct s_addr *a1, *a2; /* Start and end address */ - u_long startline; /* Start line number or zero */ + unsigned long startline; /* Start line number or zero */ char *t; /* Text for : a c i r w */ union { struct s_command *c; /* Command(s) for b t { */ @@ -103,7 +105,7 @@ struct s_command { int fd; /* File descriptor for w */ } u; char code; /* Command code */ - u_int nonsel:1; /* True if ! */ + bool nonsel; /* True if ! */ }; /* diff --git a/usr.bin/sed/extern.h b/usr.bin/sed/extern.h index 0d28591..f2b82a0 100644 --- a/usr.bin/sed/extern.h +++ b/usr.bin/sed/extern.h @@ -40,7 +40,7 @@ extern struct s_command *prog; extern struct s_appends *appends; extern regmatch_t *match; extern size_t maxnsub; -extern u_long linenum; +extern unsigned long linenum; extern size_t appendnum; extern int aflag, eflag, nflag; extern const char *fname, *outfname; @@ -59,3 +59,7 @@ char *strregerror(int, regex_t *); void *xmalloc(size_t); void *xrealloc(void *, size_t); void *xcalloc(size_t, size_t); + +#define DEFFILEMODE (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH) +#define ALLPERMS (S_ISUID|S_ISGID|S_IRWXU|S_IRWXG|S_IRWXO) + diff --git a/usr.bin/sed/main.c b/usr.bin/sed/main.c index cfe9d35..69def8b 100644 --- a/usr.bin/sed/main.c +++ b/usr.bin/sed/main.c @@ -34,25 +34,6 @@ * SUCH DAMAGE. */ -#if HAVE_NBTOOL_CONFIG_H -#include "nbtool_config.h" -#endif - -#include <sys/cdefs.h> -__RCSID("$NetBSD: main.c,v 1.34 2015/03/12 12:40:41 christos Exp $"); -#ifdef __FBSDID -__FBSDID("$FreeBSD: head/usr.bin/sed/main.c 252231 2013-06-26 04:14:19Z pfg $"); -#endif - -#ifndef lint -__COPYRIGHT("@(#) Copyright (c) 1992, 1993\ - The Regents of the University of California. All rights reserved."); -#endif - -#if 0 -static const char sccsid[] = "@(#)main.c 8.2 (Berkeley) 1/3/94"; -#endif - #include <sys/types.h> #include <sys/mman.h> #include <sys/param.h> @@ -69,6 +50,7 @@ static const char sccsid[] = "@(#)main.c 8.2 (Berkeley) 1/3/94"; #define _WITH_GETLINE #include <stdio.h> #include <stdlib.h> +#include <bsd/stdlib.h> #include <string.h> #include <unistd.h> @@ -123,11 +105,11 @@ const char *outfname; /* Output file name */ static char oldfname[PATH_MAX]; /* Old file name (for in-place editing) */ static char tmpfname[PATH_MAX]; /* Temporary file name (for in-place editing) */ static const char *inplace; /* Inplace edit file extension. */ -u_long linenum; +unsigned long linenum; static void add_compunit(enum e_cut, char *); static void add_file(char *); -static void usage(void) __dead; +static void usage(void); int main(int argc, char *argv[]) @@ -148,7 +130,7 @@ main(int argc, char *argv[]) rflags = REG_EXTENDED; break; case 'I': - inplace = optarg ? optarg : __UNCONST(""); + inplace = optarg ? optarg : ""; ispan = 1; /* span across input files */ break; case 'a': @@ -166,15 +148,11 @@ main(int argc, char *argv[]) add_compunit(CU_FILE, optarg); break; case 'i': - inplace = optarg ? optarg : __UNCONST(""); + inplace = optarg ? optarg : ""; ispan = 0; /* don't span across input files */ break; case 'l': -#ifdef _IOLBF c = setvbuf(stdout, NULL, _IOLBF, 0); -#else - c = setlinebuf(stdout); -#endif if (c) warn("setting line buffered output failed"); break; @@ -182,12 +160,7 @@ main(int argc, char *argv[]) nflag = 1; break; case 'u': -#ifdef _IONBF c = setvbuf(stdout, NULL, _IONBF, 0); -#else - c = -1; - errno = EOPNOTSUPP; -#endif if (c) warn("setting unbuffered output failed"); break; diff --git a/usr.bin/sed/misc.c b/usr.bin/sed/misc.c index bd0ecdf..ee133b5 100644 --- a/usr.bin/sed/misc.c +++ b/usr.bin/sed/misc.c @@ -33,20 +33,6 @@ * SUCH DAMAGE. */ -#if HAVE_NBTOOL_CONFIG_H -#include "nbtool_config.h" -#endif - -#include <sys/cdefs.h> -__RCSID("$NetBSD: misc.c,v 1.15 2014/06/26 02:14:32 christos Exp $"); -#ifdef __FBSDID -__FBSDID("$FreeBSD: head/usr.bin/sed/misc.c 200462 2009-12-13 03:14:06Z delphij $"); -#endif - -#if 0 -static const char sccsid[] = "@(#)misc.c 8.1 (Berkeley) 6/6/93"; -#endif - #include <sys/types.h> #include <err.h> diff --git a/usr.bin/sed/process.c b/usr.bin/sed/process.c index 896df5a..12a0240 100644 --- a/usr.bin/sed/process.c +++ b/usr.bin/sed/process.c @@ -33,20 +33,6 @@ * SUCH DAMAGE. */ -#if HAVE_NBTOOL_CONFIG_H -#include "nbtool_config.h" -#endif - -#include <sys/cdefs.h> -__RCSID("$NetBSD: process.c,v 1.52 2015/03/12 12:40:41 christos Exp $"); -#ifdef __FBSDID -__FBSDID("$FreeBSD: head/usr.bin/sed/process.c 192732 2009-05-25 06:45:33Z brian $"); -#endif - -#if 0 -static const char sccsid[] = "@(#)process.c 8.6 (Berkeley) 4/20/94"; -#endif - #include <sys/types.h> #include <sys/stat.h> #include <sys/ioctl.h> |