From:	CRDGW2::CRDGW2::MRGATE::"SMTP::CRVAX.SRI.COM::RELAY-INFO-VAX" 24-MAY-1991 04:00:35.80
To:	ARISIA::EVERHART
CC:	
Subj:	was Problem with VMSMAIL_PROFILE.DATA - now mail_edit 2/4

From:	RELAY-INFO-VAX@CRVAX.SRI.COM@SMTP@CRDGW2
To:	Everhart@Arisia@MRGATE

Received:  by crdgw1.ge.com (5.57/GE 1.97)
	 id AA26366; Fri, 24 May 91 03:48:10 EDT
Message-Id:  <9105240748.AA26366@crdgw1.ge.com>
Received: From SCFB.NWC.NAVY.MIL by CRVAX.SRI.COM with TCP; Thu, 23 MAY 91 16:28:55 PDT
Date: 23 May 91 13:03:00 PDT
From: "351M::LEVINE" <levine%351m.decnet@scfb.nwc.navy.mil>
Subject: was Problem with VMSMAIL_PROFILE.DATA - now mail_edit 2/4
To: "info-vax" <info-vax@kl.sri.com>

-+-+-+-+-+-+-+-+ START OF PART 2 -+-+-+-+-+-+-+-+
X`09if(user_name.length>12)user_name.length=12;
X`09uai_lst`5B0`5D.buffer= &temp_list->defdev;
X`09uai_lst`5B1`5D.buffer= &temp_list->defdir;
X`09status=smg$put_chars(&banner_id,&user_name,&22,&1,
X`09`09&SMG$M_ERASE_LINE);
X`09if((status&1)==0)exit(status);
X`09status=sys$getuai(0,0,&user_name,uai_lst,0,0,0);
X`09if(status!=SS$_NORMAL)
X`09`7B`09temp_list->in_sysuaf=FALSE;`7D
X`09else
X`09`7B`09temp_list->in_sysuaf=TRUE;`7D
X`09if(user_list==NULL)
X`09`7B`09user_list=end_list=temp_list;`7D
X`09else
X`09`7B`09end_list->next_user=temp_list;
X`09`09end_list=temp_list;
X`09`7D
X`7D
Xvoid build_user_menu_array()
X`7B`09char *name;
X`09long`09i,j,k,l;
X
X`09menu_list.length=NAME_SIZE;
X`09menu_list.dtype=DSC$K_DTYPE_T;
X`09menu_list.class=DSC$K_CLASS_A;
X`09menu_list.pointer=malloc((user_count+1)*NAME_SIZE);
X`09if(menu_list.pointer==NULL)
X`09`7B`09perror("allocation error");
X`09`09exit(1);
X`09`7D
X`09memset(menu_list.pointer,32,(user_count+1)*NAME_SIZE);
X`09menu_list.scale=0;
X`09menu_list.digits=0;
X`09menu_list.aflags=14*16;
X`09menu_list.dimct=1;
X`09menu_list.arsize=(user_count+1)*NAME_SIZE;
X`09menu_list.a0=menu_list.pointer-NAME_SIZE;
X`09menu_list.m1=user_count+1;
X`09menu_list.l1=1;
X`09menu_list.u1=user_count+1;`09
X
X`09temp_list=user_list;
X`09name=menu_list.pointer;
X
X`09for(i=1;i<=user_count;i++)
X`09`7B`09j=strlen(temp_list->username);
X`09`09if(j>(NAME_SIZE-2))j=NAME_SIZE-2;
X`09`09strncpy(name,temp_list->username,j);
X`09`09if(temp_list->in_sysuaf!=TRUE)name`5Bj`5D=42;
X`09`09temp_list=temp_list->next_user;
X`09`09name += NAME_SIZE;
X`09`7D
X`09strncpy(name,"Exit",4);
X`7D
Xlong select_user_action()
X`7B`09long`09status,i,j,k;
X`09short`09choice,last;
X
X`09status=smg$erase_display(&banner_id);
X`09if((status&1)==0)exit(status);
X`09status=smg$create_menu(&banner_id,&menu_list,0,&SMG$M_FIXED_FORMAT);
X`09if((status&1)==0)exit(status);
X`09while(1)
X`09`7B`09j=user_count+1;
X`09`09status=smg$select_from_menu(&keyboard_id,&banner_id,&choice
X`09`09`09,&last_entry);
X`09`09last_entry=choice;
X`09`09if(status==SMG$_EOF)return(user_count+1);
X`09`09if(((status&1))==0)exit(status);
X`09`09if((choice>0)&(choice<=(user_count+1)))return((long)choice);
X`09`7D
X`7D
Xvoid close_down()
X`7B`09long`09status;
X`09struct itmlst dummy;
X
X`09memset(&dummy,0,sizeof(struct itmlst));
X`09status=smg$delete_pasteboard(&pasteboard_id);
X`09if((status&1)==0)exit(status);
X`09status=mail$user_end(&context,&dummy,&dummy);
X`09if((status&1)==0)exit(status);
X`7D
Xvoid process_user(long user)
X`7B`09long i,j,k,l,status,action,select_record_action();
X`09short terminator;
X`09struct m_descripter record_list;
X`09struct s_descripter not_allowed,not_implimented,confirm;
X`09void build_record_menu(),update_personal_name(),update_message_count();
X`09void update_mail_dir(),update_forward(),update_edit(),update_queue();
X`09void update_form();
X`09struct itmlst set_list`5B3`5D,get_list;
X`09struct userlist *scan_list;
X
X`09not_allowed.type=0;
X`09not_allowed.address= &"Selected item can not be modified";
X`09not_allowed.length=strlen(not_allowed.address);
X`09not_implimented.type=0;
X`09not_implimented.address= &"Feature not implimented or unknown";
X`09not_implimented.length=strlen(not_implimented.address);
X`09memset(&get_list,0,sizeof(struct itmlst));
X
X`09temp_list=user_list;
X`09i=1;
X`09while(i<user)
X`09`7B`09temp_list=temp_list->next_user;
X`09`09i++;
X`09`7D
X`09while(1)
X`09`7B`09build_record_menu(temp_list,&record_list);
X`09`09action=select_record_action(&record_list);
X`09`09memset(&set_list,0,3*sizeof(struct itmlst));
X`09`09set_list`5B0`5D.item_code=MAIL$_USER_USERNAME;
X`09`09set_list`5B0`5D.buffer= &temp_list->username;
X`09`09set_list`5B0`5D.buffer_length=strlen(set_list`5B0`5D.buffer);
X`09`09if(set_list`5B0`5D.buffer_length>31)set_list`5B0`5D.buffer_length=31;
X`09`09switch(action)
X`09`09`7B`09case 1:
X`09`09`09case 4:
X`09`09`09case 6:
X`09`09`09`09smg$put_chars(&banner_id,&not_allowed,&22,&1,
X`09`09`09`09&SMG$M_ERASE_LINE,&SMG$M_BLINK,&0);
X`09`09`09`09smg$ring_bell(&banner_id);
X`09`09`09`09sleep(3);
X`09`09`09`09break;
X`09`09`09case 2:
X`09`09`09`09update_personal_name(temp_list,&set_list);
X`09`09`09`09break;
X`09`09`09case 3:
X`09`09`09`09update_message_count(temp_list,&set_list);
X`09`09`09`09break;
X`09`09`09case 5:
X`09`09`09`09update_mail_dir(temp_list,&set_list);
X`09`09`09`09break;
X`09`09`09case 7:
X`09`09`09`09update_forward(temp_list,&set_list);
X`09`09`09`09break;
X`09`09`09case 8:
X`09`09`09`09update_edit(temp_list,&set_list);
X`09`09`09`09break;
X`09`09`09case 9:
X`09`09`09`09update_queue(temp_list,&set_list);
X`09`09`09`09break;
X`09`09`09case 10:
X`09`09`09`09update_form(temp_list,&set_list);
X`09`09`09`09break;
X`09`09`09case 11:
X`09`09`09`09if((temp_list->auto_purge&1)!=0)
X`09`09`09`09`7B`09set_list`5B1`5D.item_code=
X`09`09`09`09`09`09MAIL$_USER_SET_NO_AUTO_PURGE;
X`09`09`09`09`09temp_list->auto_purge=0;
X`09`09`09`09`7D
X`09`09`09`09else
X`09`09`09`09`7B`09set_list`5B1`5D.item_code=
X`09`09`09`09`09`09MAIL$_USER_SET_AUTO_PURGE;
X`09`09`09`09`09temp_list->auto_purge=1;
X`09`09`09`09`7D
X`09`09`09`09status=mail$user_set_info(&context,&set_list,
X`09`09`09`09`09&get_list);
X`09`09`09`09if((status&1)==0)exit(status);
X`09`09`09`09break;
X`09`09`09case 12:
X`09`09`09`09if((temp_list->cc_prompt&1)!=0)
X`09`09`09`09`7B`09set_list`5B1`5D.item_code=
X`09`09`09`09`09`09MAIL$_USER_SET_NO_CC_PROMPT;
X`09`09`09`09`09temp_list->cc_prompt=0;
X`09`09`09`09`7D
X`09`09`09`09else
X`09`09`09`09`7B`09set_list`5B1`5D.item_code=
X`09`09`09`09`09`09MAIL$_USER_SET_CC_PROMPT;
X`09`09`09`09`09temp_list->cc_prompt=1;
X`09`09`09`09`7D
X`09`09`09`09status=mail$user_set_info(&context,&set_list,
X`09`09`09`09`09&get_list);
X`09`09`09`09if((status&1)==0)exit(status);
X`09`09`09`09break;
X`09`09`09case 13:
X`09`09`09`09if((temp_list->copy_forward&1)!=0)
X`09`09`09`09`7B`09set_list`5B1`5D.item_code=
X`09`09`09`09`09`09MAIL$_USER_SET_NO_COPY_FORWARD;
X`09`09`09`09`09temp_list->copy_forward=0;
X`09`09`09`09`7D
X`09`09`09`09else
X`09`09`09`09`7B`09set_list`5B1`5D.item_code=
X`09`09`09`09`09`09MAIL$_USER_SET_COPY_FORWARD;
X`09`09`09`09`09temp_list->copy_forward=1;
X`09`09`09`09`7D
X`09`09`09`09status=mail$user_set_info(&context,&set_list,
X`09`09`09`09`09&get_list);
X`09`09`09`09if((status&1)==0)exit(status);
X`09`09`09`09break;
X`09`09`09case 14:
X`09`09`09`09if((temp_list->copy_reply&1)!=0)
X`09`09`09`09`7B`09set_list`5B1`5D.item_code=
X`09`09`09`09`09`09MAIL$_USER_SET_NO_COPY_REPLY;
X`09`09`09`09`09temp_list->copy_reply=0;
X`09`09`09`09`7D
X`09`09`09`09else
X`09`09`09`09`7B`09set_list`5B1`5D.item_code=
X`09`09`09`09`09`09MAIL$_USER_SET_COPY_REPLY;
X`09`09`09`09`09temp_list->copy_reply=1;
X`09`09`09`09`7D
X`09`09`09`09status=mail$user_set_info(&context,&set_list,
X`09`09`09`09`09&get_list);
X`09`09`09`09if((status&1)==0)exit(status);
X`09`09`09`09break;
X`09`09`09case 15:
X`09`09`09`09if((temp_list->copy_send&1)!=0)
X`09`09`09`09`7B`09set_list`5B1`5D.item_code=
X`09`09`09`09`09`09MAIL$_USER_SET_NO_COPY_SEND;
X`09`09`09`09`09temp_list->copy_send=0;
X`09`09`09`09`7D
X`09`09`09`09else
X`09`09`09`09`7B`09set_list`5B1`5D.item_code=
X`09`09`09`09`09`09MAIL$_USER_SET_COPY_SEND;
X`09`09`09`09`09temp_list->copy_send=1;
X`09`09`09`09`7D
X`09`09`09`09status=mail$user_set_info(&context,&set_list,
X`09`09`09`09`09&get_list);
X`09`09`09`09if((status&1)==0)exit(status);
X`09`09`09`09break;
X`09`09`09case 16:
X`09`09`09`09confirm.type=0;
X`09`09`09`09confirm.address= &"Confirm delete (Y/N) `5BN`5D :";
X`09`09`09`09confirm.length=strlen(confirm.address);
X`09`09`09`09status=smg$put_chars(&banner_id,&confirm,
X`09`09`09`09`09&21,&1);
X`09`09`09`09if((status&1)==0)exit(status);
X`09`09`09`09status=smg$read_keystroke(&keyboard_id,
X`09`09`09`09`09`09&terminator);
X`09`09`09`09if((status&1)==0)exit(status);
X`09`09`09`09if((terminator!=SMG$K_TRM_UPPERCASE_Y)&
X`09`09`09`09`09(terminator!=SMG$K_TRM_LOWERCASE_Y))
X`09`09`09`09`09break;
X`09`09`09`09scan_list=user_list;
X`09`09`09`09if(temp_list==user_list)
X`09`09`09`09`7B`09user_list=scan_list->next_user;
X`09`09`09`09`09if(end_list==temp_list)end_list=NULL;
X`09`09`09`09`7D
X`09`09`09`09else
X`09`09`09`09`7B`09scan_list=user_list;
X`09`09`09`09`09while(scan_list->next_user!=temp_list)
X`09`09`09`09`09`09scan_list=scan_list->next_user;
X`09`09`09`09`09scan_list->next_user=
X`09`09`09`09`09`09temp_list->next_user;
X`09`09`09`09`09if(end_list==temp_list)
X`09`09`09`09`09`09end_list=scan_list;
X`09`09`09`09`7D
X`09`09`09`09status=mail$user_delete_info(&context
X`09`09`09`09`09,&set_list,&get_list);
X`09`09`09`09if((status&1)==0)exit(status);
X`09`09`09`09free(temp_list);
X`09`09`09`09user_count--;
X`09`09`09case 17:
X`09`09`09`09return;
X`09`09`09`09break;
X`09`09`09default:
X`09`09`09`09smg$put_chars(&banner_id,&not_implimented,
X`09`09`09`09&22,&1,&SMG$M_ERASE_LINE,&SMG$M_BLINK,&0);
X`09`09`09`09smg$ring_bell(&banner_id);
X`09`09`09`09sleep(3);
X`09`09`09`09break;
X`09`09`7D
X`09`7D
X`7D
Xvoid build_record_menu(struct userlist *temp_list,
X`09struct m_descripter *record_list)
X`7B`09long`09status,i,j,k,l;
X`09char`09*entry;
X
X`09record_list->length=MAX_LINE_SIZE;
X`09record_list->dtype=DSC$K_DTYPE_T;
X`09record_list->class=DSC$K_CLASS_A;
X`09record_list->pointer=malloc(17*MAX_LINE_SIZE);
X`09if(record_list->pointer==NULL)
X`09`7B`09perror("allocation error");
X`09`09exit(1);
X`09`7D
X`09memset(record_list->pointer,32,17*MAX_LINE_SIZE);
X`09record_list->scale=0;
X`09record_list->digits=0;
X`09record_list->aflags=14*17;
X`09record_list->dimct=1;
X`09record_list->arsize=17*MAX_LINE_SIZE;
X`09record_list->a0=record_list->pointer-MAX_LINE_SIZE;
X`09record_list->m1=17;
X`09record_list->l1=1;
X`09record_list->u1=17;`09
X
X`09entry=record_list->pointer;
X/* selection 1  username*/
X`09sprintf(entry,"Username:      %-.*s",
X`09`09(MAX_LINE_SIZE-15),temp_list->username);
X/* selection 2  personal name*/
X`09entry += MAX_LINE_SIZE;
X`09if(strlen(temp_list->personal_name)==0)
X`09`7B`09sprintf(entry,"No personal name");`7D
X`09else
X`09`7B`09sprintf(entry,"Personal Name: %-.*s",
X`09`09(MAX_LINE_SIZE-15),temp_list->personal_name);
X`09`7D
X/* selection 3  message count*/
X`09entry += MAX_LINE_SIZE;
X`09sprintf(entry,"Message Count: %u",temp_list->new_messages);
X/* selection 4 mail directory */
X`09entry += MAX_LINE_SIZE;
X`09sprintf(entry,"Mail dir:      %-.*s",
X`09`09(MAX_LINE_SIZE-15),temp_list->directory);
X/* selection 5 mail subdirectory */
X`09entry += MAX_LINE_SIZE;
X`09if(strlen(temp_list->subdirectory)==0)
X`09`7B`09sprintf(entry,"No mail subdirectory");`7D
X`09else
X`09`7B`09sprintf(entry,"Mail subdir:   %-.*s",
X`09`09(MAX_LINE_SIZE-15),temp_list->subdirectory);
X`09`7D
X/* selection 6 login dir*/
X`09entry += MAX_LINE_SIZE;
X`09if(temp_list->in_sysuaf==TRUE)
X`09`7B`09temp_list->defdev`5Btemp_list->defdev`5B0`5D+1`5D=0;
X`09`09temp_list->defdir`5Btemp_list->defdir`5B0`5D+1`5D=0;
X`09`09sprintf(entry,"Login dir:     %s%s",
X`09`09&temp_list->defdev`5B1`5D,&temp_list->defdir`5B1`5D);
X`09`7D
X`09else
X`09`7B`09sprintf(entry,"User not in sysuaf.dat");`7D
X/* selection 7 forwarding address*/
X`09entry += MAX_LINE_SIZE;
X`09if(strlen(temp_list->forwarding)==0)
X`09`7B`09sprintf(entry,"No forwarding");`7D
X`09else
X`09`7B`09sprintf(entry,"Forward to:    %-.*s",
X`09`09(MAX_LINE_SIZE-15),temp_list->forwarding);
X`09`7D
X/* selection 8 default editor */
X`09entry += MAX_LINE_SIZE;
X`09if(strlen(temp_list->editor)==0)
X`09`7B`09sprintf(entry,"No default editor (EDT used)");`7D
X`09else
X`09`7B`09sprintf(entry,"Default Editor:%-.*s",
X`09`09(MAX_LINE_SIZE-15),temp_list->editor);
X`09`7D
X/* selection 9 print queue*/
X`09entry += MAX_LINE_SIZE;
X`09if(strlen(temp_list->queue)==0)
X`09`7B`09sprintf(entry,"No default queue (SYS$PRINT used)");`7D
X`09else
X`09`7B`09sprintf(entry,"Default Queue :%-.*s",
X`09`09(MAX_LINE_SIZE-15),temp_list->queue);
X`09`7D
X/* selection 10 printer form*/
X`09entry += MAX_LINE_SIZE;
X`09if(strlen(temp_list->form)==0)
X`09`7B`09sprintf(entry,"No default form");`7D
X`09else
X`09`7B`09sprintf(entry,"Default Form  :%-.*s",
X`09`09(MAX_LINE_SIZE-15),temp_list->form);
X`09`7D
X/* selection 11 autopurge*/
X`09entry += MAX_LINE_SIZE;
X`09if((temp_list->auto_purge&1)==0)
X`09`7B `09sprintf(entry,"Autopurge:     Disabled");`7D
X`09else
X`09`7B `09sprintf(entry,"Autopurge:     Enabled");`7D
X/* selection 12 cc prompt*/
X`09entry += MAX_LINE_SIZE;
X`09if((temp_list->cc_prompt&1)==0)
X`09`7B `09sprintf(entry,"CC Prompt:     Disabled");`7D
X`09else
X`09`7B `09sprintf(entry,"CC Prompt:     Enabled");`7D
X/* selection 13 copy forward */
X`09entry += MAX_LINE_SIZE;
X`09if((temp_list->copy_forward&1)==0)
X`09`7B `09sprintf(entry,"Copy forward:  Disabled");`7D
X`09else
X`09`7B `09sprintf(entry,"Copy forward:  Enabled");`7D
X/* selection 14 copy reply */
X`09entry += MAX_LINE_SIZE;
X`09if((temp_list->copy_reply&1)==0)
X`09`7B `09sprintf(entry,"Copy reply:    Disabled");`7D
X`09else
X`09`7B `09sprintf(entry,"Copy reply:    Enabled");`7D
X/* selection 15 copy send*/
X`09entry += MAX_LINE_SIZE;
X`09if((temp_list->copy_send&1)==0)
X`09`7B `09sprintf(entry,"Copy send:     Disabled");`7D
X`09else
X`09`7B `09sprintf(entry,"Copy send:     Enabled");`7D
X/* selection 16 delete */
X`09entry += MAX_LINE_SIZE;
X`09sprintf(entry,"Delete user record");
X/* selection 17 exit*/
X`09entry += MAX_LINE_SIZE;
X`09sprintf(entry,"Exit");
X`7D
Xlong select_record_action(struct m_descripter *record_list)
X`7B`09long`09status,i,j,k;
X`09short`09choice,last;
X
X`09status=smg$erase_display(&banner_id);
X`09if((status&1)==0)exit(status);
X`09status=smg$create_menu(&banner_id,record_list,&SMG$K_VERTICAL);
X`09if((status&1)==0)exit(status);
X`09while(1)
X`09`7B`09status=smg$select_from_menu(&keyboard_id,&banner_id,&choice
X`09`09`09,&last_record);
X`09`09last_record=choice;
X`09`09if(status==SMG$_EOF)return(17);
X`09`09if(((status&1))==0)exit(status);
X`09`09if((choice>0)&(choice<=17))return((long)choice);
X`09`7D
X`7D
Xvoid update_personal_name(struct userlist *temp_list,struct itmlst *set_list
V)
X`7B`09char name`5B255`5D;
X`09unsigned short r_len;
X`09struct s_descripter result,prompt,confirm;
X`09struct itmlst get_list;
X`09short terminator;
X`09long status;
X
X`09memset(&get_list,0,sizeof(struct itmlst));
X`09prompt.type=0;
X`09prompt.address= &"Enter new personal name :";
+-+-+-+-+-+-+-+-  END  OF PART 2 +-+-+-+-+-+-+-+-


