Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 146319 Details for
Bug 217359
[A-Z] globbing doesn't match glob() or fnmatch() behaviour
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
regex_vs_strcoll.c
regex_vs_strcoll.c (text/plain), 2.16 KB, created by
Tim Waugh
on 2007-01-23 17:04:40 UTC
(
hide
)
Description:
regex_vs_strcoll.c
Filename:
MIME Type:
Creator:
Tim Waugh
Created:
2007-01-23 17:04:40 UTC
Size:
2.16 KB
patch
obsolete
>#define _GNU_SOURCE >#include <fnmatch.h> >#include <langinfo.h> >#include <locale.h> >#include <regex.h> >#include <stdint.h> >#include <stdio.h> > >/* Lookup in a table of uint32_t, with default value 0xffffffff. */ >uint32_t >__collseq_table_lookup (const char *table, uint32_t wc) >{ > uint32_t shift1 = ((const uint32_t *) table)[0]; > uint32_t index1 = wc >> shift1; > uint32_t bound = ((const uint32_t *) table)[1]; > if (index1 < bound) > { > uint32_t lookup1 = ((const uint32_t *) table)[5 + index1]; > if (lookup1 != 0) > { > uint32_t shift2 = ((const uint32_t *) table)[2]; > uint32_t mask2 = ((const uint32_t *) table)[3]; > uint32_t index2 = (wc >> shift2) & mask2; > uint32_t lookup2 = ((const uint32_t *)(table + lookup1))[index2]; > if (lookup2 != 0) > { > uint32_t mask3 = ((const uint32_t *) table)[4]; > uint32_t index3 = wc & mask3; > uint32_t lookup3 = ((const uint32_t *)(table + lookup2))[index3]; > > return lookup3; > } > } > } > return ~((uint32_t) 0); >} > >int >main (void) >{ > setlocale (LC_ALL, ""); > char *collseqwc = nl_langinfo (_NL_COLLATE_COLLSEQWC); > printf ("A %u\n", __collseq_table_lookup (collseqwc, L'A')); > printf ("H %u\n", __collseq_table_lookup (collseqwc, L'H')); > printf ("h %u\n", __collseq_table_lookup (collseqwc, L'h')); > printf ("Z %u\n", __collseq_table_lookup (collseqwc, L'Z')); > unsigned char *collseq = nl_langinfo (_NL_COLLATE_COLLSEQMB); > printf ("A %u\n", collseq['A']); > printf ("H %u\n", collseq['H']); > printf ("h %u\n", collseq['h']); > printf ("Z %u\n", collseq['Z']); > regex_t reg; > int regexec_ret; > if (regcomp (®, "[A-Z]", 0)) { puts ("regcomp failed"); return 1; } > regexec_ret = regexec (®, "h", 0, NULL, 0); > printf ("regex [A-Z] %s h\n", regexec_ret ? "did not match" : "matched"); > int strcoll_1 = strcoll ("A", "h"); > int strcoll_2 = strcoll ("h", "Z"); > int strcoll_ret = strcoll_1 > 0 || strcoll_2 > 0; > printf ("strcoll (A, h) %d strcoll (h, Z) %d means %s\n", strcoll_1, strcoll_2, > strcoll_ret ? "not in range" : "in range"); > int fnmatch_ret = fnmatch ("[A-Z]", "h", 0); > printf ("fnmatch ([A-Z], h, 0) %s\n", fnmatch_ret ? "did not match" : "matched"); > return 0; >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 217359
: 146319