Tiny Core Linux
Tiny Core Base => TCB Bugs => Topic started by: maro on December 13, 2010, 11:13:03 PM
-
Not specific to this RC but probably around since a long time: When using the answer 'q' (to quit) for 'usr/bin/select' with the (default) "offset" of 1 (e.g. as a test case: rm -f /tmp/select.ans ; seq 3 -1 1 > s ; select test s 1 ; od -c /tmp/select.ans and then pressing 'q') one just gets a linefeed (i.e. "\n") as result (instead of the expected "q\n").
I believe this can be fixed with changing if ( offset == 1 ) to if ( offset == 1 && selection != "q")
-
When I first created select, as my tiny replacement for Dialog, it was for my ab, tiny appbrowser. There I was expecting a null value and not 'q'. Later when I dropped Dialog in favor of select, those scripts were expecting a return value of 'q'. Select needed to be revisited as well as ab. Adjustments made. Thanks.
-
Robert, as you mentioned 'ab' I thought I better test this as well, as I had stumbled over this problem originally with 'xsetup.sh'.
I guess you did the same test of 'ab', but just in case: The quitting was not really working, so I made some minor modifications:
--- /usr/bin/ab-
+++ /usr/bin/ab
@@ -45,21 +45,22 @@
ITEM="$1"
searchRepository $ITEM
selectItem
-displayInfo
+ANS=$EXTN
while [ "$ANS" != "q" ]; do
-[ -n "$EXTN" ] && echo -n "I)nstall O)nDemand D)epends F)iles L)ist "
-echo -n "S)earch, P)rovides, or Q)uit: "; read -s -n1 ANS; echo
-case ${ANS} in
- I|i) tce-load -w -i "$EXTN" ;;
- O|o) tce-load -w "$EXTN" ;;
- D|d) displayDepends ;;
- F|f) displayFiles ;;
- L|l) selectItem ;;
- S|s) ITEM="" && searchRepository "$ITEM" && selectItem && displayInfo ;;
- P|p) ITEM="" && whatProvides "$ITEM" && selectItem && displayInfo ;;
- Q|q) rm info.lst && exit ;;
- *) displayInfo ;;
-esac
+ displayInfo
+ [ -n "$EXTN" ] && echo -n "I)nstall O)nDemand D)epends F)iles L)ist "
+ echo -n "S)earch, P)rovides, or Q)uit: "; read -s -n1 ANS; echo
+ case ${ANS} in
+ I|i) tce-load -w -i "$EXTN" ;;
+ O|o) tce-load -w "$EXTN" ;;
+ D|d) displayDepends ;;
+ F|f) displayFiles ;;
+ L|l) selectItem ;;
+ S|s) ITEM="" && searchRepository "$ITEM" && selectItem && displayInfo ;;
+ P|p) ITEM="" && whatProvides "$ITEM" && selectItem && displayInfo ;;
+ Q|q) continue ;;
+ *) displayInfo ;;
+ esac
done
-cd -
+cd - > /dev/null
rm -rf $TMPDIR 2>/dev/null
Now, that looks like more than it really is, as I've chosen to indent the while block (for better readability). So apart from setting ANS just before the while, and moving 'displayInfo' into the block, it just changes the quit case (to ensure a proper cleanup) plus surpresses a surplus message.
-
As I posted above, I had already made those changes to ab
-
As I posted above, I had already made those changes to ab
I'm sorry, I obviously did not read your post carefully enough. Re-reading it made it clear to me.