summaryrefslogtreecommitdiffstats
path: root/journal-notify.c
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2014-08-09 11:03:16 +0200
committerGravatar Christian Hesse <mail@eworm.de>2014-08-09 11:03:16 +0200
commit16f4940a89df5dfe21ed545e28e17d65e6bd72a9 (patch)
tree83e06ff57b3a214b80b5686ab547401326708b68 /journal-notify.c
parent465ee18154534aedfda28e29130b1f2b8c2e5189 (diff)
downloadjournal-notify-16f4940a89df5dfe21ed545e28e17d65e6bd72a9.tar.gz
journal-notify-16f4940a89df5dfe21ed545e28e17d65e6bd72a9.tar.zst
allow to give long arguments
Diffstat (limited to 'journal-notify.c')
-rw-r--r--journal-notify.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/journal-notify.c b/journal-notify.c
index 9819f07..ea73666 100644
--- a/journal-notify.c
+++ b/journal-notify.c
@@ -9,6 +9,21 @@
const char * program = NULL;
+const static char optstring[] = "aehi:m:nor:v";
+const static struct option options_long[] = {
+ /* name has_arg flag val */
+ { "and", no_argument, NULL, 'a' },
+ { "extended-regex", no_argument, NULL, 'e' },
+ { "help", no_argument, NULL, 'h' },
+ { "icon", required_argument, NULL, 'i' },
+ { "match", required_argument, NULL, 'm' },
+ { "no-case", no_argument, NULL, 'n' },
+ { "or", no_argument, NULL, 'o' },
+ { "regex", required_argument, NULL, 'r' },
+ { "verbose", no_argument, NULL, 'v' },
+ { 0, 0, 0, 0 }
+};
+
/*** notify ***/
int notify(const char * summary, const char * body, const char * icon) {
NotifyNotification * notification;
@@ -55,7 +70,7 @@ int main(int argc, char **argv) {
/* get command line options - part I
* just get -h (help), -e and -n (regex options) here */
- while ((i = getopt(argc, argv, OPTSTRING)) != -1) {
+ while ((i = getopt_long(argc, argv, optstring, options_long, NULL)) != -1) {
switch (i) {
case 'e':
regex_flags |= REG_EXTENDED;
@@ -86,7 +101,7 @@ int main(int argc, char **argv) {
}
/* get command line options - part II*/
- while ((i = getopt(argc, argv, OPTSTRING)) != -1) {
+ while ((i = getopt_long(argc, argv, optstring, options_long, NULL)) != -1) {
switch (i) {
case 'a':
if (verbose > 1)