char *getline( char *str, char *buf )
{
int tmp = 0;
bool found = FALSE;
while ( *str )
{
if ( *str == '\n' )
{
found = TRUE;
break;
}
buf[tmp++] = *(str++);
}
if ( found )
{
if ( *(str + 1) == '\r' )
str += 2;
else
str += 1;
} /* para que quedemos en el inicio de la prox linea */
buf[tmp] = '\0';
return str;
}
char *numlineas( char *string )
{
int cnt = 1;
static char buf[MAX_STRING_LENGTH*2];
char buf2[MAX_STRING_LENGTH], tmpb[MAX_STRING_LENGTH];
buf[0] = '\0';
while ( *string )
{
string = getline( string, tmpb );
sprintf( buf2, "%2d. %s\n\r", cnt++, tmpb );
strcat( buf, buf2 );
}
return buf;
}
gcc -c -Wall -O -ggdb string.c
string.c: In function numlineas:
string.c:637: warning: passing argument 1 of getline from incompatible pointer type
/usr/include/stdio.h:651: note: expected char ** __restrict__ but argument is of type char *
string.c:637: warning: passing argument 2 of getline from incompatible pointer type
/usr/include/stdio.h:651: note: expected size_t * __restrict__ but argument is of type char *
string.c:637: error: too few arguments to function getline
I'm running Rom2.4b on Ubuntu 9.10. GCC Version is gcc version 4.4.1 (Ubuntu 4.4.1-4ubuntu9).
Here is the error message.
Here is line 628 (starting line) and all the ones after it for that block.