1e026a48cSDavid E. O'Brien #include <sys/cdefs.h> 2e026a48cSDavid E. O'Brien __FBSDID("$FreeBSD$"); 362f882d6SWarner Losh 459f31bb2SBrooks Davis /* 559f31bb2SBrooks Davis * This material, written by Henry Spencer, was released by him 659f31bb2SBrooks Davis * into the public domain and is thus not subject to any copyright. 759f31bb2SBrooks Davis */ 859f31bb2SBrooks Davis 9*cd1693d3SConrad Meyer #include <capsicum_helpers.h> 10*cd1693d3SConrad Meyer #include <err.h> 11*cd1693d3SConrad Meyer #include <errno.h> 12b37b9a6dSNate Williams #include <stdio.h> 13821df508SXin LI #include <stdlib.h> 1462f882d6SWarner Losh #include <unistd.h> 15b37b9a6dSNate Williams 16b2688868SDavid Malone int 17f4ac32deSDavid Malone main(int argc, char *argv[]) 18b37b9a6dSNate Williams { 19b37b9a6dSNate Williams int c; 20b37b9a6dSNate Williams int status = 0; 21b37b9a6dSNate Williams 22*cd1693d3SConrad Meyer if (caph_limit_stdio() < 0 || (cap_enter() < 0 && errno != ENOSYS)) 23*cd1693d3SConrad Meyer err(1, "capsicum"); 24*cd1693d3SConrad Meyer 25b37b9a6dSNate Williams optind = 2; /* Past the program name and the option letters. */ 261c8af878SWarner Losh while ((c = getopt(argc, argv, argv[1])) != -1) 27b37b9a6dSNate Williams switch (c) { 28b37b9a6dSNate Williams case '?': 29b37b9a6dSNate Williams status = 1; /* getopt routine gave message */ 30b37b9a6dSNate Williams break; 31b37b9a6dSNate Williams default: 32b37b9a6dSNate Williams if (optarg != NULL) 330ab2a7aeSMartin Cracauer printf(" -%c %s", c, optarg); 34b37b9a6dSNate Williams else 35b37b9a6dSNate Williams printf(" -%c", c); 36b37b9a6dSNate Williams break; 37b37b9a6dSNate Williams } 38b37b9a6dSNate Williams printf(" --"); 39b37b9a6dSNate Williams for (; optind < argc; optind++) 40b37b9a6dSNate Williams printf(" %s", argv[optind]); 41b37b9a6dSNate Williams printf("\n"); 426c28b67bSMark Murray return status; 43b37b9a6dSNate Williams } 44