ipcrm: add static keyword to some functions
PATCH 1/3 ipcrm: add static keyword to some functions
Signed-off-by Francesco Cosoleto <[email protected]>
--- sys-utils/ipcrm.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-)
sys-utils/ipcrm.c +3 -3
@@ -64,7 +64,7 @@ static void __attribute__ ((__noreturn__)) usage(FILE * out)exit (out == stderr ?EXIT_FAILURE :EXIT_SUCCESS ); } -int remove_id (int type,int iskey,int id) +static int remove_id (int type,int iskey,int id) {int ret;char *errmsg;
@@ -163,7 +163,7 @@ static int deprecated_main(int argc, char **argv)return 1 ; } -unsigned long strtokey (const char *str,const char *errmesg) +static unsigned long strtokey (const char *str,const char *errmesg) {unsigned long num;char *end =NULL ;
@@ -230,7 +230,7 @@ static int key_to_id(type_id type, char *optarg)return id; } -int remove_all (type_id type) +static int remove_all (type_id type) {int ret =0 ;int id, rm_me, maxid;
Signature · 1 line
1.7.3.4
PATCH 2/3 ipcrm: use ternary operator in "(key|id) failed" message
Signed-off-by Francesco Cosoleto <[email protected]>
--- sys-utils/ipcrm.c | 4 +--- 1 files changed, 1 insertions(+), 3 deletions(-)
sys-utils/ipcrm.c +1 -3
@@ -107,9 +107,7 @@ static int remove_id(int type, int iskey, int id) errmsg = iskey ?_ ("already removed key" ) :_ ("already removed id" );break ;default : -if (iskey) -err (EXIT_FAILURE ,_ ("key failed" )); -err (EXIT_FAILURE ,_ ("id failed" )); +err (EXIT_FAILURE , iskey ?_ ("key failed" ) :_ ("id failed" )); }warnx ("%s (%d)" , errmsg, id);return 1 ;
Signature · 1 line
1.7.3.4
PATCH 3/3 ipcrm: fix wrong subject in error messages for -m, -q, -s id options
In reply to Francesco CosoletoThis makes error messages print 'id' instead of 'key' using id options.
Signed-off-by Francesco Cosoleto <[email protected]>
--- sys-utils/ipcrm.c | 23 ++++++++--------------- 1 files changed, 8 insertions(+), 15 deletions(-)
sys-utils/ipcrm.c +8 -15
@@ -323,52 +323,45 @@ int main(int argc, char **argv)return EXIT_SUCCESS ;/* process new syntax to conform with SYSV ipcrm */ -for (id =-1 ; - (c =getopt_long (argc, argv,"q:m:s:Q:M:S:a::vhV" , longopts,NULL )) !=-1 ; - id =-1 ) { +while ((c =getopt_long (argc, argv,"q:m:s:Q:M:S:a::vhV" , longopts,NULL )) !=-1 ) { + iskey =0 ;switch (c) {case 'M' : - iskey =0 ; + iskey =1 ; id =key_to_id (SHM , optarg);if (id <0 ) { ret++;break ; }case 'm' : -if (id <0 ) { - iskey =1 ; +if (!iskey) id =strtoll_or_err (optarg,_ ("failed to parse argument" )); - }if (remove_id (SHM , iskey, id)) ret++;break ;case 'Q' : - iskey =0 ; + iskey =1 ; id =key_to_id (MSG , optarg);if (id <0 ) { ret++;break ; }case 'q' : -if (id <0 ) { - iskey =1 ; +if (!iskey) id =strtoll_or_err (optarg,_ ("failed to parse argument" )); - }if (remove_id (MSG , iskey, id)) ret++;break ;case 'S' : - iskey =0 ; + iskey =1 ; id =key_to_id (SEM , optarg);if (id <0 ) { ret++;break ; }case 's' : -if (id <0 ) { - iskey =1 ; +if (!iskey) id =strtoll_or_err (optarg,_ ("failed to parse argument" )); - }if (remove_id (SEM , iskey, id)) ret++;break ;
Signature · 1 line
1.7.3.4
Karel Zak
maintainerQuoted 4 lines · Francesco Cosoleto
Signed-off-by Francesco Cosoleto <[email protected]>--- sys-utils/ipcrm.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-)
Quoted 4 lines · Francesco Cosoleto
Signed-off-by Francesco Cosoleto <[email protected]>--- sys-utils/ipcrm.c | 4 +--- 1 files changed, 1 insertions(+), 3 deletions(-)
Quoted 6 lines · Francesco Cosoleto
This makes error messages print 'id' instead of 'key' using id options.
Signed-off-by Francesco Cosoleto <[email protected]>--- sys-utils/ipcrm.c | 23 ++++++++--------------- 1 files changed, 8 insertions(+), 15 deletions(-)
All applied. Thanks for review!
Signature · 2 lines
Karel Zak <[email protected]> http://karelzak.blogspot.com