diff --git a/usr.bin/mktemp/mktemp.1 b/usr.bin/mktemp/mktemp.1 --- a/usr.bin/mktemp/mktemp.1 +++ b/usr.bin/mktemp/mktemp.1 @@ -28,7 +28,7 @@ .\" From: $OpenBSD: mktemp.1,v 1.8 1998/03/19 06:13:37 millert Exp $ .\" $FreeBSD$ .\" -.Dd December 30, 2005 +.Dd August 4, 2022 .Dt MKTEMP 1 .Os .Sh NAME @@ -132,9 +132,9 @@ .Sh OPTIONS The available options are as follows: .Bl -tag -width indent -.It Fl d +.It Fl d , Fl -directory Make a directory instead of a file. -.It Fl q +.It Fl q , Fl -quiet Fail silently if an error occurs. This is useful if a script does not want error output to go to standard error. @@ -144,7 +144,7 @@ and .Ev TMPDIR if set) to create a filename template. -.It Fl u +.It Fl u , Fl -dry-run Operate in .Dq unsafe mode. diff --git a/usr.bin/mktemp/mktemp.c b/usr.bin/mktemp/mktemp.c --- a/usr.bin/mktemp/mktemp.c +++ b/usr.bin/mktemp/mktemp.c @@ -37,6 +37,7 @@ */ #include +#include #include #include #include @@ -50,6 +51,13 @@ static void usage(void); +static const struct option long_opts[] = { + {"directory", no_argument, NULL, 'd'}, + {"quiet", no_argument, NULL, 'q'}, + {"dry-run", no_argument, NULL, 'u'}, + {NULL, no_argument, NULL, 0}, +}; + int main(int argc, char **argv) { @@ -63,7 +71,7 @@ prefix = "mktemp"; name = NULL; - while ((c = getopt(argc, argv, "dqt:u")) != -1) + while ((c = getopt_long(argc, argv, "dqt:u", long_opts, NULL)) != -1) switch (c) { case 'd': dflag++;