Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.csd.uwm.edu!gem.mps.ohio-state.edu!ginosko!uunet!seismo!ukma!psuvax1!psuvax1!schwartz From: schwartz@shire.cs.psu.edu (Scott Schwartz) Newsgroups: comp.lang.pascal Subject: Re: Sun 4 Pascal compiler Message-ID: Date: 7 Sep 89 02:18:28 GMT References: <20792@adm.BRL.MIL> Sender: news@psuvax1.cs.psu.edu Organization: Pennsylvania State University, computer science Lines: 45 In-reply-to: raj@pic.ucla.edu's message of 6 Sep 89 20:24:21 GMT In article <20792@adm.BRL.MIL> Shiladitya Raj Chaudhury writes: | Is there anyone out there who is actually USING this compiler? We have one on | order from SUN for MONTHS, but still there is no sign of it. We have it, and lots of people use it routinely. | I would appreciate | any comments from people with experience on the SUN 4 'pc'. I've done a little with it. Not enough to have any war stories though. It's nice to have an actual ISO level 1 compiler. | Also would be interested in Martin Jourdan's file existence testing code | for the SUN 'pc'. The compiler seems to fit into the Sun/Unix environment very well. As has been mentioned previously, it is trivially easy to call routines from other languages (and therefore the unix library libc). The pascal manual explains in great detail, with lots of examples, how to do this. As far as file existence testing goes, rather than using "access" (from libc) to do it, you should write a little routine in C that tries to open the file (simply closing it again if the open succeeds) and then returns status. Then call that routine from pascal. The reason to use "open" instead of "access" is that "access" may not do what you expect if you call it from a program running set-uid. This is documented in the man page: Security mavens, take note! Just as an example, here is how you use the unix library routine "open" from Sun Pascal: function open (path: packed array [lb..ub: integer] of char; flags: integer; mode: integer): integer; external c; ... file_descriptor := open ('foo.bar', 0, 0); -- Scott Schwartz "APAR's? We don' neeed no steeenking APARS!"