Alumno2k14 de Marzo del 2004
Preguntahola, estoy implementando un shell script. Este shell scrip en su main tiene una funcion llamada getline que sirve para leer los comandos que posteriormente deberá analizar y ejecutar. Tengo problemas con la función getline() .. haber si alguien me ayuda, esto es lo que tengo:
//////////////////////////////
char * getline()
{
int i=0;
char linea[MAXLINE];
fprintf(stdout, "%s: %s", getcwd(), PROMPT);
do {
linea[i]=getchar;
i++;
}
while((linea[i-1] != 'n') && (linea[i-1] != EOF));
if(linea[i-1]==EOF) {
printf("ush: saliendo");
exit(0); }
if (strlen(linea) > MAXLINE) { printf("ERROR: Excesivos caracteres"); exit(0); }
return 0;
} /* getline */
/////////////////////////
Al compilar me sale este error:
ush.c: In function `getline':
ush.c:101: error: invalid type argument of `unary *'
no domino mucho los Punteros quizás sea este el problema, pero no encuentro el error.
Agradezco vuestra ayuda
Saludos
//////////////////////////////
char * getline()
{
int i=0;
char linea[MAXLINE];
fprintf(stdout, "%s: %s", getcwd(), PROMPT);
do {
linea[i]=getchar;
i++;
}
while((linea[i-1] != 'n') && (linea[i-1] != EOF));
if(linea[i-1]==EOF) {
printf("ush: saliendo");
exit(0); }
if (strlen(linea) > MAXLINE) { printf("ERROR: Excesivos caracteres"); exit(0); }
return 0;
} /* getline */
/////////////////////////
Al compilar me sale este error:
ush.c: In function `getline':
ush.c:101: error: invalid type argument of `unary *'
no domino mucho los Punteros quizás sea este el problema, pero no encuentro el error.
Agradezco vuestra ayuda
Saludos
