version 1.20, 2002/09/23 04:10:14 |
version 1.21, 2003/04/05 16:24:59 |
|
|
char *arg; |
char *arg; |
{ |
{ |
char *mval; |
char *mval; |
|
size_t len = 8; |
|
|
/* |
/* |
* kludge -- we assume that all tty's end with |
* kludge -- we assume that all tty's end with |
|
|
*/ |
*/ |
if (strlen(arg) == 2) { |
if (strlen(arg) == 2) { |
/* either 6 for "ttyxx" or 8 for "console" */ |
/* either 6 for "ttyxx" or 8 for "console" */ |
if (!(mval = malloc((u_int)8))) |
if (!(mval = malloc(len))) |
err(1, "malloc failure"); |
err(1, "malloc failure"); |
if (!strcmp(arg, "co")) |
if (!strcmp(arg, "co")) |
(void)strcpy(mval, "console"); |
(void)strlcpy(mval, "console", len); |
else { |
else |
(void)strcpy(mval, "tty"); |
snprintf(mval, len, "tty%s", arg); |
(void)strcpy(mval + 3, arg); |
|
} |
|
return (mval); |
return (mval); |
} |
} |
if (!strncmp(arg, _PATH_DEV, sizeof(_PATH_DEV) - 1)) |
if (!strncmp(arg, _PATH_DEV, sizeof(_PATH_DEV) - 1)) |