! ! Random.c: A program to be called from VAXTPU ! via call_user. It will return a random number. #include descrip #include math char random_string [1000]; tpu$calluser (code, instring, outstring) int *code; struct dsc$descriptor *instring, *outstring; { int len; if (*code != 0) srand (*code); sprintf (random_string, "%d", rand()); len = strlen (random_string); return lib$scopy_r_dx (&len, random_string, outstring); } ----- ! ! The options file to govern linking of random.exe ! random.obj psect_attr=random_string,noshr universal=tpu$calluser ----- ! ! TPU command file to demonstrate call_user ! message (call_user (1, "")); message (call_user (0, "")); message (call_user (0, "")); message (call_user (0, "")); message (call_user (0, "")); message (""); message (call_user (1, "")); ----- ! ! The DCL command file showing how to ! link random and how to make it possible ! for TPU to use it ! $cc random $ $define/user lnk$library sys$share:vaxcrtl $link random/share/opt/map $ $define/user tpu$calluser reinig$dua0:[reinig.tpu.calluser]random $edit/tpu/nodis/nosec/command=random.tpu ------ ! ! Sample output from the above command file ! REINIG$ @random %TPU-S-FILEIN, 7 lines read from file REINIG$DUA0:[REINIG.TPU]RANDOM.TPU;3 1103527590 377401575 662824084 1147902781 2035015474 1103527590