]> git.ipfire.org Git - thirdparty/systemd.git/blobdiff - src/shared/specifier.c
Add SPDX license identifiers to source files under the LGPL
[thirdparty/systemd.git] / src / shared / specifier.c
index 610aec0df5bdcdcfa889bd54d82ba70104c21af1..b0f00dbb5a558ff407c663b87c314a4d768b6c65 100644 (file)
@@ -1,5 +1,4 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
+/* SPDX-License-Identifier: LGPL-2.1+ */
 /***
   This file is part of systemd.
 
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
+#include <errno.h>
+#include <stdbool.h>
+#include <stddef.h>
+#include <stdlib.h>
 #include <string.h>
 #include <sys/utsname.h>
 
+#include "sd-id128.h"
+
+#include "alloc-util.h"
 #include "hostname-util.h"
 #include "macro.h"
-#include "string-util.h"
-#include "util.h"
 #include "specifier.h"
+#include "string-util.h"
 
 /*
  * Generic infrastructure for replacing %x style specifiers in
@@ -103,6 +108,10 @@ int specifier_printf(const char *text, const Specifier table[], void *userdata,
                         *(t++) = *f;
         }
 
+        /* if string ended with a stray %, also end with % */
+        if (percent)
+                *(t++) = '%';
+
         *t = 0;
         *_ret = ret;
         return 0;