/* Collection of code snippets by Arne Vajhøj */
/* (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) */
#include <stdio.h>
#include <unistd.h>
#include <jpidef.h>
#include <lib$routines.h>
#include <starlet.h>

struct item_list_3 { short int buflen,code;
                     long int bufadr,retlenadr; };

int main()
{
   long int pid1,pid2,pid3;
   struct item_list_3 itms[2] =
      { {sizeof(long int),JPI$_PID,(long int)&pid3,0}, {0,0,0,0} };
   pid1 = getpid();
   printf("pid=%8X\n",pid1);
   lib$getjpi(&JPI$_PID,0,0,&pid2);
   printf("pid=%8X\n",pid2);
   sys$getjpiw(0,0,0,itms,0,0,0);
   printf("pid=%8X\n",pid3);
}

