/***
This file is part of systemd.
Copyright 2014 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 "fd-util.h"
#include "io-util.h"
#include "parse-util.h"
#include "show-status.h"
#include "string-util.h"
#include "terminal-util.h"
#include "util.h"
int r;
assert(v);
if (streq(v, "auto")) {
*ret = SHOW_STATUS_AUTO;
return 0;
}
r = parse_boolean(v);
if (r < 0)
return r;
return 0;
}
int status_vprintf(const char *status, bool ellipse, bool ephemeral, const char *format, va_list ap) {
_cleanup_free_ char *s = NULL;
int n = 0;
static bool prev_ephemeral;
/* This is independent of logging, as status messages are
* optional and go exclusively to the console. */
return log_oom();
if (fd < 0)
return fd;
if (ellipse) {
char *e;
int c;
c = fd_columns(fd);
if (c <= 0)
c = 80;
if (emax < 3)
emax = 3;
if (e) {
free(s);
s = e;
}
}
if (prev_ephemeral)
if (status) {
} else
}
IOVEC_SET_STRING(iovec[n++], s);
if (!ephemeral)
return -errno;
return 0;
}
int r;
return r;
}