ip link: add VLAN support
[oweals/busybox.git] / selinux / matchpathcon.c
index 83ea75d473cdc22983a8d2a501947e00a4fe10a8..9e5728eb3b8c31aa6a2ad79ed63af7b8b01b0cdb 100644 (file)
@@ -3,8 +3,19 @@
  *                  based on libselinux-1.32
  * Port to busybox: KaiGai Kohei <kaigai@kaigai.gr.jp>
  *
+ * Licensed under GPLv2, see file LICENSE in this source tree.
  */
-#include "busybox.h"
+
+//usage:#define matchpathcon_trivial_usage
+//usage:       "[-n] [-N] [-f file_contexts_file] [-p prefix] [-V]"
+//usage:#define matchpathcon_full_usage "\n\n"
+//usage:       "       -n      Don't display path"
+//usage:     "\n       -N      Don't use translations"
+//usage:     "\n       -f      Use alternate file_context file"
+//usage:     "\n       -p      Use prefix to speed translations"
+//usage:     "\n       -V      Verify file context on disk matches defaults"
+
+#include "libbb.h"
 
 static int print_matchpathcon(char *path, int noprint)
 {
@@ -17,7 +28,7 @@ static int print_matchpathcon(char *path, int noprint)
        if (!noprint)
                printf("%s\t%s\n", path, buf);
        else
-               printf("%s\n", buf);
+               puts(buf);
 
        freecon(buf);
        return 0;
@@ -29,8 +40,8 @@ static int print_matchpathcon(char *path, int noprint)
 #define OPT_PREFIX      (1<<3)  /* -p */
 #define OPT_VERIFY      (1<<4)  /* -V */
 
-int matchpathcon_main(int argc, char **argv);
-int matchpathcon_main(int argc, char **argv)
+int matchpathcon_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
+int matchpathcon_main(int argc UNUSED_PARAM, char **argv)
 {
        int error = 0;
        unsigned opts;
@@ -38,7 +49,7 @@ int matchpathcon_main(int argc, char **argv)
 
        opt_complementary = "-1" /* at least one param reqd */
                ":?:f--p:p--f"; /* mutually exclusive */
-       opts = getopt32(argc, argv, "nNf:p:V", &fcontext, &prefix);
+       opts = getopt32(argv, "nNf:p:V", &fcontext, &prefix);
        argv += optind;
 
        if (opts & OPT_NOT_TRANS) {
@@ -53,7 +64,7 @@ int matchpathcon_main(int argc, char **argv)
                        bb_perror_msg_and_die("error while processing %s", prefix);
        }
 
-       while((path = *argv++) != NULL) {
+       while ((path = *argv++) != NULL) {
                security_context_t con;
                int rc;