pub unsafe fn mailimf_header_string_write_driver(
    mut do_write: Option<
        unsafe fn(_: *mut libc::c_void, _: *const libc::c_char, _: size_t) -> libc::c_int,
    >,
    mut data: *mut libc::c_void,
    mut col: *mut libc::c_int,
    mut str: *const libc::c_char,
    mut length: size_t,
) -> libc::c_int {
    let mut state: libc::c_int = 0;
    let mut p: *const libc::c_char = 0 as *const libc::c_char;
    let mut word_begin: *const libc::c_char = 0 as *const libc::c_char;
    let mut first: libc::c_int = 0;
    state = STATE_BEGIN as libc::c_int;
    p = str;
    word_begin = p;
    first = 1i32;
    while length > 0i32 as libc::size_t {
        match state {
            0 => match *p as libc::c_int {
                13 | 10 | 32 | 9 => {
                    p = p.offset(1isize);
                    length = length.wrapping_sub(1)
                }
                _ => {
                    word_begin = p;
                    state = STATE_WORD as libc::c_int
                }
            },
            2 => match *p as libc::c_int {
                13 | 10 | 32 | 9 => {
                    p = p.offset(1isize);
                    length = length.wrapping_sub(1)
                }
                _ => {
                    word_begin = p;
                    state = STATE_WORD as libc::c_int
                }
            },
            1 => match *p as libc::c_int {
                13 | 10 | 32 | 9 => {
                    if p.wrapping_offset_from(word_begin) as libc::c_int
                        + *col as libc::c_int
                        + 1i32 as libc::c_int
                        > 72i32 as libc::c_int
                    {
                        mailimf_string_write_driver(
                            do_write,
                            data,
                            col,
                            b"\r\n \x00" as *const u8 as *const libc::c_char,
                            (::std::mem::size_of::<[libc::c_char; 4]>() as libc::size_t)
                                .wrapping_sub(1i32 as libc::size_t),
                        );
                    } else if 0 == first {
                        mailimf_string_write_driver(
                            do_write,
                            data,
                            col,
                            b" \x00" as *const u8 as *const libc::c_char,
                            1i32 as size_t,
                        );
                    }
                    first = 0i32;
                    mailimf_string_write_driver(
                        do_write,
                        data,
                        col,
                        word_begin,
                        p.wrapping_offset_from(word_begin) as libc::c_int as size_t,
                    );
                    state = STATE_SPACE as libc::c_int
                }
                _ => {
                    if p.wrapping_offset_from(word_begin) as libc::c_int + *col as libc::c_int
                        >= 998i32 as libc::c_int
                    {
                        mailimf_string_write_driver(
                            do_write,
                            data,
                            col,
                            word_begin,
                            p.wrapping_offset_from(word_begin) as libc::c_int as size_t,
                        );
                        mailimf_string_write_driver(
                            do_write,
                            data,
                            col,
                            b"\r\n \x00" as *const u8 as *const libc::c_char,
                            (::std::mem::size_of::<[libc::c_char; 4]>() as libc::size_t)
                                .wrapping_sub(1i32 as libc::size_t),
                        );
                        word_begin = p
                    }
                    p = p.offset(1isize);
                    length = length.wrapping_sub(1)
                }
            },
            _ => {}
        }
    }
    if state == STATE_WORD as libc::c_int {
        if p.wrapping_offset_from(word_begin) as libc::c_int + *col as libc::c_int
            >= 72i32 as libc::c_int
        {
            mailimf_string_write_driver(
                do_write,
                data,
                col,
                b"\r\n \x00" as *const u8 as *const libc::c_char,
                (::std::mem::size_of::<[libc::c_char; 4]>() as libc::size_t)
                    .wrapping_sub(1i32 as libc::size_t),
            );
        } else if 0 == first {
            mailimf_string_write_driver(
                do_write,
                data,
                col,
                b" \x00" as *const u8 as *const libc::c_char,
                1i32 as size_t,
            );
        }
        first = 0i32;
        mailimf_string_write_driver(
            do_write,
            data,
            col,
            word_begin,
            p.wrapping_offset_from(word_begin) as libc::c_int as size_t,
        );
    }
    return MAILIMF_NO_ERROR as libc::c_int;
}
/*
  mailimf_header_string_write writes a header value and fold the header
    if needed.

  @param f is the stream
  @param col (* col) is the column number where we will start to
    write the text, the ending column will be stored in (* col)
  @param str is the string to write
*/
mailimf_header_string_write writes a header value and fold the header
if needed.
mailimf_header_string_write writes a header value and fold the header if needed .
pub unsafe fn mailimf_header_string_write_driver(
    mut do_write: Option<
        unsafe fn(_: *mut libc::c_void, _: *const libc::c_char, _: size_t) -> libc::c_int,
    >,
    mut data: *mut libc::c_void,
    mut col: *mut libc::c_int,
    mut str: *const libc::c_char,
    mut length: size_t,
) -> libc::c_int {
    let mut state: libc::c_int = 0;
    let mut p: *const libc::c_char = 0 as *const libc::c_char;
    let mut word_begin: *const libc::c_char = 0 as *const libc::c_char;
    let mut first: libc::c_int = 0;
    state = STATE_BEGIN as libc::c_int;
    p = str;
    word_begin = p;
    first = 1i32;
    while length > 0i32 as libc::size_t {
        match state {
            0 => match *p as libc::c_int {
                13 | 10 | 32 | 9 => {
                    p = p.offset(1isize);
                    length = length.wrapping_sub(1)
                }
                _ => {
                    word_begin = p;
                    state = STATE_WORD as libc::c_int
                }
            },
            2 => match *p as libc::c_int {
                13 | 10 | 32 | 9 => {
                    p = p.offset(1isize);
                    length = length.wrapping_sub(1)
                }
                _ => {
                    word_begin = p;
                    state = STATE_WORD as libc::c_int
                }
            },
            1 => match *p as libc::c_int {
                13 | 10 | 32 | 9 => {
                    if p.wrapping_offset_from(word_begin) as libc::c_int
                        + *col as libc::c_int
                        + 1i32 as libc::c_int
                        > 72i32 as libc::c_int
                    {
                        mailimf_string_write_driver(
                            do_write,
                            data,
                            col,
                            b"\r\n \x00" as *const u8 as *const libc::c_char,
                            (::std::mem::size_of::<[libc::c_char; 4]>() as libc::size_t)
                                .wrapping_sub(1i32 as libc::size_t),
                        );
                    } else if 0 == first {
                        mailimf_string_write_driver(
                            do_write,
                            data,
                            col,
                            b" \x00" as *const u8 as *const libc::c_char,
                            1i32 as size_t,
                        );
                    }
                    first = 0i32;
                    mailimf_string_write_driver(
                        do_write,
                        data,
                        col,
                        word_begin,
                        p.wrapping_offset_from(word_begin) as libc::c_int as size_t,
                    );
                    state = STATE_SPACE as libc::c_int
                }
                _ => {
                    if p.wrapping_offset_from(word_begin) as libc::c_int + *col as libc::c_int
                        >= 998i32 as libc::c_int
                    {
                        mailimf_string_write_driver(
                            do_write,
                            data,
                            col,
                            word_begin,
                            p.wrapping_offset_from(word_begin) as libc::c_int as size_t,
                        );
                        mailimf_string_write_driver(
                            do_write,
                            data,
                            col,
                            b"\r\n \x00" as *const u8 as *const libc::c_char,
                            (::std::mem::size_of::<[libc::c_char; 4]>() as libc::size_t)
                                .wrapping_sub(1i32 as libc::size_t),
                        );
                        word_begin = p
                    }
                    p = p.offset(1isize);
                    length = length.wrapping_sub(1)
                }
            },
            _ => {}
        }
    }
    if state == STATE_WORD as libc::c_int {
        if p.wrapping_offset_from(word_begin) as libc::c_int + *col as libc::c_int
            >= 72i32 as libc::c_int
        {
            mailimf_string_write_driver(
                do_write,
                data,
                col,
                b"\r\n \x00" as *const u8 as *const libc::c_char,
                (::std::mem::size_of::<[libc::c_char; 4]>() as libc::size_t)
                    .wrapping_sub(1i32 as libc::size_t),
            );
        } else if 0 == first {
            mailimf_string_write_driver(
                do_write,
                data,
                col,
                b" \x00" as *const u8 as *const libc::c_char,
                1i32 as size_t,
            );
        }
        first = 0i32;
        mailimf_string_write_driver(
            do_write,
            data,
            col,
            word_begin,
            p.wrapping_offset_from(word_begin) as libc::c_int as size_t,
        );
    }
    return MAILIMF_NO_ERROR as libc::c_int;
}
pub unsafe fn mailimf_header_string_write_driver ( mut do_write : Option < unsafe fn ( _ : * mut libc :: c_void , _ : * const libc :: c_char , _ : size_t ) -> libc :: c_int , > , mut data : * mut libc :: c_void , mut col : * mut libc :: c_int , mut str : * const libc :: c_char , mut length : size_t , ) -> libc :: c_int { let mut state : libc :: c_int = 0 ; let mut p : * const libc :: c_char = 0 as * const libc :: c_char ; let mut word_begin : * const libc :: c_char = 0 as * const libc :: c_char ; let mut first : libc :: c_int = 0 ; state = STATE_BEGIN as libc :: c_int ; p = str ; word_begin = p ; first = 1i32 ; while length > 0i32 as libc :: size_t { match state { 0 => match * p as libc :: c_int { 13 | 10 | 32 | 9 => { p = p . offset ( 1isize ) ; length = length . wrapping_sub ( 1 ) } _ => { word_begin = p ; state = STATE_WORD as libc :: c_int } } , 2 => match * p as libc :: c_int { 13 | 10 | 32 | 9 => { p = p . offset ( 1isize ) ; length = length . wrapping_sub ( 1 ) } _ => { word_begin = p ; state = STATE_WORD as libc :: c_int } } , 1 => match * p as libc :: c_int { 13 | 10 | 32 | 9 => { if p . wrapping_offset_from ( word_begin ) as libc :: c_int + * col as libc :: c_int + 1i32 as libc :: c_int > 72i32 as libc :: c_int { mailimf_string_write_driver ( do_write , data , col , b" \r \n \x00 " as * const u8 as * const libc :: c_char , ( :: std :: mem :: size_of :: < [ libc :: c_char ; 4 ] > ( ) as libc :: size_t ) . wrapping_sub ( 1i32 as libc :: size_t ) , ) ; } else if 0 == first { mailimf_string_write_driver ( do_write , data , col , b" \x00 " as * const u8 as * const libc :: c_char , 1i32 as size_t , ) ; } first = 0i32 ; mailimf_string_write_driver ( do_write , data , col , word_begin , p . wrapping_offset_from ( word_begin ) as libc :: c_int as size_t , ) ; state = STATE_SPACE as libc :: c_int } _ => { if p . wrapping_offset_from ( word_begin ) as libc :: c_int + * col as libc :: c_int >= 998i32 as libc :: c_int { mailimf_string_write_driver ( do_write , data , col , word_begin , p . wrapping_offset_from ( word_begin ) as libc :: c_int as size_t , ) ; mailimf_string_write_driver ( do_write , data , col , b" \r \n \x00 " as * const u8 as * const libc :: c_char , ( :: std :: mem :: size_of :: < [ libc :: c_char ; 4 ] > ( ) as libc :: size_t ) . wrapping_sub ( 1i32 as libc :: size_t ) , ) ; word_begin = p } p = p . offset ( 1isize ) ; length = length . wrapping_sub ( 1 ) } } , _ => { } } } if state == STATE_WORD as libc :: c_int { if p . wrapping_offset_from ( word_begin ) as libc :: c_int + * col as libc :: c_int >= 72i32 as libc :: c_int { mailimf_string_write_driver ( do_write , data , col , b" \r \n \x00 " as * const u8 as * const libc :: c_char , ( :: std :: mem :: size_of :: < [ libc :: c_char ; 4 ] > ( ) as libc :: size_t ) . wrapping_sub ( 1i32 as libc :: size_t ) , ) ; } else if 0 == first { mailimf_string_write_driver ( do_write , data , col , b" \x00 " as * const u8 as * const libc :: c_char , 1i32 as size_t , ) ; } first = 0i32 ; mailimf_string_write_driver ( do_write , data , col , word_begin , p . wrapping_offset_from ( word_begin ) as libc :: c_int as size_t , ) ; } return MAILIMF_NO_ERROR as libc :: c_int ; }
mailimf_header_string_write writes a header value and fold the header
if needed.
mailimf_header_string_write writes a header value and fold the header if needed .
do_write
size_t
data
*mut libc::c_void
col
*mut libc::c_int
str
*const libc::c_char
length
size_t
do_write
size_t
data
*mut libc::c_void
col
*mut libc::c_int
(* col) is the column number where we will start to
write the text, the ending column will be stored in (* col)
( * col ) is the column number where we will start to write the text the ending column will be stored in ( * col )
str
*const libc::c_char
None
length
size_t
f
None