aboutsummaryrefslogtreecommitdiff
path: root/toys/lsb/mktemp.c
AgeCommit message (Collapse)Author
2019-09-17Allow --tmpdir's argument to be optional.Rob Landley
2018-12-07Fix mktemp to pass tests.Rob Landley
2018-12-04mktemp: more tests, more fixes.Elliott Hughes
I realized (after being questioned about my motivation) that I hadn't added a test for the -u behavior. Adding the missing test confirmed the usual "if there isn't a test, the code is broken", but now I think I actually understand how we're supposed to choose between DIR, $TMPDIR, and /tmp. I've added more tests to back this up, and rewritten the code one more time so that we pass all the tests.
2018-12-03mktemp: fix warning with glibc 2.15.Elliott Hughes
Old versions of glibc had warn_unused_result on mktemp(3), despite it always returning its argument. Still, we can silence the warning and save a line, so...
2018-11-28mktemp: add -t and fix behavior.Elliott Hughes
The new tests pass on the host (coreutils 8.28) and with toybox after this patch is applied.
2018-11-17Convert more GLOBALS argument vars to the new single letter code style.Rob Landley
2015-12-30Don't let mktemp -q /path/to/file delete arbitrary files, and don't haveRob Landley
"mktemp -u > /dev/full" leave file around.
2015-12-30lsb/mktemp: Add -u flagKylie McClain
The -u flag creates a file, and unlinks it before exiting. This is usually known as "unsafe mode", or "dry-run" mode. GNU mktemp has it, as does Busybox's mktemp and likely many others.
2015-03-11Fix mktemp when TMPDIR is set to empty string, reported by Kylie McClain.Rob Landley
2015-02-12Fix bug introduced by last commit (print template instead of toybuf).Rob Landley
Also, xstrdup() the unmodified template because changing the environment string could make the changed version show up in "ps".
2015-02-11Only apply mktemp directory to targets that aren't already paths.Rob Landley
2015-02-10Fix longopts (pointed out by Hyejin Kim).Rob Landley
2015-02-07Shameless meddling.Rob Landley
2015-02-07Use $TMPDIR if set (necessary on Android, where there is no /tmp).Elliot Hughes
Include full template in error messages. Don't report success on failure with -q. Avoid unnecessary allocation. Fix "xxxxxx" versus "XXXXXX" confusion.
2014-01-16Rename xmsprintf() to just xmprintf().Rob Landley
Partly because there's no supplied target string ala sprintf, and partly because I can never remember what order the m and s go in.
2012-11-13Reindent to two spaces per level. Remove vi: directives that haven't worked ↵Rob Landley
right in years (ubuntu broke its' vim implementation). Remove trailing spaces. Add/remove blank lines. Re-wordwrap in places. Update documentation with new coding style. The actual code should be the same afterward, this is just cosmetic refactoring.
2012-10-08New build infrastructure to generate FLAG_ macros and TT alias, #define ↵Rob Landley
FOR_commandname before #including toys.h to trigger it. Rename DEFINE_GLOBALS() to just GLOBALS() (because I could never remember if it was DECLARE_GLOBALS). Convert existing commands to use new infrastructure, and replace optflag constants with FLAG_ macros where appropriate.
2012-09-03mktemp broke kernel build, so new rules: if you don't specify anything, ↵Rob Landley
/tmp/tmp.* Specify a file, ./file. Specify -p dir then dir/tmp.*. Specify -p dir and file, dir/file. Also implement -q which lsb wants.
2012-08-25Regularize command headers, update links to standards documents.Rob Landley
2012-08-25Move commands into "posix", "lsb", and "other" menus/directories.Rob Landley