From 6c837610a1bb0762f786a1bf5ff166e966f15eed Mon Sep 17 00:00:00 2001 From: Dan Buch Date: Wed, 13 Apr 2016 09:41:34 -0400 Subject: [PATCH] Use basename in usage string --- lcthw-remnants-2/ex17-ec.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lcthw-remnants-2/ex17-ec.c b/lcthw-remnants-2/ex17-ec.c index 24a2eca..33bc92f 100644 --- a/lcthw-remnants-2/ex17-ec.c +++ b/lcthw-remnants-2/ex17-ec.c @@ -3,6 +3,7 @@ #include #include #include +#include #define MAX_DATA 512 #define MAX_ROWS 100 @@ -153,7 +154,10 @@ void Database_list(struct Connection *conn) int main(int argc, char *argv[]) { - if(argc < 3) die("USAGE: ex17 [action params]", NULL); + char usage[64]; + sprintf(usage, "USAGE: %s [action params]", basename(argv[0])); + + if(argc < 3) die(usage, NULL); char *filename = argv[1]; char action = argv[2][0];