@@ -6,6 +6,7 @@ pub type socklen_t = u32;
66pub type sa_family_t = u8 ;
77pub type pthread_t = :: uintptr_t ;
88pub type nfds_t = :: c_uint ;
9+ pub type regoff_t = off_t ;
910
1011s ! {
1112 pub struct sockaddr {
@@ -101,6 +102,18 @@ s! {
101102 pub if_index: :: c_uint,
102103 pub if_name: * mut :: c_char,
103104 }
105+
106+ pub struct regex_t {
107+ __re_magic: :: c_int,
108+ __re_nsub: :: size_t,
109+ __re_endp: * const :: c_char,
110+ __re_g: * mut :: c_void,
111+ }
112+
113+ pub struct regmatch_t {
114+ pub rm_so: regoff_t,
115+ pub rm_eo: regoff_t,
116+ }
104117}
105118
106119s_no_extra_traits ! {
@@ -450,6 +463,41 @@ pub const BIOCGHDRCMPLT: ::c_ulong = 0x40044274;
450463pub const BIOCSHDRCMPLT : :: c_ulong = 0x80044275 ;
451464pub const SIOCGIFADDR : :: c_ulong = 0xc0206921 ;
452465
466+ pub const REG_BASIC : :: c_int = 0o0000 ;
467+ pub const REG_EXTENDED : :: c_int = 0o0001 ;
468+ pub const REG_ICASE : :: c_int = 0o0002 ;
469+ pub const REG_NOSUB : :: c_int = 0o0004 ;
470+ pub const REG_NEWLINE : :: c_int = 0o0010 ;
471+ pub const REG_NOSPEC : :: c_int = 0o0020 ;
472+ pub const REG_PEND : :: c_int = 0o0040 ;
473+ pub const REG_DUMP : :: c_int = 0o0200 ;
474+
475+ pub const REG_NOMATCH : :: c_int = 1 ;
476+ pub const REG_BADPAT : :: c_int = 2 ;
477+ pub const REG_ECOLLATE : :: c_int = 3 ;
478+ pub const REG_ECTYPE : :: c_int = 4 ;
479+ pub const REG_EESCAPE : :: c_int = 5 ;
480+ pub const REG_ESUBREG : :: c_int = 6 ;
481+ pub const REG_EBRACK : :: c_int = 7 ;
482+ pub const REG_EPAREN : :: c_int = 8 ;
483+ pub const REG_EBRACE : :: c_int = 9 ;
484+ pub const REG_BADBR : :: c_int = 10 ;
485+ pub const REG_ERANGE : :: c_int = 11 ;
486+ pub const REG_ESPACE : :: c_int = 12 ;
487+ pub const REG_BADRPT : :: c_int = 13 ;
488+ pub const REG_EMPTY : :: c_int = 14 ;
489+ pub const REG_ASSERT : :: c_int = 15 ;
490+ pub const REG_INVARG : :: c_int = 16 ;
491+ pub const REG_ATOI : :: c_int = 255 ;
492+ pub const REG_ITOA : :: c_int = 0o0400 ;
493+
494+ pub const REG_NOTBOL : :: c_int = 0o00001 ;
495+ pub const REG_NOTEOL : :: c_int = 0o00002 ;
496+ pub const REG_STARTEND : :: c_int = 0o00004 ;
497+ pub const REG_TRACE : :: c_int = 0o00400 ;
498+ pub const REG_LARGE : :: c_int = 0o01000 ;
499+ pub const REG_BACKR : :: c_int = 0o02000 ;
500+
453501f ! {
454502 pub fn CMSG_FIRSTHDR ( mhdr: * const :: msghdr) -> * mut :: cmsghdr {
455503 if ( * mhdr) . msg_controllen as usize >= :: mem:: size_of:: <:: cmsghdr>( ) {
@@ -785,6 +833,29 @@ extern "C" {
785833 options : :: c_int ,
786834 rusage : * mut :: rusage ,
787835 ) -> :: pid_t ;
836+
837+ pub fn regcomp (
838+ preg : * mut regex_t ,
839+ pattern : * const :: c_char ,
840+ cflags : :: c_int ,
841+ ) -> :: c_int ;
842+
843+ pub fn regexec (
844+ preg : * const regex_t ,
845+ input : * const :: c_char ,
846+ nmatch : :: size_t ,
847+ pmatch : * mut regmatch_t ,
848+ eflags : :: c_int ,
849+ ) -> :: c_int ;
850+
851+ pub fn regerror (
852+ errcode : :: c_int ,
853+ preg : * const regex_t ,
854+ errbuf : * mut :: c_char ,
855+ errbuf_size : :: size_t ,
856+ ) -> :: size_t ;
857+
858+ pub fn regfree ( preg : * mut regex_t ) ;
788859}
789860
790861cfg_if ! {
0 commit comments