add -v/--version option.

This partially overrides the verbosity option, but that was poorly
implemented and needs to be reworked anyway.
This commit is contained in:
Sascha Kruse 2012-06-28 20:12:36 +02:00
parent e4f2e031ab
commit bdf1561cb6
3 changed files with 13 additions and 3 deletions

View File

@ -80,9 +80,9 @@ a negative from the right side of the screen.
Y is measured from the top and down respectevly. Y is measured from the top and down respectevly.
see also EXAMPLES show the notification on monitor n. see also EXAMPLES show the notification on monitor n.
=item B<-v> =item B<-v/--version>
Increase verbosity. Can be used multiple times. print version information.
=item B<-config file> =item B<-config file>

View File

@ -2,6 +2,8 @@
PREFIX = /usr/local PREFIX = /usr/local
MANPREFIX = ${PREFIX}/share/man MANPREFIX = ${PREFIX}/share/man
VERSION="pre-0.3.0"
X11INC = /usr/X11R6/include X11INC = /usr/X11R6/include
X11LIB = /usr/X11R6/lib X11LIB = /usr/X11R6/lib

10
dunst.c
View File

@ -112,6 +112,7 @@ l_node *most_important(list * l);
void draw_win(void); void draw_win(void);
void hide_win(void); void hide_win(void);
void move_all_to_history(void); void move_all_to_history(void);
void print_version(void);
int cmp_notification(notification * a, notification * b) int cmp_notification(notification * a, notification * b)
{ {
@ -841,6 +842,7 @@ void parse_cmdline(int argc, char *argv[])
{"config", required_argument, NULL, 'r'}, {"config", required_argument, NULL, 'r'},
{"mod", required_argument, NULL, 'M'}, {"mod", required_argument, NULL, 'M'},
{"ns", no_argument, NULL, 'x'}, {"ns", no_argument, NULL, 'x'},
{"version", no_argument, NULL, 'v'},
{0, 0, 0, 0} {0, 0, 0, 0}
}; };
@ -940,7 +942,7 @@ void parse_cmdline(int argc, char *argv[])
sort = False; sort = False;
break; break;
case 'v': case 'v':
verbosity++; print_version();
break; break;
default: default:
usage(EXIT_FAILURE); usage(EXIT_FAILURE);
@ -1204,4 +1206,10 @@ void usage(int exit_status)
exit(exit_status); exit(exit_status);
} }
void print_version(void)
{
printf("Dunst - Dmenuish notification daemon version: %s\n", VERSION);
exit(EXIT_SUCCESS);
}
/* vim: set ts=8 sw=8 tw=0: */ /* vim: set ts=8 sw=8 tw=0: */