auto-console-getty.c revision 5192bd1945f59254b3d260ded15dd9f2b8cc2de7
/*-*- 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 General Public License as published by
the Free Software Foundation; either version 2 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
General Public License for more details.
You should have received a copy of the GNU General Public License
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
#include <errno.h>
#include <string.h>
#include <stdlib.h>
#include "util.h"
#include "log.h"
#include "dbus-common.h"
const char *fail = "fail";
char *name;
int r = -EIO;
/* FIXME: we probably should escape the tty name properly here */
return -ENOMEM;
if (!(m = dbus_message_new_method_call("org.freedesktop.systemd1", "/org/freedesktop/systemd1", "org.freedesktop.systemd1.Manager", "StartUnit"))) {
log_error("Could not allocate message.");
goto finish;
}
if (!dbus_message_append_args(m,
log_error("Could not attach target and flag information to message.");
goto finish;
}
goto finish;
}
r = 0;
if (m)
if (reply)
return r;
}
const char *k;
size_t l;
char *w = NULL;
k = word + 8;
l = strcspn(k, ",");
if (l < 4 ||
!startswith(k, "tty") ||
if (!(w = strndup(k, l)))
return -ENOMEM;
}
*console = w;
}
return 0;
}
static int parse_proc_cmdline(char **console) {
char *line;
int r;
char *w;
size_t l;
char *state;
return 0;
}
char *word;
r = -ENOMEM;
goto finish;
}
if (r < 0)
goto finish;
}
r = 0;
return r;
}
int r = 1;
if (argc > 1) {
log_error("This program does not take arguments.");
return 1;
}
log_open();
goto finish;
}
if (parse_proc_cmdline(&console) < 0)
goto finish;
if (console)
goto finish;
r = 0;
if (bus) {
}
return r;
}