]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
lsfd: remove --source option
authorMasatake YAMATO <yamato@redhat.com>
Wed, 20 Oct 2021 13:29:45 +0000 (22:29 +0900)
committerMasatake YAMATO <yamato@redhat.com>
Thu, 21 Oct 2021 12:10:46 +0000 (21:10 +0900)
-Q '(SOURCE == ...)' works well for the same purpose.
See https://github.com/karelzak/util-linux/pull/1418#issuecomment-945643880

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
misc-utils/lsfd.c

index 247c678ee03358906c4aafeef5a439ca14486548..3d27466e78434e57265994531cd2a08405f8656e 100644 (file)
@@ -991,7 +991,6 @@ static void __attribute__((__noreturn__)) usage(void)
        fputs(_("     --sysroot <dir>   use specified directory as system root\n"), out);
        fputs(_(" -u, --notruncate      don't truncate text in columns\n"), out);
        fputs(_(" -Q, --filter <expr>   apply display filter\n"), out);
-       fputs(_("     --source <source> add filter by SOURCE\n"), out);
        fputs(_("     --debug-filter    dump the innternal data structure of filter and exit\n"), out);
 
        fputs(USAGE_SEPARATOR, out);
@@ -1023,28 +1022,6 @@ static void xstrputc(char **a, char c)
        xstrappend(a, b);
 }
 
-static char * quote_filter_expr(char *expr)
-{
-       char c[] = {'\0', '\0'};
-       char *r = strdup("");
-       while (*expr) {
-               switch (*expr) {
-               case '\'':
-                       xstrappend(&r, "\\'");
-                       break;
-               case '"':
-                       xstrappend(&r, "\\\"");
-                       break;
-               default:
-                       c[0] = *expr;
-                       xstrappend(&r, c);
-                       break;
-               }
-               expr++;
-       }
-       return r;
-}
-
 static void append_filter_expr(char **a, const char *b, bool and)
 {
        if (*a == NULL) {
@@ -1077,7 +1054,6 @@ int main(int argc, char *argv[])
 
        enum {
                OPT_SYSROOT = CHAR_MAX + 1,
-               OPT_SOURCE,
                OPT_DEBUG_FILTER,
        };
        static const struct option longopts[] = {
@@ -1091,7 +1067,6 @@ int main(int argc, char *argv[])
                { "notruncate", no_argument, NULL, 'u' },
                { "sysroot",    required_argument, NULL, OPT_SYSROOT },
                { "filter",     required_argument, NULL, 'Q' },
-               { "source",     required_argument, NULL, OPT_SOURCE },
                { "debug-filter",no_argument, NULL, OPT_DEBUG_FILTER },
                { NULL, 0, NULL, 0 },
        };
@@ -1127,17 +1102,6 @@ int main(int argc, char *argv[])
                case 'Q':
                        append_filter_expr(&filter_expr, optarg, true);
                        break;
-               case OPT_SOURCE: {
-                       char * quoted_source = quote_filter_expr(optarg);
-                       char * source_expr = NULL;
-                       xstrappend(&source_expr, "(SOURCE == '");
-                       xstrappend(&source_expr, quoted_source);
-                       xstrappend(&source_expr, "')");
-                       append_filter_expr(&filter_expr, source_expr, true);
-                       free(source_expr);
-                       free(quoted_source);
-                       break;
-               }
                case OPT_DEBUG_FILTER:
                        debug_filter = true;
                        break;