[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
GLOBAL 5.7.1 abs2rel DOS patch
From: |
Jason Hood |
Subject: |
GLOBAL 5.7.1 abs2rel DOS patch |
Date: |
Wed, 27 Aug 2008 00:12:11 +1000 |
User-agent: |
Thunderbird 2.0.0.6 (Windows/20070728) |
G'day.
I have attached a simple patch for the functions in abs2rel.c
to recognise DOS-style drive specifiers (rather than testing
for an initial slash, they use isabspath from path.c).
Jason.
--- abs2rel.c~ 2008-04-21 10:23:06.000000000 +1000
+++ abs2rel.c 2008-08-27 00:04:24.000000000 +1000
@@ -34,6 +34,7 @@
#include "gparam.h"
#include "locatestring.h"
#include "strlimcpy.h"
+#include "path.h"
/*
@@ -185,7 +186,7 @@
if (normalize_pathname(path, result, size) == NULL)
goto toolong;
- if (*path == '/') {
+ if (isabspath(path)) {
if (strlen(result) > MAXPATHLEN)
goto toolong;
strcpy(abs, result);
@@ -237,8 +238,14 @@
char *endp = result + size - 1;
/* accept the first '/' */
- if (*p == '/') {
+ if (isabspath(p)) {
*q++ = *p++;
+#if defined(_WIN32) || defined(__DJGPP__)
+ if (*p == ':') {
+ *q++ = *p++;
+ *q++ = *p++;
+ }
+#endif
final = q;
}
do {
@@ -318,12 +325,12 @@
const char *endp = result + size - 1;
char *rp;
- if (*path != '/') {
+ if (!isabspath(path)) {
if (strlen(path) >= size)
goto erange;
strcpy(result, path);
goto finish;
- } else if (*base != '/' || !size) {
+ } else if (!isabspath(base) || !size) {
errno = EINVAL;
return (NULL);
} else if (size == 1)
@@ -399,12 +406,12 @@
char *rp;
int length;
- if (*path == '/') {
+ if (isabspath(path)) {
if (strlen(path) >= size)
goto erange;
strcpy(result, path);
goto finish;
- } else if (*base != '/' || !size) {
+ } else if (!isabspath(base) || !size) {
errno = EINVAL;
return (NULL);
} else if (size == 1)
- GLOBAL 5.7.1 abs2rel DOS patch,
Jason Hood <=