HP3000-L Archives

November 2000, Week 3

HP3000-L@RAVEN.UTC.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
"Emerson, Tom # El Monte" <[log in to unmask]>
Reply To:
Emerson, Tom # El Monte
Date:
Tue, 21 Nov 2000 12:23:21 -0500
Content-Type:
text/plain
Parts/Attachments:
text/plain (37 lines)
> -----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

ATOM RSS1 RSS2