diff options
author | Mattias Andrée <maandree@kth.se> | 2021-04-11 08:11:57 +0200 |
---|---|---|
committer | Mattias Andrée <maandree@kth.se> | 2021-04-11 08:11:57 +0200 |
commit | 06007976c137ebd81b3708729dae6d33d608b0a0 (patch) | |
tree | d9521ecdb3a8309b5ca0d48b6959b455cbca1cb0 | |
parent | Improve set-contact-blocks so it can edit a looked up value (diff) | |
download | contacts-06007976c137ebd81b3708729dae6d33d608b0a0.tar.gz contacts-06007976c137ebd81b3708729dae6d33d608b0a0.tar.bz2 contacts-06007976c137ebd81b3708729dae6d33d608b0a0.tar.xz |
Use lower case to set and upper case to look up
Signed-off-by: Mattias Andrée <maandree@kth.se>
-rw-r--r-- | set-contact-addresses.c | 36 | ||||
-rw-r--r-- | set-contact-blocks.c | 32 |
2 files changed, 34 insertions, 34 deletions
diff --git a/set-contact-addresses.c b/set-contact-addresses.c index 6423641..84c0c04 100644 --- a/set-contact-addresses.c +++ b/set-contact-addresses.c @@ -1,8 +1,8 @@ /* See LICENSE file for copyright and license details. */ #include "common.h" -USAGE("[-a address] [-A address] [-c context] [-C context] [-g [latitude]:[longitude]] [-G latitude:longitude] " - "[-n country] [-N country] [-o care-of] [-O care-of] [-p post-code] [-P post-code] [-t city] [-T city] " +USAGE("[-A address] [-a address] [-C context] [-c context] [-G [latitude]:[longitude]] [-g latitude:longitude] " + "[-N country] [-n country] [-O care-of] [-o care-of] [-P post-code] [-p post-code] [-T city] [-t city] " "[-u] contact-id"); @@ -28,86 +28,86 @@ main(int argc, char *argv[]) char *p; ARGBEGIN { - case 'c': + case 'C': add = 0; if (lookup_context) usage(); lookup_context = ARG(); break; - case 'C': + case 'c': edit = 1; if (context) usage(); context = ARG(); break; - case 'o': + case 'O': add = 0; if (lookup_careof) usage(); lookup_careof = ARG(); break; - case 'O': + case 'o': add = 0; edit = 1; if (careof) usage(); careof = ARG(); break; - case 'a': + case 'A': add = 0; if (lookup_address) usage(); lookup_address = ARG(); break; - case 'A': + case 'a': edit = 1; if (address) usage(); address = ARG(); break; - case 'p': + case 'P': add = 0; if (lookup_postcode) usage(); lookup_postcode = ARG(); break; - case 'P': + case 'p': edit = 1; if (postcode) usage(); postcode = ARG(); break; - case 't': + case 'T': add = 0; if (lookup_city) usage(); lookup_city = ARG(); break; - case 'T': + case 't': edit = 1; if (city) usage(); city = ARG(); break; - case 'n': + case 'N': add = 0; if (lookup_country) usage(); lookup_country = ARG(); break; - case 'N': + case 'n': edit = 1; if (country) usage(); country = ARG(); break; - case 'g': + case 'G': add = 0; if (lookup_location) usage(); lookup_location = ARG(); break; - case 'G': + case 'g': edit = 1; if (location) usage(); @@ -130,8 +130,8 @@ main(int argc, char *argv[]) if (remove == edit) { if (edit) - eprintf("-u cannot be combined with -ACGLOPT\n"); - eprintf("at least one of -ACGLOPTu is required\n"); + eprintf("-u cannot be combined with -acglopt\n"); + eprintf("at least one of -acgloptu is required\n"); } if (add) diff --git a/set-contact-blocks.c b/set-contact-blocks.c index ac0f595..014777a 100644 --- a/set-contact-blocks.c +++ b/set-contact-blocks.c @@ -1,8 +1,8 @@ /* See LICENSE file for copyright and license details. */ #include "common.h" -USAGE("[-a ask-at] [-A ask-at] [-s service] [-S service] [-t type] [-T type] " - "[-u unblock-at] [-U unblock-at] [-y style] [-Y style] contact-id"); +USAGE("[-A ask-at] [-a ask-at] [-S service] [-s service] [-T type] [-t type] " + "[-U unblock-at] [-u unblock-at] [-Y style] [-y style] contact-id"); int @@ -22,7 +22,7 @@ main(int argc, char *argv[]) size_t i; ARGBEGIN { - case 'a': + case 'A': add = 0; if (lookup_ask) usage(); @@ -33,7 +33,7 @@ main(int argc, char *argv[]) if (errno || *p) usage(); break; - case 'A': + case 'a': edit = 1; if (ask) usage(); @@ -44,31 +44,31 @@ main(int argc, char *argv[]) if (errno || *p) usage(); break; - case 's': + case 'S': add = 0; if (lookup_srv) usage(); lookup_srv = ARG(); break; - case 'S': + case 's': edit = 1; if (srv) usage(); srv = ARG(); break; - case 't': + case 'T': add = 0; if (lookup_type) usage(); lookup_type = ARG(); break; - case 'T': + case 't': edit = 1; if (type) usage(); type = ARG(); break; - case 'u': + case 'U': add = 0; if (lookup_ublk) usage(); @@ -79,7 +79,7 @@ main(int argc, char *argv[]) if (errno || *p) usage(); break; - case 'U': + case 'u': edit = 1; if (ublk) usage(); @@ -90,13 +90,13 @@ main(int argc, char *argv[]) if (errno || *p) usage(); break; - case 'y': + case 'Y': add = 0; if (lookup_style) usage(); lookup_style = ARG(); break; - case 'Y': + case 'y': edit = 1; if (style) usage(); @@ -118,7 +118,7 @@ main(int argc, char *argv[]) else if (!strcmp(lookup_type, "shadow")) lookup_explicit = 0; else - eprintf("value of -t shall be either \"explicit\" or \"shadow\"\n"); + eprintf("value of -T shall be either \"explicit\" or \"shadow\"\n"); } if (type) { @@ -127,7 +127,7 @@ main(int argc, char *argv[]) else if (!strcmp(type, "shadow")) explicit = 0; else - eprintf("value of -T shall be either \"explicit\" or \"shadow\"\n"); + eprintf("value of -t shall be either \"explicit\" or \"shadow\"\n"); } if (lookup_style) { @@ -140,7 +140,7 @@ main(int argc, char *argv[]) else if (!strcmp(lookup_style, "ignore")) lookup_shadow_block = LIBCONTACTS_BLOCK_IGNORE; else - eprintf("value of -y shall be either \"silent\", \"as-off\", \"as-busy\", or \"ignore\"\n"); + eprintf("value of -Y shall be either \"silent\", \"as-off\", \"as-busy\", or \"ignore\"\n"); } if (style) { @@ -153,7 +153,7 @@ main(int argc, char *argv[]) else if (!strcmp(style, "ignore")) shadow_block = LIBCONTACTS_BLOCK_IGNORE; else - eprintf("value of -Y shall be either \"silent\", \"as-off\", \"as-busy\", or \"ignore\"\n"); + eprintf("value of -y shall be either \"silent\", \"as-off\", \"as-busy\", or \"ignore\"\n"); } errno = 0; |