Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Parse error in my C program!

Status
Not open for further replies.

aboujouj83

IS-IT--Management
May 9, 2003
52
US
I am having a parsing error when I am compiling a big C program that implements a unix shell.
I am using gcc compiler in sun os 5.8.

the problem is related to this part of the code:
-----------------------------------------------------------
void shinit(myshenvTP P, char *pwd, char *path, char *home) {
if(MALLOC(P->PWD, MAX_LEN, char) || MALLOC(P->PATH, strlen(path)+1, char) || MALLOC(P->HOME,strlen(home)+1, char)){

fprintf(stderr, "No enough memory available!\n");

exit(EXIT_FAILURE);

}

strcpy(P -> PWD, pwd);

strcpy(P -> PATH, path);

strcpy(P ->HOME, home);

}
-----------------------------------------------------------
Note that I've already defined the type myshenvTP as:
-----------------------------------------------------------
typedef struct {

char *PWD;

char *PATH;

char *HOME;

}myshnvT, *myshenvTP;
-----------------------------------------------------------

The error that I am having is:
***********************************************************
> gcc -o gsh gshell.c
gshell.c: In function `shinit':
gshell.c:286: parse error before `||'
gshell.c: At top level:
gshell.c:294: parse error before `->'
gshell.c:294: warning: data definition has no type or storage class
gshell.c:296: parse error before `->'
gshell.c:296: warning: data definition has no type or storage class
gshell.c:298: parse error before `->'
gshell.c:298: warning: data definition has no type or storage class
***********************************************************

WAITING FOR ANY EXPLANATION!
THANKS,

ABOUJOUJ
 
It's defined, plz check again my first posting.
Aboujouj
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top