Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/ipcrm formatting nits; nothing a quick pass through ...



details:   https://anonhg.NetBSD.org/src/rev/f08eb7a507cf
branches:  trunk
changeset: 475774:f08eb7a507cf
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Wed Aug 25 05:15:39 1999 +0000

description:
formatting nits; nothing a quick pass through indent(1) can't fix.

diffstat:

 usr.bin/ipcrm/ipcrm.c |  223 ++++++++++++++++++++++++++-----------------------
 1 files changed, 118 insertions(+), 105 deletions(-)

diffs (260 lines):

diff -r 2e99cf426e35 -r f08eb7a507cf usr.bin/ipcrm/ipcrm.c
--- a/usr.bin/ipcrm/ipcrm.c     Wed Aug 25 05:13:06 1999 +0000
+++ b/usr.bin/ipcrm/ipcrm.c     Wed Aug 25 05:15:39 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ipcrm.c,v 1.9 1999/08/25 05:13:06 thorpej Exp $        */
+/*     $NetBSD: ipcrm.c,v 1.10 1999/08/25 05:15:39 thorpej Exp $       */
 
 /*
  * Copyright (c) 1994 Adam Glass
@@ -48,133 +48,146 @@
 #define IPC_TO_STRING(x) (x == 'Q' ? "message queue" : \
        (x == 'M' ? "shared memory segment" : "semaphore"))
 
-int signaled;
+int     signaled;
 
-void usage __P((void));
-int msgrm __P((key_t, int));
-int shmrm __P((key_t, int));
-int semrm __P((key_t, int));
-void not_configured __P((void));
-int main __P((int, char *[]));
+void   usage __P((void));
+int    msgrm __P((key_t, int));
+int    shmrm __P((key_t, int));
+int    semrm __P((key_t, int));
+void   not_configured __P((void));
+int    main __P((int, char *[]));
 
-void usage()
+void 
+usage()
 {
-        fprintf(stderr, "usage: ipcrm [ [-q msqid] [-m shmid] [-s semid]\n");
+       fprintf(stderr, "usage: ipcrm [ [-q msqid] [-m shmid] [-s semid]\n");
        fprintf(stderr, "        [-Q msgkey] [-M shmkey] [-S semkey] ...]\n");
        exit(1);
 }
 
-int msgrm(key, id)
-    key_t key;
-    int id;
+int 
+msgrm(key, id)
+       key_t   key;
+       int     id;
 {
-    if (key) {
-       id = msgget(key, 0);
-       if (id == -1)
-           return -1;
-    }
-    return msgctl(id, IPC_RMID, NULL);    
+       if (key) {
+               id = msgget(key, 0);
+               if (id == -1)
+                       return -1;
+       }
+       return msgctl(id, IPC_RMID, NULL);
 }
 
-int shmrm(key, id)
-    key_t key;
-    int id;
+int 
+shmrm(key, id)
+       key_t   key;
+       int     id;
 {
-    if (key) {
-       id = shmget(key, 0, 0);
-       if (id == -1)
-           return -1;
-    }
-    return shmctl(id, IPC_RMID, NULL);
+       if (key) {
+               id = shmget(key, 0, 0);
+               if (id == -1)
+                       return -1;
+       }
+       return shmctl(id, IPC_RMID, NULL);
 }
 
-int semrm(key, id)
-    key_t key;
-    int id;
+int 
+semrm(key, id)
+       key_t   key;
+       int     id;
 {
 
-    if (key) {
-       id = semget(key, 0, 0);
-       if (id == -1)
-           return -1;
-    }
-    return semctl(id, 0, IPC_RMID, NULL);
+       if (key) {
+               id = semget(key, 0, 0);
+               if (id == -1)
+                       return -1;
+       }
+       return semctl(id, 0, IPC_RMID, NULL);
 }
 
-void not_configured()
+void 
+not_configured()
 {
-    signaled++;
+       signaled++;
 }
-    
-int main(argc, argv)
-    int argc;
-    char *argv[];
+
+int 
+main(argc, argv)
+       int     argc;
+       char   *argv[];
 
 {
-    int c, result, errflg, target_id;
-    key_t target_key;
+       int     c, result, errflg, target_id;
+       key_t   target_key;
 
-    errflg = 0;
-    signal(SIGSYS, (void (*) __P((int)))not_configured);
-    while ((c = getopt(argc, argv, ":q:m:s:Q:M:S:")) != -1) {
+       errflg = 0;
+       signal(SIGSYS, (void (*) __P((int))) not_configured);
+       while ((c = getopt(argc, argv, ":q:m:s:Q:M:S:")) != -1) {
 
-       signaled = 0;
-       switch (c) {
-       case 'q':
-       case 'm':
-       case 's':
-           target_id = atoi(optarg);
-           if (c == 'q')
-               result = msgrm(0, target_id);
-           else if (c == 'm')
-               result = shmrm(0, target_id);
-           else
-               result = semrm(0, target_id);
-           if (result < 0) {
-               errflg++;
-               if (!signaled)
-                   warn("%sid(%d): ", IPC_TO_STR(toupper(c)), target_id);
-               else
-                   warnx("%ss are not configured in the running kernel",
-                         IPC_TO_STRING(toupper(c)));
-           }
-           break;
-       case 'Q':
-       case 'M':
-       case 'S':
-           target_key = atol(optarg);
-           if (target_key == IPC_PRIVATE) {
-               warnx("can't remove private %ss", IPC_TO_STRING(c));
-               continue;
-           }
-           if (c == 'Q')
-               result = msgrm(target_key, 0);
-           else if (c == 'M')
-               result = shmrm(target_key, 0);
-           else
-               result = semrm(target_key, 0);
-           if (result < 0) {
-               errflg++;
-               if (!signaled)
-                   warn("%skey(%ld): ", IPC_TO_STR(c), (long) target_key);
-               else
-                   warnx("%ss are not configured in the running kernel",
-                         IPC_TO_STRING(c));
-           }
-           break;
-       case ':':
-           fprintf(stderr, "option -%c requires an argument\n", optopt);
-           usage();
-       case '?':
-           fprintf(stderr, "unrecognized option: -%c\n", optopt);
-           usage();
+               signaled = 0;
+               switch (c) {
+               case 'q':
+               case 'm':
+               case 's':
+                       target_id = atoi(optarg);
+                       if (c == 'q')
+                               result = msgrm(0, target_id);
+                       else
+                               if (c == 'm')
+                                       result = shmrm(0, target_id);
+                               else
+                                       result = semrm(0, target_id);
+                       if (result < 0) {
+                               errflg++;
+                               if (!signaled)
+                                       warn("%sid(%d): ",
+                                           IPC_TO_STR(toupper(c)), target_id);
+                               else
+                                       warnx("%ss are not configured in "
+                                           "the running kernel",
+                                           IPC_TO_STRING(toupper(c)));
+                       }
+                       break;
+               case 'Q':
+               case 'M':
+               case 'S':
+                       target_key = atol(optarg);
+                       if (target_key == IPC_PRIVATE) {
+                               warnx("can't remove private %ss",
+                                   IPC_TO_STRING(c));
+                               continue;
+                       }
+                       if (c == 'Q')
+                               result = msgrm(target_key, 0);
+                       else
+                               if (c == 'M')
+                                       result = shmrm(target_key, 0);
+                               else
+                                       result = semrm(target_key, 0);
+                       if (result < 0) {
+                               errflg++;
+                               if (!signaled)
+                                       warn("%skey(%ld): ",
+                                           IPC_TO_STR(c), (long) target_key);
+                               else
+                                       warnx("%ss are not configured "
+                                           in the running kernel",
+                                           IPC_TO_STRING(c));
+                       }
+                       break;
+               case ':':
+                       fprintf(stderr, "option -%c requires an argument\n",
+                           optopt);
+                       usage();
+               case '?':
+                       fprintf(stderr, "unrecognized option: -%c\n", optopt);
+                       usage();
+               }
        }
-    }
 
-    if (optind != argc) {
-           fprintf(stderr, "unknown argument: %s\n", argv[optind]);
-           usage();
-    }
-    exit(errflg);
+       if (optind != argc) {
+               fprintf(stderr, "unknown argument: %s\n", argv[optind]);
+               usage();
+       }
+       exit(errflg);
 }
-    



Home | Main Index | Thread Index | Old Index