OSDN Git Service

* kill.cc (usage): Move to top of file.
authorcgf <cgf>
Mon, 11 Mar 2002 18:33:02 +0000 (18:33 +0000)
committercgf <cgf>
Mon, 11 Mar 2002 18:33:02 +0000 (18:33 +0000)
(getsig): Ditto.
(forcekill): Ditto.

winsup/utils/ChangeLog
winsup/utils/kill.cc

index 1a6bf8a..a02f2a4 100644 (file)
@@ -1,3 +1,9 @@
+2001-03-11 Joshua Daniel Franklin <joshuadfranklin@yahoo.com>
+
+       * kill.cc (usage): Move to top of file.
+       (getsig): Ditto.
+       (forcekill): Ditto.
+
 2002-03-06  Christopher Faylor  <cgf@redhat.com>
 
        * cygcheck.cc: Reformat.
index 626b071..2f538ea 100644 (file)
@@ -17,9 +17,42 @@ details. */
 #include <windows.h>
 #include <sys/cygwin.h>
 
-static void usage (void);
-static int __stdcall getsig (char *);
-static void __stdcall forcekill (int, int, int);
+static void
+usage (void)
+{
+  fprintf (stderr, "Usage: kill [-sigN] pid1 [pid2 ...]\n");
+  exit (1);
+}
+
+static int
+getsig (char *in_sig)
+{
+  char *sig;
+  char buf[80];
+
+  if (strncmp (in_sig, "SIG", 3) == 0)
+    sig = in_sig;
+  else
+    {
+      sprintf (buf, "SIG%s", in_sig);
+      sig = buf;
+    }
+  return (strtosigno (sig) ?: atoi (in_sig));
+}
+
+static void __stdcall
+forcekill (int pid, int sig, int wait)
+{
+  external_pinfo *p = (external_pinfo *) cygwin_internal (CW_GETPINFO_FULL, pid);
+  if (!p)
+    return;
+  HANDLE h = OpenProcess (PROCESS_TERMINATE, FALSE, (DWORD) p->dwProcessId);
+  if (!h)
+    return;
+  if (!wait || WaitForSingleObject (h, 200) != WAIT_OBJECT_0)
+    TerminateProcess (h, sig << 8);
+  CloseHandle (h);
+}
 
 int
 main (int argc, char **argv)
@@ -83,40 +116,3 @@ sig0:
     }
   return ret;
 }
-
-static void
-usage (void)
-{
-  fprintf (stderr, "Usage: kill [-sigN] pid1 [pid2 ...]\n");
-  exit (1);
-}
-
-static int
-getsig (char *in_sig)
-{
-  char *sig;
-  char buf[80];
-
-  if (strncmp (in_sig, "SIG", 3) == 0)
-    sig = in_sig;
-  else
-    {
-      sprintf (buf, "SIG%s", in_sig);
-      sig = buf;
-    }
-  return (strtosigno (sig) ?: atoi (in_sig));
-}
-
-static void __stdcall
-forcekill (int pid, int sig, int wait)
-{
-  external_pinfo *p = (external_pinfo *) cygwin_internal (CW_GETPINFO_FULL, pid);
-  if (!p)
-    return;
-  HANDLE h = OpenProcess (PROCESS_TERMINATE, FALSE, (DWORD) p->dwProcessId);
-  if (!h)
-    return;
-  if (!wait || WaitForSingleObject (h, 200) != WAIT_OBJECT_0)
-    TerminateProcess (h, sig << 8);
-  CloseHandle (h);
-}