1 #include "git-compat-util.h"
2 #include "run-command.h"
5 int cmd_main(int argc
, const char **argv
)
7 const char *trash_directory
= getenv("TRASH_DIRECTORY");
8 struct strbuf buf
= STRBUF_INIT
;
11 const char *child_argv
[] = { NULL
, NULL
};
13 /* First, print all parameters into $TRASH_DIRECTORY/ssh-output */
15 die("Need a TRASH_DIRECTORY!");
16 strbuf_addf(&buf
, "%s/ssh-output", trash_directory
);
17 f
= fopen(buf
.buf
, "w");
19 die("Could not write to %s", buf
.buf
);
20 for (i
= 0; i
< argc
; i
++)
21 fprintf(f
, "%s%s", i
> 0 ? " " : "", i
> 0 ? argv
[i
] : "ssh:");
25 /* Now, evaluate the *last* parameter */
28 child_argv
[0] = argv
[argc
- 1];
29 return run_command_v_opt(child_argv
, RUN_USING_SHELL
);