Subject: | |
From: | |
Reply To: | Emerson, Tom # El Monte |
Date: | Tue, 21 Nov 2000 12:23:21 -0500 |
Content-Type: | text/plain |
Parts/Attachments: |
|
|
> -----Original Message-----
> From: Gary Smith [mailto:[log in to unmask]]
>
> Although it does not solve the more general issue with
> calling intrinsics
> from gcc, the easiest and most portable way of getting environment
> variables is to use getenv():
This solution has been brewing in the back of my mind as well -- however,
since the original program was written in SPL, transliterated to SPLash!,
then finally converted to C, I hadn't considered which "C library routines"
matched MPE intrinsics well enough to use instead of direct intrinisc calls
[which, in theory, are probably calling the aforementioned intrinsic
anyway...]
> #include <stdlib.h>
>
> char Sys_Id_Code(void)
> {
> char *sysname = getenv("HPSYSNAME");
>
> return sysname[0];
> }
>
> int main(int argc, char *argv[])
> {
> printf("The system name starts with %c\n",Sys_Id_Code());
> }
>
lots cleaner! I think I'll drop that in place in this particular piece of
code...
[but as you said, it won't neccessarilly help for "other" intrinsics]
Tom
|
|
|