322 register Name shell = getvar(shell_name);
323 register char *shellname;
324 char *tmp_mbs_buffer;
325
326
327 if (IS_EQUAL(shell->string_mb, "")) {
328 shell = shell_name;
329 }
330 if ((shellname = strrchr(shell->string_mb, (int) slash_char)) == NULL) {
331 shellname = shell->string_mb;
332 } else {
333 shellname++;
334 }
335
336 /*
337 * Only prepend the /usr/bin/nice command to the original command
338 * if the nice priority, nice_prio, is NOT zero (0).
339 * Nice priorities can be a positive or a negative number.
340 */
341 if (nice_prio != 0) {
342 argv[argv_index++] = NOCATGETS("nice");
343 (void) sprintf(nice_prio_buf, NOCATGETS("-%d"), nice_prio);
344 argv[argv_index++] = strdup(nice_prio_buf);
345 }
346 argv[argv_index++] = shellname;
347 #if defined(linux)
348 if(0 == strcmp(shell->string_mb, (char*)NOCATGETS("/bin/sh"))) {
349 argv[argv_index++] = (char*)(ignore_error ? NOCATGETS("-c") : NOCATGETS("-ce"));
350 } else {
351 argv[argv_index++] = (char*)NOCATGETS("-c");
352 }
353 #else
354 argv[argv_index++] = (char*)(ignore_error ? NOCATGETS("-c") : NOCATGETS("-ce"));
355 #endif
356 if ((length = wslen(command)) >= MAXPATHLEN) {
357 tmp_mbs_buffer = getmem((length * MB_LEN_MAX) + 1);
358 (void) wcstombs(tmp_mbs_buffer, command, (length * MB_LEN_MAX) + 1);
359 cmd_argv_index = argv_index;
360 argv[argv_index++] = strdup(tmp_mbs_buffer);
361 retmem_mb(tmp_mbs_buffer);
362 } else {
|
322 register Name shell = getvar(shell_name);
323 register char *shellname;
324 char *tmp_mbs_buffer;
325
326
327 if (IS_EQUAL(shell->string_mb, "")) {
328 shell = shell_name;
329 }
330 if ((shellname = strrchr(shell->string_mb, (int) slash_char)) == NULL) {
331 shellname = shell->string_mb;
332 } else {
333 shellname++;
334 }
335
336 /*
337 * Only prepend the /usr/bin/nice command to the original command
338 * if the nice priority, nice_prio, is NOT zero (0).
339 * Nice priorities can be a positive or a negative number.
340 */
341 if (nice_prio != 0) {
342 argv[argv_index++] = (char *)NOCATGETS("nice");
343 (void) sprintf(nice_prio_buf, NOCATGETS("-%d"), nice_prio);
344 argv[argv_index++] = strdup(nice_prio_buf);
345 }
346 argv[argv_index++] = shellname;
347 #if defined(linux)
348 if(0 == strcmp(shell->string_mb, (char*)NOCATGETS("/bin/sh"))) {
349 argv[argv_index++] = (char*)(ignore_error ? NOCATGETS("-c") : NOCATGETS("-ce"));
350 } else {
351 argv[argv_index++] = (char*)NOCATGETS("-c");
352 }
353 #else
354 argv[argv_index++] = (char*)(ignore_error ? NOCATGETS("-c") : NOCATGETS("-ce"));
355 #endif
356 if ((length = wslen(command)) >= MAXPATHLEN) {
357 tmp_mbs_buffer = getmem((length * MB_LEN_MAX) + 1);
358 (void) wcstombs(tmp_mbs_buffer, command, (length * MB_LEN_MAX) + 1);
359 cmd_argv_index = argv_index;
360 argv[argv_index++] = strdup(tmp_mbs_buffer);
361 retmem_mb(tmp_mbs_buffer);
362 } else {
|