*: use "can't" instead of "cannot"
[oweals/busybox.git] / util-linux / ipcrm.c
index d13fb83b1f461982dceae2e390a513130691934e..8b0b226d3046ae5dcf577612e79bbd75684798dc 100644 (file)
@@ -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 <sys/{types,ipc,sem}.h> for semctl() */
 /* X/OPEN tells us to use <sys/{types,ipc,msg}.h> for msgctl() */
 #include <sys/msg.h>
 #include <sys/sem.h>
 
-#if defined (__GNU_LIBRARY__) && !defined(_SEM_SEMUN_UNDEFINED)
+#if defined(__GNU_LIBRARY__) && !defined(_SEM_SEMUN_UNDEFINED)
 /* union semun is defined by including <sys/sem.h> */
 #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,
@@ -60,7 +63,7 @@ static int remove_ids(type_id type, int argc, char **argv)
                                ret = shmctl(id, IPC_RMID, NULL);
 
                        if (ret) {
-                               bb_perror_msg("cannot remove id %s", argv[0]);
+                               bb_perror_msg("can't remove id %s", argv[0]);
                                nb_errors++;
                        }
                }
@@ -70,10 +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);
+int ipcrm_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
 int ipcrm_main(int argc, char **argv)
 {
        int c;
@@ -82,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. */
        {
@@ -108,18 +111,18 @@ 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) {
                int result;
                int id = 0;
-               int iskey = (isupper)(c);
+               int iskey = isupper(c);
 
                /* needed to delete semaphores */
                union semun arg;