6 static int do_generic_cmd(const char *me, char *arg)
8 const char *my_argv[4];
10 if (!arg || !(arg = sq_dequote(arg)))
12 if (prefixcmp(me, "git-"))
19 return execv_git_cmd(my_argv);
22 static int do_cvs_cmd(const char *me, char *arg)
24 const char *cvsserver_argv[3] = {
25 "cvsserver", "server", NULL
28 if (!arg || strcmp(arg, "server"))
29 die("git-cvsserver only handles server: %s", arg);
33 return execv_git_cmd(cvsserver_argv);
37 static struct commands {
39 int (*exec)(const char *me, char *arg);
41 { "git-receive-pack", do_generic_cmd },
42 { "git-upload-pack", do_generic_cmd },
43 { "cvs", do_cvs_cmd },
47 int main(int argc, char **argv)
52 if (argc == 2 && !strcmp(argv[1], "cvs server"))
54 /* We want to see "-c cmd args", and nothing else */
55 else if (argc != 3 || strcmp(argv[1], "-c"))
56 die("What do you think I am? A shell?");
61 for (cmd = cmd_list ; cmd->name ; cmd++) {
62 int len = strlen(cmd->name);
64 if (strncmp(cmd->name, prog, len))
77 exit(cmd->exec(cmd->name, arg));
79 die("unrecognized command '%s'", prog);