5 static int do_generic_cmd(const char *me
, char *arg
)
7 const char *my_argv
[4];
9 if (!arg
|| !(arg
= sq_dequote(arg
)))
11 if (strncmp(me
, "git-", 4))
18 return execv_git_cmd((char**) my_argv
);
21 static struct commands
{
23 int (*exec
)(const char *me
, char *arg
);
25 { "git-receive-pack", do_generic_cmd
},
26 { "git-upload-pack", do_generic_cmd
},
30 int main(int argc
, char **argv
)
35 /* We want to see "-c cmd args", and nothing else */
36 if (argc
!= 3 || strcmp(argv
[1], "-c"))
37 die("What do you think I am? A shell?");
42 for (cmd
= cmd_list
; cmd
->name
; cmd
++) {
43 int len
= strlen(cmd
->name
);
45 if (strncmp(cmd
->name
, prog
, len
))
58 exit(cmd
->exec(cmd
->name
, arg
));
60 die("unrecognized command '%s'", prog
);