On 12.06.2013 14:27, kardan wrote:
> From 386ad6bfd134833a19e40c1920975e100f207a51 Mon Sep 17 00:00:00 2001
> From: kardan <[email protected]>
> Date: Wed, 12 Jun 2013 14:15:54 +0200
> Subject: [PATCH] honor appended -c option for --check
> 
> ---
>  awesome.c |   31 ++++++++++++++++++++-----------
>  1 file changed, 20 insertions(+), 11 deletions(-)
> 
> diff --git a/awesome.c b/awesome.c
> index 4755d1c..776417e 100644
> --- a/awesome.c
> +++ b/awesome.c
> @@ -288,6 +288,7 @@ main(int argc, char **argv)
>      ssize_t cmdlen = 1;
>      xdgHandle xdg;
>      bool no_argb = false;
> +    bool run_test = false;
>      xcb_generic_event_t *event;
>      xcb_query_tree_cookie_t tree_c;
>      static struct option long_options[] =
> @@ -331,6 +332,7 @@ main(int argc, char **argv)
>      /* check args */
>      while((opt = getopt_long(argc, argv, "vhkc:a",
>                               long_options, NULL)) != -1)
> +      {

Uhm, what? This seems odd and doesn't match any of the indentation of the rest
of the file.

>          switch(opt)
>          {
>            case 'v':
> @@ -340,16 +342,8 @@ main(int argc, char **argv)
>              exit_help(EXIT_SUCCESS);
>              break;
>            case 'k':
> -            if(!luaA_parserc(&xdg, confpath, false))
> -            {
> -                fprintf(stderr, "✘ Configuration file syntax error.\n");
> -                return EXIT_FAILURE;
> -            }
> -            else
> -            {
> -                fprintf(stderr, "✔ Configuration file syntax OK.\n");
> -                return EXIT_SUCCESS;
> -            }
> +         run_test = true;
> +         break;
>            case 'c':

This uses tabs instead of spaces (which is why it looks like the indentation is
too short).

>              if(a_strlen(optarg))
>                  confpath = a_strdup(optarg);
> @@ -360,7 +354,22 @@ main(int argc, char **argv)
>              no_argb = true;
>              break;
>          }
> -
> +      }
> +
> +    if (run_test)
> +      {
> +     if(!luaA_parserc(&xdg, confpath, false))
> +       {
> +         fprintf(stderr, "✘ Configuration file syntax error.\n");
> +         return EXIT_FAILURE;
> +       }
> +     else
> +       {
> +         fprintf(stderr, "✔ Configuration file syntax OK.\n");
> +         return EXIT_SUCCESS;
> +       }
> +      }

Hm, I consider the placement of the curly braces here to be creative. Have you
read the linux kernel's coding style document? It suggests to print out the GNU
coding style and burn it as a symbolic gesture...

> +    

Trailing spaces!

>      /* register function for signals */
>      g_unix_signal_add(SIGINT, exit_on_signal, NULL);
>      g_unix_signal_add(SIGTERM, exit_on_signal, NULL);

I cleaned up the above stylistic nitpicks and pushed the resulting patch. 
Thanks!

Uli
-- 
- He made himself, me nothing, you nothing out of the dust
- Er machte sich mir nichts, dir nichts aus dem Staub

-- 
To unsubscribe, send mail to [email protected].

Reply via email to