On 30 March 2016 at 05:21, Rob Landley <[email protected]> wrote: > On 03/29/2016 07:37 PM, Ed Maste wrote: >> >> Because /usr/bin/env is universally available on relevant UNIX-like >> systems (POSIX requires it), and /bin/bash is not. > > Posix requires "batch", "compress", and "pax" too, none of which are > currently on my system. (There's a lot of other stuff in the standard it > expects ala qdel, sccs, ed, fort77, uucp. And stuff like cpio and cc > that the standard _dropped_ but which linux requires. And then show me > the posix spec for "init" or "mount"...) > > But ok, let's assume it does expect it there. Where does it say it > should be in /usr/bin instead of in /bin? Why is expecting THAT to be at > a specific location ok, but not expecting bash to be at a specific > location (next to /bin/sh) to avoid having to launch two binaries to > interpret one file?
Perhaps I should have left the parenthetical comment out -- I just meant POSIX requires 'env'. The more relevant point is that Linuxes, *BSD, OS X, Solaris, Illumos and derivatives all have /usr/bin/env. >>>> Another error shows up in a few spots due to conflicts between a >>>> couple of toybox functions and libc: >>>> >>>> ./lib/lib.h:204:7: error: conflicting types for 'strnstr' >>>> char *strnstr(char *line, char *str); >>>> ./lib/lib.h:289:7: error: conflicting types for 'basename_r' >>>> char *basename_r(char *name); >>> >>> In neither case did you say what the conflicting definition was. What >>> header they came from, how they're defining those prototypes... >> >> strnstr is: >> /usr/include/string.h:char *strnstr(const char *, const char *, >> size_t) __pure; >> It originated in FreeBSD, > > I'd never heard of it, I just combined "strnchr" and "strstr" in the > obvious way. Apparently what I'm missing is const, which toybox > functions never have. (Some global read-only arrays have it, that's > about it, one of the links in http://landley.net/toybox/cleanup.html > explains why.) The reference I found for strnchr claimed it's used to "Find a character in a length limited string." It looks like toybox's strnstr is what FreeBSD and glibc call strcasestr: "The strcasestr() function is like strstr(), but ignores the case of both arguments." > Then again the WORST such name clash was way back when I wrote a BBS > that had a DOS direct screen write function that updated the buffer at > 0xb8000000 directly, using a function called "throw()". Switching from > borland C++ 1.0 to borland C++ 2.0 made that program very unhappy... Yeah, I can't imagine that went well. The most annoying case of this for me is qsort_r, where BSDs and glibc have implementations with arguments in a different order. _______________________________________________ Toybox mailing list [email protected] http://lists.landley.net/listinfo.cgi/toybox-landley.net
