gnokii-users
[Top][All Lists]
Advanced

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

Re: support for --config in smsd


From: Jan Derfinak
Subject: Re: support for --config in smsd
Date: Fri, 1 Jun 2012 00:49:31 +0200 (CEST)
User-agent: Alpine 2.00 (LNX 1167 2008-08-23)

On Thu, 31 May 2012, alonso acuña wrote:

Hello.

> Hello these are some changes that I made in order to be able to pass a
> --config argument to smsd which apparently was missing.
> 
> smsd.c line 164:
>              "            -v, --version\n"
> +             "            -w, --config config file\n"
>              "            -h, --help\n"), p);
> 
> line 236
>       {"phone", 1, 0, 't'},
> +      {"config", 1, 0, 'w'},
>       {"version", 0, 0, 'v'},

I prefer to use '-C' as short option instead of '-w'.

> 
> line 247 change to
>   c = getopt_long (argc, argv, "u:p:d:c:s:e:m:l:f:t:w:vi:S:b:0h",
> longOptions, &optionIndex);
> 
> near line 300 add:
>      case 'w':
>         if (smsdConfig.configFile)
>           g_free (smsdConfig.configFile);
>         smsdConfig.configFile = g_strdup (optarg);
>         break;

You should initialize smsdConfig.configFile before use. It works for you 
because smsdConfig is static variable and smsdConfig.configFile is
automaticaly initialized to NULL but I think it is not safe practice.

> 
> smsd.h line 60 add:
>   gchar *configFile;
> 
> lowlevel.c line 108 change to
>  error = gn_lib_phoneprofile_load_from_file(smsdConfig.configFile, iname, 
> &sm);
> 
> 
> Do you think this can be added to your next release?

The patch looks reasonable.  I will add it to smsd.
Thanks.

Jan


-- 

reply via email to

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