> i notice that the header isn't truncated to the terminal size, which > you presumably consider a bug,
Ok, think I've fixed that now? > but what _might_ be okay is to say "if > the terminal size is less than the space needed for the requested > fields, trust the fields". I added -M to measure the fields and expand as necessary to avoid truncating. (As with -k it requires reading everything into memory and printing in a second pass, so bad for low-memory embedded and nommu devices, but if you really want that to be a default on android we can do that. I note it _doesn't_ override "-o blah:5" so if you specify explicit width, you get it.) > then we might be able to get away with just > saying that the default Android fields include a wider than desktop > NAME field. but i'm still not sure. folks assume that NAME isn't > truncated. (i've had requests to ) TT.width now defaults to 99999 when we don't have any tty metrics, although to make that work right now I have to go: ./ps -af 2</dev/null < /dev/null | cat I can switch to _just_ checking stdout, but that makes | more go funny. (Piping to _less_ can truncate at a screenfull and let you scroll right, although ubuntu's wraps unless you scroll right in which case it gives you _just_ the line continuations, which is odd. And I don't see a command line option to control wrapping vs not wrapping? I've seen vi implementations go both ways too. Hmmm... the word "wrap" does not appear in the less man page. Lovely.) > the problem really is that Android defaults to so many fields you > don't get to see much of NAME right now. and that's before people > start adding the extra fields. Android's ps never truncated NAME at > all. i'm hoping long term (when no cares about < N or whatever release > we can switch ps over in) callers will be able to use -o to ask for > exactly what they want. so if they really only want pid and an > untruncated name (which seems fairly common) they can say -o > pid,name:99999 and lose the regular expressions. I want to provide behavior that gives everyone what they want. I'm not sure if there _is_ such behavior, but let me know what the constraints are and where I'm violating them and I'll do my best. > (having trailing whitespace in the NAME field caused by truncation > caused a lot of trouble from one attempt to switch over.) Sort of fixed? The header line has trailing whitespace (because the same plumbing gives us the "top" line that's reverse text and needs the reverse bar to continue to the right), but the individual lines don't. The rightmost entry is not padded when it's left justified.) But there is usually a space before the first "pid" field due to that being right justified and padded... > ps | thing is pretty much the default case in Android, not least > because historically ps couldn't really do anything fancy for itself. Also you're usually calling stuff through adb, which doesn't provide a tty. (I currently just did "no tty on stdin/out/err", I can switch to "only check stdout for tty" if you prefer, but this way if you pull up an android terminal window or set COLUMNS= it does the workstation behavior.) > ugh... testing i just realized that toybox will truncate the user > field rather than either auto-size it or just misalign those lines. I didn't directly fix this, but added -M. Let me know if that needs to become Android's default. (I can also do something more like vmstat's running padding, where a field can leak into the next field and later padding will squash down to one space until it's aligned again.) Rob _______________________________________________ Toybox mailing list [email protected] http://lists.landley.net/listinfo.cgi/toybox-landley.net
