ref: 6438ae2591701f598a343dbe8b6bc0570d1ee716
parent: 33ae6d8ca32eae8c04e31d5236782dda60c5725c
author: stag019 <[email protected]>
date: Mon Mar 9 09:57:04 EDT 2015
Remove __progname; add progname set to argv[0] in each main().
--- a/Makefile
+++ b/Makefile
@@ -87,7 +87,6 @@
mingw:
$Qenv PATH=/usr/local/mingw32/bin:/bin:/usr/bin:/usr/local/bin \
make WARNFLAGS= CC=gcc CFLAGS="-I/usr/local/mingw32/include \
- -D__progname=\\\"\\\" \
${CFLAGS}"
$Qmv rgbasm rgbasm.exe
$Qmv rgblink rgblink.exe
--- a/src/asm/main.c
+++ b/src/asm/main.c
@@ -19,6 +19,9 @@
int cldefines_index;
int cldefines_size;
char **cldefines;
+
+char *progname;
+
clock_t nStartClock, nEndClock;
SLONG nLineNo;
ULONG nTotalLines, nPass, nPC, nIFDepth, nErrors;
@@ -279,6 +282,8 @@
if (argc == 1)
usage();
+
+ progname = argv[0];
/* yydebug=1; */
--- a/src/extern/err.c
+++ b/src/extern/err.c
@@ -26,13 +26,11 @@
#include <stdlib.h>
#include "extern/err.h"
-#ifndef __MINGW32__
-char *__progname;
-#endif
+extern char *progname;
void rgbds_vwarn(const char *fmt, va_list ap)
{
- fprintf (stderr, "%s: ", __progname);
+ fprintf (stderr, "%s: ", progname);
if (fmt) {
vfprintf(stderr, fmt, ap);
fputs (": ", stderr);
@@ -42,7 +40,7 @@
void rgbds_vwarnx(const char *fmt, va_list ap)
{
- fprintf (stderr, "%s: ", __progname);
+ fprintf (stderr, "%s: ", progname);
if (fmt) vfprintf(stderr, fmt, ap);
putc('\n', stderr);
}
--- a/src/fix/main.c
+++ b/src/fix/main.c
@@ -23,6 +23,8 @@
#include "extern/err.h"
+char *progname;
+
static void
usage(void)
{
@@ -68,6 +70,8 @@
int ramsize; /* RAM size ID */
int version; /* mask ROM version number */
int padvalue; /* to pad the rom with if it changes size */
+
+ progname = argv[0];
while ((ch = getopt(argc, argv, "Cci:jk:l:m:n:p:sr:t:v")) != -1) {
switch (ch) {
--- a/src/link/main.c
+++ b/src/link/main.c
@@ -24,6 +24,8 @@
SLONG fillchar = 0;
char smartlinkstartsymbol[256];
+char *progname;
+
/*
* Print the usagescreen
*
@@ -51,6 +53,8 @@
if (argc == 1)
usage();
+
+ progname = argv[0];
while ((ch = getopt(argc, argv, "m:n:o:p:s:t")) != -1) {
switch (ch) {