%META:TOPICINFO{author="ChrisBartram" date="1170385212" format="1.1" version="1.2"}% %META:TOPICPARENT{name="Hp3000PosixShell"}% ---+ [[Hp3000CiCommandsFromShell][Executing CI commands and system calls from POSIX apps on the HP3000]] The system() call actually uses the Posix CI, since it expects Posix- : syntax system commands. It's not a call to HPCICOMMAND, which would use : the MPE command interpreter. --[[BruceToback]] Let me expound on Bruce's answer just a little bit. [We were talking about this today at the MPE Technical Roundtable at IPROF's.] When you compile and link a C program in the MPE CI environment, your program is bound to the 3000's "ANSI" C library. [I call it the ANSI C library, but it really is the non-POSIX C library that has always been part of XL.PUB.SYS.] This library was around long before we began the design of POSIX on MPE. So, the system() function was implemented as an interface to the HPCICOMMAND intrinsic. When we added POSIX to MPE, we didn't want existing programs to have to be re-written. So, the ANSI C library still calls the HPCICOMMAND intrinsic. The POSIX C library, /lib/libc.a, implements the system() function by invoking the POSIX shell. When you use c89 in the POSIX shell, your program is bound to the POSIX C library. The correct call in this case is: nRval = system ("callci \"TELL #s383; Edward, send help!\r\""); callci is the POSIX shell command for invoking the MPE CI. Any object file that wants to call the POSIX C functions must be linked with the POSIX C library, /lib/libc.a. Note that this library is an RL. A couple of additional notes. A program built in the POSIX shell can be run from the MPE CI prompt. [Jeff Kell has a few cautions in this regard which he posted to this newsgroup.] You can also use the MPE CI to compile and link a program with the POSIX C library. You do the compile as you did in your example, but you use a different link command.
   ccxl tstsysmc,tstsysmo
   link from=tstsysmo;to=./TSYS2;rl=/lib/libc.a;cap=ph;posix;share
One final note, in your POSIX shell example you had the comment, (use linkedit to alter program capabilities to add ph) This is unnecessary. c89 from the POSIX shell always links programs with PH capability. --[[MikePaivinen]] -- Main.ChrisBartram - 09 Jun 2006