aboutsummaryrefslogtreecommitdiff
path: root/toys/posix
AgeCommit message (Collapse)Author
2015-03-02On 64 bit, subtracting two pointers produces a long result. On 32 bit, it's ↵Rob Landley
an int. Even though long _is_ 32 bits on a 32 bit systems, gcc warns about it because reasons. Also, the warning being that "expects int, but type is wchar_t"... no, type is not wchar_t. Type is probably long. Specify the ACTUAL TYPE, not the random typedef alias for it. If the translated type _did_ match, there wouldn't be a warning! (This is why c89 promoted all arguments to int, precisely so this wasn't a problem.)
2015-03-01Fix several printf_format warnings.Rob Landley
2015-03-01Patches from Elliott Hughes to fix various printf() format strings.Rob Landley
(Don't specify the space flag when it's the default behavior. The ifconfig stuff was actual bugs.)
2015-03-01Patches from Elliott Hughes to add missing arguments to error_exit() calls.Rob Landley
2015-03-01remove accidental space in format stringElliott Hughes
the ' ' flag makes no sense for %c.
2015-02-28BSD sed uses -E instead of -r to enable ERE.Isabella Bosia
GNU sed silently supports -E as an alias for -r too.
2015-02-15Add --remove-destination longopt for -F because the host version doesn't ↵Rob Landley
have a shortopt for it.
2015-02-14Make egrep and fgrep build standalone.Rob Landley
2015-02-08Rewrite of a patch from Elliott Hughes to implement touch -h and switch API ↵Rob Landley
to utimensat() which offers nanosecond granularity and UTIME_OMIT/UTIME_NOW.
2015-02-07Cleanup pass on env, removing exec_optargs().Rob Landley
2015-02-07Make toy_exec() check if argc is in optargs and deal with it there so we ↵Rob Landley
don't need a separate xexec_optargs().
2015-02-06In rm, init using to AT_REMOVEDIR in the dir case earlier.Rob Landley
(If you had a chmod 000 directory and did rm -r on it without -f, after the prompt it would complain it was a directory.)
2015-02-06Alright, the Android guys agree with the musl guys: ↵Rob Landley
faccessat(AT_SYMLINK_NOFOLLOW) is not supported.
2015-01-22Fix sed s//\[newline]/ line continuations.Rob Landley
The problem was that readline() was returning a newline at the end of each string, which wasn't getting stripped in the parser and thus \ wasn't at the end of a line for -f, it was escaping a literal newline, so the continuation logic didn't trigger. Remove some redundant null checks while we're at it, and don't bother terminating a string we don't return (yes we leak memory in an error path, but it's about to error_exit() anyway).
2015-01-20fix typo in printfElliott Hughes
2015-01-18Lift the basename/libgen.h shenanigans back out of portability.c and make it ↵Rob Landley
a static inline in portability.h, and prototype dirname() while we're at it.
2015-01-16id.c #ifdefectomy. (ifdefs belong in headers, not in C code.)Rob Landley
2015-01-16This patch adds a TOYBOX_SELINUX configuration option to control bothElliott Hughes
the SELinux commands (such as chcon) and the SELinux-specific options to regular commands (such as ls -Z). This lets us #include <selinux/selinux.h> in portability.h. I've also fixed chcon to insist on being given the a context argument. This patch also adds -Z to id and fixes id's regular output (-G should be separated by spaces, non-G output should be separated by commas, and you don't want a double comma where the egid is omitted from the list of groups).
2015-01-14Make touch -d miliseconds work. (Still only 6 digits precision instead of 9, ↵Rob Landley
but it's a start.)
2015-01-14i found a few problems while manually smoke testing toybox chown versus ↵Elliott Hughes
toolbox (NetBSD) chown... new test: and here's the patch to fix "owner:" ":group" and the ":" special case:
2015-01-14Let chown build standalone.Rob Landley
2015-01-13sed bugfix: N or n at end of script would save the terminating NULL as the ↵Rob Landley
resume position, so the script would restart from beginning.
2015-01-13sed s/// can have line continuations in the replacement part, with or ↵Rob Landley
without a \ escaping the newline.
2015-01-11Promote printf.Rob Landley
2015-01-04Fix sed backslash parsing in square bracket pattern sections.Rob Landley
2014-12-31Redo option parsing infrastructure so #define FORCE_FLAGS can unzero flag ↵Rob Landley
macros for a disabled command (needed when multiple commands share infrastructure with a common set of flags). This means the flag space is no longer packed, but leaves gaps where the zeroes go. (Actual flag bit positions are the same for all configs.) Since the option parsing needs to know where the holes are, the OPTSTR values are now generated as part of flags.h with ascii 1 values for the disabled values. (So generated/oldflags.h went away.) This also means that the option string argument for OLDTOY() went away, it now uses the same arguments as the NEWTOY() it references.
2014-12-31When CP_MORE was disabled, the d flag was still in the [-exclusion] list at ↵Rob Landley
the end and option parsing fell off the end looking for it (segfault) if DEBUG wasn't enabled to check for that.
2014-12-31When you include the posix header libgen.h, glibc #defines basename to some ↵Rob Landley
random other symbol name (because gnu) and this screws up nontrivial macro expansions of NEWTOY(basename), so work around it in portability.h.
2014-12-23Merge catv back into cat as discussed on the list. Add comments about ↵Rob Landley
infrastructure upgrades needed to restore separate catv option.
2014-12-22sed 'r' didn't work right.Rob Landley
2014-12-21Another sed bug. (The e2fsprogs build uses multiple line continuations on ↵Rob Landley
the same command.)
2014-12-21Promote sed to posix.Rob Landley
2014-12-18Decouple cp and mv so mv uses its own --help text.Rob Landley
MV still requires CP enabled until the flag generation logic gets updated.
2014-12-13Leftover variable from factoring out base64_init() caused an unused variable ↵Rob Landley
warning.
2014-12-13Add base64.Rob Landley
The tizen guys wanted this. Yeah, I know there's base64 code in uuencode/uudecode, but that this has -i, input lines aren't of fixed length, encode/decode are in same file, there's no prefix/suffix code, it always writes to stdout... Eliminating the code duplication wouldn't be worth the if/else I'd have to add, so I just did a new one. Factored out the base64 table init into lib.c though: that was worth sharing.
2014-12-01Ashwini Sharma pointed out that "mkdir sub; ln -s . sub/up; du -L sub" ↵Rob Landley
shouldn't loop endlessly.
2014-11-25Variant of a patch from Ashwini Sharma, making df /dev/node work and ↵Rob Landley
tweaking the spacing. I didn't apply the POSIXLY_CORRECT gnuism because it's a can of worms (as would be LSB_CORRECT), and you can presumably alias df="df -P" if you want that. Possibly in future I should factor out the "readahead and align columns based on measuring the largest value in each" code from ls and apply it here.
2014-11-22As long as Android's going to require fortify, fixup the warnings it generates.Rob Landley
2014-11-19probe for getspnam(), forkpty(), utmpx, replace sethostname()Isaac Dunham
Android is missing all of these; we need to probe for some so we have a config symbol to depend on. sethostname() is easily replaced. We got termios.h via pty.h; now it's not included in configure-step tools, so we need termios.h to generate globals.
2014-11-19Fix "tail -c 10" segfault spotted by Lukasz Szpakowski.Rob Landley
Once we've read through the initial TT.bytes backlog we discard the extra data, meaning we adjust the remaining amount each time so the overflow is zero bytes. We were doing the adjustment right, but not zeroing out the overflow counter after we did so.
2014-10-30Test for ls -d from Isaac Dunham, and he pointed out -F also disables ↵Rob Landley
symlink following.
2014-10-30Bug report from Isaac Dunham: ls -d shouldn't follow command line symlinks ↵Rob Landley
without -H or -L (just like ls -l).
2014-10-27Fix use after free error spotted by ?ukasz Szpakowski.Rob Landley
2014-10-22Teach ln -f to leave original target alone if link creation fails.Rob Landley
Suggested by Ashwini Sharma, I wound up implementing it by creating the new link at a temporary name and renaming it over the old one instead of renaming the old file out of the way and putting it back if it failed. (Because "mkdir -p one/one/blah && ln -sf /bin/one one" would otherwise rename one/one out of the way and only notice it can't delete it way at the end when recovery's darn awkward, vs create new thing and if rename fails (including EISDIR) that's the main error path. And yes the temporary name is in the same directory as the destination so we never rename between mounts.) link over the old one instead of renaming the old file and renaming it back.
2014-10-20More static analysis fixes from Ashwini Sharma.Rob Landley
2014-10-18Factor out printf-style escape parsing logic from echo.c.Rob Landley
2014-10-14Use O_CLOEXEC instead of O_RDONLY to signal loopfiles_rw() to close filehandles.Rob Landley
2014-10-14Fix last night's mv commit (use dest, not source).Rob Landley
2014-10-14Implement mv -f and -i.Rob Landley
2014-10-09Various bugfixes (mostly resource leaks) from Ashwini Sharma's static ↵Rob Landley
analysis, plus occasional tweak by me while reviewing them.