4 static int do_generic_cmd(const char *me
, char *arg
)
6 const char *my_argv
[4];
16 return execvp(me
, (char**) my_argv
);
19 static struct commands
{
21 int (*exec
)(const char *me
, char *arg
);
23 { "git-receive-pack", do_generic_cmd
},
24 { "git-upload-pack", do_generic_cmd
},
28 int main(int argc
, char **argv
)
33 /* We want to see "-c cmd args", and nothing else */
34 if (argc
!= 3 || strcmp(argv
[1], "-c"))
35 die("What do you think I am? A shell?");
40 for (cmd
= cmd_list
; cmd
->name
; cmd
++) {
41 int len
= strlen(cmd
->name
);
43 if (strncmp(cmd
->name
, prog
, len
))
56 exit(cmd
->exec(cmd
->name
, arg
));
58 die("unrecognized command '%s'", prog
);