Skip to content
Snippets Groups Projects
Commit e6ef17db authored by Moe Jette's avatar Moe Jette
Browse files

Set job's default name to that of the executable.

parent ba2c3473
No related branches found
No related tags found
No related merge requests found
......@@ -283,6 +283,9 @@ static void opt_args(int, char **);
*/
static bool opt_verify(poptContext, bool, bool, bool);
/* return command name from its full path name */
static char * base_name(char* command);
/* list known options and their settings
*/
#if __DEBUG
......@@ -365,6 +368,27 @@ static enum distribution_t verify_dist_type(const char *arg)
return result;
}
/* return command name from its full path name */
char * base_name(char* command)
{
char *char_ptr, *name;
int i;
if (command == NULL)
return NULL;
char_ptr = strrchr(command, (int)'/');
if (char_ptr == NULL)
char_ptr = command;
else
char_ptr++;
i = strlen(char_ptr);
name = xmalloc(i+1);
strcpy(name, char_ptr);
return name;
}
/*
* to_bytes(): verify that arg is numeric with optional "G" or "M" at end
* if "G" or "M" is there, multiply by proper power of 2 and return
......@@ -493,7 +517,7 @@ static void opt_default()
opt.time_limit = -1;
opt.partition = NULL;
opt.job_name = "";
opt.job_name = NULL;
opt.distribution = SRUN_DIST_BLOCK;
......@@ -823,6 +847,9 @@ opt_verify(poptContext optctx,
verified = false;
}
if ((opt.job_name == NULL) && (remote_argc > 0))
opt.job_name = base_name(remote_argv[0]);
if (mode == MODE_ATTACH) { /* attach to a running job */
if (nodes_set || cpus_set || procs_set) {
error("do not specific a node allocation "
......@@ -1031,7 +1058,6 @@ print_commandline()
return xstrdup(buf);
}
#define tf_(b) (b == true) ? "true" : "false"
static
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment