speechd-discuss
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 1/1] add --log-dir option (-L) to the speech-dispatcher


From: Steve Holmes
Subject: [PATCH 1/1] add --log-dir option (-L) to the speech-dispatcher
Date: Mon, 18 Oct 2010 14:36:34 -0700

I just tested the patch on my Arch Linux system it it works fine.  As
son as this gets committed to master, I can upload a new PKGBUILD
package to the Arch User Repository, taking advantage of the new
parameter.  Thanks a bunch; this eliminates another change I was
making to the speechd.conf file.

Thanks for the patch.

On Mon, Oct 18, 2010 at 08:17:30PM +0200, Andrei Kholodnyi wrote:
> speech-dispatcher can now set log dir from the command line
> this option will override the same param from conf file
> ---
>  src/server/configuration.c |    3 ++-
>  src/server/options.c       |    9 ++++++++-
>  src/server/speechd.c       |    1 +
>  src/server/speechd.h       |    1 +
>  4 files changed, 12 insertions(+), 2 deletions(-)
> 
> diff --git a/src/server/configuration.c b/src/server/configuration.c
> index 952bf69..4be17e1 100644
> --- a/src/server/configuration.c
> +++ b/src/server/configuration.c
> @@ -232,7 +232,8 @@ DOTCONF_CB(cb_LogDir)
>  {
>    assert(cmd->data.str != NULL);
>  
> -  if (strcmp(cmd->data.str, "default")){
> +  if (strcmp(cmd->data.str, "default")
> +      && !SpeechdOptions.log_dir_set){
>      // cmd->data.str different from "default"
>      SpeechdOptions.log_dir = g_strdup(cmd->data.str);
>    }
> diff --git a/src/server/options.c b/src/server/options.c
> index 076c957..57a8a0f 100644
> --- a/src/server/options.c
> +++ b/src/server/options.c
> @@ -41,6 +41,7 @@ static const struct option spd_long_options[] = {
>      {"run-single", 0, 0, 's'},
>      {"spawn", 0, 0, 'a'},
>      {"log-level", 1, 0, 'l'},
> +    {"log-dir", required_argument, 0, 'L'},
>      {"communication-method", 1, 0, 'c'},
>      {"socket-path", 1, 0, 'S'},
>      {"port", 1, 0, 'p'},
> @@ -52,7 +53,7 @@ static const struct option spd_long_options[] = {
>      {0, 0, 0, 0}
>  };
>  
> -static const char *const spd_short_options = "dsal:c:S:p:P:C:vDh";
> +static const char *const spd_short_options = "dsal:L:c:S:p:P:C:vDh";
>  
>  void
>  options_print_help(char *argv[])
> @@ -70,6 +71,8 @@ options_print_help(char *argv[])
>      printf(_("Start only if autospawn is not disabled\n"));
>      printf("-l, --log-level\t");
>      printf(_("Set log level (1..5)\n"));
> +    printf("-L, --log-dir\t");
> +    printf(_("Set path to logging\n"));
>      printf("-c, --communication-method\t");
>      printf(_("Communication method to use (unix_socket or inet_socket)\n"));
>      printf("-S, --socket-path\t");
> @@ -150,6 +153,10 @@ options_parse(int argc, char *argv[])
>          case 'l':
>              SPD_OPTION_SET_INT(log_level);      
>              break;
> +        case 'L':
> +            SPD_OPTION_SET_STR(log_dir);
> +            SpeechdOptions.log_dir_set = 1;
> +            break;
>          case 'c':
>              SPD_OPTION_SET_STR(communication_method);
>              SpeechdOptions.communication_method_set = 1;
> diff --git a/src/server/speechd.c b/src/server/speechd.c
> index fcbd45c..0d379dc 100644
> --- a/src/server/speechd.c
> +++ b/src/server/speechd.c
> @@ -548,6 +548,7 @@ speechd_options_init(void)
>      SpeechdOptions.conf_file = NULL;
>      SpeechdOptions.home_speechd_dir = NULL;
>      SpeechdOptions.log_dir = NULL;
> +    SpeechdOptions.log_dir_set = 0;
>      SpeechdOptions.debug = 0;
>      SpeechdOptions.debug_destination = NULL;
>      debug_logfile = NULL;
> diff --git a/src/server/speechd.h b/src/server/speechd.h
> index f5424f9..750054c 100644
> --- a/src/server/speechd.h
> +++ b/src/server/speechd.h
> @@ -171,6 +171,7 @@ struct{
>      char *conf_dir;
>      char *home_speechd_dir;
>      char *log_dir;
> +    int log_dir_set;
>      int spawn;
>      int debug;
>      char *debug_destination;
> -- 
> 1.6.0.4
> 
> 
> _______________________________________________
> Speechd mailing list
> Speechd at lists.freebsoft.org
> http://lists.freebsoft.org/mailman/listinfo/speechd



reply via email to

[Prev in Thread] Current Thread [Next in Thread]