1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-10-01 03:36:26 -04:00

Revert 06eb3fa02abf12c6d2352af4288a6ad465a0e8c1 (in the historic repo)

This was reverted by zas in commit 2a71adda10
in current HEAD (elinks-0.12).

The original commit message reads: Anchors with '#' didn't "work" for
libstdc++ local documentation due to encoded filenames. This change fixes
it and hopefully has no impact for other parts of ELinks.
This commit is contained in:
Jonas Fonseca 2006-01-29 12:28:43 +01:00 committed by Jonas Fonseca
parent ba68992ef2
commit 081ab78a88

View File

@ -46,7 +46,7 @@
#include "util/file.h"
#include "util/memory.h"
#include "util/string.h"
#include "protocol/uri.h"
/* Not that these two would be so useful for portability (they are ANSI C) but
* they encapsulate the lowlevel stuff (need for <unistd.h>) nicely. */
@ -54,29 +54,12 @@
int
file_exists(const unsigned char *filename)
{
int result;
unsigned char *decoded_filename;
#ifdef HAVE_ACCESS
result = access(filename, F_OK);
if (result >= 0) return 1;
decoded_filename = stracpy((unsigned char *)filename);
if (!decoded_filename) return 0;
decode_uri(decoded_filename);
result = access(decoded_filename, F_OK);
mem_free(decoded_filename);
return result >= 0;
return access(filename, F_OK) >= 0;
#else
struct stat buf;
result = stat(filename, &buf);
if (result >= 0) return 1;
decoded_filename = stracpy((unsigned char *)filename);
if (!decoded_filename) return 0;
decode_uri(decoded_filename);
result = stat(decoded_filename, &buf);
mem_free(decoded_filename);
return result >= 0;
return stat(filename, &buf) >= 0;
#endif
}