pub unsafe fn mailimf_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 r: libc::c_int = 0;
    let mut count: size_t = 0;
    let mut block_begin: *const libc::c_char = 0 as *const libc::c_char;
    let mut p: *const libc::c_char = 0 as *const libc::c_char;
    let mut done: libc::c_int = 0;
    p = str;
    block_begin = str;
    count = 0i32 as size_t;
    while length > 0i32 as libc::size_t {
        if count >= 998i32 as libc::size_t {
            r = flush_buf(do_write, data, block_begin, count);
            if r != MAILIMF_NO_ERROR as libc::c_int {
                return r;
            }
            r = do_write.expect("non-null function pointer")(
                data,
                b"\r\n\x00" as *const u8 as *const libc::c_char,
                (::std::mem::size_of::<[libc::c_char; 3]>() as libc::size_t)
                    .wrapping_sub(1i32 as libc::size_t),
            );
            if r == 0i32 {
                return MAILIMF_ERROR_FILE as libc::c_int;
            }
            count = 0i32 as size_t;
            block_begin = p;
            *col = 0i32
        }
        match *p as libc::c_int {
            10 => {
                r = flush_buf(do_write, data, block_begin, count);
                if r != MAILIMF_NO_ERROR as libc::c_int {
                    return r;
                }
                r = do_write.expect("non-null function pointer")(
                    data,
                    b"\r\n\x00" as *const u8 as *const libc::c_char,
                    (::std::mem::size_of::<[libc::c_char; 3]>() as libc::size_t)
                        .wrapping_sub(1i32 as libc::size_t),
                );
                if r == 0i32 {
                    return MAILIMF_ERROR_FILE as libc::c_int;
                }
                p = p.offset(1isize);
                length = length.wrapping_sub(1);
                count = 0i32 as size_t;
                block_begin = p;
                *col = 0i32
            }
            13 => {
                done = 0i32;
                if length >= 2i32 as libc::size_t {
                    if *p.offset(1isize) as libc::c_int == '\n' as i32 {
                        r = flush_buf(do_write, data, block_begin, count);
                        if r != MAILIMF_NO_ERROR as libc::c_int {
                            return r;
                        }
                        r = do_write.expect("non-null function pointer")(
                            data,
                            b"\r\n\x00" as *const u8 as *const libc::c_char,
                            (::std::mem::size_of::<[libc::c_char; 3]>() as libc::size_t)
                                .wrapping_sub(1i32 as libc::size_t),
                        );
                        if r == 0i32 {
                            return MAILIMF_ERROR_FILE as libc::c_int;
                        }
                        p = p.offset(2isize);
                        length = (length as libc::size_t).wrapping_sub(2i32 as libc::size_t)
                            as size_t as size_t;
                        count = 0i32 as size_t;
                        block_begin = p;
                        *col = 0i32;
                        done = 1i32
                    }
                }
                if 0 == done {
                    r = flush_buf(do_write, data, block_begin, count);
                    if r != MAILIMF_NO_ERROR as libc::c_int {
                        return r;
                    }
                    r = do_write.expect("non-null function pointer")(
                        data,
                        b"\r\n\x00" as *const u8 as *const libc::c_char,
                        (::std::mem::size_of::<[libc::c_char; 3]>() as libc::size_t)
                            .wrapping_sub(1i32 as libc::size_t),
                    );
                    if r == 0i32 {
                        return MAILIMF_ERROR_FILE as libc::c_int;
                    }
                    p = p.offset(1isize);
                    length = length.wrapping_sub(1);
                    count = 0i32 as size_t;
                    block_begin = p;
                    *col = 0i32
                }
            }
            _ => {
                p = p.offset(1isize);
                count = count.wrapping_add(1);
                length = length.wrapping_sub(1)
            }
        }
    }
    r = flush_buf(do_write, data, block_begin, count);
    if r != MAILIMF_NO_ERROR as libc::c_int {
        return r;
    }
    *col = (*col as libc::size_t).wrapping_add(count) as libc::c_int as libc::c_int;
    return MAILIMF_NO_ERROR as libc::c_int;
}
/*
  mailimf_string_write writes a string to a given stream

  @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_string_write writes a string to a given stream
mailimf_string_write writes a string to a given stream
pub unsafe fn mailimf_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 r: libc::c_int = 0;
    let mut count: size_t = 0;
    let mut block_begin: *const libc::c_char = 0 as *const libc::c_char;
    let mut p: *const libc::c_char = 0 as *const libc::c_char;
    let mut done: libc::c_int = 0;
    p = str;
    block_begin = str;
    count = 0i32 as size_t;
    while length > 0i32 as libc::size_t {
        if count >= 998i32 as libc::size_t {
            r = flush_buf(do_write, data, block_begin, count);
            if r != MAILIMF_NO_ERROR as libc::c_int {
                return r;
            }
            r = do_write.expect("non-null function pointer")(
                data,
                b"\r\n\x00" as *const u8 as *const libc::c_char,
                (::std::mem::size_of::<[libc::c_char; 3]>() as libc::size_t)
                    .wrapping_sub(1i32 as libc::size_t),
            );
            if r == 0i32 {
                return MAILIMF_ERROR_FILE as libc::c_int;
            }
            count = 0i32 as size_t;
            block_begin = p;
            *col = 0i32
        }
        match *p as libc::c_int {
            10 => {
                r = flush_buf(do_write, data, block_begin, count);
                if r != MAILIMF_NO_ERROR as libc::c_int {
                    return r;
                }
                r = do_write.expect("non-null function pointer")(
                    data,
                    b"\r\n\x00" as *const u8 as *const libc::c_char,
                    (::std::mem::size_of::<[libc::c_char; 3]>() as libc::size_t)
                        .wrapping_sub(1i32 as libc::size_t),
                );
                if r == 0i32 {
                    return MAILIMF_ERROR_FILE as libc::c_int;
                }
                p = p.offset(1isize);
                length = length.wrapping_sub(1);
                count = 0i32 as size_t;
                block_begin = p;
                *col = 0i32
            }
            13 => {
                done = 0i32;
                if length >= 2i32 as libc::size_t {
                    if *p.offset(1isize) as libc::c_int == '\n' as i32 {
                        r = flush_buf(do_write, data, block_begin, count);
                        if r != MAILIMF_NO_ERROR as libc::c_int {
                            return r;
                        }
                        r = do_write.expect("non-null function pointer")(
                            data,
                            b"\r\n\x00" as *const u8 as *const libc::c_char,
                            (::std::mem::size_of::<[libc::c_char; 3]>() as libc::size_t)
                                .wrapping_sub(1i32 as libc::size_t),
                        );
                        if r == 0i32 {
                            return MAILIMF_ERROR_FILE as libc::c_int;
                        }
                        p = p.offset(2isize);
                        length = (length as libc::size_t).wrapping_sub(2i32 as libc::size_t)
                            as size_t as size_t;
                        count = 0i32 as size_t;
                        block_begin = p;
                        *col = 0i32;
                        done = 1i32
                    }
                }
                if 0 == done {
                    r = flush_buf(do_write, data, block_begin, count);
                    if r != MAILIMF_NO_ERROR as libc::c_int {
                        return r;
                    }
                    r = do_write.expect("non-null function pointer")(
                        data,
                        b"\r\n\x00" as *const u8 as *const libc::c_char,
                        (::std::mem::size_of::<[libc::c_char; 3]>() as libc::size_t)
                            .wrapping_sub(1i32 as libc::size_t),
                    );
                    if r == 0i32 {
                        return MAILIMF_ERROR_FILE as libc::c_int;
                    }
                    p = p.offset(1isize);
                    length = length.wrapping_sub(1);
                    count = 0i32 as size_t;
                    block_begin = p;
                    *col = 0i32
                }
            }
            _ => {
                p = p.offset(1isize);
                count = count.wrapping_add(1);
                length = length.wrapping_sub(1)
            }
        }
    }
    r = flush_buf(do_write, data, block_begin, count);
    if r != MAILIMF_NO_ERROR as libc::c_int {
        return r;
    }
    *col = (*col as libc::size_t).wrapping_add(count) as libc::c_int as libc::c_int;
    return MAILIMF_NO_ERROR as libc::c_int;
}
pub unsafe fn mailimf_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 r : libc :: c_int = 0 ; let mut count : size_t = 0 ; let mut block_begin : * const libc :: c_char = 0 as * const libc :: c_char ; let mut p : * const libc :: c_char = 0 as * const libc :: c_char ; let mut done : libc :: c_int = 0 ; p = str ; block_begin = str ; count = 0i32 as size_t ; while length > 0i32 as libc :: size_t { if count >= 998i32 as libc :: size_t { r = flush_buf ( do_write , data , block_begin , count ) ; if r != MAILIMF_NO_ERROR as libc :: c_int { return r ; } r = do_write . expect ( " " ) ( data , b" \r \n \x00 " as * const u8 as * const libc :: c_char , ( :: std :: mem :: size_of :: < [ libc :: c_char ; 3 ] > ( ) as libc :: size_t ) . wrapping_sub ( 1i32 as libc :: size_t ) , ) ; if r == 0i32 { return MAILIMF_ERROR_FILE as libc :: c_int ; } count = 0i32 as size_t ; block_begin = p ; * col = 0i32 } match * p as libc :: c_int { 10 => { r = flush_buf ( do_write , data , block_begin , count ) ; if r != MAILIMF_NO_ERROR as libc :: c_int { return r ; } r = do_write . expect ( " " ) ( data , b" \r \n \x00 " as * const u8 as * const libc :: c_char , ( :: std :: mem :: size_of :: < [ libc :: c_char ; 3 ] > ( ) as libc :: size_t ) . wrapping_sub ( 1i32 as libc :: size_t ) , ) ; if r == 0i32 { return MAILIMF_ERROR_FILE as libc :: c_int ; } p = p . offset ( 1isize ) ; length = length . wrapping_sub ( 1 ) ; count = 0i32 as size_t ; block_begin = p ; * col = 0i32 } 13 => { done = 0i32 ; if length >= 2i32 as libc :: size_t { if * p . offset ( 1isize ) as libc :: c_int == '\n' as i32 { r = flush_buf ( do_write , data , block_begin , count ) ; if r != MAILIMF_NO_ERROR as libc :: c_int { return r ; } r = do_write . expect ( " " ) ( data , b" \r \n \x00 " as * const u8 as * const libc :: c_char , ( :: std :: mem :: size_of :: < [ libc :: c_char ; 3 ] > ( ) as libc :: size_t ) . wrapping_sub ( 1i32 as libc :: size_t ) , ) ; if r == 0i32 { return MAILIMF_ERROR_FILE as libc :: c_int ; } p = p . offset ( 2isize ) ; length = ( length as libc :: size_t ) . wrapping_sub ( 2i32 as libc :: size_t ) as size_t as size_t ; count = 0i32 as size_t ; block_begin = p ; * col = 0i32 ; done = 1i32 } } if 0 == done { r = flush_buf ( do_write , data , block_begin , count ) ; if r != MAILIMF_NO_ERROR as libc :: c_int { return r ; } r = do_write . expect ( " " ) ( data , b" \r \n \x00 " as * const u8 as * const libc :: c_char , ( :: std :: mem :: size_of :: < [ libc :: c_char ; 3 ] > ( ) as libc :: size_t ) . wrapping_sub ( 1i32 as libc :: size_t ) , ) ; if r == 0i32 { return MAILIMF_ERROR_FILE as libc :: c_int ; } p = p . offset ( 1isize ) ; length = length . wrapping_sub ( 1 ) ; count = 0i32 as size_t ; block_begin = p ; * col = 0i32 } } _ => { p = p . offset ( 1isize ) ; count = count . wrapping_add ( 1 ) ; length = length . wrapping_sub ( 1 ) } } } r = flush_buf ( do_write , data , block_begin , count ) ; if r != MAILIMF_NO_ERROR as libc :: c_int { return r ; } * col = ( * col as libc :: size_t ) . wrapping_add ( count ) as libc :: c_int as libc :: c_int ; return MAILIMF_NO_ERROR as libc :: c_int ; }
mailimf_string_write writes a string to a given stream
mailimf_string_write writes a string to a given stream
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