Fixes for Cygwin POSIX emulation layer from Norman Vine.
Requires the symbol __CYGWIN__ to be defined, appears to disable the special meaning of backslash and colon in file names. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.0@1056 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
parent
6f42bc1a58
commit
328a8f8f0d
@ -1,5 +1,5 @@
|
|||||||
//
|
//
|
||||||
// "$Id: fluid.cxx,v 1.15.2.2 1999/11/20 09:17:21 bill Exp $"
|
// "$Id: fluid.cxx,v 1.15.2.3 2000/04/04 17:57:01 bill Exp $"
|
||||||
//
|
//
|
||||||
// FLUID main entry for the Fast Light Tool Kit (FLTK).
|
// FLUID main entry for the Fast Light Tool Kit (FLTK).
|
||||||
//
|
//
|
||||||
@ -62,7 +62,7 @@ const char *copyright =
|
|||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
#if defined(WIN32) && !defined(CYGNUS)
|
#if defined(WIN32) && !defined(__CYGWIN__)
|
||||||
# include <direct.h>
|
# include <direct.h>
|
||||||
#else
|
#else
|
||||||
# include <unistd.h>
|
# include <unistd.h>
|
||||||
@ -428,5 +428,5 @@ int main(int argc,char **argv) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// End of "$Id: fluid.cxx,v 1.15.2.2 1999/11/20 09:17:21 bill Exp $".
|
// End of "$Id: fluid.cxx,v 1.15.2.3 2000/04/04 17:57:01 bill Exp $".
|
||||||
//
|
//
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
//
|
//
|
||||||
// "$Id: filename_absolute.cxx,v 1.5 1999/01/13 16:56:05 mike Exp $"
|
// "$Id: filename_absolute.cxx,v 1.5.2.1 2000/04/04 17:57:03 bill Exp $"
|
||||||
//
|
//
|
||||||
// Filename expansion routines for the Fast Light Tool Kit (FLTK).
|
// Filename expansion routines for the Fast Light Tool Kit (FLTK).
|
||||||
//
|
//
|
||||||
@ -32,7 +32,7 @@
|
|||||||
#include <FL/filename.H>
|
#include <FL/filename.H>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#if defined(WIN32) && !defined(CYGNUS)
|
#if defined(WIN32) && !defined(__CYGWIN__)
|
||||||
# include <direct.h>
|
# include <direct.h>
|
||||||
//# define getcwd(a,b) _getdcwd(0,a,b)
|
//# define getcwd(a,b) _getdcwd(0,a,b)
|
||||||
#else
|
#else
|
||||||
@ -42,7 +42,7 @@
|
|||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(WIN32) || defined(__EMX__)
|
#if defined(WIN32) || defined(__EMX__) && !defined(__CYGWIN__)
|
||||||
inline int isdirsep(char c) {return c=='/' || c=='\\';}
|
inline int isdirsep(char c) {return c=='/' || c=='\\';}
|
||||||
#else
|
#else
|
||||||
#define isdirsep(c) ((c)=='/')
|
#define isdirsep(c) ((c)=='/')
|
||||||
@ -51,7 +51,7 @@ inline int isdirsep(char c) {return c=='/' || c=='\\';}
|
|||||||
int filename_absolute(char *to,const char *from) {
|
int filename_absolute(char *to,const char *from) {
|
||||||
|
|
||||||
if (isdirsep(*from) || *from == '|'
|
if (isdirsep(*from) || *from == '|'
|
||||||
#if defined(WIN32) || defined(__EMX__)
|
#if defined(WIN32) || defined(__EMX__) && !defined(__CYGWIN__)
|
||||||
|| from[1]==':'
|
|| from[1]==':'
|
||||||
#endif
|
#endif
|
||||||
) {
|
) {
|
||||||
@ -65,7 +65,7 @@ int filename_absolute(char *to,const char *from) {
|
|||||||
a = getenv("PWD");
|
a = getenv("PWD");
|
||||||
if (a) strncpy(temp,a,FL_PATH_MAX);
|
if (a) strncpy(temp,a,FL_PATH_MAX);
|
||||||
else {a = getcwd(temp,FL_PATH_MAX); if (!a) return 0;}
|
else {a = getcwd(temp,FL_PATH_MAX); if (!a) return 0;}
|
||||||
#if defined(WIN32) || defined(__EMX__)
|
#if defined(WIN32) || defined(__EMX__) && !defined(__CYGWIN__)
|
||||||
for (a = temp; *a; a++) if (*a=='\\') *a = '/'; // ha ha
|
for (a = temp; *a; a++) if (*a=='\\') *a = '/'; // ha ha
|
||||||
#else
|
#else
|
||||||
a = temp+strlen(temp);
|
a = temp+strlen(temp);
|
||||||
@ -92,5 +92,5 @@ int filename_absolute(char *to,const char *from) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// End of "$Id: filename_absolute.cxx,v 1.5 1999/01/13 16:56:05 mike Exp $".
|
// End of "$Id: filename_absolute.cxx,v 1.5.2.1 2000/04/04 17:57:03 bill Exp $".
|
||||||
//
|
//
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
//
|
//
|
||||||
// "$Id: filename_expand.cxx,v 1.4 1999/01/07 19:17:34 mike Exp $"
|
// "$Id: filename_expand.cxx,v 1.4.2.1 2000/04/04 17:57:03 bill Exp $"
|
||||||
//
|
//
|
||||||
// Filename expansion routines for the Fast Light Tool Kit (FLTK).
|
// Filename expansion routines for the Fast Light Tool Kit (FLTK).
|
||||||
//
|
//
|
||||||
@ -31,13 +31,13 @@
|
|||||||
#include <FL/filename.H>
|
#include <FL/filename.H>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#ifdef WIN32
|
#if defined(WIN32) && !defined(__CYGWIN__)
|
||||||
#else
|
#else
|
||||||
# include <unistd.h>
|
# include <unistd.h>
|
||||||
# include <pwd.h>
|
# include <pwd.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(WIN32) || defined(__EMX__)
|
#if defined(WIN32) || defined(__EMX__) && !defined(__CYGWIN__)
|
||||||
static inline int isdirsep(char c) {return c=='/' || c=='\\';}
|
static inline int isdirsep(char c) {return c=='/' || c=='\\';}
|
||||||
#else
|
#else
|
||||||
#define isdirsep(c) ((c)=='/')
|
#define isdirsep(c) ((c)=='/')
|
||||||
@ -76,7 +76,7 @@ int filename_expand(char *to,const char *from) {
|
|||||||
if (value) {
|
if (value) {
|
||||||
// substitutions that start with slash delete everything before them:
|
// substitutions that start with slash delete everything before them:
|
||||||
if (isdirsep(value[0])) start = a;
|
if (isdirsep(value[0])) start = a;
|
||||||
#if defined(WIN32) || defined(__EMX__)
|
#if defined(WIN32) || defined(__EMX__) && !defined(__CYGWIN__)
|
||||||
// also if it starts with "A:"
|
// also if it starts with "A:"
|
||||||
if (value[0] && value[1]==':') start = a;
|
if (value[0] && value[1]==':') start = a;
|
||||||
#endif
|
#endif
|
||||||
@ -87,7 +87,7 @@ int filename_expand(char *to,const char *from) {
|
|||||||
ret++;
|
ret++;
|
||||||
} else {
|
} else {
|
||||||
a = e+1;
|
a = e+1;
|
||||||
#if defined(WIN32) || defined(__EMX__)
|
#if defined(WIN32) || defined(__EMX__) && !defined(__CYGWIN__)
|
||||||
if (*e == '\\') {*e = '/'; ret++;} // ha ha!
|
if (*e == '\\') {*e = '/'; ret++;} // ha ha!
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -97,5 +97,5 @@ int filename_expand(char *to,const char *from) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// End of "$Id: filename_expand.cxx,v 1.4 1999/01/07 19:17:34 mike Exp $".
|
// End of "$Id: filename_expand.cxx,v 1.4.2.1 2000/04/04 17:57:03 bill Exp $".
|
||||||
//
|
//
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
//
|
//
|
||||||
// "$Id: filename_ext.cxx,v 1.4 1999/01/07 19:17:34 mike Exp $"
|
// "$Id: filename_ext.cxx,v 1.4.2.1 2000/04/04 17:57:03 bill Exp $"
|
||||||
//
|
//
|
||||||
// Filename extension routines for the Fast Light Tool Kit (FLTK).
|
// Filename extension routines for the Fast Light Tool Kit (FLTK).
|
||||||
//
|
//
|
||||||
@ -32,7 +32,7 @@ const char *filename_ext(const char *buf) {
|
|||||||
const char *p = buf;
|
const char *p = buf;
|
||||||
for (p=buf; *p; p++) {
|
for (p=buf; *p; p++) {
|
||||||
if (*p == '/') q = 0;
|
if (*p == '/') q = 0;
|
||||||
#if defined(WIN32) || defined(__EMX__)
|
#if defined(WIN32) || defined(__EMX__) && !defined(__CYGWIN__)
|
||||||
else if (*p == '\\') q = 0;
|
else if (*p == '\\') q = 0;
|
||||||
#endif
|
#endif
|
||||||
else if (*p == '.') q = p;
|
else if (*p == '.') q = p;
|
||||||
@ -41,5 +41,5 @@ const char *filename_ext(const char *buf) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// End of "$Id: filename_ext.cxx,v 1.4 1999/01/07 19:17:34 mike Exp $".
|
// End of "$Id: filename_ext.cxx,v 1.4.2.1 2000/04/04 17:57:03 bill Exp $".
|
||||||
//
|
//
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
//
|
//
|
||||||
// "$Id: filename_match.cxx,v 1.5 1999/01/07 21:22:28 mike Exp $"
|
// "$Id: filename_match.cxx,v 1.5.2.1 2000/04/04 17:57:03 bill Exp $"
|
||||||
//
|
//
|
||||||
// Pattern matching routines for the Fast Light Tool Kit (FLTK).
|
// Pattern matching routines for the Fast Light Tool Kit (FLTK).
|
||||||
//
|
//
|
||||||
@ -89,7 +89,7 @@ int filename_match(const char *s, const char *p) {
|
|||||||
case 0: // end of pattern
|
case 0: // end of pattern
|
||||||
return !*s;
|
return !*s;
|
||||||
|
|
||||||
#ifdef WIN32
|
#if defined(WIN32) && !defined(__CYGWIN__)
|
||||||
case '\\': // quote next character
|
case '\\': // quote next character
|
||||||
if (*p) p++;
|
if (*p) p++;
|
||||||
if (*s++ != *(p-1)) return 0;
|
if (*s++ != *(p-1)) return 0;
|
||||||
@ -109,5 +109,5 @@ int filename_match(const char *s, const char *p) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// End of "$Id: filename_match.cxx,v 1.5 1999/01/07 21:22:28 mike Exp $".
|
// End of "$Id: filename_match.cxx,v 1.5.2.1 2000/04/04 17:57:03 bill Exp $".
|
||||||
//
|
//
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
//
|
//
|
||||||
// "$Id: fl_file_chooser.cxx,v 1.10 1999/01/07 21:22:28 mike Exp $"
|
// "$Id: fl_file_chooser.cxx,v 1.10.2.1 2000/04/04 17:57:03 bill Exp $"
|
||||||
//
|
//
|
||||||
// File chooser widget for the Fast Light Tool Kit (FLTK).
|
// File chooser widget for the Fast Light Tool Kit (FLTK).
|
||||||
//
|
//
|
||||||
@ -247,12 +247,12 @@ void FCB::set(const char* buf) {
|
|||||||
const char* c = buf;
|
const char* c = buf;
|
||||||
for (bufdirend=0; *c;) switch(*c++) {
|
for (bufdirend=0; *c;) switch(*c++) {
|
||||||
case '?': case '[': case '*': case '{': ispattern = 1; goto BREAK;
|
case '?': case '[': case '*': case '{': ispattern = 1; goto BREAK;
|
||||||
#if defined(WIN32) || defined(__EMX__)
|
#if defined(WIN32) || defined(__EMX__) && !defined(__CYGWIN__)
|
||||||
case '\\':
|
case '\\':
|
||||||
#endif
|
#endif
|
||||||
case '/': bufdirend=c-buf; break;
|
case '/': bufdirend=c-buf; break;
|
||||||
}
|
}
|
||||||
#if defined(WIN32) || defined(__EMX__)
|
#if defined(WIN32) || defined(__EMX__) && !defined(__CYGWIN__)
|
||||||
if ((!bufdirend) && isalpha(buf[0]) && (buf[1]==':')) bufdirend = 2;
|
if ((!bufdirend) && isalpha(buf[0]) && (buf[1]==':')) bufdirend = 2;
|
||||||
#endif
|
#endif
|
||||||
BREAK:
|
BREAK:
|
||||||
@ -305,7 +305,7 @@ void FCB::set(const char* buf) {
|
|||||||
any = 1;
|
any = 1;
|
||||||
const char* a = (*q)->d_name;
|
const char* a = (*q)->d_name;
|
||||||
const char* b = buf+bufdirend;
|
const char* b = buf+bufdirend;
|
||||||
#ifdef WIN32
|
#if defined(WIN32) && !defined(__CYGWIN__)
|
||||||
while (*b && tolower(*a)==tolower(*b)) {a++; b++;}
|
while (*b && tolower(*a)==tolower(*b)) {a++; b++;}
|
||||||
#else
|
#else
|
||||||
while (*b && *a==*b) {a++; b++;}
|
while (*b && *a==*b) {a++; b++;}
|
||||||
@ -327,7 +327,7 @@ void FCB::set(const char* buf) {
|
|||||||
any = 1;
|
any = 1;
|
||||||
const char* a = (*q)->d_name;
|
const char* a = (*q)->d_name;
|
||||||
const char* b = buf+bufdirend;
|
const char* b = buf+bufdirend;
|
||||||
#ifdef WIN32
|
#if defined(WIN32) && !defined(__CYGWIN__)
|
||||||
while (*b && tolower(*a)==tolower(*b)) {a++; b++;}
|
while (*b && tolower(*a)==tolower(*b)) {a++; b++;}
|
||||||
#else
|
#else
|
||||||
while (*b && *a==*b) {a++; b++;}
|
while (*b && *a==*b) {a++; b++;}
|
||||||
@ -405,7 +405,7 @@ static void tab_cb(Fl_Widget*, void* v) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(WIN32) || defined(__EMX__)
|
#if defined(WIN32) || defined(__EMX__) && !defined(__CYGWIN__)
|
||||||
// ':' needs very special handling!
|
// ':' needs very special handling!
|
||||||
static inline int isdirsep(char c) {return c=='/' || c=='\\';}
|
static inline int isdirsep(char c) {return c=='/' || c=='\\';}
|
||||||
#else
|
#else
|
||||||
@ -622,5 +622,5 @@ char* fl_file_chooser(const char* message, const char* pat, const char* fname)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// End of "$Id: fl_file_chooser.cxx,v 1.10 1999/01/07 21:22:28 mike Exp $".
|
// End of "$Id: fl_file_chooser.cxx,v 1.10.2.1 2000/04/04 17:57:03 bill Exp $".
|
||||||
//
|
//
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* "$Id: numericsort.c,v 1.10 1999/03/08 14:53:44 mike Exp $"
|
* "$Id: numericsort.c,v 1.10.2.1 2000/04/04 17:57:04 bill Exp $"
|
||||||
*
|
*
|
||||||
* Numeric sorting routine for the Fast Light Tool Kit (FLTK).
|
* Numeric sorting routine for the Fast Light Tool Kit (FLTK).
|
||||||
*
|
*
|
||||||
@ -31,7 +31,7 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|
||||||
#ifdef WIN32
|
#if defined(WIN32) && !defined(__CYGWIN__)
|
||||||
#include <FL/filename.H>
|
#include <FL/filename.H>
|
||||||
#else
|
#else
|
||||||
#if HAVE_DIRENT_H
|
#if HAVE_DIRENT_H
|
||||||
@ -84,5 +84,5 @@ int numericsort(struct dirent **A, struct dirent **B) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* End of "$Id: numericsort.c,v 1.10 1999/03/08 14:53:44 mike Exp $".
|
* End of "$Id: numericsort.c,v 1.10.2.1 2000/04/04 17:57:04 bill Exp $".
|
||||||
*/
|
*/
|
||||||
|
@ -16,7 +16,7 @@ License along with this library; if not, write to the Free Software
|
|||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
||||||
USA. */
|
USA. */
|
||||||
|
|
||||||
#ifdef WIN32
|
#if defined(WIN32) && !defined(__CYGWIN__)
|
||||||
#include "scandir_win32.c"
|
#include "scandir_win32.c"
|
||||||
#else
|
#else
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
//
|
//
|
||||||
// "$Id: scandir_win32.c,v 1.11 1999/01/07 19:17:47 mike Exp $"
|
// "$Id: scandir_win32.c,v 1.11.2.1 2000/04/04 17:57:04 bill Exp $"
|
||||||
//
|
//
|
||||||
// WIN32 scandir function for the Fast Light Tool Kit (FLTK).
|
// WIN32 scandir function for the Fast Light Tool Kit (FLTK).
|
||||||
//
|
//
|
||||||
@ -23,6 +23,7 @@
|
|||||||
// Please report all bugs and problems to "fltk-bugs@easysw.com".
|
// Please report all bugs and problems to "fltk-bugs@easysw.com".
|
||||||
//
|
//
|
||||||
|
|
||||||
|
#ifndef __CYGWIN__
|
||||||
// Emulation of posix scandir() call
|
// Emulation of posix scandir() call
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
@ -97,6 +98,8 @@ int alphasort (struct dirent **a, struct dirent **b) {
|
|||||||
return strcmp ((*a)->d_name, (*b)->d_name);
|
return strcmp ((*a)->d_name, (*b)->d_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
//
|
//
|
||||||
// End of "$Id: scandir_win32.c,v 1.11 1999/01/07 19:17:47 mike Exp $".
|
// End of "$Id: scandir_win32.c,v 1.11.2.1 2000/04/04 17:57:04 bill Exp $".
|
||||||
//
|
//
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
//
|
//
|
||||||
// "$Id: demo.cxx,v 1.8 1999/02/22 21:09:13 mike Exp $"
|
// "$Id: demo.cxx,v 1.8.2.1 2000/04/04 17:57:05 bill Exp $"
|
||||||
//
|
//
|
||||||
// Main demo program for the Fast Light Tool Kit (FLTK).
|
// Main demo program for the Fast Light Tool Kit (FLTK).
|
||||||
//
|
//
|
||||||
@ -26,7 +26,7 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#if defined(WIN32) && !defined(CYGNUS)
|
#if defined(WIN32) && !defined(__CYGWIN__)
|
||||||
# include <direct.h>
|
# include <direct.h>
|
||||||
#else
|
#else
|
||||||
# include <unistd.h>
|
# include <unistd.h>
|
||||||
@ -320,6 +320,7 @@ int main(int argc, char **argv) {
|
|||||||
if (!Fl::args(argc,argv,i) || i < argc-1)
|
if (!Fl::args(argc,argv,i) || i < argc-1)
|
||||||
Fl::fatal("Usage: %s <switches> <menufile>\n%s",Fl::help);
|
Fl::fatal("Usage: %s <switches> <menufile>\n%s",Fl::help);
|
||||||
if (i < argc) fname = argv[i];
|
if (i < argc) fname = argv[i];
|
||||||
|
|
||||||
if (!load_the_menu(fname)) Fl::fatal("Can't open %s",fname);
|
if (!load_the_menu(fname)) Fl::fatal("Can't open %s",fname);
|
||||||
strcpy(buf,fname);
|
strcpy(buf,fname);
|
||||||
const char *c = filename_name(buf);
|
const char *c = filename_name(buf);
|
||||||
@ -331,6 +332,6 @@ int main(int argc, char **argv) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// End of "$Id: demo.cxx,v 1.8 1999/02/22 21:09:13 mike Exp $".
|
// End of "$Id: demo.cxx,v 1.8.2.1 2000/04/04 17:57:05 bill Exp $".
|
||||||
//
|
//
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user