static int ftp_get_line(FTPContext *s, char *line, int line_size)

{

    int ch;

    char *q = line;

    int ori_block_flag = s->conn_control_block_flag;



    for (;;) {

        ch = ftp_getc(s);

        if (ch < 0) {

            s->conn_control_block_flag = ori_block_flag;

            return ch;

        }

        if (ch == '\n') {

            /* process line */

            if (q > line && q[-1] == '\r')

                q--;

            *q = '\0';



            s->conn_control_block_flag = ori_block_flag;

            return 0;

        } else {

            s->conn_control_block_flag = 0; /* line need to be finished */

            if ((q - line) < line_size - 1)

                *q++ = ch;

        }

    }

}

static int ftp_get_line(FTPContext *s, char *line, int line_size)

{

    int ch;

    char *q = line;

    int ori_block_flag = s->conn_control_block_flag;



    for (;;) {

        ch = ftp_getc(s);

        if (ch < 0) {

            s->conn_control_block_flag = ori_block_flag;

            return ch;

        }

        if (ch == '\n') {

            

            if (q > line && q[-1] == '\r')

                q--;

            *q = '\0';



            s->conn_control_block_flag = ori_block_flag;

            return 0;

        } else {

            s->conn_control_block_flag = 0; 

            if ((q - line) < line_size - 1)

                *q++ = ch;

        }

    }

}

static int FUNC_0(FTPContext *VAR_0, char *VAR_1, int VAR_2)

{

    int VAR_3;

    char *VAR_4 = VAR_1;

    int VAR_5 = VAR_0->conn_control_block_flag;



    for (;;) {

        VAR_3 = ftp_getc(VAR_0);

        if (VAR_3 < 0) {

            VAR_0->conn_control_block_flag = VAR_5;

            return VAR_3;

        }

        if (VAR_3 == '\n') {

            

            if (VAR_4 > VAR_1 && VAR_4[-1] == '\r')

                VAR_4--;

            *VAR_4 = '\0';



            VAR_0->conn_control_block_flag = VAR_5;

            return 0;

        } else {

            VAR_0->conn_control_block_flag = 0; 

            if ((VAR_4 - VAR_1) < VAR_2 - 1)

                *VAR_4++ = VAR_3;

        }

    }

}

static int FUNC_0(FTPContext *VAR_0, char *VAR_1, int VAR_2)
{ int VAR_3; char *VAR_4 = VAR_1; int VAR_5 = VAR_0->conn_control_block_flag; for (;;) { VAR_3 = ftp_getc(VAR_0); if (VAR_3 < 0) { VAR_0->conn_control_block_flag = VAR_5; return VAR_3; } if (VAR_3 == '\n') { if (VAR_4 > VAR_1 && VAR_4[-1] == '\r')
VAR_4--; *VAR_4 = '\0'; VAR_0->conn_control_block_flag = VAR_5; return 0; } else { VAR_0->conn_control_block_flag = 0; if ((VAR_4 - VAR_1) < VAR_2 - 1)
*VAR_4++ = VAR_3; } } }