9a00f57a5ba7ed431e6bac8d8b36518708503b4eLennart Poettering This file is part of systemd.
9a00f57a5ba7ed431e6bac8d8b36518708503b4eLennart Poettering Copyright 2014 Lennart Poettering
9a00f57a5ba7ed431e6bac8d8b36518708503b4eLennart Poettering systemd is free software; you can redistribute it and/or modify it
9a00f57a5ba7ed431e6bac8d8b36518708503b4eLennart Poettering under the terms of the GNU Lesser General Public License as published by
9a00f57a5ba7ed431e6bac8d8b36518708503b4eLennart Poettering the Free Software Foundation; either version 2.1 of the License, or
9a00f57a5ba7ed431e6bac8d8b36518708503b4eLennart Poettering (at your option) any later version.
9a00f57a5ba7ed431e6bac8d8b36518708503b4eLennart Poettering systemd is distributed in the hope that it will be useful, but
9a00f57a5ba7ed431e6bac8d8b36518708503b4eLennart Poettering WITHOUT ANY WARRANTY; without even the implied warranty of
9a00f57a5ba7ed431e6bac8d8b36518708503b4eLennart Poettering MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
9a00f57a5ba7ed431e6bac8d8b36518708503b4eLennart Poettering Lesser General Public License for more details.
9a00f57a5ba7ed431e6bac8d8b36518708503b4eLennart Poettering You should have received a copy of the GNU Lesser General Public License
9a00f57a5ba7ed431e6bac8d8b36518708503b4eLennart Poettering along with systemd; If not, see <http://www.gnu.org/licenses/>.
9a00f57a5ba7ed431e6bac8d8b36518708503b4eLennart Poetteringstatic const char* const path_table[_SD_PATH_MAX] = {
9a00f57a5ba7ed431e6bac8d8b36518708503b4eLennart Poettering [SD_PATH_TEMPORARY_LARGE] = "temporary-large",
9a00f57a5ba7ed431e6bac8d8b36518708503b4eLennart Poettering [SD_PATH_SYSTEM_BINARIES] = "system-binaries",
9a00f57a5ba7ed431e6bac8d8b36518708503b4eLennart Poettering [SD_PATH_SYSTEM_INCLUDE] = "system-include",
9a00f57a5ba7ed431e6bac8d8b36518708503b4eLennart Poettering [SD_PATH_SYSTEM_LIBRARY_PRIVATE] = "system-library-private",
9a00f57a5ba7ed431e6bac8d8b36518708503b4eLennart Poettering [SD_PATH_SYSTEM_LIBRARY_ARCH] = "system-library-arch",
9a00f57a5ba7ed431e6bac8d8b36518708503b4eLennart Poettering [SD_PATH_SYSTEM_SHARED] = "system-shared",
9a00f57a5ba7ed431e6bac8d8b36518708503b4eLennart Poettering [SD_PATH_SYSTEM_CONFIGURATION_FACTORY] = "system-configuration-factory",
9a00f57a5ba7ed431e6bac8d8b36518708503b4eLennart Poettering [SD_PATH_SYSTEM_STATE_FACTORY] = "system-state-factory",
9a00f57a5ba7ed431e6bac8d8b36518708503b4eLennart Poettering [SD_PATH_SYSTEM_CONFIGURATION] = "system-configuration",
9a00f57a5ba7ed431e6bac8d8b36518708503b4eLennart Poettering [SD_PATH_SYSTEM_RUNTIME] = "system-runtime",
9a00f57a5ba7ed431e6bac8d8b36518708503b4eLennart Poettering [SD_PATH_SYSTEM_RUNTIME_LOGS] = "system-runtime-logs",
9a00f57a5ba7ed431e6bac8d8b36518708503b4eLennart Poettering [SD_PATH_SYSTEM_STATE_PRIVATE] = "system-state-private",
9a00f57a5ba7ed431e6bac8d8b36518708503b4eLennart Poettering [SD_PATH_SYSTEM_STATE_LOGS] = "system-state-logs",
9a00f57a5ba7ed431e6bac8d8b36518708503b4eLennart Poettering [SD_PATH_SYSTEM_STATE_CACHE] = "system-state-cache",
9a00f57a5ba7ed431e6bac8d8b36518708503b4eLennart Poettering [SD_PATH_SYSTEM_STATE_SPOOL] = "system-state-spool",
9a00f57a5ba7ed431e6bac8d8b36518708503b4eLennart Poettering [SD_PATH_USER_BINARIES] = "user-binaries",
9a00f57a5ba7ed431e6bac8d8b36518708503b4eLennart Poettering [SD_PATH_USER_LIBRARY_PRIVATE] = "user-library-private",
9a00f57a5ba7ed431e6bac8d8b36518708503b4eLennart Poettering [SD_PATH_USER_LIBRARY_ARCH] = "user-library-arch",
9a00f57a5ba7ed431e6bac8d8b36518708503b4eLennart Poettering [SD_PATH_USER_CONFIGURATION] = "user-configuration",
9a00f57a5ba7ed431e6bac8d8b36518708503b4eLennart Poettering [SD_PATH_USER_STATE_CACHE] = "user-state-cache",
9a00f57a5ba7ed431e6bac8d8b36518708503b4eLennart Poettering [SD_PATH_USER_DOCUMENTS] = "user-documents",
9a00f57a5ba7ed431e6bac8d8b36518708503b4eLennart Poettering [SD_PATH_USER_PICTURES] = "user-pictures",
9a00f57a5ba7ed431e6bac8d8b36518708503b4eLennart Poettering [SD_PATH_USER_DOWNLOAD] = "user-download",
9a00f57a5ba7ed431e6bac8d8b36518708503b4eLennart Poettering [SD_PATH_USER_TEMPLATES] = "user-templates",
9a00f57a5ba7ed431e6bac8d8b36518708503b4eLennart Poettering [SD_PATH_SEARCH_BINARIES] = "search-binaries",
9a00f57a5ba7ed431e6bac8d8b36518708503b4eLennart Poettering [SD_PATH_SEARCH_LIBRARY_PRIVATE] = "search-library-private",
9a00f57a5ba7ed431e6bac8d8b36518708503b4eLennart Poettering [SD_PATH_SEARCH_LIBRARY_ARCH] = "search-library-arch",
9a00f57a5ba7ed431e6bac8d8b36518708503b4eLennart Poettering [SD_PATH_SEARCH_SHARED] = "search-shared",
9a00f57a5ba7ed431e6bac8d8b36518708503b4eLennart Poettering [SD_PATH_SEARCH_CONFIGURATION_FACTORY] = "search-configuration-factory",
9a00f57a5ba7ed431e6bac8d8b36518708503b4eLennart Poettering [SD_PATH_SEARCH_STATE_FACTORY] = "search-state-factory",
9a00f57a5ba7ed431e6bac8d8b36518708503b4eLennart Poettering [SD_PATH_SEARCH_CONFIGURATION] = "search-configuration",
9a00f57a5ba7ed431e6bac8d8b36518708503b4eLennart Poettering for (i = 0; i < ELEMENTSOF(path_table); i++) {
da927ba997d68401563b927f92e6e40e021a8e5cMichal Schmidt log_error_errno(r, "Failed to query %s: %m", path_table[i]);
9a00f57a5ba7ed431e6bac8d8b36518708503b4eLennart Poettering for (i = 0; i < ELEMENTSOF(path_table); i++) {
f647962d64e844689f3e2acfce6102fc47e76df2Michal Schmidt return log_error_errno(r, "Failed to query %s: %m", n);
601185b43da638b1c74153deae01dbd518680889Zbigniew Jędrzejewski-Szmek printf("%s [OPTIONS...] [NAME...]\n\n"
601185b43da638b1c74153deae01dbd518680889Zbigniew Jędrzejewski-Szmek "Show system and user paths.\n\n"
601185b43da638b1c74153deae01dbd518680889Zbigniew Jędrzejewski-Szmek " -h --help Show this help\n"
601185b43da638b1c74153deae01dbd518680889Zbigniew Jędrzejewski-Szmek " --version Show package version\n"
601185b43da638b1c74153deae01dbd518680889Zbigniew Jędrzejewski-Szmek " --suffix=SUFFIX Suffix to append to paths\n",
9a00f57a5ba7ed431e6bac8d8b36518708503b4eLennart Poetteringstatic int parse_argv(int argc, char *argv[]) {
9a00f57a5ba7ed431e6bac8d8b36518708503b4eLennart Poettering { "version", no_argument, NULL, ARG_VERSION },
9a00f57a5ba7ed431e6bac8d8b36518708503b4eLennart Poettering { "suffix", required_argument, NULL, ARG_SUFFIX },
601185b43da638b1c74153deae01dbd518680889Zbigniew Jędrzejewski-Szmek while ((c = getopt_long(argc, argv, "h", options, NULL)) >= 0)