diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index fe69eea93..5c40fa3c4 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,11 @@ +2008-12-31 Christopher Faylor + + * glob_pattern_p.cc: New file. + * Makefile.in (DLL_OFILES): Add glob_pattern_p.o. + * glob.h: Add declaration for glob_pattern_p. + + * pinfo.cc (pinfo::thisproc): Remove __stdcall attribute. + 2008-12-30 Christopher Faylor * include/bits/wordsize.h: New linux-compatibility header. diff --git a/winsup/cygwin/Makefile.in b/winsup/cygwin/Makefile.in index 49baebc96..4c433ff94 100644 --- a/winsup/cygwin/Makefile.in +++ b/winsup/cygwin/Makefile.in @@ -135,17 +135,18 @@ DLL_OFILES:=assert.o autoload.o bsdlib.o ctype.o cxx.o cygheap.o cygthread.o \ fhandler_registry.o fhandler_serial.o fhandler_socket.o fhandler_tape.o \ fhandler_termios.o fhandler_tty.o fhandler_virtual.o fhandler_windows.o \ fhandler_zero.o flock.o fnmatch.o fork.o fts.o ftw.o getopt.o glob.o \ - grp.o heap.o hookapi.o inet_addr.o inet_network.o init.o ioctl.o ipc.o \ - kernel32.o localtime.o lsearch.o malloc_wrapper.o minires-os-if.o \ - minires.o miscfuncs.o mktemp.o mmap.o msg.o mount.o net.o netdb.o nfs.o \ - nftw.o ntea.o passwd.o path.o pinfo.o pipe.o poll.o posix_ipc.o \ - pthread.o random.o regcomp.o regerror.o regexec.o regfree.o registry.o \ - resource.o rexec.o rcmd.o scandir.o sched.o sec_acl.o sec_auth.o \ - sec_helper.o security.o select.o sem.o setlsapwd.o shared.o shm.o \ - sigfe.o signal.o sigproc.o smallprint.o spawn.o strace.o strfuncs.o \ - strptime.o strsep.o strsig.o sync.o syscalls.o sysconf.o syslog.o \ - termios.o thread.o timer.o times.o tls_pbuf.o tty.o uinfo.o uname.o \ - wait.o wincap.o window.o winf.o xsique.o \ + glob_pattern_p.o grp.o heap.o hookapi.o inet_addr.o inet_network.o \ + init.o ioctl.o ipc.o kernel32.o localtime.o lsearch.o malloc_wrapper.o \ + minires-os-if.o minires.o miscfuncs.o mktemp.o mmap.o msg.o mount.o \ + net.o netdb.o nfs.o nftw.o ntea.o passwd.o path.o pinfo.o pipe.o \ + poll.o posix_ipc.o pthread.o random.o regcomp.o regerror.o regexec.o \ + regfree.o registry.o resource.o rexec.o rcmd.o scandir.o sched.o \ + sec_acl.o sec_auth.o sec_helper.o security.o select.o sem.o \ + setlsapwd.o shared.o shm.o sigfe.o signal.o sigproc.o smallprint.o \ + spawn.o strace.o strfuncs.o strptime.o strsep.o strsig.o sync.o \ + syscalls.o sysconf.o syslog.o termios.o thread.o timer.o times.o \ + tls_pbuf.o tty.o uinfo.o uname.o wait.o wincap.o window.o winf.o \ + xsique.o \ $(EXTRA_DLL_OFILES) $(EXTRA_OFILES) $(MALLOC_OFILES) $(MT_SAFE_OBJECTS) GMON_OFILES:=gmon.o mcount.o profil.o diff --git a/winsup/cygwin/cygwin.din b/winsup/cygwin/cygwin.din index 9c6385b30..350f27773 100644 --- a/winsup/cygwin/cygwin.din +++ b/winsup/cygwin/cygwin.din @@ -719,9 +719,8 @@ getwd SIGFE _getwd = getwd SIGFE getxattr SIGFE glob SIGFE -_glob = glob SIGFE globfree SIGFE -_globfree = globfree SIGFE +glob_pattern_p gmtime SIGFE _gmtime = gmtime SIGFE gmtime_r SIGFE diff --git a/winsup/cygwin/glob_pattern_p.cc b/winsup/cygwin/glob_pattern_p.cc new file mode 100644 index 000000000..e8f42519b --- /dev/null +++ b/winsup/cygwin/glob_pattern_p.cc @@ -0,0 +1,28 @@ +/* glob_pattern_p.c + + int glob_pattern_p (__const char *__pattern, int __quote) + + Return nonzero if PATTERN contains any metacharacters. + Metacharacters can be quoted with backslashes if QUOTE is nonzero. + + This function is not part of the interface specified by POSIX.2 + but several programs want to use it. */ + +#include + +extern "C" { + +int glob_pattern_p (const char *pattern, int quote) +{ + const char *quote_chars = "\\?*[]"; + if (!quote) + quote_chars++; + while ((pattern = strpbrk (pattern, quote_chars)) != NULL) + if (*pattern == '\\') + pattern++; + else + return true; + return false; +} + +} /* extern "C" */ diff --git a/winsup/cygwin/include/glob.h b/winsup/cygwin/include/glob.h index 1a463cad1..93f2d7e94 100644 --- a/winsup/cygwin/include/glob.h +++ b/winsup/cygwin/include/glob.h @@ -109,8 +109,9 @@ __BEGIN_DECLS # define DLLEXPORT __declspec(dllimport) #endif -int DLLEXPORT glob(const char *, int, int (*)(const char *, int), glob_t *); -void DLLEXPORT globfree(glob_t *); +int DLLEXPORT glob (const char *, int, int (*)(const char *, int), glob_t *); +void DLLEXPORT globfree (glob_t *); +int DLLEXPORT glob_pattern_p (const char *, int); __END_DECLS #endif /* !_GLOB_H_ */ diff --git a/winsup/cygwin/pinfo.cc b/winsup/cygwin/pinfo.cc index fd555c918..300388f64 100644 --- a/winsup/cygwin/pinfo.cc +++ b/winsup/cygwin/pinfo.cc @@ -51,7 +51,7 @@ bool is_toplevel_proc; /* Setup the pinfo structure for this process. There may already be a _pinfo for this "pid" if h != NULL. */ -void __stdcall +void pinfo::thisproc (HANDLE h) { procinfo = NULL;