This is the mail archive of the cygwin-patches@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

long-option patch for kill.cc


Um. And here's the patch.


__________________________________________________
Do You Yahoo!?
Try FREE Yahoo! Mail - the world's greatest free email!
http://mail.yahoo.com/
--- kill.cc-orig	Mon Mar 11 19:48:34 2002
+++ kill.cc	Mon Mar 11 19:55:19 2002
@@ -1,6 +1,6 @@
 /* kill.cc
 
-   Copyright 1996, 1997, 1998, 1999, 2000, 2001 Red Hat, Inc.
+   Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
 
 This file is part of Cygwin.
 
@@ -61,26 +61,50 @@ main (int argc, char **argv)
   int force = 0;
   int gotsig = 0;
   int ret = 0;
+  int opt = 0;
+  char *longopt;
 
   if (argc == 1)
     usage ();
 
   while (*++argv && **argv == '-')
-    if (strcmp (*argv + 1, "f") == 0)
-      force = 1;
-    else if (gotsig)
-      break;
-    else if (strcmp(*argv + 1, "0") != 0)
-      {
-	sig = getsig (*argv + 1);
-	gotsig = 1;
-      }
-    else
-      {
-	argv++;
-	sig = 0;
-	goto sig0;
-      }
+    {
+      opt = *(*argv + 1);
+      if (!gotsig)
+        switch (opt)
+          {
+          case 'f':
+            force = 1;
+            break;
+
+          case '0':
+            argv++;
+            sig = 0;
+            goto sig0;
+            return ret;
+
+          /* Handle long options */
+          case '-':
+            longopt = *argv + 2;
+            if (strcmp (longopt, "force") == 0)
+              force = 1;
+            else
+              {
+                fprintf (stderr, "kill: unknown long option: --%s\n\n",
+                         longopt);
+                usage ();
+              }
+            *argv += strlen (longopt);
+            break;
+          /* End of long options */
+
+          default:
+            sig = getsig (*argv + 1);
+            gotsig = 1;
+          }
+      else
+        break;
+    }
 
   if (sig <= 0 || sig > NSIG)
     {

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]