]> git.pond.sub.org Git - empserver/commitdiff
(info): `info' was not checking for all types of common files in
authorRon Koenderink <rkoenderink@yahoo.ca>
Tue, 7 Sep 2004 14:04:19 +0000 (14:04 +0000)
committerRon Koenderink <rkoenderink@yahoo.ca>
Tue, 7 Sep 2004 14:04:19 +0000 (14:04 +0000)
Windows, therefore could miss info files depending on the status
(archive, read-only).  Also changed the error message to user to
provide a more accurate description of the problem.  Closes #1018297.

src/lib/commands/info.c

index 0139afdd7e73597d22debe4b77fcb3be966400e0..a6d1702178f211c12a6527e19bf983b82d3b4ada 100644 (file)
@@ -409,11 +409,22 @@ info(void)
        strncat(filename, "*", sizeof(filename) - 1 - strlen(filename));
        hDir = FindFirstFile(filename, &fData);
        if (hDir == INVALID_HANDLE_VALUE) {
-           pr("Can't open info dir \"%s\"\n", infodir);
+           switch (GetLastError()) {
+           case ERROR_FILE_NOT_FOUND:
+               pr("Sorry, there is no info on %s\n", bp);
+               break;
+           case ERROR_PATH_NOT_FOUND:
+               pr("Can't open info dir \"%s\"\n", infodir);
+               break;
+           default:
+               pr("Error getting info file \"%s\"\n", filename);
+           }
            return RET_SYS;
        }
        do {
-           if ((fData.dwFileAttributes == FILE_ATTRIBUTE_NORMAL) &&
+           if (((fData.dwFileAttributes == FILE_ATTRIBUTE_NORMAL) ||
+                (fData.dwFileAttributes == FILE_ATTRIBUTE_ARCHIVE) ||
+                (fData.dwFileAttributes == FILE_ATTRIBUTE_READONLY)) &&
                (strnccmp(bp, fData.cFileName, len) == 0)) {
                strncpy(filename, infodir, sizeof(filename) - 2);
                strcat(filename, "//");