Use basename in usage string

This commit is contained in:
Dan Buch 2016-04-13 09:41:34 -04:00
parent 80a7be5ba9
commit 6c837610a1

View File

@ -3,6 +3,7 @@
#include <stdlib.h>
#include <errno.h>
#include <string.h>
#include <libgen.h>
#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 <dbfile> <action> [action params]", NULL);
char usage[64];
sprintf(usage, "USAGE: %s <dbfile> <action> [action params]", basename(argv[0]));
if(argc < 3) die(usage, NULL);
char *filename = argv[1];
char action = argv[2][0];