DEPENDENCY_REVERSE,
DEPENDENCY_AFTER,
DEPENDENCY_BEFORE,
+ _DEPENDENCY_MAX
} arg_dependency = DEPENDENCY_FORWARD;
static const char *arg_job_mode = "replace";
static UnitFileScope arg_scope = UNIT_FILE_SYSTEM;
return r;
}
- return strcasecmp(path_get_file_name(u->path), path_get_file_name(v->path));
+ return strcasecmp(basename(u->path), basename(v->path));
}
static bool output_show_unit_file(const UnitFileList *u) {
if (!output_show_unit_file(u))
continue;
- max_id_len = MAX(max_id_len, strlen(path_get_file_name(u->path)));
+ max_id_len = MAX(max_id_len, strlen(basename(u->path)));
state_cols = MAX(state_cols, strlen(unit_file_state_to_string(u->state)));
}
} else
on = off = "";
- id = path_get_file_name(u->path);
+ id = basename(u->path);
e = arg_full ? NULL : ellipsize(id, id_cols, 33);
static int list_dependencies_get_dependencies(sd_bus *bus, const char *name, char ***deps) {
- static const char *dependencies[] = {
+ static const char *dependencies[_DEPENDENCY_MAX] = {
[DEPENDENCY_FORWARD] = "Requires\0"
"RequiresOverridable\0"
"Requisite\0"
assert(bus);
assert(name);
assert(deps);
- assert(arg_dependency < ELEMENTSOF(dependencies));
+ assert_cc(ELEMENTSOF(dependencies) == _DEPENDENCY_MAX);
path = unit_dbus_path_from_name(name);
if (!path)
q = start_unit_one(bus, method, *name, mode, &error, s);
if (q < 0) {
- r = translate_bus_error_to_exit_status(r, &error);
+ r = translate_bus_error_to_exit_status(q, &error);
sd_bus_error_free(&error);
}
}
last = ! (*(dropin + 1) && startswith(*(dropin + 1), dir));
- printf("%s%s", path_get_file_name(*dropin), last ? "\n" : ", ");
+ printf("%s%s", basename(*dropin), last ? "\n" : ", ");
}
}
_cleanup_free_ char *fragment_path = NULL;
_cleanup_strv_free_ char **dropin_paths = NULL;
sd_bus_error error;
- FILE *stdout;
char **path;
n = unit_name_mangle(*name);
continue;
}
- stdout = fdopen(STDOUT_FILENO, "a");
-
if (!isempty(fragment_path)) {
fprintf(stdout, "# %s\n", fragment_path);
fflush(stdout);
if (!isempty(arg_root))
argv[c++] = q = strappend("--root=", arg_root);
- argv[c++] = path_get_file_name(p);
+ argv[c++] = basename(p);
argv[c++] =
streq(verb, "enable") ? "on" :
streq(verb, "disable") ? "off" : "--level=5";