From a6a10e4a1f47cec9ce6dd9a6a2392d97d0dc5015 Mon Sep 17 00:00:00 2001 From: Kevin Date: Sun, 23 Jul 2017 20:16:07 -0400 Subject: [PATCH] Fix help option and remove linker option from makefile --- Makefile | 8 ++++---- src/opt-pricer.c | 5 +++-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 1dfdcf9..8d7f4fa 100644 --- a/Makefile +++ b/Makefile @@ -4,16 +4,16 @@ LDFLAGS=-lm PREFIX= /usr/local opt-pricer : src/opt-pricer.c gbm.o black_scholes.o utils.o - @$(CC) $(CFLAGS) $^ $(LDFLAGS) -o $@ + @$(CC) $(CFLAGS) $^ -o $@ gbm.o : src/gbm_mc.c - @$(CC) $(CFLAGS) -c $^ $(LDFLAGS) -o $@ + @$(CC) $(CFLAGS) -c $^ -o $@ black_scholes.o : src/black_scholes.c - @$(CC) $(CFLAGS) -c $^ $(LDFLAGS) -o $@ + @$(CC) $(CFLAGS) -c $^ -o $@ utils.o : src/utils.c - @$(CC) $(CFLAGS) -c $^ $(LDFLAGS) -o $@ + @$(CC) $(CFLAGS) -c $^ -o $@ .PHONY: install install : opt-pricer diff --git a/src/opt-pricer.c b/src/opt-pricer.c index bdfecdf..5c68263 100644 --- a/src/opt-pricer.c +++ b/src/opt-pricer.c @@ -34,7 +34,7 @@ static struct helptext options[] = { "Call flag"}, {"-p, --put", "Put or call flag"}, - {"-h", + {"-h, --help", "This help text"}, { NULL , NULL } }; @@ -49,6 +49,7 @@ static struct option long_options[] = { {"expiry-date", required_argument, 0, 'e'}, {"call", no_argument, 0, 'c'}, {"put", no_argument, 0, 'p'}, + {"help", no_argument, 0, 'h'}, {0, 0, 0, 0} }; @@ -78,7 +79,7 @@ int main(int argc, char *argv[]) memset(&expiry, 0, sizeof(expiry)); memset(&value, 0, sizeof(value)); - while ((opt = getopt_long(argc, argv, "s:k:r:v:d:e:N:cp", long_options, &option_index)) != -1) { + while ((opt = getopt_long(argc, argv, "s:k:r:v:d:e:N:cp:h", long_options, &option_index)) != -1) { switch (opt) { case 's': if (sscanf(optarg, "%lf", &spot) == EOF) {