On Wed, Sep 4, 2013 at 4:01 PM, Ivana Varekova <varek...@redhat.com> wrote:
>
>
> ----- Original Message -----
>> From: "Libo Chen" <libo.c...@huawei.com>
>> To: varek...@redhat.com
>> Cc: "dhaval giani" <dhaval.gi...@gmail.com>, jsafr...@redhat.com, 
>> libcg-devel@lists.sourceforge.net,
>> lize...@huawei.com, "h huangqiang" <h.huangqi...@huawei.com>, "wengmeiling 
>> weng" <wengmeiling.w...@huawei.com>,
>> "libo chen" <libo.c...@huawei.com>
>> Sent: Tuesday, September 3, 2013 10:49:18 AM
>> Subject: [PATCH v3 5/8] cgconfig: change function usage behavior
>>
>> From: Libo Chen <clbchenlibo.c...@huawei.com>
>>
>> remove exit from function usage and add a structure like usage function
>> in the other tools.
>> This is suggested by Ivana Hutarova Varekova <varek...@redhat.com>
>>
>> now usage willn't exit, so we should help it in err case.
>>
>> Signed-off-by: Libo Chen <clbchenlibo.c...@huawei.com>
>> ---
>>  src/tools/cgconfig.c |   46 +++++++++++++++++++++++++++-------------------
>>  1 files changed, 27 insertions(+), 19 deletions(-)
>>
>> diff --git a/src/tools/cgconfig.c b/src/tools/cgconfig.c
>> index 095fe27..c856a91 100644
>> --- a/src/tools/cgconfig.c
>> +++ b/src/tools/cgconfig.c
>> @@ -35,29 +35,33 @@
>>
>>  static struct cgroup_string_list cfg_files;
>>
>> -static void usage(char *progname)
>> +static void usage(int status, char *progname)
>>  {
>> -     printf("Usage: %s [-h] [-f mode] [-d mode] [-s mode] "\
>> +     if (status != 0) {
>> +             fprintf(stderr, "Wrong input parameters,"
>> +                     " try %s -h' for more information.\n", progname);
>> +     } else {
>> +             printf("Usage: %s [-h] [-f mode] [-d mode] [-s mode] "\
>>                       "[-t <tuid>:<tgid>] [-a <agid>:<auid>] "\
>>                       "[-l FILE] [-L DIR] ...\n", basename(progname));
>> -     printf("Parse and load the specified cgroups configuration file\n");
>> -     printf("\n");
>> -     printf("  -h, --help                    Display this help\n");
>> -     printf("  -l, --load=FILE               Parse and load the cgroups"\
>> +             printf("Parse and load the specified cgroups configuration 
>> file\n");
>> +             printf("\n");
>> +             printf("  -h, --help                    Display this help\n");
>> +             printf("  -l, --load=FILE               Parse and load the 
>> cgroups"\
>>                       " configuration file\n");
>> -     printf("  -L, --load-directory=DIR      Parse and load the cgroups"\
>> +             printf("  -L, --load-directory=DIR      Parse and load the 
>> cgroups"\
>>                       " configuration files from a directory\n");
>> -     printf("  -a <tuid>:<tgid>              Default owner of groups files"\
>> +             printf("  -a <tuid>:<tgid>              Default owner of 
>> groups files"\
>>                       " and directories\n");
>> -     printf("  -d, --dperm=mode              Default group directory"\
>> +             printf("  -d, --dperm=mode              Default group 
>> directory"\
>>                       " permissions\n");
>> -     printf("  -f, --fperm=mode              Default group file"\
>> +             printf("  -f, --fperm=mode              Default group file"\
>>                       " permissions\n");
>> -     printf("  -s, --tperm=mode              Default tasks file"
>> +             printf("  -s, --tperm=mode              Default tasks file"\
>>                       " permissions\n");
>> -     printf("  -t <tuid>:<tgid>              Default owner of the tasks "
>> +             printf("  -t <tuid>:<tgid>              Default owner of the 
>> tasks "\
>>                       "file\n");
>> -     exit(2);
>> +     }
>
>
> only small change - the rows should have less or equal to  80 characters (see 
> checkpatch.pl)

Or, return inside the if, so that you don't change the indentation.

Dhaval

------------------------------------------------------------------------------
Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more!
Discover the easy way to master current and previous Microsoft technologies
and advance your career. Get an incredible 1,500+ hours of step-by-step
tutorial videos with LearnDevNow. Subscribe today and save!
http://pubads.g.doubleclick.net/gampad/clk?id=58041391&iu=/4140/ostg.clktrk
_______________________________________________
Libcg-devel mailing list
Libcg-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libcg-devel

Reply via email to