Commit Graph

279 Commits

Author SHA1 Message Date
Rob Landley
1fb3ae7075 Various cleanups found by Tom Sparrow's static analysis. 2014-02-16 11:09:23 -06:00
Rob Landley
b6c8a8609f Move bunzip2 logic from lib into bzcat. 2014-02-07 07:56:46 -06:00
Isaac Dunham
714a0db2ad Two changes to shut up GCC:
* __GLIBC__ was checked unconditionally;
this made for a very messy build on musl.
* int fd in chvt is always initialized; GCC 3.4 does not recognize this.
2014-01-28 10:10:25 -06:00
Rob Landley
59d85e2bb0 Rename xmsprintf() to just xmprintf().
Partly because there's no supplied target string ala sprintf, and partly
because I can never remember what order the m and s go in.
2014-01-16 09:26:50 -06:00
Rob Landley
dc3731783e Pass through all the readfile() arguments from xreadfile(). 2013-12-27 18:45:01 -06:00
Ashwini Sharma
656d5043b8 Attached is an implementation for groupdel.
This is aliased to delgroup, for a requirement at my end.
Also lib/password.c is modified to along with.
2013-12-23 07:23:28 -06:00
Rob Landley
afba5b8efd Fix some issues raised (albeit indirectly) by Isaac Dunham.
POLL_IN defined as a constant by some libc.
Factor out login.c's change_identity() to xwrap.c as xsetuser().
Replace xsetuid() with xsetuser()
Put a space between argument globals and non-argument globals.
TT starts zeroed, don't need to re-zero entries in it.
STDIN_FILENO has been 0 since 1969, even DOS copied that. Just say 0.
Added an xchroot() using xchdir() to lib/xwrap.c.
Remove endgrent() call until somebody can explain why it was there.
2013-12-23 06:49:38 -06:00
Rob Landley
10d55b1129 Only define MNT_DETACH for old glibc, portability.h included _before_ sys/mount.h... 2013-12-19 15:11:45 -06:00
Rob Landley
0201900cad Regression test against Ancient Build Environment (Ubuntu 8.04), fixup bit-rot. 2013-12-19 15:02:18 -06:00
Rob Landley
db1009dc5c Move names_to_pid from pending to lib. 2013-12-19 09:32:30 -06:00
Rob Landley
dbbd3d6e48 Doing math on void pointers isn't portable, reported by Nathan McSween. 2013-12-08 13:26:05 -06:00
Rob Landley
b5e74165d1 Oops, cleaned up ifconfig uses atolx_range() instead of get_int_list(). Check that in. 2013-11-28 21:11:34 -06:00
Rob Landley
5ec4ab3113 Add xgetpwnam() to lib/xwrap.c. 2013-11-28 21:06:15 -06:00
Rob Landley
9e44a5841f Move xgetpwuid() and xgetgrgid() into xwrap.c 2013-11-28 20:18:04 -06:00
Rob Landley
35b40be7aa du from Ashwini Sharma. 2013-11-10 18:23:19 -06:00
Rob Landley
34b91a97ee Break out lib/pending.h from lib/lib.h. 2013-11-10 18:20:16 -06:00
Rob Landley
10bdaa4227 Tweak terminal_size to never set either to 0, and return true/false whether it could determine at least one coordinate.
(If you set $COLUMNS but not $ROWS, we assume you're happy with the 80x25 default for the other.)
2013-11-07 09:04:50 -06:00
Rob Landley
938b830aba Fix off by one, pointed out by Ashwini Sharma. 2013-11-03 17:09:33 -06:00
Rob Landley
3704f826b4 Give xstrncpy() a more informative error message. 2013-11-02 14:24:54 -05:00
Rob Landley
98c322e881 Merge toynet.h into toys.h: musl supports it and micromanaging uClibc config options isn't very interesting anymore. 2013-11-02 14:24:33 -05:00
Rob Landley
c9cc530371 Refactor terminal querying. 2013-10-27 00:02:56 -05:00
Rob Landley
3403742655 Minor lib/password.c cleanup, described on the list. (Inline two functions.) 2013-10-16 20:01:46 -05:00
Rob Landley
d0f7935f63 Prep work for useradd by Ashwini Sharma. 2013-10-16 19:30:17 -05:00
Rob Landley
04051858fc Whitespace tweaks and remove unused variable. 2013-10-06 16:02:20 -05:00
Rob Landley
507026bca2 It's not a problem to exactly fill up the buffer with a run if the next symbol is the terminating symbol. Fixes https://jira.cyanogenmod.org/browse/CYAN-1896 2013-10-06 17:35:57 -05:00
Rob Landley
c705b95cef Tweak args (yank old + that never worked, rename | to +), and add uname -o as a synonym for -s. 2013-09-21 13:46:44 -05:00
Rob Landley
dc6db1a81a Fluff out option parsing documentation, add another DEBUG test. 2013-09-21 12:24:04 -05:00
Rob Landley
bc382bed73 Fix -t c0 and -J as reported by heehooman at gmail on the list.
Also fix up help text, and hook up -c.
2013-09-16 23:41:51 -05:00
Rob Landley
cd0b70e739 Ah, that's why commit 1057 was skipped last pull: it was unfinished. Oops. (Fix it.) 2013-09-11 12:09:53 -05:00
Rob Landley
e3e80849a6 Remove two unused functions and shrink another. 2013-09-10 01:01:35 -05:00
Rob Landley
bb215e4a1f Adjust patch to use dlist_pop() 2013-09-09 05:26:52 -05:00
Rob Landley
5f57bccc41 Redo tail closer to the original design. Add more tests for large data sets. (Still no -f support yet.) 2013-09-09 04:26:03 -05:00
Rob Landley
9d4cd46b82 Fix [-group] argument dropping. 2013-09-09 02:44:02 -05:00
Rob Landley
7d64dae54b Replace for_each_pid_with_name_in_array_perform_callback_function_upon_translated_value() with name_to_pid(), comparing absolute paths or just basename() consistently as spotted by Lukasz Skalski, and adjust callers. 2013-09-03 18:43:32 -05:00
Rob Landley
12c8814cc5 Ashwini Sharma submitted route.c, adding it to pending. 2013-09-06 12:21:28 -05:00
Rob Landley
c8a49971cb Make [-abc] exclude logic clear argument slots when disabling options. 2013-09-06 12:18:46 -05:00
Rob Landley
46e8e1dcb3 Fix for xpidfile spotted by Felix Janda. 2013-09-06 04:45:36 -05:00
Rob Landley
8fdcfdb447 Introduce libbuf analogous to toybuf but for use by lib/*.c. Change readfile() semantics to be able to read into an existing buffer, or malloc its own if that's NULL. 2013-09-03 17:56:28 -05:00
Rob Landley
f538f420de Remove itoa/utoa, let libc do this with sprintf. 2013-09-03 08:30:47 -05:00
Rob Landley
b7162a47e7 Improve --longopt parsing: general bugfixes, better error reporting, new ; option for optional arguments only suppliable with =. 2013-09-01 07:50:32 -05:00
Rob Landley
42adb7a56b Allow getmountlist to read fstab too. 2013-08-30 17:34:24 -05:00
Rob Landley
d04dc1feb9 Add scripts/single.sh to build individual non-multiplexed standalone commands.
Alas, you can't quite do this yet:

  make defconfig
  make
  for i in $(./toybox)
  do
    echo $i
    PREFIX=singles/ scripts/single.sh $i || break
  done

Because the OLDTOY() aliases for commands won't build without the base command.
And I can't just skip them because chown/chmod or mv/cp aren't the same thing.
2013-08-30 01:53:31 -05:00
Rob Landley
455865a837 Rewrite pmap to be simpler and match other implementation's output more closely. 2013-08-27 23:48:54 -05:00
Felix Janda
dccfb2a9c1 syslogd: cleanup
- fix bugs introduced in the cleanups
- inline addrfds() and open_unix_socks() and simplify them
- use xpidfile()
- remove isNetwork from struct logfile
- invert the meaning of facility and level in struct logfile so
  that they are automatically correctly initialized
- fix memory leak regarding the filenames of logfiles
- TT.sd was unused
2013-08-26 21:55:33 +02:00
Rob Landley
100fb23994 Remove files du no longer needs. 2013-08-18 04:12:51 -05:00
Felix Janda
e49fe14705 Add daemonize function to lib for klogd and syslogd 2013-08-10 20:18:18 +02:00
Rob Landley
035f27ae4d Achille Fouilleul pointed out that fdlength wasn't returning the right length in the binary search case.
(This code was originally written for mke2fs, and applies to block devices. The regular file case should just return the length from stat. The ioctl is left commented out in case I want to add back code to check the size of CDROMs without spinning them up again; not sure the sector size is always right these days.)
2013-08-08 02:46:45 -05:00
Rob Landley
1aa75118c4 Forgot to check in xfdopen(). My bad.
Failure of fdopen() is most likely failure of malloc() for the FILE structure.
2013-08-07 12:19:51 -05:00
Rob Landley
9e89d47a29 Cleanup renice and implement '|' (required option) in argument parsing. 2013-07-31 03:24:58 -05:00
Rob Landley
bb504f382d Start of TOYBOX_SINGLE support, for building standalone commands with no multiplexer. 2013-07-19 02:03:02 -05:00