diff --git a/funcs/func_env.c b/funcs/func_env.c index 3302df3721..6830292026 100644 --- a/funcs/func_env.c +++ b/funcs/func_env.c @@ -144,6 +144,9 @@ Maybe specified as any number. If negative, offset specifies the number of bytes back from the end of the file. + + Line offsets begin at 0, not 1. + If specified, will limit the length of the data read to that size. If negative, @@ -173,13 +176,13 @@ used to delimit the type of line terminators in line mode. @@ -547,9 +550,9 @@ static int file_count_line(struct ast_channel *chan, const char *cmd, char *data #define LINE_COUNTER(cptr, term, counter) \ if (*cptr == '\n' && term == FF_UNIX) { \ counter++; \ - } else if (*cptr == '\n' && term == FF_DOS && dos_state == 0) { \ + } else if (*cptr == '\r' && term == FF_DOS && dos_state == 0) { \ dos_state = 1; \ - } else if (*cptr == '\r' && term == FF_DOS && dos_state == 1) { \ + } else if (*cptr == '\n' && term == FF_DOS && dos_state == 1) { \ dos_state = 0; \ counter++; \ } else if (*cptr == '\r' && term == FF_MAC) { \