add --version and --help

This commit is contained in:
albert 2002-12-12 04:49:39 +00:00
parent dd5b24727f
commit 78d2adaa15
4 changed files with 21 additions and 9 deletions

View File

@ -18,9 +18,9 @@
VERSION := 3 VERSION := 3
SUBVERSION := 1 SUBVERSION := 1
MINORVERSION := 2 MINORVERSION := 3
TARVERSION := 3.1.2 TARVERSION := 3.1.3
LIBVERSION := 3.1.2 LIBVERSION := 3.1.3
############ vars ############ vars

View File

@ -1,15 +1,15 @@
Begin4 Begin4
Title: procps Title: procps
Version: 3.1.2 Version: 3.1.3
Entered-date: 2002-12-08 Entered-date: 2002-12-11
Description: Linux system utilities Description: Linux system utilities
Keywords: procps /proc libproc sysctl pmap Keywords: procps /proc libproc sysctl pmap
ps uptime tload free w top vmstat watch skill snice kill pgrep pkill ps uptime tload free w top vmstat watch skill snice kill pgrep pkill
Author: Albert Cahalan, Michael K. Johnson, Jim Warner, etc. Author: Albert Cahalan, Michael K. Johnson, Jim Warner, etc.
Maintained-by: various <procps-feedback@lists.sf.net> Maintained-by: various <procps-feedback@lists.sf.net>
Primary-site: http://procps.sf.net/ Primary-site: http://procps.sf.net/
236kB procps-3.1.2.tar.gz 236kB procps-3.1.3.tar.gz
Alternate-site: http://www.debian.org/Packages/unstable/base/procps.html Alternate-site: http://www.debian.org/Packages/unstable/base/procps.html
236kB procps-3.1.2.tar.gz 236kB procps-3.1.3.tar.gz
Copying-policy: mixed Copying-policy: mixed
End End

View File

@ -3,7 +3,7 @@ Summary: System and process monitoring utilities
Name: procps Name: procps
%define major_version 3 %define major_version 3
%define minor_version 1 %define minor_version 1
%define revision 2 %define revision 3
%define version %{major_version}.%{minor_version}.%{revision} %define version %{major_version}.%{minor_version}.%{revision}
Version: %{version} Version: %{version}
Release: 1 Release: 1

View File

@ -379,12 +379,24 @@ int main(int argc, char **argv) {
if (argc < 2) { if (argc < 2) {
return Usage(me); return Usage(me);
} /* endif */ }
argv++; argv++;
for (; argv && *argv && **argv; argv++) { for (; argv && *argv && **argv; argv++) {
if (SwitchesAllowed && **argv == '-') { /* we have a switch */ if (SwitchesAllowed && **argv == '-') { /* we have a switch */
if ((*argv)[1] && (*argv)[2]){ // don't yet handle "sysctl -ew"
if (!strcmp("--help",*argv)) {
Usage(me);
exit(0);
}
if (!strcmp("--version",*argv)) {
fprintf(stdout, "sysctl (%s)\n",procps_version);
exit(0);
}
fprintf(stderr, ERR_UNKNOWN_PARAMETER, *argv);
return Usage(me);
}
switch((*argv)[1]) { switch((*argv)[1]) {
case 'b': case 'b':
/* This is "binary" format, which means more for BSD. */ /* This is "binary" format, which means more for BSD. */