home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / PASCAL / NVDC87.ZIP / PROCESS.ZIP / CHILDB.PAS < prev    next >
Encoding:
Pascal/Delphi Source File  |  1987-08-17  |  1.7 KB  |  63 lines

  1. PROGRAM B;
  2.  
  3.   {$I LISTOF.VAR}
  4.   {$I HEX.INC}
  5.   {$I GETPARAM.INC}
  6.  
  7. VAR
  8.   S,O,Len : word;
  9.   Is_child : boolean;
  10.  
  11.   PROCEDURE Passback_Status(code : integer);
  12.   BEGIN
  13.     status := Code;
  14.     MOVE(mark1, MEM[S:O], Len);
  15.   END;
  16.  
  17.   PROCEDURE Check_If_Child;
  18.   (* ------------------------------------------------ *)
  19.   (*  IF this program is running as a child process,  *)
  20.   (*  then there will be two valid WORDs on the       *)
  21.   (*  command line.  Assuming we find these words,    *)
  22.   (*  we set a pointer to the address they define     *)
  23.   (*  and look for a particular "password" in that    *)
  24.   (*  area.  IF we find it, then we have successfully *)
  25.   (*  set up a shared data area with the parent.      *)
  26.   (* ------------------------------------------------ *)
  27.   BEGIN
  28.     Get_Parameters(S, O, Is_Child); {in GETPARAM.INC}
  29.     IF Is_Child THEN
  30.       BEGIN
  31.         Len := ofs(mark2) - ofs(mark1);
  32.         MOVE(MEM[S:O], mark1, Len);
  33.         IF keyword = 'BORLANDint' THEN
  34.           BEGIN
  35.             Is_Child := true;
  36.             Passback_Status(3);
  37.           END
  38.         ELSE
  39.           BEGIN
  40.             WriteLn('ERROR in address');
  41.             Is_Child := false;
  42.           END;
  43.       END;
  44.   END;
  45.  
  46.  {$I ERRORHAN.INC}
  47.  
  48. BEGIN
  49.   ExitProc := @ErrorHandler;
  50.   WriteLn;
  51.   WriteLn('     THIS is program B');
  52.   Check_If_Child;
  53.   IF Is_Child THEN
  54.     BEGIN
  55.       WriteLn('     The string passed from PARENT was "',thing,'"');
  56.       Write('     ENTER LONGINT: '); ReadLn(L);
  57.       Write('     ENTER STRING : '); ReadLn(thing);
  58.       status := 1;
  59.       {status 1 is normal termination}
  60.     END;
  61.   IF Is_Child THEN MOVE(mark1, MEM[S:O], Len);
  62. END.
  63.