4 static int do_generic_cmd(const char *me
, char *arg
)
6 const char *my_argv
[4];
8 if (!arg
|| !(arg
= sq_dequote(arg
)))
15 return execvp(me
, (char**) my_argv
);
18 static struct commands
{
20 int (*exec
)(const char *me
, char *arg
);
22 { "git-receive-pack", do_generic_cmd
},
23 { "git-upload-pack", do_generic_cmd
},
27 int main(int argc
, char **argv
)
32 /* We want to see "-c cmd args", and nothing else */
33 if (argc
!= 3 || strcmp(argv
[1], "-c"))
34 die("What do you think I am? A shell?");
39 for (cmd
= cmd_list
; cmd
->name
; cmd
++) {
40 int len
= strlen(cmd
->name
);
42 if (strncmp(cmd
->name
, prog
, len
))
55 exit(cmd
->exec(cmd
->name
, arg
));
57 die("unrecognized command '%s'", prog
);