[Toybox] Toybox post from l.skalski at partner.samsung.com requires approval
Rob Landley
rob at landley.net
Mon Sep 2 16:45:42 PDT 2013
Lukasz Skalski <l.skalski at partner.samsung.com> said:
> Hi Rob,
>
> In attachment you can find an implementation of pwdx comannd.
Applied here, although it may take a bit to collate and upload.
(Migrating systems, email not on main work machine because I don't just
want to reinstall balsa, it's a really crappy email program...)
> I know that pwdx is not on your TODO list, but it could be useful toy.
It's a really trivial wrapper for:
$ readlink /proc/$$/pwd
/home/landley/toybox/toybox
But it's smallish, and if you say you need it...
> The pwdx command reports the current working directory of a process
> or processes.
Badly. Not yours, I mean the upstream version of pwdx is a badly
designed
command. Failure is not recognized in the return code:
$ pwdx 9999999 && echo hello
9999999: No such process
hello
$ pwdx 1 && echo hello
1: Permission denied
hello
I _guess_ you can distinguish between success and failure when it
doesn't
return an absolute path? (Directory names can have spaces in them, but
absolute paths always start with / which error messages don't...)
I'll trust your judgement that this is a command you actually need, and
it
is small. But I'm tempted to make it behave like grep does with
filenames
(only prefix with an identifier when you have more than one argument).
> Please review and add it to the tree if found suitable.
> Let me know for any comments.
It's in here, plus a (mostly cosmetic) cleanup pass. Might not get
pushed
to the website for a bit...
Still a slight delta from upstream:
$ ./toybox pwdx 42
42: No such file or directory
$ pwdx 42
42: No such process
But I'm not special-casing an english-only message when the rest are
translated...
Rob
1378165542.0
More information about the Toybox
mailing list