diff options
author | michel_j <michel_j@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2005-05-27 20:35:37 +0000 |
---|---|---|
committer | michel_j <michel_j@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2005-05-27 20:35:37 +0000 |
commit | 5b0dbd7ddb37eb4cd4542be4a47832675d4219e4 (patch) | |
tree | e40f3a036d4ddc01b56ec6cab0207bb80180c4ac /ace | |
parent | 99e67f7a700fb0550a674b47bc8c04146e524e99 (diff) | |
download | ATCD-5b0dbd7ddb37eb4cd4542be4a47832675d4219e4.tar.gz |
ChangeLogTag: Fri May 27 15:32:15 2005 Justin Michel <michel_j@ociweb.com>
Diffstat (limited to 'ace')
-rw-r--r-- | ace/ACE.cpp | 56 | ||||
-rw-r--r-- | ace/ACE.h | 12 | ||||
-rw-r--r-- | ace/SOCK_SEQPACK_Association.h | 2 | ||||
-rw-r--r-- | ace/SOCK_SEQPACK_Connector.h | 2 |
4 files changed, 65 insertions, 7 deletions
diff --git a/ace/ACE.cpp b/ace/ACE.cpp index 85e0a036811..fd8c9a73f10 100644 --- a/ace/ACE.cpp +++ b/ace/ACE.cpp @@ -3232,7 +3232,7 @@ ACE::sock_error (int error) /* NOTREACHED */ case WSAEDESTADDRREQ: return ACE_LIB_TEXT ("destination address required"); - /* NOTREACHED */ + /* NOTREACHED */ default: ACE_OS::sprintf (unknown_msg, ACE_LIB_TEXT ("unknown error: %d"), error); return unknown_msg; @@ -3457,3 +3457,57 @@ ACE::strdelete (wchar_t *s) delete [] s; } #endif /* ACE_HAS_WCHAR */ + +inline static bool equal_char(char a, char b, bool case_sensitive) +{ + if (case_sensitive) + return a == b; + return ACE_OS::ace_tolower(a) == ACE_OS::ace_tolower(b); +} + +bool +ACE::wild_match(const char* str, const char* pat, bool case_sensitive) +{ + if (str == pat) + return true; + if (pat == 0 || str == 0) + return false; + + bool star = false; + const char* s = str; + const char* p = pat; + while (*s != '\0') + { + if (*p == '*') + { + star = true; + pat = p; + while (*++pat == '*'); + + if (*pat == '\0') + return true; + p = pat; + } + else if (*p == '?') + { + ++s; + ++p; + } + else if (! equal_char(*s, *p, case_sensitive)) + { + if (!star) + return false; + s = ++str; + p = pat; + } + else + { + ++s; + ++p; + } + } + if (*p == '*') + while (*++p == '*'); + + return *p == '\0'; +} diff --git a/ace/ACE.h b/ace/ACE.h index d42be3c5098..5556ed65237 100644 --- a/ace/ACE.h +++ b/ace/ACE.h @@ -98,6 +98,10 @@ namespace ACE /// Check if error indicates the process being out of handles (file /// descriptors). extern ACE_Export int out_of_handles (int error); + + /// Simple wildcard matching function supporting '*' and '?' + /// return true if string s matches pattern. + extern ACE_Export bool wild_match(const char* s, const char* pattern, bool case_sensitive = true); /** * @name I/O operations @@ -540,23 +544,23 @@ namespace ACE /// Computes CRC-CCITT for the buffer. extern ACE_Export ACE_UINT16 crc_ccitt(const void *buf, size_t len, - ACE_UINT16 crc = 0); + ACE_UINT16 crc = 0); /// Computes CRC-CCITT for the @ len iovec buffers. extern ACE_Export ACE_UINT16 crc_ccitt(const iovec *iov, int len, - ACE_UINT16 crc = 0); + ACE_UINT16 crc = 0); /// Computes the ISO 8802-3 standard 32 bits CRC for the string. extern ACE_Export ACE_UINT32 crc32 (const char *str); /// Computes the ISO 8802-3 standard 32 bits CRC for the buffer. extern ACE_Export ACE_UINT32 crc32 (const void *buf, size_t len, - ACE_UINT32 crc = 0); + ACE_UINT32 crc = 0); /// Computes the ISO 8802-3 standard 32 bits CRC for the /// @ len iovec buffers. extern ACE_Export ACE_UINT32 crc32 (const iovec *iov, int len, - ACE_UINT32 crc = 0); + ACE_UINT32 crc = 0); /// Euclid's greatest common divisor algorithm. extern ACE_Export u_long gcd (u_long x, u_long y); diff --git a/ace/SOCK_SEQPACK_Association.h b/ace/SOCK_SEQPACK_Association.h index b2ea5896adb..0320c90a7dd 100644 --- a/ace/SOCK_SEQPACK_Association.h +++ b/ace/SOCK_SEQPACK_Association.h @@ -19,7 +19,7 @@ #define ACE_SOCK_SEQPACK_ASSOCIATION_H #include /**/ "ace/pre.h" -#include "ace/config.h" +#include "ace/config-all.h" #include "ace/ACE_export.h" #include "ace/SOCK_IO.h" diff --git a/ace/SOCK_SEQPACK_Connector.h b/ace/SOCK_SEQPACK_Connector.h index af75a23b963..26139d10eee 100644 --- a/ace/SOCK_SEQPACK_Connector.h +++ b/ace/SOCK_SEQPACK_Connector.h @@ -18,7 +18,7 @@ #define ACE_SOCK_SEQPACK_CONNECTOR_H #include /**/ "ace/pre.h" -#include "ace/config.h" +#include "ace/config-all.h" #include "ace/ACE_export.h" #include "ace/SOCK_SEQPACK_Association.h" |