add -v option for printing version (#17), fix -h option text and optstring

master
Yu-Jie Lin 11 years ago
parent ac5c5614c5
commit 67bfef75b3
  1. 14
      cava.c
  2. 6
      makefile

@ -261,7 +261,7 @@ int main(int argc, char **argv)
float sm = 1.25; //min val from the above array
struct timespec req = { .tv_sec = 0, .tv_nsec = 0 };
char *usage = "\n\
Usage : ./cava [options]\n\
Usage : " PACKAGE " [options]\n\
\n\
Options:\n\
-b 1..(console columns/2-1) or 200 number of bars in the spectrum (default 25 + fills up the console), program wil auto adjust to maxsize if input is to high)\n\
@ -280,7 +280,12 @@ Options:\n\
\n\
-f framerate max frames per second to be drawn, if you are experiencing high CPU usage, try redcing this (default: 60)\n\
\n\
-S \"scientific\" mode (disables most smoothing)\n";
-S \"scientific\" mode (disables most smoothing)\n\
\n\
-h print this again\n\
\n\
-v print version\n\
";
//**END INIT**//
setlocale(LC_ALL, "");
@ -294,7 +299,7 @@ Options:\n\
for (i = 0; i < M; i++)shared[i] = 0;
//**arg handler**//
while ((c = getopt (argc, argv, "p:i:b:d:s:f:c:C:h:S")) != -1)
while ((c = getopt (argc, argv, "p:i:b:d:s:f:c:C:hSv")) != -1)
switch (c) {
case 'p':
path = optarg;
@ -362,6 +367,9 @@ Options:\n\
case 'h':
printf ("%s", usage);
return 0;
case 'v':
printf (PACKAGE " " VERSION "\n");
return 0;
case '?':
printf ("%s", usage);
return 1;

@ -1,6 +1,10 @@
PACKAGE ?= cava
VERSION ?= $(shell git describe --always --tags --dirty)
CC = gcc
CFLAGS = -std=c99 -Wall -Wextra
CPPFLAGS = -D_POSIX_SOURCE -D _POSIX_C_SOURCE=200809L
CPPFLAGS = -DPACKAGE=\"$(PACKAGE)\" -DVERSION=\"$(VERSION)\" \
-D_POSIX_SOURCE -D _POSIX_C_SOURCE=200809L
LDLIBS = -lasound -lm -lfftw3 -lpthread
INSTALL = install

Loading…
Cancel
Save