Hello Rob, all, Attached is a patch which performs some minor cleanup for watch.
- it adds support for the -e flag to stop the while loop when the command executed runs into an error. (but I replaced the 'press a key' by a 'press enter', i don't think there's anything generic in toybox yet which waits for a single keypress ?) - the real watch has some intelligence where the width of the terminal influences the contents of the header, I implemented a basic version of this (it doesn't get triggered when the window gets changed and it doesn't support the ... notation for partial commandline printing). - i modified the formatting of the time to just using ctime() which is also what upstream does. - i removed a memory leak in the creation of the 'cmd' buffers. Some things which crossed my mind but I didn't add in this commit: - the real watch supports non-integer arguments e.g. watch -n 0.1 ls to perform ls every 100 msecs, how would this be done with the config_float ? Ideally we would be able to do something with CFG_TOYBOX_FLOAT() which falls back to integer operation when its not set. Is this doable ? - I'm tempted to replace the entire xmsprintf() story by using toybuf, but I'd fear running into a buffer overflow there, so I just left it there. my 2 cents E. -- Elie De Brauwer
watch.patch
Description: Binary data
_______________________________________________ Toybox mailing list [email protected] http://lists.landley.net/listinfo.cgi/toybox-landley.net
