remake  4.3+dbg-1.5
run.h
Go to the documentation of this file.
1 /* Restart/run program. */
2 static debug_return_t
3 dbg_cmd_run(char *psz_arg)
4 {
5  char * const *ppsz_argv = (char * const *)global_argv;
6  const char *psz_make_cmd = global_argv[0];
7  printf("Changing directory to %s and restarting...\n",
9 
10  if (chdir(directory_before_chdir) == -1)
11  fprintf(stderr, "changing working directory; %s\n",
12  strerror(errno));
13 
14  if (psz_arg && strlen(psz_arg)) {
15  unsigned int len = strlen(global_argv[0]) + strlen(psz_arg) + 2;
16  char *psz_full_args = CALLOC(char, len);
17  snprintf(psz_full_args, len, "%s %s", global_argv[0], psz_arg);
18  ppsz_argv = buildargv(psz_full_args);
19  free(psz_full_args);
20  }
21  execvp (psz_make_cmd, ppsz_argv);
22  /* NOT USED: */
23  return debug_readloop;
24 }
25 
26 static void
27 dbg_cmd_run_init(unsigned int c)
28 {
29  short_command[c].func = &dbg_cmd_run;
30  short_command[c].use = _("run [ARGS]");
31  short_command[c].doc =
32  _("Run Makefile from the beginning.\n"
33  "You may specify arguments to give it.\n"
34  "With no arguments, uses arguments last specified (with \"run\")");
35 }
36 
37 /*
38  * Local variables:
39  * c-file-style: "gnu"
40  * indent-tabs-mode: nil
41  * End:
42  */
#define CALLOC(t, n)
Definition: types.h:83
const char *const * global_argv
char ** buildargv(const char *input)
debug_return_t
Definition: trace.h:32
char * directory_before_chdir
#define _(msgid)
Definition: make.h:293
Definition: trace.h:40
int errno