systemctl status a and systemctl status a.service lead to same output but
systemctl status a.b and systemctl status a.b.service do not.
char *unit_name_mangle(const char *name) {
char *r, *t;
const char *f;
- bool dot = false;
assert(name);
return NULL;
for (f = name, t = r; *f; f++) {
-
- if (*f == '.')
- dot = true;
-
if (*f == '/')
*(t++) = '-';
else if (!strchr("@" VALID_CHARS, *f))
*(t++) = *f;
}
- if (!dot)
+ if (unit_name_to_type(name) < 0)
strcpy(t, ".service");
else
*t = 0;