along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
-#include <stdio.h>
-#include <getopt.h>
#include <errno.h>
-#include <unistd.h>
+#include <getopt.h>
+#include <stdio.h>
#include <stdlib.h>
-#include <string.h>
#include "sd-path.h"
-#include "build.h"
+
+#include "log.h"
#include "macro.h"
+#include "string-util.h"
#include "util.h"
-#include "log.h"
static const char *arg_suffix = NULL;
if (q == -ENXIO)
continue;
if (q < 0) {
- log_error("Failed to query %s: %s", path_table[i], strerror(-r));
+ log_error_errno(r, "Failed to query %s: %m", path_table[i]);
r = q;
continue;
}
_cleanup_free_ char *p = NULL;
r = sd_path_home(i, arg_suffix, &p);
- if (r < 0) {
- log_error("Failed to query %s: %s", n, strerror(-r));
- return r;
- }
+ if (r < 0)
+ return log_error_errno(r, "Failed to query %s: %m", n);
printf("%s\n", p);
return 0;
}
log_error("Path %s not known.", n);
- return -ENOTSUP;
+ return -EOPNOTSUPP;
}
static void help(void) {
return 0;
case ARG_VERSION:
- puts(PACKAGE_STRING);
- puts(SYSTEMD_FEATURES);
- return 0;
+ return version();
case ARG_SUFFIX:
arg_suffix = optarg;