Message ID | 20230531013224.1135775-1-yamato@redhat.com (mailing list archive) |
---|---|
State | Accepted |
Commit | 5045368da367 |
Delegated to: | Petr Lautrbach |
Headers | show |
Series | [1/4] dismod: add --help option | expand |
On Tue, May 30, 2023 at 9:36 PM Masatake YAMATO <yamato@redhat.com> wrote: > > Signed-off-by: Masatake YAMATO <yamato@redhat.com> It might make sense to add the actions option to dispol as well, but I am not sure how much dismod and dispol are actually used. For these four patches: Acked-by: James Carter <jwcart2@gmail.com> > --- > checkpolicy/test/dismod.c | 8 ++++++-- > 1 file changed, 6 insertions(+), 2 deletions(-) > > diff --git a/checkpolicy/test/dismod.c b/checkpolicy/test/dismod.c > index 929ee308..eb090a36 100644 > --- a/checkpolicy/test/dismod.c > +++ b/checkpolicy/test/dismod.c > @@ -66,7 +66,11 @@ static const char *symbol_labels[9] = { > > static __attribute__((__noreturn__)) void usage(const char *progname) > { > - printf("usage: %s binary_pol_file\n\n", progname); > + puts("Usage:"); > + printf(" %s [OPTIONS] binary_pol_file\n\n", progname); > + puts("Options:"); > + puts(" -h, --help print this help message"); > + puts("\n"); > exit(1); > } > > @@ -872,7 +876,7 @@ int main(int argc, char **argv) > FILE *out_fp = stdout; > char ans[81], OutfileName[121]; > > - if (argc != 2) > + if (argc < 2 || strcmp(argv[1], "-h") == 0 || strcmp(argv[1], "--help") == 0) > usage(argv[0]); > > /* read the binary policy */ > -- > 2.40.1 >
> On Tue, May 30, 2023 at 9:36 PM Masatake YAMATO <yamato@redhat.com> wrote: >> >> Signed-off-by: Masatake YAMATO <yamato@redhat.com> > > It might make sense to add the actions option to dispol as well, but I > am not sure how much dismod and dispol are actually used. See https://serverfault.com/questions/321301/how-do-i-view-the-contents-of-a-selinux-policy-package The page is viewed 40K tiems. There are alwasy some people interested in the backyard of technoogy. Masatake YAMATO > > For these four patches: > Acked-by: James Carter <jwcart2@gmail.com> > >> --- >> checkpolicy/test/dismod.c | 8 ++++++-- >> 1 file changed, 6 insertions(+), 2 deletions(-) >> >> diff --git a/checkpolicy/test/dismod.c b/checkpolicy/test/dismod.c >> index 929ee308..eb090a36 100644 >> --- a/checkpolicy/test/dismod.c >> +++ b/checkpolicy/test/dismod.c >> @@ -66,7 +66,11 @@ static const char *symbol_labels[9] = { >> >> static __attribute__((__noreturn__)) void usage(const char *progname) >> { >> - printf("usage: %s binary_pol_file\n\n", progname); >> + puts("Usage:"); >> + printf(" %s [OPTIONS] binary_pol_file\n\n", progname); >> + puts("Options:"); >> + puts(" -h, --help print this help message"); >> + puts("\n"); >> exit(1); >> } >> >> @@ -872,7 +876,7 @@ int main(int argc, char **argv) >> FILE *out_fp = stdout; >> char ans[81], OutfileName[121]; >> >> - if (argc != 2) >> + if (argc < 2 || strcmp(argv[1], "-h") == 0 || strcmp(argv[1], "--help") == 0) >> usage(argv[0]); >> >> /* read the binary policy */ >> -- >> 2.40.1 >> >
On Wed, Jun 7, 2023 at 9:22 AM James Carter <jwcart2@gmail.com> wrote: > > On Tue, May 30, 2023 at 9:36 PM Masatake YAMATO <yamato@redhat.com> wrote: > > > > Signed-off-by: Masatake YAMATO <yamato@redhat.com> > > It might make sense to add the actions option to dispol as well, but I > am not sure how much dismod and dispol are actually used. > > For these four patches: > Acked-by: James Carter <jwcart2@gmail.com> > These four patches have been merged. Thanks, Jim > > --- > > checkpolicy/test/dismod.c | 8 ++++++-- > > 1 file changed, 6 insertions(+), 2 deletions(-) > > > > diff --git a/checkpolicy/test/dismod.c b/checkpolicy/test/dismod.c > > index 929ee308..eb090a36 100644 > > --- a/checkpolicy/test/dismod.c > > +++ b/checkpolicy/test/dismod.c > > @@ -66,7 +66,11 @@ static const char *symbol_labels[9] = { > > > > static __attribute__((__noreturn__)) void usage(const char *progname) > > { > > - printf("usage: %s binary_pol_file\n\n", progname); > > + puts("Usage:"); > > + printf(" %s [OPTIONS] binary_pol_file\n\n", progname); > > + puts("Options:"); > > + puts(" -h, --help print this help message"); > > + puts("\n"); > > exit(1); > > } > > > > @@ -872,7 +876,7 @@ int main(int argc, char **argv) > > FILE *out_fp = stdout; > > char ans[81], OutfileName[121]; > > > > - if (argc != 2) > > + if (argc < 2 || strcmp(argv[1], "-h") == 0 || strcmp(argv[1], "--help") == 0) > > usage(argv[0]); > > > > /* read the binary policy */ > > -- > > 2.40.1 > >
diff --git a/checkpolicy/test/dismod.c b/checkpolicy/test/dismod.c index 929ee308..eb090a36 100644 --- a/checkpolicy/test/dismod.c +++ b/checkpolicy/test/dismod.c @@ -66,7 +66,11 @@ static const char *symbol_labels[9] = { static __attribute__((__noreturn__)) void usage(const char *progname) { - printf("usage: %s binary_pol_file\n\n", progname); + puts("Usage:"); + printf(" %s [OPTIONS] binary_pol_file\n\n", progname); + puts("Options:"); + puts(" -h, --help print this help message"); + puts("\n"); exit(1); } @@ -872,7 +876,7 @@ int main(int argc, char **argv) FILE *out_fp = stdout; char ans[81], OutfileName[121]; - if (argc != 2) + if (argc < 2 || strcmp(argv[1], "-h") == 0 || strcmp(argv[1], "--help") == 0) usage(argv[0]); /* read the binary policy */
Signed-off-by: Masatake YAMATO <yamato@redhat.com> --- checkpolicy/test/dismod.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)