source: MondoRescue/trunk/mindi-busybox/debianutils/mktemp.c@ 956

Last change on this file since 956 was 821, checked in by Bruno Cornec, 18 years ago

Addition of busybox 1.2.1 as a mindi-busybox new package
This should avoid delivering binary files in mindi not built there (Fedora and Debian are quite serious about that)

File size: 717 bytes
Line 
1/* vi: set sw=4 ts=4: */
2/*
3 * Mini mktemp implementation for busybox
4 *
5 *
6 * Copyright (C) 2000 by Daniel Jacobowitz
7 * Written by Daniel Jacobowitz <dan@debian.org>
8 *
9 * Licensed under the GPL v2 or later, see the file LICENSE in this tarball.
10 */
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>
18
19int mktemp_main(int argc, char **argv)
20{
21 unsigned long flags = bb_getopt_ulflags(argc, argv, "dq");
22
23 if (optind + 1 != argc)
24 bb_show_usage();
25
26 if (flags & 1) {
27 if (mkdtemp(argv[optind]) == NULL)
28 return EXIT_FAILURE;
29 }
30 else {
31 if (mkstemp(argv[optind]) < 0)
32 return EXIT_FAILURE;
33 }
34
35 puts(argv[optind]);
36
37 return EXIT_SUCCESS;
38}
Note: See TracBrowser for help on using the repository browser.