* "This program is in the Public Domain."
*/
-#include "internal.h"
#include <sys/types.h>
-#include <sys/stat.h>
#include <unistd.h>
#include <ctype.h>
#include <errno.h>
#include <stdlib.h>
#include <string.h>
+#include "busybox.h"
#define BB_DECLARE_EXTERN
#define bb_need_help
#include "messages.c"
PAREN
};
-struct t_op {
+static const struct t_op {
const char *op_text;
short op_num, op_type;
-} const ops [] = {
+} ops [] = {
{"-r", FILRD, UNOP},
{"-w", FILWR, UNOP},
{"-x", FILEX, UNOP},
{0, 0, 0}
};
-char **t_wp;
-struct t_op const *t_wp_op;
+static char **t_wp;
+static struct t_op const *t_wp_op;
static gid_t *group_array = NULL;
static int ngroups;
if (strcmp(applet_name, "[") == 0) {
if (strcmp(argv[--argc], "]"))
- fatalError("missing ]\n");
+ error_msg_and_die("missing ]");
argv[argc] = NULL;
}
/* Implement special cases from POSIX.2, section 4.62.4 */
char *msg;
{
if (op && *op)
- fatalError("%s: %s\n", op, msg);
+ error_msg_and_die("%s: %s", op, msg);
else
- fatalError("%s\n", msg);
+ error_msg_and_die("%s", msg);
}
static int
r = strtol(s, &p, 10);
if (errno != 0)
- fatalError("%s: out of range\n", s);
+ error_msg_and_die("%s: out of range", s);
while (isspace(*p))
p++;
if (*p)
- fatalError("%s: bad number\n", s);
+ error_msg_and_die("%s: bad number", s);
return (int) r;
}
initialize_group_array ()
{
ngroups = getgroups(0, NULL);
- if ((group_array = realloc(group_array, ngroups * sizeof(gid_t))) == NULL)
- fatalError("Out of space\n");
-
+ group_array = xrealloc(group_array, ngroups * sizeof(gid_t));
getgroups(ngroups, group_array);
}