-
-
Notifications
You must be signed in to change notification settings - Fork 16
Description
I want to use ttok to truncate input, and inform the user if it was truncated. At the moment, that'd mean I have to call ttok twice as far as I can tell - once to count the tokens and a second time to truncate.
ttok takes about 0.16 seconds to run on my machine even with minimal input, which means that two calls add up to .3 seconds, which is definitely perceptible to the user.
You probably can't alter the return code of ttok -t at this point; many users are likely depending on the return code being 0 whether it truncates or not.
The only way I can think of to implement this feature would be with another command-line flag for "truncate and signal", which would return a non-zero status code if it truncated the input - any out of band signalling mechanism I can think of seems like it wouldn't work across platforms