[hackers] [sbase] tr(1): Show an error when classes and non-classes are mixed || FRIGN

From: <git_AT_suckless.org>
Date: Mon, 20 Apr 2015 21:41:16 +0200 (CEST)

commit 7be2449aa9281c072dc2de33a8818a548dc40ad2
Author: FRIGN <dev_AT_frign.de>
Date: Mon Apr 20 21:38:46 2015 +0200

    tr(1): Show an error when classes and non-classes are mixed

diff --git a/tr.c b/tr.c
index 9ec9640..38ea6a3 100644
--- a/tr.c
+++ b/tr.c
_AT_@ -197,6 +197,8 @@ main(int argc, char *argv[])
                 set2ranges = makeset(argv[1], &set2, &set2check);
         if (dflag == sflag && !set2ranges && !set2check)
                 eprintf("set2 must be non-empty.\n");
+ if (argc == 2 && !set2check != !set1check)
+ eprintf("can't mix classes with non-classes.\n");
         if (set2check && set2check != islowerrune && set2check != isupperrune)
                 eprintf("set2 can only be the 'lower' or 'upper' class.\n");
         if (set2check && cflag && !dflag)
Received on Mon Apr 20 2015 - 21:41:16 CEST

This archive was generated by hypermail 2.3.0 : Mon Apr 20 2015 - 21:48:12 CEST