← Commit list

ecac9853f

Andrej Valek
Andrej Valek
2021-10-08
SUCCESS Duration: 155s

Subject

mktemp: add --tmpdir option

Binary

No binary (build failed)

Architecture & Compiler Flags

Architecture: x86_64-linux-gnu Compiler: gcc (Ubuntu 11.4.0-1ubuntu1~22.04.3) 11.4.0

—

Build Log

(log yok)

Commit Diff GitHub →

coreutils/mktemp.c+15 -1
@@ -72,13 +72,27 @@ int mktemp_main(int argc UNUSED_PARAM, char **argv)
OPT_t = 1 << 2,
OPT_p = 1 << 3,
OPT_u = 1 << 4,
+ OPT_tmpdir = (1 << 5) * ENABLE_LONG_OPTS,
};
path = getenv("TMPDIR");
if (!path || path[0] == '\0')
path = "/tmp";
+#if ENABLE_LONG_OPTS
+ opts = getopt32long(argv, "^"
+ "dqtp:u"
+ "\0"
+ "?1" /* 1 arg max */,
+ "directory\0" No_argument "d"
+ "quiet\0" No_argument "q"
+ "dry-run\0" No_argument "u"
+ "tmpdir\0" Optional_argument "\xff"
+ , &path, &path
+ );
+#else
opts = getopt32(argv, "^" "dqtp:u" "\0" "?1"/*1 arg max*/, &path);
+#endif
chp = argv[optind];
if (!chp) {
@@ -95,7 +109,7 @@ int mktemp_main(int argc UNUSED_PARAM, char **argv)
goto error;
}
#endif
- if (opts & (OPT_t|OPT_p))
+ if (opts & (OPT_t|OPT_p|OPT_tmpdir))
chp = concat_path_file(path, chp);
if (opts & OPT_u) {