/* CALLBACK TEST cback_sub_c.c */ /* ------------- */ /* */ /* main() in this file is justa server loop. ** display_all() displays one message in several lines with stars around ** display_line() displays one line indented, with the newline on the end. */ #include /* Main server loop ** ---------------- ** ** Syntax: ** ** cback_ser_tcp ** ** If omitted, defaults to */ extern void attach_cback1(); extern void open_cback2(); extern rpc_handle h_cback2; int main(int argc, char *argv[]) { rpc_status status; attach_cback1(); printf("SUB: Server stub attached.\n"); rpc_open(&status, &h_cback2, "0@CALLBACK"); if (!(status & 1)) exit(status); printf("SUB: Callback client stub opened.\n"); rpc_loop_server(&status, (argc>1)? argv[1] : "*:1789.TCP"); if (!(status & 1)) exit(status); exit(status); } /* Display a message ** ----------------- */ extern void display_line(char *line); void display_all(char * message) { char stars[80], myline[80]; int i; for (i=0;i<50;i++) stars[i]='*'; stars[50]=0; /* terminate */ sprintf(myline, "* %46s *", message); /* make a box out of several repetitions of the message: */ display_line(stars); display_line(myline); display_line(myline); display_line(myline); display_line(stars); display_line(""); } void dummy() { }