
*copyc OSD$DEFAULT_PRAGMATS
?? NEWTITLE := 'NOS/VE  Remote Host :' ??
MODULE rhm$link_user_descriptor_saved;

{ PURPOSE:
{   The purpose of this module is to save a link_user_descriptor that
{   can later be used to provide information to retrieve a file from
{   the 170 side of a 180 machine running in dual state.

?? NEWTITLE := '         Global Type Declarations' ??
?? SET (LIST := OFF) ??
?? EJECT ??

*copyc OST$NAME
*copyc OST$STRING
*copyc OST$STATUS
*copyc RHT$LINK_USER_DESCRIPTOR

?? TITLE := '         External Procedures Referenced By This Module' ??
?? SET (LIST := OFF) ??
?? EJECT ??

*copyc OSV$JOB_PAGEABLE_HEAP

?? TITLE := '         rhp$link_user_descriptor_saved' ??
?? SET (LIST := ON) ??
?? EJECT ??

{     The purpose of this request is to save the last link user
{ description entered by a user.  The information is saved with
{ the user's job environment.
{
{              RHP$LINK_USER_DESCRIPTOR_SAVED (USER, FAMILY, PASSWORD,
{                CHARGE, PROJECT, STATUS)
{
{ USER: (input) This parameter specifies the NOS/170 user name
{           under which the user is validated.
{
{ FAMILY: (input) This parameter specifies the NOS/170 family under
{           which the user is validated.
{
{ PASSWORD: (input) This parameter specifies the user's NOS/170
{           password needed to gain access to NOS/170 via the
{           user name.
{
{ CHARGE: (input) This parameter specifies the user's NOS/170 charge
{           number to be charged.
{
{ PROJECT: (input) This parameter specifies the user's NOS/170 project
{           number to be charged.
{
{ STATUS: (output) This parameter specifies the request status.
{

  VAR
    rhv$link_user_current_family: [XDCL, #GATE] string(31),
    rhv$link_user_descriptor_p: [XDCL, #GATE] ^rht$link_user_descriptor := NIL;

  PROCEDURE [XDCL, #GATE] rhp$link_user_descriptor_saved (user: string (31);
        family: string (31);
        password: string (31);
        charge: string (31);
        project: string (31);
    VAR status: ost$status);

    VAR
      lud: rht$link_user_descriptor,
      lud_pp: ^^rht$link_user_descriptor;

{ Save the current link_user_family.

    rhv$link_user_current_family := family;

{ If a link_user_descriptor for the family name given is already in the
{ link_user_descriptor chain then update the descriptor entry with
{ with the new parameters.

    lud_pp := ^rhv$link_user_descriptor_p;
    WHILE (lud_pp^ <> NIL) DO
      IF lud_pp^^.family = family THEN
        lud_pp^^.user := user;
        lud_pp^^.password := password;
        lud_pp^^.charge := charge;
        lud_pp^^.project := project;
        RETURN;
      IFEND;
      lud_pp := ^lud_pp^^.next_lud_p;
    WHILEND;

{ Initialize the link user descriptor.

    lud.next_lud_p := NIL;
    lud.user := user;
    lud.family := family;
    lud.password := password;
    lud.charge := charge;
    lud.project := project;

{ Obtain space for a new link_user_descriptor and fill in
{ the required information.

    ALLOCATE lud_pp^ IN osv$job_pageable_heap^;

    lud_pp^^ := lud;

  PROCEND rhp$link_user_descriptor_saved;

MODEND rhm$link_user_descriptor_saved;
