Adds the "-i" flag, which prints the version and
architecture identifier of the regular expression back end.

Signed-off-by: Janis Danisevskis <[email protected]>
---
 libselinux/utils/sefcontext_compile.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/libselinux/utils/sefcontext_compile.c 
b/libselinux/utils/sefcontext_compile.c
index d91db9a..8c48d32 100644
--- a/libselinux/utils/sefcontext_compile.c
+++ b/libselinux/utils/sefcontext_compile.c
@@ -280,6 +280,11 @@ static void usage(const char *progname)
            "         (PCRE2 only. Compiled PCRE2 regular expressions are\n\t"
            "         not portable across architectures. When linked 
against\n\t"
            "         PCRE this flag is ignored)\n\t"
+           "-i       Print regular expression info end exit. That is, back\n\t"
+           "         end version and architecture identifier.\n\t"
+           "         Arch identifier format (PCRE2):\n\t"
+           "         <pointer width>-<size type width>-<endianness>, e.g.,\n\t"
+           "         \"8-8-el\" for x86_64.\n\t"
            "fc_file  The text based file contexts file to be processed.\n",
            progname);
                exit(EXIT_FAILURE);
@@ -301,7 +306,7 @@ int main(int argc, char *argv[])
        if (argc < 2)
                usage(argv[0]);
 
-       while ((opt = getopt(argc, argv, "o:p:r")) > 0) {
+       while ((opt = getopt(argc, argv, "io:p:r")) > 0) {
                switch (opt) {
                case 'o':
                        out_file = optarg;
@@ -312,6 +317,10 @@ int main(int argc, char *argv[])
                case 'r':
                        do_write_precompregex = 1;
                        break;
+               case 'i':
+                       printf("%s (%s)\n", regex_version(),
+                                       regex_arch_string());
+                       return 0;
                default:
                        usage(argv[0]);
                }
-- 
2.8.0.rc3.226.g39d4020

_______________________________________________
Seandroid-list mailing list
[email protected]
To unsubscribe, send email to [email protected].
To get help, send an email containing "help" to 
[email protected].

Reply via email to