* 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)
{
if (!noprint)
printf("%s\t%s\n", path, buf);
else
- printf("%s\n", buf);
+ puts(buf);
freecon(buf);
return 0;
#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;
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) {
bb_perror_msg_and_die("error while processing %s", prefix);
}
- while((path = *argv++) != NULL) {
+ while ((path = *argv++) != NULL) {
security_context_t con;
int rc;