Changeset 1770 in MondoRescue for branches/stable/mindi-busybox/debianutils/mktemp.c
- Timestamp:
- Nov 6, 2007, 11:01:53 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/stable/mindi-busybox/debianutils/mktemp.c
r821 r1770 10 10 */ 11 11 12 #include "busybox.h" 13 #include <stdio.h> 14 #include <errno.h> 15 #include <string.h> 16 #include <unistd.h> 17 #include <stdlib.h> 12 #include "libbb.h" 18 13 14 int mktemp_main(int argc, char **argv); 19 15 int mktemp_main(int argc, char **argv) 20 16 { 21 unsigned long flags = bb_getopt_ulflags(argc, argv, "dq"); 17 unsigned long flags = getopt32(argv, "dqt"); 18 char *chp; 22 19 23 20 if (optind + 1 != argc) 24 21 bb_show_usage(); 25 22 23 chp = argv[optind]; 24 25 if (flags & 4) { 26 char *dir = getenv("TMPDIR"); 27 if (dir && *dir != '\0') 28 chp = concat_path_file(dir, chp); 29 else 30 chp = concat_path_file("/tmp/", chp); 31 } 32 26 33 if (flags & 1) { 27 if (mkdtemp( argv[optind]) == NULL)34 if (mkdtemp(chp) == NULL) 28 35 return EXIT_FAILURE; 29 } 30 else { 31 if (mkstemp(argv[optind]) < 0) 36 } else { 37 if (mkstemp(chp) < 0) 32 38 return EXIT_FAILURE; 33 39 } 34 40 35 puts( argv[optind]);41 puts(chp); 36 42 37 43 return EXIT_SUCCESS;
Note:
See TracChangeset
for help on using the changeset viewer.