}
for (f_string_length_t i = 0; i < arguments.used; i++) {
- f_macro_string_t_new(status, fixed_arguments[i + 1], arguments.array[i].used + 1);
-
- if (F_status_is_error(status)) {
- if (name_size > 0) f_macro_string_t_delete_simple(program_name, name_size);
-
- for (f_string_length_t j = 0; j < i; j++) {
- f_macro_string_t_delete_simple(fixed_arguments[i + 1], arguments.array[j].used + 1);
- } // for
-
- return status;
- }
-
- memcpy(fixed_arguments[i + 1], arguments.array[i].string, arguments.array[i].used);
- fixed_arguments[i + 1][arguments.array[i].used] = 0;
+ fixed_arguments[i + 1] = arguments.array[i].string;
} // for
// insert the required array terminated
if (F_status_is_error(status)) {
if (name_size > 0) f_macro_string_t_delete_simple(program_name, name_size);
- for (f_string_length_t i = 0; i < arguments.used; i++) {
- f_macro_string_t_delete_simple(fixed_arguments[i + 1], arguments.array[i].used + 1);
- } // for
-
return status;
}
else if (status == F_false) {
if (name_size > 0) f_macro_string_t_delete_simple(program_name, name_size);
- for (f_string_length_t i = 0; i < arguments.used; i++) {
- f_macro_string_t_delete_simple(fixed_arguments[i + 1], arguments.array[i].used + 1);
- } // for
-
return F_status_set_error(F_file_found_not);
}
if (process_id < 0) {
if (name_size > 0) f_macro_string_t_delete_simple(program_name, name_size);
- for (f_string_length_t i = 0; i < arguments.used; i++) {
- f_macro_string_t_delete_simple(fixed_arguments[i + 1], arguments.array[i].used + 1);
- } // for
-
return F_status_set_error(F_fork);
}
if (name_size > 0) f_macro_string_t_delete_simple(program_name, name_size);
- for (f_string_length_t i = 0; i < arguments.used; i++) {
- f_macro_string_t_delete_simple(fixed_arguments[i + 1], arguments.array[i].used + 1);
- } // for
-
if (result != 0 && *result != 0) return F_status_set_error(F_failure);
return F_none;
}
for (f_string_length_t i = 0; i < arguments.used; i++) {
- f_macro_string_t_new(status, fixed_arguments[i + 1], arguments.array[i].used + 1);
-
- if (F_status_is_error(status)) {
- if (name_size > 0) f_macro_string_t_delete_simple(program_name, name_size);
-
- for (f_string_length_t j = 0; j < i; j++) {
- f_macro_string_t_delete_simple(fixed_arguments[i + 1], arguments.array[j].used + 1);
- } // for
-
- return status;
- }
-
- memcpy(fixed_arguments[i + 1], arguments.array[i].string, arguments.array[i].used);
- fixed_arguments[i + 1][arguments.array[i].used] = 0;
+ fixed_arguments[i + 1] = arguments.array[i].string;
} // for
// insert the required array terminated
if (F_status_is_error(status)) {
if (name_size > 0) f_macro_string_t_delete_simple(program_name, name_size);
- for (f_string_length_t i = 0; i < arguments.used; i++) {
- f_macro_string_t_delete_simple(fixed_arguments[i + 1], arguments.array[i].used + 1);
- } // for
-
return status;
}
else if (status == F_false) {
if (name_size > 0) f_macro_string_t_delete_simple(program_name, name_size);
- for (f_string_length_t i = 0; i < arguments.used; i++) {
- f_macro_string_t_delete_simple(fixed_arguments[i + 1], arguments.array[i].used + 1);
- } // for
-
return F_status_set_error(F_file_found_not);
}
if (process_id < 0) {
if (name_size > 0) f_macro_string_t_delete_simple(program_name, name_size);
- for (f_string_length_t i = 0; i < arguments.used; i++) {
- f_macro_string_t_delete_simple(fixed_arguments[i + 1], arguments.array[i].used + 1);
- } // for
-
return F_status_set_error(F_fork);
}
if (name_size > 0) f_macro_string_t_delete_simple(program_name, name_size);
- for (f_string_length_t i = 0; i < arguments.used; i++) {
- f_macro_string_t_delete_simple(fixed_arguments[i + 1], arguments.array[i].used + 1);
- } // for
-
if (result != 0 && *result != 0) return F_status_set_error(F_failure);
return F_none;
f_array_length_t i = 0;
for (; i < arguments.used; i++) {
- f_macro_string_t_new(status, fixed_arguments[i + 1], arguments.array[i].used + 1);
-
- if (F_status_is_error(status)) {
- for (f_array_length_t j = 0; j < i; j++) {
- f_macro_string_t_delete_simple(fixed_arguments[j + 1], arguments.array[j].used + 1);
- } // for
-
- return status;
- }
-
- memcpy(fixed_arguments[i + 1], arguments.array[i].string, arguments.array[i].used);
- fixed_arguments[i + 1][arguments.array[i].used] = 0;
+ fixed_arguments[i + 1] = arguments.array[i].string;
} // for
// insert the required array terminated
process_id = fork();
if (process_id < 0) {
- for (i = 0; i < arguments.used; i++) {
- f_macro_string_t_delete_simple(fixed_arguments[i + 1], arguments.array[i].used + 1);
- } // for
-
return F_status_set_error(F_fork);
}
if (process_id == 0) {
execvp(program_name, fixed_arguments);
- for (i = 0; i < arguments.used; i++) {
- f_macro_string_t_delete_simple(fixed_arguments[i + 1], arguments.array[i].used + 1);
- } // for
-
// according to manpages, calling _exit() is safer and should be called here instead of exit()
_exit(-1);
}
- for (i = 0; i < arguments.used; i++) {
- f_macro_string_t_delete_simple(fixed_arguments[i + 1], arguments.array[i].used + 1);
- } // for
-
// have the parent wait for the child process to finish
waitpid(process_id, result, 0);
f_array_length_t i = 0;
for (; i < arguments.used; i++) {
- f_macro_string_t_new(status, fixed_arguments[i + 1], arguments.array[i].used + 1);
-
- if (F_status_is_error(status)) {
- for (f_array_length_t j = 0; j < i; j++) {
- f_macro_string_t_delete_simple(fixed_arguments[j + 1], arguments.array[j].used + 1);
- } // for
-
- return status;
- }
-
- memcpy(fixed_arguments[i + 1], arguments.array[i].string, arguments.array[i].used);
- fixed_arguments[i + 1][arguments.array[i].used] = 0;
+ fixed_arguments[i + 1] = arguments.array[i].string;
} // for
// insert the required array terminated
}
if (F_status_is_error(status)) {
- for (i = 0; i < arguments.used; i++) {
- f_macro_string_t_delete_simple(fixed_arguments[i + 1], arguments.array[i].used + 1);
- } // for
-
f_macro_string_dynamic_t_delete_simple(path);
f_macro_string_dynamics_t_delete_simple(paths);
return status;
f_macro_string_dynamic_t_delete(status, path);
if (F_status_is_error(status)) {
- for (i = 0; i < arguments.used; i++) {
- f_macro_string_t_delete_simple(fixed_arguments[i + 1], arguments.array[i].used + 1);
- } // for
-
f_macro_string_dynamics_t_delete_simple(paths);
return status;
}
}
if (F_status_is_error(status)) {
- for (i = 0; i < arguments.used; i++) {
- f_macro_string_t_delete_simple(fixed_arguments[i + 1], arguments.array[i].used + 1);
- } // for
-
f_macro_string_dynamics_t_delete_simple(paths);
return status;
}
} // for
if (found == 0) {
- for (i = 0; i < arguments.used; i++) {
- f_macro_string_t_delete_simple(fixed_arguments[i + 1], arguments.array[i].used + 1);
- } // for
-
f_macro_string_dynamics_t_delete_simple(paths);
return F_status_set_error(F_file_found_not);
}
f_macro_string_dynamics_t_delete(status, paths);
if (F_status_is_error(status)) {
- for (i = 0; i < arguments.used; i++) {
- f_macro_string_t_delete_simple(fixed_arguments[i + 1], arguments.array[i].used + 1);
- } // for
-
return status;
}
process_id = fork();
if (process_id < 0) {
- for (i = 0; i < arguments.used; i++) {
- f_macro_string_t_delete_simple(fixed_arguments[i + 1], arguments.array[i].used + 1);
- } // for
-
return F_status_set_error(F_fork);
}
execvp(program_path, fixed_arguments);
- for (i = 0; i < arguments.used; i++) {
- f_macro_string_t_delete_simple(fixed_arguments[i + 1], arguments.array[i].used + 1);
- } // for
-
// according to manpages, calling _exit() is safer and should be called here instead of exit()
_exit(-1);
}
- for (i = 0; i < arguments.used; i++) {
- f_macro_string_t_delete_simple(fixed_arguments[i + 1], arguments.array[i].used + 1);
- } // for
-
// have the parent wait for the child process to finish
waitpid(process_id, result, 0);