1 #include <unistd.h> 2 #include <stdlib.h> 3 #include <stdio.h> 4 #include <getopt.h> 5 #include <errno.h> 6 #include <string.h> 7 #include <selinux/selinux.h> 8 #include "mcstrans.h" 9 10 void usage(const char *progname) 11 { 12 fprintf(stderr, "usage: %s context\n", progname); 13 exit(1); 14 } 15 16 int main(int argc, char **argv) { 17 security_context_t scon; 18 if ( argc != 2 ) usage(argv[0]); 19 if (init_translations()==0) { 20 if(trans_context(argv[1],&scon) == 0) { 21 printf("%s\n", scon); 22 freecon(scon); 23 return 0; 24 } 25 } 26 printf("Failed\n"); 27 return -1; 28 } 29 30 31