On Sat, Apr 12, 2014 at 9:31 AM, Silvan Jegen <s.je...@gmail.com> wrote: > On Fri, Apr 11, 2014 at 11:17:53PM +0100, sin wrote: >> On Fri, Apr 11, 2014 at 09:07:10PM +0200, Silvan Jegen wrote: >> > I can see the need for a '-d' flag for compatibility reasons but my >> > preference would be to just ignore the flag if it is specified. What are >> > peoples opinion on the '-d' flag? >> >> One thing that is different is the breaking conditions for when to consider >> the invocation as invalid usage (in the -d case we check for >= 2 in >> any other case we check for != 2). So in that case we cannot consider -d >> as a no-op as far as I uderstand it. > > I have a patch in the pipeline that will adjust the usage checks. I will > submit it if we decide to change the behavior. >
OK I changed the behaviour to how it was: If one argument is specified or the dflag is specified: use delete. If the dflag is specified but argc != 1, show usage. For translate 2 arguments should be specified else usage information will be shown. Does this seem OK to you? Then sin or me will commit it. I'm working on updating the man pages for tr and other tools and the TODO file, so don't worry about that :) I'll also probably rewrite the mmap code to use malloc since it causes issues on some machines. Thanks and kind regards, Hiltjo
From f40a0b2bae3cb089dae3dc7b1536a2168189c1e5 Mon Sep 17 00:00:00 2001 From: Hiltjo Posthuma <hil...@codemadness.org> Date: Sat, 12 Apr 2014 12:56:56 +0200 Subject: [PATCH] tr: change delete behaviour when one argument is specified use delete behaviour again Signed-off-by: Hiltjo Posthuma <hil...@codemadness.org> --- tr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tr.c b/tr.c index aad2245..32e805a 100644 --- a/tr.c +++ b/tr.c @@ -137,8 +137,8 @@ main(int argc, char *argv[]) if(argc == 0) usage(); - if(dflag) { - if(argc >= 2) + if(dflag || argc == 1) { + if(argc != 1) usage(); parsemapping(argv[0], NULL, mappings); mapfunc = maptonull; -- 1.9.2