TIP: Click on subject to list as thread! ANSI
echo: cis.languages
to: 76703,4227 (X)
from: MAS 76336,3226
date: 1990-12-04 20:57:58
subject: login shel tst prg 1

#: 8602 S3/Languages
    04-Dec-90  20:57:58
Sb: login shel tst prg 1
Fm: MAS 76336,3226
To:  76703,4227 (X)

PART 1 OF TEST PROGRAM

************************************************************************* Here
is a sample test program! Plese see "#### WRITE 3 ####": BS is not recognized
by the login shell.
*************************************************************************

/* os9exec() login and piping */

#include  #include  #include 

extern int errno; extern char **environ; extern int os9fork();

main() {  int i;
        int c[2], std[3], pid, ret;
        char buffer[2];
   char *argblk[2];

   char bs[2];
        bs[0] = (char) 8;

   argblk[0] = "/h0/cmds/login";
   argblk[1] = 0;

        if ((c[0] = open("/pipe",S_IREAD|S_IWRITE)) == -1)
   {  printf("Unable to open() read pipe : #%d\n",errno);
      exit(0);
   }


   if ((c[1] = open("/pipe",S_IREAD|S_IWRITE)) == -1)
   {  printf("Unable to open() write pipe : #%d\n",errno);
      exit(0);
   }

   std[0] = dup(0);
   std[1] = dup(1);
   std[2] = dup(2);

   close(0);
   dup(c[0]);
   close(1);
   dup(c[1]);
   close(2);
   dup(c[1]);

   pid = os9exec(os9fork,argblk[0],argblk,environ,0,0,3);

   close(0);
   dup(std[0]);
   close(std[0]);
   close(1);
   dup(std[1]);
   close(std[1]);
   close(2);
   dup(std[2]);
   close(std[2]);

   if (pid == -1)
   {   printf("\n*** Can't os9exec() ***\n");
      exit(0);
   }

   for(i=0;i<5;i++) /* read from login pipe till pipe is empty */
   {  for(;;)
      {
         ret = getstat(1,c[1]);
         if (ret > 0)
         {   read(c[1],buffer,1);
             printf("SHELL OUTPUT CHR> %c : %x 
					
SOURCE: compuserve via textfiles.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.