diff options
author | B. Watson <urchlay@slackware.uk> | 2025-03-11 05:17:56 -0400 |
---|---|---|
committer | B. Watson <urchlay@slackware.uk> | 2025-03-11 05:17:56 -0400 |
commit | 997fb1bf0878cb6a455abec1d9d399cd5fcb0b44 (patch) | |
tree | 1c5c3375468728f49c0f43eef0cca7941c9b380e /listamsb.c | |
parent | e092e5c4bafd6bf507e0930dd64aa7dc8c61b86e (diff) | |
download | bw-atari8-tools-997fb1bf0878cb6a455abec1d9d399cd5fcb0b44.tar.gz |
listamsb: add -k option, reorganize man page.
Diffstat (limited to 'listamsb.c')
-rw-r--r-- | listamsb.c | 29 |
1 files changed, 22 insertions, 7 deletions
@@ -90,6 +90,7 @@ int unlock_mode = 0; /* -l */ int initial_eol = 1; /* -n */ int crunch = 0; /* -C, -D */ int decrunch = 0; /* -D */ +int keep_rems = 0; /* -k */ int locked = 0; int need_pclose = 0; @@ -528,16 +529,27 @@ int crunch_line(void) { } /* omit comment-only lines */ - if(code[0] == TOK_REM) return 0; - if(code[0] == ':') { - if(code[1] == TOK_SQUOTE || code[1] == TOK_BANG) - return 0; + if(!keep_rems) { + if(code[0] == TOK_REM) return 0; + if(code[0] == ':') { + if(code[1] == TOK_SQUOTE || code[1] == TOK_BANG) + return 0; + } } /* omit trailing comments */ - if(commentstart) { + if(commentstart > 1) { code[commentstart - 1] = 0; /* null out the colon before the comment */ codelen = commentstart; + + /* removing the comment from this: 10 PRINT :! BLAH + ...leaves a trailing colon. get rid of it if needed. */ + if(codelen >= 2) { + if(code[codelen - 2] == ':') { + code[codelen - 2] = 0; + codelen--; + } + } } codelen += 4; /* account for ptr and lineno */ @@ -832,11 +844,14 @@ void parse_args(int argc, char **argv) { } } - while( (opt = getopt(argc, argv, "DCnlr:cvaiutmsh")) != -1) { + while( (opt = getopt(argc, argv, "DCnLUlr:cvaiutmshk")) != -1) { switch(opt) { + case 'L': crunch = decrunch = 0; break; case 'D': crunch = decrunch = 1; break; case 'C': crunch = 1; break; - case 'l': unlock_mode = 1; break; + case 'l': + case 'U': unlock_mode = 1; break; + case 'k': keep_rems = 1; break; case 'c': check_only = 1; break; case 'a': raw_output = 1; break; case 'v': verbosity++ ; break; |