home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / unix / programm / 5358 < prev    next >
Encoding:
Text File  |  1992-11-19  |  2.4 KB  |  82 lines

  1. Newsgroups: comp.unix.programmer
  2. Path: sparky!uunet!paladin.american.edu!darwin.sura.net!zaphod.mps.ohio-state.edu!rpi!fitzgb
  3. From: fitzgb@mml0.meche.rpi.edu (Brian Fitzgerald)
  4. Subject: Re: RPC server did not return status
  5. Message-ID: <q6y1sla@rpi.edu>
  6. Nntp-Posting-Host: mml0.meche.rpi.edu
  7. Organization: Rensselaer Polytechnic Institute, Troy, NY
  8. References: <1992Nov11.095253.23538@news.mentorg.com> <1992Nov18.032708.12062@linus.mitre.org>
  9. Date: Thu, 19 Nov 1992 15:26:24 GMT
  10. Lines: 70
  11.  
  12. Randy Crawford writes:
  13. >In article <1992Nov11.095253.23538@news.mentorg.com> thiam-chye_sim@mentorg.com writes:
  14. >
  15. >No additional input to the server should be necessary.  However, I believe a 
  16. >return integer* from the server _is_ customary.  After all, aren't the 
  17. >rpcgenned functions (like whatever_1() ) typed to return an int?  Be sure 
  18.  
  19. They return pointers, as far as I know.
  20.  
  21. Sim Thiam Chye's rpcgen file generates the following client code:
  22.  
  23. void *
  24. send_alarm_1(argp, clnt)
  25.         body *argp;
  26.         CLIENT *clnt;
  27. {
  28.         static char res;
  29.  
  30.         bzero((char *)&res, sizeof(res));
  31.         if (clnt_call(clnt, SEND_ALARM, xdr_body, argp, xdr_void, &res, TIMEOUT)
  32.  != RPC_SUCCESS) {
  33.                 return (NULL);
  34.         }
  35.         return ((void *)&res);
  36. }
  37.  
  38. Many standard rpc functions return void *.  The NULLPROC is an example.
  39.  
  40. >that the return pointer is to a global or static integer.  Don't return the
  41. >address of an automatic/stack variable.
  42.  
  43. Good advice.
  44.  
  45. >Did you try using rpcgen on the HP on your whetever.x file, and then compiling 
  46. >up the new HP rpcgenned code?  The two rpcgens are a tad different (using 
  47. >bzero() on the sun and goofing up memset() on the HP is "hpux" isn't defined).
  48. >It's worth a try.
  49. >-- 
  50. >| Randy Crawford        crawford@mitre.org        The MITRE Corporation
  51.  
  52. In Thiam's code,
  53.  
  54. typedef char *string;
  55. char sys_cmd[2048];
  56.  
  57. void *send_alarm_1(list)
  58. body *list;
  59. {
  60.         char buf1[2048] ;
  61.         char *token;
  62.         int i;
  63.         int j = 60;
  64.  
  65.         strcpy(sys_cmd,"xalarm -geom +0+0 -nc -time +0 \"");
  66.         strcat(buf1, list->msg);
  67.         strcat(buf1, "\"");
  68.         strcat(sys_cmd, buf1);
  69.         system(sys_cmd);
  70. }
  71.  
  72. I think strcat(buf1, list->msg); is trouble because buf1 is uninitialized.
  73.  
  74. I have suggested
  75.  
  76.         strcpy(sys_cmd,"xalarm -geom +0+0 -nc -time +0 \"");
  77.         strcat(sys_cmd, list->msg);
  78.         strcat(sys_cmd, "\"");
  79.         system(sys_cmd);
  80.  
  81. Brian
  82.