Your offset calculation is incorrect in your statement.
Try the following sample:
Pardon the "LookOut-applied" text alignment.
(I compile with CCOPTS "-Aa -C +e +w1")
#pragma list off
#include <stdio.h>
#include <string.h>
#pragma intrinsic COMMAND
#pragma intrinsic HPCICOMMAND
int main ()
{
int x;
short ierr, iparm;
char cmdline [50];
ierr = 0;
/* examples of system, COMMAND */
x = system ( "listf [log in to unmask],2" );
printf ( "system=%d\n", x );
sleep (2);
COMMAND ( "listf [log in to unmask],2\r", &ierr, &iparm );
printf ( "COMMAND err %d\n", ierr );
sleep (2);
sprintf ( cmdline, "listf %s,2\r", "[log in to unmask]" );
COMMAND ( cmdline, &ierr, &iparm );
printf ( "COMMAND err %d\n", ierr );
sleep (2);
sprintf ( cmdline, "listf [log in to unmask],2" );
printf ( "len %d line [%s]\n", strlen (cmdline), cmdline );
printf ( "Your statement has an incorrect offset for the return\n" );
/* Your statement */
/*cmd is put on the stack and a command line like LISTFILE is put into it*/
*(cmdline+strlen(cmdline)+1) = '\r';
ierr = 0;
HPCICOMMAND ( cmdline, &ierr );
printf ( "HPCICOM %d\n", ierr );
sleep (2);
/* Your offset for the return is off by +1 */
printf ( "You didn't need the +1\n" );
*(cmdline +strlen(cmdline)) = '\r';
ierr = 0;
HPCICOMMAND ( cmdline, &ierr );
printf ( "HPCICOM %d\n", ierr );
sleep(2);
/* personally, since I've done some in language translation
and rewrite, I prefer to avoid my own pointer arithmetic */
cmdline [strlen(cmdline)] = '\r';
HPCICOMMAND ( cmdline, &ierr );
printf ( "HPCICOM %d\n", ierr );
}
:run $oldpass
ACCOUNT= SYS GROUP= PUB
FILENAME CODE ------------LOGICAL RECORD----------- ----SPACE----
SIZE TYP EOF LIMIT R/B SECTORS #X MX
XL * NMXL 128W FB 105889 4096000 1 106496 55 *
system=0
ACCOUNT= SYS GROUP= PUB
FILENAME CODE ------------LOGICAL RECORD----------- ----SPACE----
SIZE TYP EOF LIMIT R/B SECTORS #X MX
XL * NMXL 128W FB 105889 4096000 1 106496 55 *
COMMAND err 0
ACCOUNT= SYS GROUP= PUB
FILENAME CODE ------------LOGICAL RECORD----------- ----SPACE----
SIZE TYP EOF LIMIT R/B SECTORS #X MX
XL * NMXL 128W FB 105889 4096000 1 106496 55 *
COMMAND err 0
len 19 line [listf [log in to unmask],2]
Your statement has an incorrect offset for the return
listf [log in to unmask],2
^
Level of LISTF must be -5, or within the range -3 to 9. (CIWARN 420)
ACCOUNT= SYS GROUP= PUB
FILENAME CODE ------------LOGICAL RECORD----------- ----SPACE----
SIZE TYP EOF LIMIT R/B SECTORS #X MX
XL * NMXL 128W FB 105889 4096000 1 106496 55 *
HPCICOM -420
You didn't need the +1
ACCOUNT= SYS GROUP= PUB
FILENAME CODE ------------LOGICAL RECORD----------- ----SPACE----
SIZE TYP EOF LIMIT R/B SECTORS #X MX
XL * NMXL 128W FB 105889 4096000 1 106496 55 *
HPCICOM 0
ACCOUNT= SYS GROUP= PUB
FILENAME CODE ------------LOGICAL RECORD----------- ----SPACE----
SIZE TYP EOF LIMIT R/B SECTORS #X MX
XL * NMXL 128W FB 105889 4096000 1 106496 55 *
HPCICOM 0
End Run
Keven Miller
* To join/leave the list, search archives, change list settings, *
* etc., please visit http://raven.utc.edu/archives/hp3000-l.html *
|