From f8294bed64126df0043e157d693267b5ce31ee4e Mon Sep 17 00:00:00 2001 From: "R. Steve McKown" Date: Fri, 28 Sep 2012 12:47:33 -0600 Subject: [PATCH] Add help option, expand test option to normal and detail --- repo_shell.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/repo_shell.c b/repo_shell.c index 4a6dd2b..7d34e57 100644 --- a/repo_shell.c +++ b/repo_shell.c @@ -179,6 +179,17 @@ int main(int argc, char **argv) die("opening /dev/null failed"); close (devnull_fd); + if (argc == 2 && (!strcmp(argv[1], "-h") || !strcmp(argv[1], "--help"))) { + fprintf(stderr, "%s is a replacement login shell.\n" + " May be ran from the command line with one of these options:\n" + " -h|--help this text\n" + " -v|--version program version string\n" + " -t|--test test access\n" + " -d|--detail test access, outputting more detail\n" + , argv[0]); + return 0; + } + if (argc == 2 && (!strcmp(argv[1], "-v") || !strcmp(argv[1], "--version"))) { fprintf(stderr, "%s\n", version); return 0; @@ -200,11 +211,11 @@ int main(int argc, char **argv) return 1; } - if ((!strcmp(argv[1], "-t") || !strcmp(argv[1], "--test"))) { + if ((!strcmp(argv[1], "-d") || !strcmp(argv[1], "--detail"))) { perms_t p; if (argc !=4) - die("usage: %s -t|--test ", argv[0]); + die("usage: %s -d|--detail ", argv[0]); p = git_acl(argv[2], argv[3], cfg.git_acl_file); fprintf(stderr, "user '%s' repo '%s' perms '%s'\n via userid '%s' repoid '%s'\n", @@ -213,11 +224,11 @@ int main(int argc, char **argv) return 0; } - if ((!strcmp(argv[1], "-c") || !strcmp(argv[1], "--check"))) { + if ((!strcmp(argv[1], "-t") || !strcmp(argv[1], "--test"))) { perms_t p; if (argc !=4) - die("usage: %s -c|--check ", argv[0]); + die("usage: %s -t|--test ", argv[0]); p = git_acl(argv[2], argv[3], cfg.git_acl_file); printf("%s\n", git_acl_perms_as_str(p)); return 0; -- 2.39.2