* %e = executable
* %g = gid
* %h = hostname
+ * %H = short hostname
* %j = jobid from environment
* %p = pid
* %u = uid
char c;
while ((c = *jobfmt++) && joblen > 1) {
- char f;
+ char f, *p;
int l;
if (isspace(c)) /* Don't allow embedded spaces */
*jobid = c;
joblen--;
jobid++;
+ *jobid = '\0';
continue;
}
l = snprintf(jobid, joblen, "%s",
init_utsname()->nodename);
break;
+ case 'H': /* short hostname. Cut at first dot */
+ l = snprintf(jobid, joblen, "%s",
+ init_utsname()->nodename);
+ p = strnchr(jobid, joblen, '.');
+ if (p) {
+ *p = '\0';
+ l = p - jobid;
+ }
+ break;
case 'j': /* jobid stored in process environment */
l = jobid_get_from_cache(jobid, joblen);
if (l < 0)