X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;ds=sidebyside;f=util-linux%2Fipcrm.c;h=5dcda859a9cdcc99a85c55d9615e32f8642e53ce;hb=11c17f75a7f29da47eae35a2f41d274a99a95760;hp=886c2efbd9d5987356495dd64ef720afc1c5c440;hpb=06c0a71d2315756db874e98bc4f760ca3283b6a6;p=oweals%2Fbusybox.git diff --git a/util-linux/ipcrm.c b/util-linux/ipcrm.c index 886c2efbd..5dcda859a 100644 --- a/util-linux/ipcrm.c +++ b/util-linux/ipcrm.c @@ -8,7 +8,7 @@ * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. */ -#include "busybox.h" +#include "libbb.h" /* X/OPEN tells us to use for semctl() */ /* X/OPEN tells us to use for msgctl() */ @@ -17,19 +17,22 @@ #include #include -#if defined (__GNU_LIBRARY__) && !defined(_SEM_SEMUN_UNDEFINED) +#if defined(__GNU_LIBRARY__) && !defined(_SEM_SEMUN_UNDEFINED) /* union semun is defined by including */ #else /* according to X/OPEN we have to define it ourselves */ union semun { int val; struct semid_ds *buf; - unsigned short int *array; + unsigned short *array; struct seminfo *__buf; }; #endif -#ifndef CONFIG_IPCRM_DROP_LEGACY +#define IPCRM_LEGACY 1 + + +#if IPCRM_LEGACY typedef enum type_id { SHM, @@ -70,9 +73,10 @@ static int remove_ids(type_id type, int argc, char **argv) return nb_errors; } -#endif /* #ifndef CONFIG_IPCRM_DROP_LEGACY */ +#endif /* IPCRM_LEGACY */ +int ipcrm_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; int ipcrm_main(int argc, char **argv) { int c; @@ -81,7 +85,7 @@ int ipcrm_main(int argc, char **argv) /* if the command is executed without parameters, do nothing */ if (argc == 1) return 0; -#ifndef CONFIG_IPCRM_DROP_LEGACY +#if IPCRM_LEGACY /* check to see if the command is being invoked in the old way if so then run the old code. Valid commands are msg, shm, sem. */ { @@ -107,12 +111,12 @@ int ipcrm_main(int argc, char **argv) what = SEM; if (remove_ids(what, argc-2, &argv[2])) - fflush_stdout_and_exit(1); + fflush_stdout_and_exit(EXIT_FAILURE); printf("resource(s) deleted\n"); return 0; } } -#endif /* #ifndef CONFIG_IPCRM_DROP_LEGACY */ +#endif /* IPCRM_LEGACY */ /* process new syntax to conform with SYSV ipcrm */ while ((c = getopt(argc, argv, "q:m:s:Q:M:S:h?")) != -1) { @@ -153,7 +157,6 @@ int ipcrm_main(int argc, char **argv) if (id < 0) { const char *errmsg; - const char *const what = "key"; error++; switch (errno) { @@ -170,7 +173,7 @@ int ipcrm_main(int argc, char **argv) errmsg = "unknown error in"; break; } - bb_error_msg("%s %s (%s)", errmsg, what, optarg); + bb_error_msg("%s %s (%s)", errmsg, "key", optarg); continue; } } else {