4
0
mirror of git://sourceware.org/git/newlib-cygwin.git synced 2025-01-18 12:29:32 +08:00

* ps.cc (main): Return 0 if pid found.

This commit is contained in:
Christopher Faylor 2009-12-18 03:34:59 +00:00
parent b292054cac
commit d0e99ecc19
2 changed files with 9 additions and 2 deletions

View File

@ -1,3 +1,7 @@
2009-12-17 Christopher Faylor <me+cygwin@cgf.cx>
* ps.cc (main): Return 0 if pid found.
2009-12-16 Corinna Vinschen <corinna@vinschen.de> 2009-12-16 Corinna Vinschen <corinna@vinschen.de>
* regtool.cc: Throughout, convert all registry calls to wide char * regtool.cc: Throughout, convert all registry calls to wide char

View File

@ -258,6 +258,7 @@ main (int argc, char *argv[])
{ {
external_pinfo *p; external_pinfo *p;
int aflag, lflag, fflag, sflag, uid, proc_id; int aflag, lflag, fflag, sflag, uid, proc_id;
bool found_proc_id = true;
cygwin_getinfo_types query = CW_GETPINFO; cygwin_getinfo_types query = CW_GETPINFO;
const char *dtitle = " PID TTY STIME COMMAND\n"; const char *dtitle = " PID TTY STIME COMMAND\n";
const char *dfmt = "%7d%4s%10s %s\n"; const char *dfmt = "%7d%4s%10s %s\n";
@ -299,6 +300,7 @@ main (int argc, char *argv[])
case 'p': case 'p':
proc_id = atoi (optarg); proc_id = atoi (optarg);
aflag = 1; aflag = 1;
found_proc_id = false;
break; break;
case 's': case 's':
sflag = 1; sflag = 1;
@ -369,6 +371,8 @@ main (int argc, char *argv[])
{ {
if ((proc_id > 0) && (p->pid != proc_id)) if ((proc_id > 0) && (p->pid != proc_id))
continue; continue;
else
found_proc_id = true;
if (aflag) if (aflag)
/* nothing to do */; /* nothing to do */;
@ -499,6 +503,5 @@ main (int argc, char *argv[])
} }
(void) cygwin_internal (CW_UNLOCK_PINFO); (void) cygwin_internal (CW_UNLOCK_PINFO);
return 0; return found_proc_id ? 0 : 1;
} }