Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ames!sun-barr!apple!vsi1!octopus!stever From: stever@Octopus.COM (Steve Resnick ) Newsgroups: comp.lang.c Subject: Pointers to functions on Xenix Message-ID: <1989Sep8.021802.29203@Octopus.COM> Date: 8 Sep 89 02:18:02 GMT Reply-To: stever@octopus.UUCP (Steve Resnick ) Organization: Octopus Enterprises, Cupertino CA Lines: 33 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!