[Initng-svn] r3636 - initng/trunk/plugins/ngc4
svn at initng.thinktux.net
svn at initng.thinktux.net
Mon Apr 3 00:05:06 CEST 2006
Author: jimmy
Date: Mon Apr 3 00:05:05 2006
New Revision: 3636
Modified:
initng/trunk/plugins/ngc4/ngc4.c
Log:
Make ngc --quiet work again.
Modified: initng/trunk/plugins/ngc4/ngc4.c
==============================================================================
--- initng/trunk/plugins/ngc4/ngc4.c (original)
+++ initng/trunk/plugins/ngc4/ngc4.c Mon Apr 3 00:05:05 2006
@@ -189,6 +189,9 @@
char *string = NULL;
reply *rep = NULL;
+
+
+
/*printf("send_and_handle(%c, %s, %s);\n", c, l, opt); */
@@ -203,19 +206,33 @@
if (ngcclient_error)
{
- printf("%s\n", ngcclient_error);
+ print_out("%s\n", ngcclient_error);
return (FALSE);
}
if (!rep)
{
- printf("Command failed.\n");
+ print_out("Command failed.\n");
return (FALSE);
}
+ /* print header if not printed before. */
+ /* TODO, put initng version from rep here */
+ if(header_printed==FALSE && quiet==FALSE)
+ {
+ /* print banner */
+ print_out(C_FG_LIGHT_BLUE
+ "\n Next Generation init Control. version ( %s )" C_OFF "\n",
+ VERSION);
+ print_out(C_FG_NEON_GREEN " http://initng.thinktux.net" C_OFF "\n");
+ print_out(" Author: Jimmy Wennlund <jimmy.wennlund at gmail.com>\n\n");
+ header_printed=TRUE;
+ }
+
+
#ifdef HAVE_NGE
- if(instant==FALSE)
+ if(instant==FALSE && quiet==FALSE)
{
/*
* there are special commands, where we wanna
@@ -228,9 +245,14 @@
}
#endif
- string = ngcclient_reply_to_string(rep, TRUE);
- printf("\n\n%s\n", string);
- free(string);
+ /* only print when not quiet */
+ if(quiet == FALSE)
+ {
+ string = ngcclient_reply_to_string(rep, TRUE);
+ print_out("\n\n%s\n", string);
+ if(string) free(string);
+ }
+
free(rep);
return (TRUE);
}
@@ -252,19 +274,7 @@
*/
header_printed = FALSE;
- /* Look if --quite is along options */
- for (i = 0; i < argc; i++)
- {
- if (argv[i] && strcmp(argv[i], "--quiet") == 0)
- quiet = TRUE;
- }
- /* print banner */
- print_out(C_FG_LIGHT_BLUE
- "\n Next Generation init Control. version ( %s )" C_OFF "\n",
- VERSION);
- print_out(C_FG_NEON_GREEN " http://initng.thinktux.net" C_OFF "\n");
- print_out(" Author: Jimmy Wennlund <jimmy.wennlund at gmail.com>\n\n");
/*
@@ -315,7 +325,7 @@
if (debug == FALSE && getuid() != 0)
{
- printf(C_ERROR "You need root access to communicate with initng."
+ print_out(C_ERROR "You need root access to communicate with initng."
C_OFF "\n");
exit(2);
}
@@ -385,6 +395,8 @@
/* if it is an --option */
if (argv[cc][1] == '-')
{
+
+ /* handle local --instant */
if(strcmp(&argv[cc][2], "instant")==0)
{
instant=TRUE;
@@ -392,6 +404,14 @@
continue;
}
+ /* handle local --quiet */
+ if(strcmp(&argv[cc][2], "quiet") == 0)
+ {
+ quiet = TRUE;
+ cc++;
+ continue;
+ }
+
if (!send_and_handle('\0', &argv[cc][2], opt, instant))
exit(1);
}
More information about the Initng-svn
mailing list