diff options
author | Bill Nottingham <notting@redhat.com> | 1999-03-18 01:01:45 +0000 |
---|---|---|
committer | Bill Nottingham <notting@redhat.com> | 1999-03-18 01:01:45 +0000 |
commit | 54d96728833eabc23f4203ee7d2c834621f6b873 (patch) | |
tree | ea968aec4460ebbc381b3ae0f58c931ef514a611 | |
parent | 6aac6bb6c8ceea467a12dc5a6810d73cf516a445 (diff) | |
download | initscripts-54d96728833eabc23f4203ee7d2c834621f6b873.tar initscripts-54d96728833eabc23f4203ee7d2c834621f6b873.tar.gz initscripts-54d96728833eabc23f4203ee7d2c834621f6b873.tar.bz2 initscripts-54d96728833eabc23f4203ee7d2c834621f6b873.tar.xz initscripts-54d96728833eabc23f4203ee7d2c834621f6b873.zip |
don't output error messages if reading commands
-rw-r--r-- | src/initlog.c | 16 | ||||
-rw-r--r-- | src/initlog.h | 2 | ||||
-rw-r--r-- | src/process.c | 2 |
3 files changed, 12 insertions, 8 deletions
diff --git a/src/initlog.c b/src/initlog.c index 4788c8fa..6e6e4385 100644 --- a/src/initlog.c +++ b/src/initlog.c @@ -189,7 +189,7 @@ int logString(char *cmd, char *string) { return logLine(&logentry); } -int processArgs(int argc, char **argv) { +int processArgs(int argc, char **argv, int silent) { char *cmdname=NULL; int cmdevent=0; char *cmd=NULL; @@ -267,18 +267,21 @@ int processArgs(int argc, char **argv) { } if ((rc < -1)) { - fprintf(stderr, "%s: %s\n", + if (!silent) + fprintf(stderr, "%s: %s\n", poptBadOption(context, POPT_BADOPTION_NOALIAS), poptStrerror(rc)); return -1; } if ( (cmd && logstring) || (cmd && cmdname) ) { - fprintf(stderr, _("--cmd and --run are incompatible with --string or --name\n")); + if (!silent) + fprintf(stderr, _("--cmd and --run are incompatible with --string or --name\n")); return -1; } if ( cmdname && (!logstring && !cmdevent)) { - fprintf(stderr, _("--name requires one of --event or --string\n")); + if (!silent) + fprintf(stderr, _("--name requires one of --event or --string\n")); return -1; } if (cmdevent) { @@ -288,7 +291,8 @@ int processArgs(int argc, char **argv) { } else if ( cmd ) { return(runCommand(cmd,reexec,quiet)); } else { - fprintf(stderr,"nothing to do!\n"); + if (!silent) + fprintf(stderr,"nothing to do!\n"); return -1; } return 0; @@ -299,5 +303,5 @@ int main(int argc, char **argv) { setlocale(LC_ALL,""); bindtextdomain("initlog","/etc/locale"); textdomain("initlog"); - exit(processArgs(argc,argv)); + exit(processArgs(argc,argv,0)); } diff --git a/src/initlog.h b/src/initlog.h index 184c916c..20f64d1d 100644 --- a/src/initlog.h +++ b/src/initlog.h @@ -13,6 +13,6 @@ struct logInfo { char *getLine(char **data); int logString(char *cmd, char *string); -int processArgs(int argc, char **argv); +int processArgs(int argc, char **argv, int silent); #endif diff --git a/src/process.c b/src/process.c index 548c1b67..f462a1de 100644 --- a/src/process.c +++ b/src/process.c @@ -163,7 +163,7 @@ int monitor(char *cmdname, int pid, int numfds, int *fds, int reexec, int quiet) for (x=0;x<(cmdargc-1);x++) { cmdargs[x+1]=tmpargs[x]; } - processArgs(cmdargc,cmdargs); + processArgs(cmdargc,cmdargs,1); } } } |