To comply with SUSv3, duplicate the variable contents for each given format,

so that multiple -ovar=header lines do not overwrite eachother.

This means that ps -ouser=USERNAME -ouser=WHO would now possibly print:
USERNAME WHO
juli     juli

Whereas before it would be:
WHO WHO
juli juli
This commit is contained in:
Juli Mallett 2002-06-05 01:58:36 +00:00
parent 05051e2898
commit 6d041cc856

View File

@ -246,7 +246,10 @@ parsefmt(const char *p)
continue;
if ((vent = malloc(sizeof(struct varent))) == NULL)
err(1, NULL);
vent->var = v;
vent->var = malloc(sizeof(*vent->var));
if (vent->var == NULL)
err(1, NULL);
memcpy(vent->var, v, sizeof(*vent->var));
vent->next = NULL;
if (vhead == NULL)
vhead = vtail = vent;