version 1.16, 2014/03/26 13:00:50 |
version 1.17, 2014/03/31 09:09:19 |
|
|
void stream_error(struct bufferevent *, short, void *); |
void stream_error(struct bufferevent *, short, void *); |
void line_read(struct bufferevent *, void *); |
void line_read(struct bufferevent *, void *); |
void line_error(struct bufferevent *, short, void *); |
void line_error(struct bufferevent *, short, void *); |
void try_remote(const char *, const char *); |
void try_remote(const char *, const char *, const char *); |
|
|
__dead void |
__dead void |
usage(void) |
usage(void) |
|
|
main(int argc, char **argv) |
main(int argc, char **argv) |
{ |
{ |
const char *errstr; |
const char *errstr; |
char *tmp, *s; |
char *tmp, *s, *host; |
int opt, i; |
int opt, i; |
|
|
if (isatty(STDIN_FILENO) && tcgetattr(STDIN_FILENO, &saved_tio) != 0) |
if (isatty(STDIN_FILENO) && tcgetattr(STDIN_FILENO, &saved_tio) != 0) |
|
|
if (argc != 0 && argc != 1) |
if (argc != 0 && argc != 1) |
usage(); |
usage(); |
|
|
s = getenv("REMOTE"); |
if (argc == 1) |
if (argc == 1) { |
host = argv[0]; |
|
else |
|
host = getenv("HOST"); |
|
if (host != NULL && *host != '\0') { |
|
s = getenv("REMOTE"); |
if (s != NULL && *s == '/') |
if (s != NULL && *s == '/') |
try_remote(argv[0], s); |
try_remote(host, s, NULL); |
else |
else |
try_remote(argv[0], NULL); |
try_remote(host, NULL, s); |
} else if (s != NULL && *s != '/') |
} |
try_remote(s, NULL); |
|
|
|
if (line_path == NULL) |
if (line_path == NULL) |
line_path = "/dev/cua00"; |
line_path = "/dev/cua00"; |
|
|
} |
} |
|
|
void |
void |
try_remote(const char *host, const char *path) |
try_remote(const char *host, const char *path, const char *entry) |
{ |
{ |
const char *paths[] = { "/etc/remote", NULL, NULL }; |
const char *paths[] = { "/etc/remote", NULL, NULL }; |
char *cp, *s; |
char *cp, *s; |
|
|
paths[1] = "/etc/remote"; |
paths[1] = "/etc/remote"; |
} |
} |
|
|
|
if (entry != NULL && cgetset(entry) != 0) |
|
cu_errx(1, "cgetset failed"); |
error = cgetent(&cp, (char**)paths, (char*)host); |
error = cgetent(&cp, (char**)paths, (char*)host); |
if (error < 0) { |
if (error < 0) { |
switch (error) { |
switch (error) { |