runit

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

commit f30af4150b9f9f991a1672b63ad9dd6cc7712b4c
parent 4cae8afab2166d1bf83078fad303138e1b570708
Author: Gerrit Pape <pape@smarden.org>
Date:   Sat, 23 Jul 2005 12:49:47 +0000

  * chpst.c: fix pointer types.

Diffstat:
Mpackage/CHANGES | 1+
Msrc/chpst.c | 28++++++++++++++++------------
2 files changed, 17 insertions(+), 12 deletions(-)

diff --git a/package/CHANGES b/package/CHANGES @@ -16,6 +16,7 @@ runit 1.2.6 * sv.c: new sv program to control services, optionally can be linked to /etc/init.d/ as lsb "init script" command line interface. * Makefile, TARGETS: adapt. + * chpst.c: fix pointer types. runit 1.2.3 Mon, 18 Apr 2005 17:08:35 +0000 diff --git a/src/chpst.c b/src/chpst.c @@ -255,6 +255,7 @@ void softlimit(int, const char *const *); int main(int argc, const char *const *argv) { int opt; int i; + unsigned long ul; progname =argv[0]; for (i =str_len(progname); i; --i) @@ -279,25 +280,25 @@ int main(int argc, const char *const *argv) { case 'U': env_user =(char*)optarg; break; case 'e': env_dir =optarg; break; case 'm': - if (optarg[scan_ulong(optarg, &limitd)]) usage(); - limits =limitl =limita =limitd; + if (optarg[scan_ulong(optarg, &ul)]) usage(); + limits =limitl =limita =limitd =ul; break; - case 'o': if (optarg[scan_ulong(optarg, &limito)]) usage(); break; - case 'p': if (optarg[scan_ulong(optarg, &limitp)]) usage(); break; - case 'f': if (optarg[scan_ulong(optarg, &limitf)]) usage(); break; - case 'c': if (optarg[scan_ulong(optarg, &limitc)]) usage(); break; - case 'r': if (optarg[scan_ulong(optarg, &limitr)]) usage(); break; - case 't': if (optarg[scan_ulong(optarg, &limitt)]) usage(); break; + case 'o': if (optarg[scan_ulong(optarg, &ul)]) usage(); limito =ul; break; + case 'p': if (optarg[scan_ulong(optarg, &ul)]) usage(); limitp =ul; break; + case 'f': if (optarg[scan_ulong(optarg, &ul)]) usage(); limitf =ul; break; + case 'c': if (optarg[scan_ulong(optarg, &ul)]) usage(); limitc =ul; break; + case 'r': if (optarg[scan_ulong(optarg, &ul)]) usage(); limitr =ul; break; + case 't': if (optarg[scan_ulong(optarg, &ul)]) usage(); limitt =ul; break; case '/': root =optarg; break; case 'n': switch (*optarg) { case '-': - if (optarg[scan_ulong(++optarg, &nicelvl)]) usage(); + if (optarg[scan_ulong(++optarg, &ul)]) usage(); nicelvl =ul; nicelvl *=-1; break; case '+': ++optarg; default: - if (optarg[scan_ulong(optarg, &nicelvl)]) usage(); + if (optarg[scan_ulong(optarg, &ul)]) usage(); nicelvl =ul; break; } break; @@ -419,12 +420,15 @@ void setlock(int argc, const char *const *argv) { } void softlimit(int argc, const char *const *argv) { int opt; + unsigned long ul; + void usage() { strerr_die4x(100, "usage: ", progname, USAGE_SOFTLIMIT, "\n"); } void getlarg(long *l) { - if (str_equal(optarg, "=")) *l =-1; - else if (optarg[scan_ulong(optarg, l)]) usage(); + if (str_equal(optarg, "=")) { *l =-1; return; } + if (optarg[scan_ulong(optarg, &ul)]) usage(); + *l =ul; } while ((opt =getopt(argc,argv,"a:c:d:f:l:m:o:p:r:s:t:")) != opteof)