-/* $Id: main.c,v 1.53 2009/10/31 06:10:57 kristaps Exp $ */
+/* $Id: main.c,v 1.54 2009/10/31 06:17:19 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se>
*
__dead static void version(void);
__dead static void usage(void);
-extern char *__progname;
+static const char *progname;
int
struct buf ln, blk;
struct curparse curp;
+ progname = strrchr(argv[0], '/');
+ if (progname == NULL)
+ progname = argv[0];
+ else
+ ++progname;
+
memset(&curp, 0, sizeof(struct curparse));
curp.inttype = INTT_AUTO;
version(void)
{
- (void)printf("%s %s\n", __progname, VERSION);
+ (void)printf("%s %s\n", progname, VERSION);
exit(EXIT_SUCCESS);
}
(void)fprintf(stderr, "usage: %s [-V] [-foption...] "
"[-mformat] [-Ooption] [-Toutput] "
- "[-Werr...]\n", __progname);
+ "[-Werr...]\n", progname);
exit(EXIT_FAILURE);
}