Add CHOICE and fix several build/runtime issues#9
Open
ostrich wants to merge 8 commits intodarkbatcher:devfrom
Open
Add CHOICE and fix several build/runtime issues#9ostrich wants to merge 8 commits intodarkbatcher:devfrom
ostrich wants to merge 8 commits intodarkbatcher:devfrom
Conversation
TSnake41
requested changes
Mar 23, 2026
Collaborator
TSnake41
left a comment
There was a problem hiding this comment.
Looks good to me overall, just found a few nits/small issues.
pbat/command/pBat_Choice.c
Outdated
| continue; | ||
| } | ||
|
|
||
| if (!stricmp(param->str, "/CS")) { |
Collaborator
There was a problem hiding this comment.
/CS starts with /C and gets catched by the /C check instead.
| #define PBAT_HELP_REM 13 | ||
| #define PBAT_HELP_DIR 14 | ||
| #define PBAT_HELP_CLS 16 | ||
| #define PBAT_HELP_CHOICE 15 |
Collaborator
There was a problem hiding this comment.
It's a good idea to use the gap (which is probably there due to a mistake).
Some nits :
- it's off by a line (breaking the ordering)
- you don't actually need to increase PBAT_HELP_ARRAY_SIZE (latest help index was 40 and is still 40)
pbat/command/pBat_Choice.c
Outdated
| return pBat_ChoiceFind(choices, def, case_sensitive); | ||
| } | ||
|
|
||
| static int pBat_ChoiceReadWithTimeout(double timeout_seconds) |
Collaborator
There was a problem hiding this comment.
I'm don't think it's very useful to use floats for timeout given that you are only manipulating (and allowing) integers in the end.
Author
|
Thanks, good catches. I fixed the /CS parsing order, cleaned up the help ID/array size, and simplified the timeout handling to use integer milliseconds instead of float bookkeeping. I’ve pushed the update. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This branch adds a
CHOICEbuiltin and includes a set of build, runtime, and test fixes that came up while implementing and validating it on Linux.Changes
CHOICEsupport with/C,/N,/CS,/D,/T,/M, and DOS-style/T:X,1COPY,CALL, andIF ERRORLEVELDIR, prompt flushing, path-independentTYPEtest output)Validation
Tested on Linux with:
make config make all bin -j4 make -C tests test PBAT=../pbat/pbat -j1