aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorB. Watson <urchlay@slackware.uk>2024-07-13 03:03:07 -0400
committerB. Watson <urchlay@slackware.uk>2024-07-13 03:03:07 -0400
commit52a21f2b8b9de0527099d24eccd2a1aa04351ae0 (patch)
treec82641cf288c0b764d19808c8c93566b13cef5e0
parente7ad411b1a8fcd7f3cdf4a81a05aa9fc19575211 (diff)
downloadbw-atari8-tools-52a21f2b8b9de0527099d24eccd2a1aa04351ae0.tar.gz
listbas: environment debug stuff.
-rw-r--r--listbas.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/listbas.c b/listbas.c
index 4a6c0a8..51e0980 100644
--- a/listbas.c
+++ b/listbas.c
@@ -141,6 +141,7 @@ void parse_args(int argc, char **argv, int from_env) {
}
#define ENV_MAX_ARGS 64
+/* #define DEBUG_ENV */
/* make a fake argv and argc */
void parse_env_args(void) {
@@ -151,8 +152,9 @@ void parse_env_args(void) {
env = getenv(ENV_OPTS);
if(!env) return;
- if(verbose)
- fprintf(stderr, "%s: read options from environment: \"%s\"\n.", self, env);
+#ifdef DEBUG_ENV
+ fprintf(stderr, "%s: " ENV_OPTS " is set in the env, using it.\n", self);
+#endif
fargv[0] = (char *)self;
fargv[1] = env;
@@ -162,7 +164,7 @@ void parse_env_args(void) {
if(*p == ' ' || *p == '\t') {
*p = '\0';
if(fargc == ENV_MAX_ARGS) {
- fprintf(stderr, "%s: too many spaces in LISTBAS_OPTS (max %d)\n", self, ENV_MAX_ARGS - 1);
+ fprintf(stderr, "%s: Too many spaces in " ENV_OPTS " (max %d)\n", self, ENV_MAX_ARGS - 1);
break;
}
fargv[fargc++] = p + 1;
@@ -171,6 +173,16 @@ void parse_env_args(void) {
fargv[fargc] = NULL;
+#ifdef DEBUG_ENV
+ {
+ char **p;
+ fprintf(stderr, "%s: Read options from environment:\n", self);
+ for(p = fargv + 1; *p; p++) {
+ fprintf(stderr, "\t%s\n", *p);
+ }
+ }
+#endif
+
parse_args(fargc, fargv, 1);
}
@@ -487,7 +499,7 @@ int main(int argc, char **argv) {
list();
if(badtok) {
- fprintf(stderr, "%s: program has unknown tokens; maybe Turbo BASIC or BASIC XL/XE?\n", self);
+ fprintf(stderr, "%s: Program has unknown tokens; maybe Turbo BASIC or BASIC XL/XE?\n", self);
return 2;
}