summaryrefslogtreecommitdiff
path: root/bin/dd/args.c
diff options
context:
space:
mode:
authorKiyoshi Aman <kiyoshi.aman+adelie@gmail.com>2019-05-16 11:47:54 -0500
committerKiyoshi Aman <kiyoshi.aman+adelie@gmail.com>2019-05-16 11:47:54 -0500
commit5fa3142cdbb67cbb8287b2ec4fc35ee6532b3c6d (patch)
tree6abb866f965d62c64868a01950e53e0e6c21f06a /bin/dd/args.c
parent5aef04248e45a1a0ce74d96e78abd871048369bf (diff)
downloaduserland-5fa3142cdbb67cbb8287b2ec4fc35ee6532b3c6d.tar.gz
userland-5fa3142cdbb67cbb8287b2ec4fc35ee6532b3c6d.tar.bz2
userland-5fa3142cdbb67cbb8287b2ec4fc35ee6532b3c6d.tar.xz
userland-5fa3142cdbb67cbb8287b2ec4fc35ee6532b3c6d.zip
bin/dd: make buildable with libbsd
Diffstat (limited to 'bin/dd/args.c')
-rw-r--r--bin/dd/args.c33
1 files changed, 11 insertions, 22 deletions
diff --git a/bin/dd/args.c b/bin/dd/args.c
index 748f52c..ff4cc58 100644
--- a/bin/dd/args.c
+++ b/bin/dd/args.c
@@ -33,15 +33,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)args.c 8.3 (Berkeley) 4/2/94";
-#else
-__RCSID("$NetBSD: args.c,v 1.40 2019/01/30 01:40:02 mrg Exp $");
-#endif
-#endif /* not lint */
-
#include <sys/types.h>
#include <sys/time.h>
@@ -60,22 +51,18 @@ __RCSID("$NetBSD: args.c,v 1.40 2019/01/30 01:40:02 mrg Exp $");
static int c_arg(const void *, const void *);
-#ifdef NO_MSGFMT
-static void f_msgfmt(char *) __dead;
-#else
static void f_msgfmt(char *);
-#endif /* NO_MSGFMT */
#ifdef NO_CONV
-static void f_conv(char *) __dead;
+static void f_conv(char *);
#else
static void f_conv(char *);
static int c_conv(const void *, const void *);
#endif /* NO_CONV */
#ifdef NO_IOFLAG
-static void f_iflag(char *) __dead;
-static void f_oflag(char *) __dead;
+static void f_iflag(char *);
+static void f_oflag(char *);
#else
static void f_iflag(char *);
static void f_oflag(char *);
@@ -120,6 +107,8 @@ static const struct arg {
{ "seek", f_seek, C_SEEK, C_SEEK },
{ "skip", f_skip, C_SKIP, C_SKIP },
};
+/* number of entries in the above */
+const int args_count = 17;
/*
* args -- parse JCL syntax of dd.
@@ -149,8 +138,7 @@ jcl(char **argv)
/* NOTREACHED */
}
tmp.name = oper;
- if (!(ap = bsearch(&tmp, args,
- __arraycount(args), sizeof(*args), c_arg))) {
+ if (!(ap = bsearch(&tmp, args, args_count, sizeof(*args), c_arg))) {
errx(EXIT_FAILURE, "unknown operand %s", tmp.name);
/* NOTREACHED */
}
@@ -371,6 +359,8 @@ static const struct conv {
* conversions to the C_BS check in the jcl routine above.
*/
};
+/* number of entries in the above table */
+const int clist_count = 16;
static void
f_conv(char *arg)
@@ -379,8 +369,7 @@ f_conv(char *arg)
while (arg != NULL) {
tmp.name = strsep(&arg, ",");
- if (!(cp = bsearch(&tmp, clist,
- __arraycount(clist), sizeof(*clist), c_conv))) {
+ if (!(cp = bsearch(&tmp, clist, clist_count, sizeof(*clist), c_conv))) {
errx(EXIT_FAILURE, "unknown conversion %s", tmp.name);
/* NOTREACHED */
}
@@ -434,8 +423,8 @@ f_oflag(char *arg)
#ifndef NO_IOFLAG
static const struct ioflag {
const char *name;
- u_int set;
- u_int allowed;
+ uint32_t set;
+ uint32_t allowed;
} olist[] = {
/* the array needs to be sorted by the first column so
bsearch() can be used to find commands quickly */