aboutsummaryrefslogtreecommitdiff
path: root/lib/args.c
AgeCommit message (Collapse)Author
2018-12-26Teach the argument plumbing how to do -@ for mkfs.vfatRob Landley
2018-12-17Only set FLAGS_NODASH when arguments didn't have a dash.Rob Landley
This (eventually) lets "ps ax" and "ps -ax" behave differently.
2018-10-21Add % to lib/args.c (long time in milliseconds), add xmillitime(), redoRob Landley
xparsetime() not to need floating point, adjust callers.
2018-03-14Fix last uninitialized warning.Elliott Hughes
clang is fine with the noreturn nature of error_exit, but only if we don't `if (false)` it out for non-debug builds. lib/args.c:304:18: error: variable 'temp' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized] } else if (CFG_TOYBOX_FLOAT && new->type == '.') { ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ external/toybox/generated/config.h:11:26: note: expanded from macro 'CFG_TOYBOX_FLOAT' ^ external/toybox/lib/args.c:308:19: note: uninitialized use occurs here options = --temp; ^~~~ external/toybox/lib/args.c:304:14: note: remove the 'if' if its condition is always true } else if (CFG_TOYBOX_FLOAT && new->type == '.') { ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ external/toybox/lib/args.c:255:15: note: initialize the variable 'temp' to silence this warning char *temp; ^ = NULL
2018-03-10Add a way for commands to distinguish "ps -ax" from "ps ax".Rob Landley
2017-06-05Have help_exit() give a brief "See %s --help" message instead of theRob Landley
full help text, and put it back in the args constraint failures.
2017-03-23Now that just about everything has --help, don't output help for argument errorsRob Landley
2017-01-04An option can't exclude itself, so "abc[-ab][!abc]" with "command -a -b"Rob Landley
shouldn't segfault falling off the end of the list trying to report a nonexistent error condition.
2016-07-04Now that we're using the adjusted option string, need to skip placeholders ↵Rob Landley
in [groups].
2015-12-10Expand toys.optargs to 64 bits so people adding more options to ls don't run ↵Rob Landley
out. Keep the low 32 bits of FLAG_x constants as 32 bit numbers so that at least on little endian platforms it's still normal 32 bit math outside of lib/args.c.
2015-09-11Replace toys.exithelp with help_exit() in lib.Rob Landley
2015-07-10Move comment about TOYBOX_DEBUG to start of file so it's more obvious.Rob Landley
2015-01-18Remove trailing whitespace.Rob Landley
2015-01-01Debris from flag handling rewrite: don't allow -^A to actually trigger.Rob Landley
2014-08-15Fix bug reported by Ashwini Sharma: [-abc] syntax to switch off a command forgetRob Landley
s _all_ saved command line arguments in GLOBALS(), not just for the command bein g dropped.
2013-09-21Tweak args (yank old + that never worked, rename | to +), and add uname -o ↵Rob Landley
as a synonym for -s.
2013-09-21Fluff out option parsing documentation, add another DEBUG test.Rob Landley
2013-09-09Fix [-group] argument dropping.Rob Landley
2013-09-06Make [-abc] exclude logic clear argument slots when disabling options.Rob Landley
2013-09-01Improve --longopt parsing: general bugfixes, better error reporting, new ; ↵Rob Landley
option for optional arguments only suppliable with =.
2013-07-31Cleanup renice and implement '|' (required option) in argument parsing.Rob Landley
2013-06-22Option type @ counts number of occurrences, it doesn't take an argument.Rob Landley
2013-04-30Fix bare longopts to set unique optflag bits.Rob Landley
2013-04-14Move guts of help command into show_help() in lib/help.c, with config ↵Rob Landley
TOYBOX_HELP controlling infrastructure.
2013-04-06Fix argument parsing so -- doesn't include itself in output.Rob Landley
2012-12-29Ashwini Sharma pointed out that my previous tweak to [!abc] groups still ↵Rob Landley
didn't get the error reporting right (test case "touch -d 12 -r f2 f1"). This says "no 'r' with 'd'" for that, and still shouldn't be able to fall off the end of the list (segfault) because an option can't conflict with itself (that's what the ~(1<<i) on lib/args.c line 317 is for).
2012-12-27Fix option grouping.Rob Landley
2012-11-25Fix typo.Rob Landley
2012-11-19Teach option parsing about [groups] of related options.Rob Landley
2012-11-13Reindent to two spaces per level. Remove vi: directives that haven't worked ↵Rob Landley
right in years (ubuntu broke its' vim implementation). Remove trailing spaces. Add/remove blank lines. Re-wordwrap in places. Update documentation with new coding style. The actual code should be the same afterward, this is just cosmetic refactoring.
2012-11-02Use stridx.Rob Landley
2012-07-15Genericize llist code a bit: rename llist_free() to llist_traverse(), and no ↵Rob Landley
longer accept NULL as a synonym for free.
2012-03-12Redo tail to use optargs and optionally support lseek. Add support to ↵Rob Landley
optargs and llist.c, plus add a test suite entry. Still no -f support though.
2012-02-28Add "-" type to optargs and teach tail.c to use it. Tighten up help text, ↵Rob Landley
use xzalloc() and xputc() as appropriate.
2012-02-26Teach lib/args.c that " " this option must take a _separate_ argument, so ↵Rob Landley
"kill -stop" and "kill -s top" aren't the same thing. Make kill.c use it, and remove leftover debug printfs.
2012-02-18Nathan McSween convinced me compilers that inline memset() can optimize the ↵Rob Landley
bzero case pretty well.
2012-02-03Removing unecessary allocation.Luis Felipe Strano Moraes
2012-01-29Add <>= to lib/args.c, with documentation.Rob Landley
2011-11-30Split out parse_optflaglist(), and move local variables to optflagstate.Rob Landley
2011-11-28Fix "tar cvjfC file dir", make @ not eat an argument, add debug check for ↵Rob Landley
(as yet) unsupported multi-function option (ala "x*@").
2008-07-03Teach option parsing logic that ^ means stop parsing after this option.Rob Landley
2008-06-26Option parsing: stopearly is now a ^ prefix (not +), and an option string withRob Landley
no flags auto-enables stopearly (so seq doesn't have to specify it to avoid having negative number arguments eaten by the option parsing logic).
2008-06-16Assemble '*' repeated argument list in order. Also implement '@' counter.Rob Landley
2008-05-17Fix command line option parsing so "echo -xen" actually prints "-xen". AddRob Landley
echo.test while I'm at it.
2008-05-04Fluffier error message.Rob Landley
2008-03-24Enabling debugging should not change behavior. Oops.Rob Landley
2008-02-18Add enable/disable/exclude logic, update docs.Rob Landley
2008-02-12Add toys.optc, an argv-style count for toys.optargs.Rob Landley
2008-01-20Zap toylist.h, moving contents of global structures into DEFINE_GLOBALS()Rob Landley
macros in each C file, and making generated/globals.h from that. Rename "toy" to "this" along the way to avoid toy/toys confusion.
2007-11-27Patch from Charlie Shepherd: remove extra \n from error_exit() arguments.Rob Landley