/*
* Mini mkdir implementation for busybox
*
- * Copyright (C) 1999,2000 by Lineo, inc.
+ * Copyright (C) 1999,2000,2001 by Lineo, inc.
* Written by Erik Andersen <andersen@lineo.com>, <andersee@debian.org>
*
* This program is free software; you can redistribute it and/or modify
*
*/
-#include "internal.h"
+#include "busybox.h"
#define bb_need_name_too_long
#define BB_DECLARE_EXTERN
#include "messages.c"
#include <stdio.h>
#include <errno.h>
+#include <string.h>
+#include <stdlib.h>
static int parentFlag = FALSE;
static mode_t mode = 0777;
/* Find the specified modes */
mode = 0;
if (parse_mode(*(++argv), &mode) == FALSE) {
- errorMsg("Unknown mode: %s\n", *argv);
- exit FALSE;
+ error_msg_and_die("Unknown mode: %s\n", *argv);
}
/* Set the umask for this process so it doesn't
* screw up whatever the user just entered. */
char buf[BUFSIZ + 1];
if (strlen(*argv) > BUFSIZ - 1) {
- errorMsg(name_too_long);
- exit FALSE;
+ error_msg_and_die(name_too_long);
}
strcpy(buf, *argv);
status = stat(buf, &statBuf);
if (parentFlag == FALSE && status != -1 && errno != ENOENT) {
- errorMsg("%s: File exists\n", buf);
- exit FALSE;
+ error_msg_and_die("%s: File exists\n", buf);
}
if (parentFlag == TRUE) {
strcat(buf, "/");
- createPath(buf, mode);
+ create_path(buf, mode);
} else {
if (mkdir(buf, mode) != 0 && parentFlag == FALSE) {
- perror(buf);
- exit FALSE;
+ perror_msg_and_die(buf);
}
}
argc--;
argv++;
}
- return( TRUE);
+ return EXIT_SUCCESS;
}