chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
journalctl: strip TABs and ANSI color sequences from log messages when displaying...
[elogind.git]
/
src
/
shared
/
unit-name.c
diff --git
a/src/shared/unit-name.c
b/src/shared/unit-name.c
index d6391228f2118686d4cae9cd79ca230a3d8ffc20..88ca0b8f2ccbf90025ab40f3877cebc7c8740c93 100644
(file)
--- a/
src/shared/unit-name.c
+++ b/
src/shared/unit-name.c
@@
-33,7
+33,7
@@
"ABCDEFGHIJKLMNOPQRSTUVWXYZ" \
":-_.\\"
"ABCDEFGHIJKLMNOPQRSTUVWXYZ" \
":-_.\\"
-
static
const char* const unit_type_table[_UNIT_TYPE_MAX] = {
+const char* const unit_type_table[_UNIT_TYPE_MAX] = {
[UNIT_SERVICE] = "service",
[UNIT_SOCKET] = "socket",
[UNIT_TARGET] = "target",
[UNIT_SERVICE] = "service",
[UNIT_SOCKET] = "socket",
[UNIT_TARGET] = "target",
@@
-48,7
+48,7
@@
static const char* const unit_type_table[_UNIT_TYPE_MAX] = {
DEFINE_STRING_TABLE_LOOKUP(unit_type, UnitType);
DEFINE_STRING_TABLE_LOOKUP(unit_type, UnitType);
-
static
const char* const unit_load_state_table[_UNIT_LOAD_STATE_MAX] = {
+const char* const unit_load_state_table[_UNIT_LOAD_STATE_MAX] = {
[UNIT_STUB] = "stub",
[UNIT_LOADED] = "loaded",
[UNIT_ERROR] = "error",
[UNIT_STUB] = "stub",
[UNIT_LOADED] = "loaded",
[UNIT_ERROR] = "error",
@@
-470,15
+470,13
@@
char *unit_dbus_path_from_name(const char *name) {
char *unit_name_mangle(const char *name) {
char *r, *t;
const char *f;
char *unit_name_mangle(const char *name) {
char *r, *t;
const char *f;
- bool dot = false;
assert(name);
/* Try to turn a string that might not be a unit name into a
* sensible unit name. */
assert(name);
/* Try to turn a string that might not be a unit name into a
* sensible unit name. */
- if (path_startswith(name, "/dev/") ||
- path_startswith(name, "/sys/"))
+ if (is_device_path(name))
return unit_name_from_path(name, ".device");
if (path_is_absolute(name))
return unit_name_from_path(name, ".device");
if (path_is_absolute(name))
@@
-492,10
+490,6
@@
char *unit_name_mangle(const char *name) {
return NULL;
for (f = name, t = r; *f; f++) {
return NULL;
for (f = name, t = r; *f; f++) {
-
- if (*f == '.')
- dot = true;
-
if (*f == '/')
*(t++) = '-';
else if (!strchr("@" VALID_CHARS, *f))
if (*f == '/')
*(t++) = '-';
else if (!strchr("@" VALID_CHARS, *f))
@@
-504,7
+498,7
@@
char *unit_name_mangle(const char *name) {
*(t++) = *f;
}
*(t++) = *f;
}
- if (
!dot
)
+ if (
unit_name_to_type(name) < 0
)
strcpy(t, ".service");
else
*t = 0;
strcpy(t, ".service");
else
*t = 0;