proc-cmdline.c revision b5efdb8af40ea759a1ea584c1bc44ecc81dd00ce
/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
/***
This file is part of systemd.
Copyright 2010 Lennart Poettering
under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
systemd is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
#include "alloc-util.h"
#include "extract-word.h"
#include "fileio.h"
#include "macro.h"
#include "parse-util.h"
#include "proc-cmdline.h"
#include "process-util.h"
#include "string-util.h"
#include "util.h"
#include "virt.h"
int proc_cmdline(char **ret) {
if (detect_container() > 0)
else
}
const char *p;
int r;
r = proc_cmdline(&line);
if (r < 0)
return r;
p = line;
for (;;) {
if (r < 0)
return r;
if (r == 0)
break;
/* Filter out arguments that are intended only for the
* initrd */
continue;
if (value)
*(value++) = 0;
if (r < 0)
return r;
}
return 0;
}
bool found = false;
const char *p;
int r;
r = proc_cmdline(&line);
if (r < 0)
return r;
p = line;
for (;;) {
const char *e;
if (r < 0)
return r;
if (r == 0)
break;
/* Filter out arguments that are intended only for the
* initrd */
continue;
if (value) {
if (!e)
continue;
r = free_and_strdup(&ret, e);
if (r < 0)
return r;
found = true;
} else {
found = true;
}
}
if (value) {
}
return found;
}
int shall_restore_state(void) {
int r;
if (r < 0)
return r;
if (r == 0)
return true;
return parse_boolean(value) != 0;
}