delta.c revision 807f46452202891731b2317ef9bc9a6bc7115f23
d360705f0f1262d49cccb6507abeafb7cfb5bbe0Lennart Poettering/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
d360705f0f1262d49cccb6507abeafb7cfb5bbe0Lennart Poettering This file is part of systemd.
d360705f0f1262d49cccb6507abeafb7cfb5bbe0Lennart Poettering Copyright 2012 Lennart Poettering
d360705f0f1262d49cccb6507abeafb7cfb5bbe0Lennart Poettering systemd is free software; you can redistribute it and/or modify it
d360705f0f1262d49cccb6507abeafb7cfb5bbe0Lennart Poettering under the terms of the GNU Lesser General Public License as published by
d360705f0f1262d49cccb6507abeafb7cfb5bbe0Lennart Poettering the Free Software Foundation; either version 2.1 of the License, or
d360705f0f1262d49cccb6507abeafb7cfb5bbe0Lennart Poettering (at your option) any later version.
d360705f0f1262d49cccb6507abeafb7cfb5bbe0Lennart Poettering systemd is distributed in the hope that it will be useful, but
d360705f0f1262d49cccb6507abeafb7cfb5bbe0Lennart Poettering WITHOUT ANY WARRANTY; without even the implied warranty of
d360705f0f1262d49cccb6507abeafb7cfb5bbe0Lennart Poettering MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
d360705f0f1262d49cccb6507abeafb7cfb5bbe0Lennart Poettering Lesser General Public License for more details.
along with systemd; If not, see <http://www.gnu.org/licenses/>.
#include <errno.h>
#include <assert.h>
#include <string.h>
#include <unistd.h>
#include <getopt.h>
#include "hashmap.h"
#include "util.h"
#include "path-util.h"
#include "log.h"
#include "pager.h"
#include "build.h"
static bool arg_no_pager = false;
static int equivalent(const char *a, const char *b) {
x = canonicalize_file_name(a);
return -errno;
y = canonicalize_file_name(b);
free(x);
return -errno;
r = path_equal(x, y);
free(x);
free(y);
#define SHOW_DEFAULTS \
char *dest;
goto finish;
goto finish;
goto finish;
if (pid < 0) {
return -errno;
} else if (pid == 0) {
DIR *d;
return -errno;
goto finish;
if (!de)
r = -ENOMEM;
goto finish;
p = strdup(p);
r = -ENOMEM;
goto finish;
} else if (k != -EEXIST) {
free(p);
goto finish;
free(p);
goto finish;
closedir(d);
Iterator i;
int n_found = 0;
if (!top) {
r = -ENOMEM;
goto finish;
if (!bottom) {
r = -ENOMEM;
goto finish;
r = -ENOMEM;
goto finish;
free(t);
assert(o);
if (path_equal(o, f)) {
n_found ++;
if (top)
if (bottom)
return r < 0 ? r : n_found;
return -EINVAL;
static void help(void) {
char *w, *state;
size_t l;
return flags;
help();
case ARG_VERSION:
case ARG_NO_PAGER:
arg_no_pager = true;
return -EINVAL;
if (*flags < 0)
return -EINVAL;
case ARG_DIFF:
if (!optarg) {
return -EINVAL;
const char prefixes[] =
#ifdef HAVE_SPLIT_USR
const char suffixes[] =
"systemd/system.preset\0"
"systemd/user.preset\0"
int n_found = 0;
int flags = 0;
log_open();
goto finish;
if (flags == 0)
if (!arg_no_pager)
pager_open();
n_found += k;
n_found += k;
pager_close();