I need to learn to read man pages more closely. readlink() does NOT null

append the return string (bleah!) so you need to do it yourself.  This
explains why Bus and PS/2 meece weren't displayed in the Mouse selection
menu.
This commit is contained in:
Jordan K. Hubbard 1997-01-24 19:31:53 +00:00
parent 5214787fd5
commit d733b8a9fb
3 changed files with 12 additions and 24 deletions

View File

@ -328,18 +328,14 @@ DMenu MenuDocumentation = {
static int
whichMouse(dialogMenuItem *self)
{
int i;
char buf[BUFSIZ];
if (!file_readable("/dev/mouse")) {
msgDebug("No /dev/mouse device!\n");
if (!file_readable("/dev/mouse"))
return FALSE;
}
if (readlink("/dev/mouse", buf, sizeof buf) == -1) {
msgDebug("Can't read /dev/mouse symlink!\n");
if ((i = readlink("/dev/mouse", buf, sizeof buf)) == -1)
return FALSE;
}
if (isDebug)
msgDebug("The evil link value is `%s'\n", buf);
buf[i] = '\0';
if (!strcmp(self->prompt, "COM1"))
return !strcmp(buf, "/dev/cuaa0");
else if (!strcmp(self->prompt, "COM2"))

View File

@ -328,18 +328,14 @@ DMenu MenuDocumentation = {
static int
whichMouse(dialogMenuItem *self)
{
int i;
char buf[BUFSIZ];
if (!file_readable("/dev/mouse")) {
msgDebug("No /dev/mouse device!\n");
if (!file_readable("/dev/mouse"))
return FALSE;
}
if (readlink("/dev/mouse", buf, sizeof buf) == -1) {
msgDebug("Can't read /dev/mouse symlink!\n");
if ((i = readlink("/dev/mouse", buf, sizeof buf)) == -1)
return FALSE;
}
if (isDebug)
msgDebug("The evil link value is `%s'\n", buf);
buf[i] = '\0';
if (!strcmp(self->prompt, "COM1"))
return !strcmp(buf, "/dev/cuaa0");
else if (!strcmp(self->prompt, "COM2"))

View File

@ -328,18 +328,14 @@ DMenu MenuDocumentation = {
static int
whichMouse(dialogMenuItem *self)
{
int i;
char buf[BUFSIZ];
if (!file_readable("/dev/mouse")) {
msgDebug("No /dev/mouse device!\n");
if (!file_readable("/dev/mouse"))
return FALSE;
}
if (readlink("/dev/mouse", buf, sizeof buf) == -1) {
msgDebug("Can't read /dev/mouse symlink!\n");
if ((i = readlink("/dev/mouse", buf, sizeof buf)) == -1)
return FALSE;
}
if (isDebug)
msgDebug("The evil link value is `%s'\n", buf);
buf[i] = '\0';
if (!strcmp(self->prompt, "COM1"))
return !strcmp(buf, "/dev/cuaa0");
else if (!strcmp(self->prompt, "COM2"))