home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / sys / mac / programm / 13047 < prev    next >
Encoding:
Internet Message Format  |  1992-07-26  |  1.5 KB

  1. Path: sparky!uunet!gatech!ncar!noao!arizona!naucse!naucse.cse.nau.edu
  2. From: jjt@naucse.cse.nau.edu (Rork)
  3. Newsgroups: comp.sys.mac.programmer
  4. Subject: Porting Bison to Mac IIsi using ThinkC5.0
  5. Keywords: ThinkC, Bison, Gnu, Yacc
  6. Message-ID: <5337@naucse.cse.nau.edu>
  7. Date: 27 Jul 92 07:47:20 GMT
  8. Sender: jjt@naucse.cse.nau.edu
  9. Organization: Northern Arizona University, Flagstaff AZ
  10. Lines: 40
  11.  
  12.  
  13. After dowloading Flex and Bison and making changes in them to get them
  14. to compile on my Mac IIsi, I decided that I would have to install some
  15. UNIX system calls that are not available in ThinkC, namely mktemp().
  16.  
  17. This function returns a temporary file name.  I had to write my own
  18. version of this, which I did, but thumbing through the standard libraries
  19. I found a function that did a similar thing, tmpnam().
  20.  
  21. Here's where the problem started, the first call to this function worked
  22. fine.  After that I did a call to malloc(), yes I'm using malloc() but
  23. it would be too time consuming to change over while porting this unix-based
  24. software.
  25.  
  26. Anyways .. the function:
  27.  
  28. char *mktemp(char *template)
  29. {
  30.     .
  31.     .
  32.     .
  33.     tmpnam(buf); // buf declared char buf[20];
  34.     .
  35.     .
  36.     str = (char *)malloc(size);
  37.     .
  38.     .
  39.     return something;
  40. }
  41.  
  42. this fails in the 2nd call ... going into a lockup during the malloc()
  43. call on the 2nd call to the function.
  44.  
  45. I went back to my origibal scheme, w/o the tmpnam() call and it functioned
  46. correctly again.  Anyone have any ideas?
  47.  
  48. John Theisen
  49. Macintosh Software Developer
  50. Precision Computer Systems
  51. jjt@naucse.cse.nau.edu
  52.