Try declaring the variables first.
... or compile as C++
void main(int argc, char *argv[])
{
struct stat cstat;
ino_t myino;
if(argc != 2) /* I get syntax errors If I use this if */
syntax(argv[0]); /* I get syntax error if I use this */
....
> I'm trying to compile this program and if I keep the statements:
>
> if (argc !=2 )
>         syntax(argv[0]);
>
> I get parse errors. I can not figure out where the parse error is. I'm
> sure I'm overlooking something. Can anyone here
> see it?
>
> -- Cut here ---
> #include
> #include
> #include
> #include
>
> void syntax(char *progname); /* Syntax Display Function */
>
> void main(int argc, char *argv[])
> {
>         if(argc != 2) /* I get syntax errors If I use this if */
>                 syntax(argv[0]); /* I get syntax error if I use this */
>         struct stat cstat;
>         ino_t myino;
>         if(stat(argv[1],&cstat)== -1)
>         {
>                 fprintf(stderr,"error opening file.\n");
>                 syntax(argv[0]);
>         }
>         myino=cstat.st_ino;
>         fprintf(stdout,"%s: %ld\n",argv[1],myino);
> }
>
> void syntax(char *progname)
> {
>         fprintf(stderr,"Usage: %s:\n",progname);
>         fprintf(stderr,"--------------------------\n");
>         fprintf(stderr,"%s [FILENAME]\n",progname);
>         fprintf(stderr,"\nFILENAME=filename to get inode location\n");
>         exit(1);
> }
> --
> To unsubscribe: mail ">majordomo@ale.org with "unsubscribe ale" in message body.
>
--
To unsubscribe: mail ">majordomo@ale.org with "unsubscribe ale" in message body.