Skip to content

Commit

Permalink
add -v option to get version of ngp
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathanklee committed Jul 3, 2014
1 parent ad8901c commit a4f71db
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion ngp.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#include <pthread.h>
#include <ctype.h>

#define NGP_VERSION 1.1

#define CURSOR_UP 'k'
#define CURSOR_DOWN 'j'
#define PAGE_UP 'K'
Expand Down Expand Up @@ -161,6 +163,7 @@ static void usage(void)
fprintf(stderr, " -r : raw mode\n");
fprintf(stderr, " -e : pattern is a regular expression\n");
fprintf(stderr, " -t type : look for a file extension only\n");
fprintf(stderr, " -v : display version\n");
exit(-1);
}

Expand Down Expand Up @@ -756,6 +759,11 @@ void display_status(void)
mvaddstr(0, COLS - 5, "Done.");
}

static void display_version(void)
{
printf("version 1.1\n");
}

int main(int argc, char *argv[])
{
int opt;
Expand All @@ -773,7 +781,7 @@ int main(int argc, char *argv[])
init_searchstruct(&mainsearch);
pthread_mutex_init(&mainsearch.data_mutex, NULL);

while ((opt = getopt(argc, argv, "heit:r")) != -1) {
while ((opt = getopt(argc, argv, "heit:rv")) != -1) {
switch (opt) {
case 'h':
usage();
Expand All @@ -790,6 +798,9 @@ int main(int argc, char *argv[])
case 'e':
mainsearch.regexp = 1;
break;
case 'v':
display_version();
exit(0);
default:
exit(-1);
break;
Expand Down

0 comments on commit a4f71db

Please sign in to comment.