Pointers to functions on Xenix
Steve Resnick
stever at Octopus.COM
Fri Sep 8 12:18:02 AEST 1989
I have a shell I am writing for MS DOS which will extend the batch language
and add some UNIX style enhancements (aliasing, history, and getting rid of
that damn backslash). As I write this I want to port it to UNIX/Xenix as well.
my problem is that the Xenix C compiler bitches at using pointers to
functions. For example, consider the follow fragment...
int echo(int, char **); /* The protos allow the forward refernce to */
int setenv(int, char **); /* the functions */
struct ci /* This is the command table */
{
char * name; /* The shell uses this name to compare
against the entered command */
int (* fptr)(int, char **); /* and here is the function pointer */
} Cmds[] =
"ECHO",echo,
"SET",setenv,
} ;
.
. /* Main and other stuff here */
.
.
/* When I get to the point where I execute an internal function, I call the
routine here..
*/
(Cmds[idx].fptr)(c,v); /* Here is where I call the function */
This is what the compiler doesn't like. The error message is something like
Term does not evaluate to a function.
This seems to be legitimate C in the MS DOS world...
Help! Please!
More information about the Comp.lang.c
mailing list