UAF_DW_MAIN 22-NOV-1993 11:28:21 VAX C V3.2-044 Page 1 X-2 25-JUN-1993 14:50:36 [PILANT.HACK.DWAUTH.BL2]UAF_DW_MAIN.C;58 (1) 1 #module UAF_DW_MAIN "X-2" 2 3 /* 4 **++ 5 ** FACILITY: Authorization record maintenance utility 6 ** 7 ** MODULE DESCRIPTION: 8 ** 9 ** This module contains the various DECwindows main window 10 ** support routines needed by the DECwindows AUTHORIZE utility. 11 ** 12 ** AUTHORS: L. Mark Pilant CREATION DATE: 30-Oct-1992 13 ** 14 ** MODIFICATION HISTORY: 15 ** 16 ** X-2 LMP L. Mark Pilant, 5-MAR-1993 12:47 17 ** Convert to C from BLISS sources. 18 ** 19 ** X-1 LMP L. Mark Pilant, 30-Oct-1992 20 ** Original version. 21 ** 22 **-- 23 */ 24 25 /* 26 ** 27 ** INCLUDE FILES 28 ** 29 */ 30 31 #include ctype 94 #include stdlib 241 242 #include 32314 32315 #include "uaf_header" 33735 33736 /* 33737 ** 33738 ** FORWARD ROUTINES 33739 ** 33740 */ 33741 33742 #pragma noinline (AUTHORIZE$COMMAND_MENU) 33743 #pragma noinline (AUTHORIZE$CREATE_ENTRY) 33744 #pragma noinline (AUTHORIZE$DELETE_ENTRY) 33745 #pragma noinline (AUTHORIZE$FILE_MENU) 33746 #pragma noinline (AUTHORIZE$HELP_MENU) 33747 #pragma noinline (AUTHORIZE$MAIN_PROCESS) 33748 #pragma noinline (AUTHORIZE$MODIFY_ENTRY) 33749 #pragma noinline (AUTHORIZE$RESET_ENTRY) 33750 #pragma noinline (AUTHORIZE$SELECT_ENTRY) 33751 #pragma noinline (AUTHORIZE$SET_DEFAULT_FILTER) 33752 #pragma noinline (AUTHORIZE$SET_UP_GROUP) 33753 #pragma noinline (AUTHORIZE$SET_UP_USERNAME) UAF_DW_MAIN 22-NOV-1993 11:28:21 VAX C V3.2-044 Page 2 X-2 25-JUN-1993 14:50:36 [PILANT.HACK.DWAUTH.BL2]UAF_DW_MAIN.C;58 (1) 33754 33755 extern void AUTHORIZE$COMMAND_MENU (widget_id, tag, reason) 33756 33757 Widget widget_id; 33758 int *tag; 33759 XmAnyCallbackStruct *reason; 33760 { 33761 1 /* 33762 1 **++ 33763 1 ** FUNCTIONAL DESCRIPTION: 33764 1 ** 33765 1 ** This routine is called to process requests from the command menu list item. 33766 1 ** 33767 1 ** FORMAL PARAMETERS: 33768 1 ** 33769 1 ** {@subtags@} 33770 1 ** 33771 1 ** RETURN VALUE: 33772 1 ** 33773 1 ** None 33774 1 ** 33775 1 ** SIDE EFFECTS: 33776 1 ** 33777 1 ** {@description or none@} 33778 1 ** 33779 1 **-- 33780 1 */ 33781 1 33782 1 /* External routines. */ 33783 1 33784 1 extern void AUTHORIZE$MODIFY_TEMPLATE (); 33785 1 33786 1 /* Global references. */ 33787 1 33788 1 globalref int uaf_l_main_operation; /* Operation (i.e., create, modify, etc.) */ 33789 1 33790 1 /* Local storage. */ 33791 1 33792 1 unsigned int status; /* Routine exit status */ 33793 1 int widget_number = *tag; 33794 1 33795 1 /* Debug information. */ 33796 1 33797 1 #ifdef DEBUGGING 33798 X printf ("command menu\n"); 33799 1 #endif /* DEBUGGING */ 33800 1 33801 1 /* Set the operation (main window widget number) */ 33802 1 33803 1 uaf_l_main_operation = widget_number; 33804 1 33805 1 /* Call the appropriate routine, based upon the menu list item. */ 33806 1 33807 1 switch (widget_number) 33808 1 { 33809 2 case uaf$c_cmd_modify_template: UAF_DW_MAIN 22-NOV-1993 11:28:21 VAX C V3.2-044 Page 3 X-2 25-JUN-1993 14:50:36 [PILANT.HACK.DWAUTH.BL2]UAF_DW_MAIN.C;58 (2) 33810 2 { 33811 3 AUTHORIZE$MODIFY_TEMPLATE (widget_id, 33812 3 tag, 33813 3 reason); 33814 3 break; 33815 3 } 33816 2 } 33817 1 } 33818 UAF_DW_MAIN 22-NOV-1993 11:28:21 VAX C V3.2-044 Page 4 X-2 25-JUN-1993 14:50:36 [PILANT.HACK.DWAUTH.BL2]UAF_DW_MAIN.C;58 (3) 33819 extern void AUTHORIZE$CREATE_ENTRY (widget_id, tag, reason) 33820 33821 Widget widget_id; 33822 int *tag; 33823 XmAnyCallbackStruct *reason; 33824 { 33825 1 /* 33826 1 **++ 33827 1 ** FUNCTIONAL DESCRIPTION: 33828 1 ** 33829 1 ** This routine is called when it is necessary to create a new authorization 33830 1 ** entry. It will be necesary to get the username (or UIC) from the main 33831 1 ** window to determine which authorization entry is to be created. 33832 1 ** 33833 1 ** FORMAL PARAMETERS: 33834 1 ** 33835 1 ** {@subtags@} 33836 1 ** 33837 1 ** RETURN VALUE: 33838 1 ** 33839 1 ** None 33840 1 ** 33841 1 ** SIDE EFFECTS: 33842 1 ** 33843 1 ** {@description or none@} 33844 1 ** 33845 1 **-- 33846 1 */ 33847 1 33848 1 /* External routines. */ 33849 1 33850 1 extern void AUTHORIZE$DECW_ERROR (); 33851 1 extern unsigned int AUTHORIZE$FIND_USER_ENTRY (); 33852 1 extern void AUTHORIZE$ITMLST_COPY (); 33853 1 extern void AUTHORIZE$ITMLST_UPDATE (); 33854 1 extern void AUTHORIZE$SET_UP_ENTRY (); 33855 1 33856 1 /* Global references. */ 33857 1 33858 1 globalref struct ITMDEF (*uaf_r_current_group_info)[]; /* Current group UAF info */ 33859 1 globalref struct ITMDEF (*uaf_r_current_user_info)[]; /* Current user UAF info */ 33860 1 globalref Widget uaf_r_entry_window_widget; /* Entry window widget info */ 33861 1 globalref struct USRLSTDEF uaf_r_master_list; /* Complete user list (from the file) */ 33862 1 globalref Widget uaf_r_widget_id_array[]; /* Array of Widget IDs in use */ 33863 1 globalref char uaf_t_current_username[]; /* Current username */ 33864 1 33865 1 /* Local storage. */ 33866 1 33867 1 int index; /* General index */ 33868 1 unsigned int status; /* Routine exit status */ 33869 1 char *temp_string; /* Temp string pointer */ 33870 1 char text_string [MAX_USERNAME]; /* Text string (from main window) storage */ 33871 1 struct USRLSTDEF *user_entry; /* Current user list entry */ 33872 1 int widget_number = *tag; 33873 1 short int wildcard_name = 0; /* Wildcard indicator */ 33874 1 UAF_DW_MAIN 22-NOV-1993 11:28:21 VAX C V3.2-044 Page 5 X-2 25-JUN-1993 14:50:36 [PILANT.HACK.DWAUTH.BL2]UAF_DW_MAIN.C;58 (3) 33875 1 /* Debug information. */ 33876 1 33877 1 #ifdef DEBUGGING 33878 X printf ("create entry\n"); 33879 1 #endif /* DEBUGGING */ 33880 1 33881 1 /* Get the supplied username from the main window, convert it to all upper case 33882 1 ** characters and see if there are wildcards present. */ 33883 1 33884 1 temp_string = XmTextGetString (uaf_r_widget_id_array[uaf$c_main_username]); 33885 1 strcpy (text_string, temp_string); /* Copy the widget text */ 33886 1 for (index = 0; index < strlen (text_string); index++) 33887 1 { 33888 2 text_string[index] = toupper (text_string[index]); /* Upcase character */ 33889 2 if (text_string[index] == '*') wildcard_name = 1; /* Check for */ 33890 2 if (text_string[index] == '%') wildcard_name = 1; /* wildcards */ 33891 2 } 33892 1 XtFree (temp_string); 33893 1 33894 1 /* Since the name is now uppercased, reflect it in the main window. */ 33895 1 33896 1 XmTextSetString (uaf_r_widget_id_array[uaf$c_main_username], 33897 1 text_string); 33898 1 33899 1 /* Note the current username for later use. */ 33900 1 33901 1 strcpy (uaf_t_current_username, text_string); 33902 1 33903 1 #ifdef DEBUGGING 33904 X printf ("creating new user: %s\n", text_string); 33905 1 #endif /* DEBUGGING */ 33906 1 33907 1 /* If there are any wildcards, complain and abort the operation. */ 33908 1 33909 1 if (wildcard_name != 0) 33910 1 { 33911 2 AUTHORIZE$DECW_ERROR (UAF$_NOWILDCARDS); 33912 2 return; 33913 2 } 33914 1 33915 1 /* See if the user already exists. */ 33916 1 33917 1 if (TRUE (AUTHORIZE$FIND_USER_ENTRY (&uaf_r_master_list.uaf$l_usrlst_flink, 33918 1 uaf_t_current_username, 33919 1 FIND_NAME_EQUAL, 33920 1 0, 33921 1 0))) 33922 1 { 33923 2 33924 2 /* The user already exists. Let the user know, and return. */ 33925 2 33926 2 AUTHORIZE$DECW_ERROR (UAF$_USEREXISTS); 33927 2 return; 33928 2 } 33929 1 33930 1 /* The user doesn't exist. Set up a new entry using the selected group "default". 33931 1 ** The selected default may be a specific group default entry or the traditional UAF_DW_MAIN 22-NOV-1993 11:28:21 VAX C V3.2-044 Page 6 X-2 25-JUN-1993 14:50:36 [PILANT.HACK.DWAUTH.BL2]UAF_DW_MAIN.C;58 (3) 33932 1 ** default entry. */ 33933 1 33934 1 AUTHORIZE$ITMLST_COPY (uaf_r_current_group_info, 33935 1 &uaf_r_current_user_info, 33936 1 0); 33937 1 33938 1 /* Update the username in the copied item list to reflect the username of the 33939 1 ** entry to create. */ 33940 1 33941 1 AUTHORIZE$ITMLST_UPDATE (&uaf_r_current_user_info, 33942 1 UAI$_USERNAME, 33943 1 strlen (uaf_t_current_username), 33944 1 uaf_t_current_username); 33945 1 33946 1 /* Set up the information in the authorization entry window. */ 33947 1 33948 1 AUTHORIZE$SET_UP_ENTRY (uaf_r_current_user_info); 33949 1 33950 1 /* Make the entry window visible. */ 33951 1 33952 1 XtManageChild (uaf_r_entry_window_widget); 33953 1 } 33954 UAF_DW_MAIN 22-NOV-1993 11:28:21 VAX C V3.2-044 Page 7 X-2 25-JUN-1993 14:50:36 [PILANT.HACK.DWAUTH.BL2]UAF_DW_MAIN.C;58 (4) 33955 extern void AUTHORIZE$DELETE_ENTRY (widget_id, tag, reason) 33956 33957 Widget widget_id; 33958 int *tag; 33959 XmAnyCallbackStruct *reason; 33960 { 33961 1 /* 33962 1 **++ 33963 1 ** FUNCTIONAL DESCRIPTION: 33964 1 ** 33965 1 ** This routine is called to delete an authorization entry. 33966 1 ** 33967 1 ** FORMAL PARAMETERS: 33968 1 ** 33969 1 ** {@subtags@} 33970 1 ** 33971 1 ** RETURN VALUE: 33972 1 ** 33973 1 ** None 33974 1 ** 33975 1 ** SIDE EFFECTS: 33976 1 ** 33977 1 ** {@description or none@} 33978 1 ** 33979 1 **-- 33980 1 */ 33981 1 33982 1 /* External routines. */ 33983 1 33984 1 extern void AUTHORIZE$DECW_ERROR (); 33985 1 extern void AUTHORIZE$DEL_LIST_ENTRY (); 33986 1 extern unsigned int AUTHORIZE$DEL_USER_INFO (); 33987 1 extern unsigned int AUTHORIZE$FIND_USER_ENTRY (); 33988 1 extern void AUTHORIZE$SET_UP_GROUP (); 33989 1 extern void AUTHORIZE$SET_UP_USERNAME (); 33990 1 33991 1 /* Global references. */ 33992 1 33993 1 globalref unsigned int uaf_l_current_group_max; /* Count of entries in group list */ 33994 1 globalref unsigned int uaf_l_current_user_max; /* Count of entries in user list */ 33995 1 globalref struct USRLSTDEF uaf_r_group_list; /* Group user name list head */ 33996 1 globalref struct USRLSTDEF uaf_r_master_list; /* Complete user list (from the file) */ 33997 1 globalref struct USRLSTDEF uaf_r_user_list; /* User name list head */ 33998 1 globalref Widget uaf_r_widget_id_array[]; /* Array of Widget IDs in use */ 33999 1 globalref char uaf_t_current_username[]; /* Current username */ 34000 1 34001 1 /* Local storage. */ 34002 1 34003 1 XmString current_username; /* Current username compound string */ 34004 1 int index; /* General index */ 34005 1 int list_count; /* Number of list entries passed before adding item */ 34006 1 unsigned int status; /* Routine exit status */ 34007 1 char *temp_string; /* Temp string pointer */ 34008 1 char text_string [MAX_USERNAME]; /* Text string (from main window) storage */ 34009 1 struct USRLSTDEF *user_entry; /* Current user list entry */ 34010 1 int widget_number = *tag; UAF_DW_MAIN 22-NOV-1993 11:28:21 VAX C V3.2-044 Page 8 X-2 25-JUN-1993 14:50:36 [PILANT.HACK.DWAUTH.BL2]UAF_DW_MAIN.C;58 (4) 34011 1 short int wildcard_name = 0; /* Wildcard indicator */ 34012 1 34013 1 /* Debug information. */ 34014 1 34015 1 #ifdef DEBUGGING 34016 X printf ("delete entry\n"); 34017 1 #endif /* DEBUGGING */ 34018 1 34019 1 /* Get the supplied username from the main window, convert it to all upper case 34020 1 ** characters and see if there are wildcards present. */ 34021 1 34022 1 temp_string = XmTextGetString (uaf_r_widget_id_array[uaf$c_main_username]); 34023 1 strcpy (text_string, temp_string); /* Copy the widget text */ 34024 1 for (index = 0; index < strlen (text_string); index++) 34025 1 { 34026 2 text_string[index] = toupper (text_string[index]); /* Upcase character */ 34027 2 if (text_string[index] == '*') wildcard_name = 1; /* Check for */ 34028 2 if (text_string[index] == '%') wildcard_name = 1; /* wildcards */ 34029 2 } 34030 1 XtFree (temp_string); 34031 1 34032 1 /* Since the name is now uppercased, reflect it in the main window. */ 34033 1 34034 1 XmTextSetString (uaf_r_widget_id_array[uaf$c_main_username], 34035 1 text_string); 34036 1 34037 1 /* Note the current username for later use. */ 34038 1 34039 1 strcpy (uaf_t_current_username, text_string); 34040 1 current_username = XmStringCreateSimple (uaf_t_current_username); /* After being upcased */ 34041 1 34042 1 /* Make sure the user already exists. */ 34043 1 34044 1 if (FALSE (AUTHORIZE$FIND_USER_ENTRY (&uaf_r_master_list.uaf$l_usrlst_flink, 34045 1 &text_string, 34046 1 FIND_NAME_EQUAL, 34047 1 0, 34048 1 0))) 34049 1 { 34050 2 34051 2 /* The user does not exist. Let the user know, and return. */ 34052 2 34053 2 AUTHORIZE$DECW_ERROR (UAF$_NOSUCHUSER); 34054 2 XtFree (current_username); 34055 2 return; 34056 2 } 34057 1 34058 1 /* Delete the requested entry from the user authorization file. */ 34059 1 34060 1 if (FALSE (AUTHORIZE$DEL_USER_INFO (uaf_t_current_username))) 34061 1 { 34062 2 34063 2 /* There was some error deleting the authorization record. Let the user 34064 2 ** know and return. */ 34065 2 34066 2 AUTHORIZE$DECW_ERROR (UAF$_UAFWRITERR); 34067 2 XtFree (current_username); UAF_DW_MAIN 22-NOV-1993 11:28:21 VAX C V3.2-044 Page 9 X-2 25-JUN-1993 14:50:36 [PILANT.HACK.DWAUTH.BL2]UAF_DW_MAIN.C;58 (4) 34068 2 return; 34069 2 } 34070 1 34071 1 /* Since the authorization record has been successfully deleted, remove 34072 1 ** the internal information. */ 34073 1 34074 1 /* Check the master list of users to find the entry to remove. */ 34075 1 34076 1 if (TRUE (AUTHORIZE$FIND_USER_ENTRY (&uaf_r_master_list.uaf$l_usrlst_flink, 34077 1 &text_string, 34078 1 FIND_NAME_EQUAL, 34079 1 0, 34080 1 &user_entry))) 34081 1 AUTHORIZE$DEL_LIST_ENTRY (&user_entry->uaf$l_usrlst_flink); 34082 1 34083 1 /* Check the list of users to find the entry to remove. */ 34084 1 34085 1 if (TRUE (AUTHORIZE$FIND_USER_ENTRY (&uaf_r_user_list.uaf$l_usrlst_flink, 34086 1 &text_string, 34087 1 FIND_NAME_EQUAL, 34088 1 list_count, 34089 1 &user_entry))) 34090 1 { 34091 2 AUTHORIZE$DEL_LIST_ENTRY (&user_entry->uaf$l_usrlst_flink); 34092 2 --uaf_l_current_user_max; /* One less user */ 34093 2 XmListDeleteItem (uaf_r_widget_id_array[uaf$c_main_user_list], 34094 2 current_username); 34095 2 } 34096 1 34097 1 /* Limit check the list entry number. */ 34098 1 34099 1 if (list_count > uaf_l_current_user_max) list_count = uaf_l_current_user_max; 34100 1 34101 1 /* Since the username has been removed from the list, select the previous 34102 1 ** entry. */ 34103 1 34104 1 AUTHORIZE$SET_UP_USERNAME (NULL, 34105 1 list_count); 34106 1 34107 1 /* Check the list of groups to find the entry to remove. */ 34108 1 34109 1 if (TRUE (AUTHORIZE$FIND_USER_ENTRY (&uaf_r_group_list.uaf$l_usrlst_flink, 34110 1 &text_string, 34111 1 FIND_NAME_EQUAL, 34112 1 list_count, 34113 1 &user_entry))) 34114 1 { 34115 2 AUTHORIZE$DEL_LIST_ENTRY (&user_entry->uaf$l_usrlst_flink); 34116 2 --uaf_l_current_user_max; /* One less user */ 34117 2 XmListDeleteItem (uaf_r_widget_id_array[uaf$c_main_group_list], 34118 2 current_username); 34119 2 } 34120 1 34121 1 /* Limit check the list entry number. */ 34122 1 34123 1 if (list_count > uaf_l_current_group_max) list_count = uaf_l_current_group_max; 34124 1 UAF_DW_MAIN 22-NOV-1993 11:28:21 VAX C V3.2-044 Page 10 X-2 25-JUN-1993 14:50:36 [PILANT.HACK.DWAUTH.BL2]UAF_DW_MAIN.C;58 (4) 34125 1 /* Since the username has been removed from the list, select the previous 34126 1 ** entry. */ 34127 1 34128 1 AUTHORIZE$SET_UP_GROUP (NULL, 34129 1 list_count); 34130 1 34131 1 XtFree (current_username); 34132 1 } 34133 UAF_DW_MAIN 22-NOV-1993 11:28:21 VAX C V3.2-044 Page 11 X-2 25-JUN-1993 14:50:36 [PILANT.HACK.DWAUTH.BL2]UAF_DW_MAIN.C;58 (5) 34134 extern void AUTHORIZE$FILE_MENU (widget_id, tag, reason) 34135 34136 Widget widget_id; 34137 int *tag; 34138 XmAnyCallbackStruct *reason; 34139 { 34140 1 /* 34141 1 **++ 34142 1 ** FUNCTIONAL DESCRIPTION: 34143 1 ** 34144 1 ** This routine is called to process requests from the file menu list item. 34145 1 ** 34146 1 ** FORMAL PARAMETERS: 34147 1 ** 34148 1 ** {@subtags@} 34149 1 ** 34150 1 ** RETURN VALUE: 34151 1 ** 34152 1 ** None 34153 1 ** 34154 1 ** SIDE EFFECTS: 34155 1 ** 34156 1 ** {@description or none@} 34157 1 ** 34158 1 **-- 34159 1 */ 34160 1 34161 1 /* External routines. */ 34162 1 34163 1 extern unsigned int AUTHORIZE$BUILD_MASTER_LIST (); 34164 1 extern void AUTHORIZE$BUILD_USER_LIST (); 34165 1 extern void AUTHORIZE$DECW_ERROR (); 34166 1 extern void AUTHORIZE$WATCH_CURSOR_ON (); 34167 1 extern void AUTHORIZE$WATCH_CURSOR_OFF (); 34168 1 34169 1 /* Global references. */ 34170 1 34171 1 globalref Widget uaf_r_file_window_widget; /* File selection widget info */ 34172 1 globalref Widget uaf_r_main_top_level_widget; /* Main window widget shell info */ 34173 1 globalref Widget uaf_r_main_window_widget; /* Main window widget info */ 34174 1 globalref Cursor uaf_r_wait_cursor_main; /* Main window wait cursor id */ 34175 1 globalref unsigned short int uaf_w_uai_context[2]; /* $xxxUAI context cell */ 34176 1 34177 1 /* Local storage. */ 34178 1 34179 1 unsigned int status; /* Routine exit status */ 34180 1 int widget_number = *tag; 34181 1 34182 1 /* Debug information. */ 34183 1 34184 1 #ifdef DEBUGGING 34185 X printf ("file menu\n"); 34186 1 #endif /* DEBUGGING */ 34187 1 34188 1 /* Based upon the widget number, determine what should be done. */ 34189 1 UAF_DW_MAIN 22-NOV-1993 11:28:21 VAX C V3.2-044 Page 12 X-2 25-JUN-1993 14:50:36 [PILANT.HACK.DWAUTH.BL2]UAF_DW_MAIN.C;58 (5) 34190 1 switch (widget_number) 34191 1 { 34192 2 case uaf$c_ctl_open: 34193 2 { 34194 3 34195 3 /* Bring up the file selection box. */ 34196 3 34197 3 XtManageChild (uaf_r_file_window_widget); 34198 3 break; 34199 3 } 34200 2 case uaf$c_ctl_quit: 34201 2 { 34202 3 34203 3 /* All through with the session. */ 34204 3 34205 3 SYS$EXIT (SS$_NORMAL); 34206 3 break; 34207 3 } 34208 2 case uaf$c_ctl_refresh: 34209 2 { 34210 3 34211 3 /* If there is no authorization file open, indicated by the uaf_w_uai_context 34212 3 ** cell being something other than -1, there is nothing to refresh. */ 34213 3 34214 3 if (uaf_w_uai_context[0] != 0xFFFF) 34215 3 { 34216 4 34217 4 /* Since building the user list may take some time, set up the wait cursor. */ 34218 4 34219 4 AUTHORIZE$WATCH_CURSOR_ON (uaf_r_main_top_level_widget, 34220 4 uaf_r_main_window_widget, 34221 4 uaf_r_wait_cursor_main); 34222 4 34223 4 /* Rebuild the in memory user lists from the authorization file. */ 34224 4 34225 4 if (FALSE (AUTHORIZE$BUILD_MASTER_LIST ())) 34226 4 AUTHORIZE$DECW_ERROR (UAF$_UAFREADERR); 34227 4 AUTHORIZE$BUILD_USER_LIST (); 34228 4 34229 4 /* Reset the cursor. */ 34230 4 34231 4 AUTHORIZE$WATCH_CURSOR_OFF (uaf_r_main_top_level_widget, 34232 4 uaf_r_main_window_widget); 34233 4 } 34234 3 break; 34235 3 } 34236 2 } 34237 1 } 34238 UAF_DW_MAIN 22-NOV-1993 11:28:21 VAX C V3.2-044 Page 13 X-2 25-JUN-1993 14:50:36 [PILANT.HACK.DWAUTH.BL2]UAF_DW_MAIN.C;58 (6) 34239 extern void AUTHORIZE$HELP_MENU (widget_id, tag, reason) 34240 34241 Widget widget_id; 34242 int *tag; 34243 XmAnyCallbackStruct *reason; 34244 { 34245 1 /* 34246 1 **++ 34247 1 ** FUNCTIONAL DESCRIPTION: 34248 1 ** 34249 1 ** {@tbs@} 34250 1 ** 34251 1 ** FORMAL PARAMETERS: 34252 1 ** 34253 1 ** {@subtags@} 34254 1 ** 34255 1 ** RETURN VALUE: 34256 1 ** 34257 1 ** None 34258 1 ** 34259 1 ** SIDE EFFECTS: 34260 1 ** 34261 1 ** {@description or none@} 34262 1 ** 34263 1 **-- 34264 1 */ 34265 1 34266 1 /* Local storage. */ 34267 1 34268 1 unsigned int status; /* Routine exit status */ 34269 1 int widget_number = *tag; 34270 1 34271 1 /* Debug information. */ 34272 1 34273 1 #ifdef DEBUGGING 34274 X printf ("help menu\n"); 34275 1 #endif /* DEBUGGING */ 34276 1 } 34277 UAF_DW_MAIN 22-NOV-1993 11:28:21 VAX C V3.2-044 Page 14 X-2 25-JUN-1993 14:50:36 [PILANT.HACK.DWAUTH.BL2]UAF_DW_MAIN.C;58 (7) 34278 extern void AUTHORIZE$MAIN_PROCESS (widget_id, tag, reason) 34279 34280 Widget widget_id; 34281 int *tag; 34282 XmAnyCallbackStruct *reason; 34283 { 34284 1 /* 34285 1 **++ 34286 1 ** FUNCTIONAL DESCRIPTION: 34287 1 ** 34288 1 ** This routine is called to process requests via the main window 34289 1 ** pushbuttons. 34290 1 ** 34291 1 ** FORMAL PARAMETERS: 34292 1 ** 34293 1 ** {@subtags@} 34294 1 ** 34295 1 ** RETURN VALUE: 34296 1 ** 34297 1 ** None 34298 1 ** 34299 1 ** SIDE EFFECTS: 34300 1 ** 34301 1 ** {@description or none@} 34302 1 ** 34303 1 **-- 34304 1 */ 34305 1 34306 1 /* External routines. */ 34307 1 34308 1 extern void AUTHORIZE$CREATE_ENTRY (); 34309 1 extern void AUTHORIZE$DELETE_ENTRY (); 34310 1 extern void AUTHORIZE$MODIFY_ENTRY (); 34311 1 extern void AUTHORIZE$RESET_ENTRY (); 34312 1 extern void AUTHORIZE$SELECT_ENTRY (); 34313 1 34314 1 /* Global references. */ 34315 1 34316 1 globalref int uaf_l_main_operation; /* Operation (i.e., create, modify, etc.) */ 34317 1 34318 1 /* Local storage. */ 34319 1 34320 1 unsigned int status; /* Routine exit status */ 34321 1 int widget_number = *tag; 34322 1 34323 1 /* Debug information. */ 34324 1 34325 1 #ifdef DEBUGGING 34326 X printf ("main process\n"); 34327 1 #endif /* DEBUGGING */ 34328 1 34329 1 /* Set the operation (main window widget number) */ 34330 1 34331 1 uaf_l_main_operation = widget_number; 34332 1 34333 1 /* Call the appropriate routine, based upon the pushbutton. */ UAF_DW_MAIN 22-NOV-1993 11:28:21 VAX C V3.2-044 Page 15 X-2 25-JUN-1993 14:50:36 [PILANT.HACK.DWAUTH.BL2]UAF_DW_MAIN.C;58 (7) 34334 1 34335 1 switch (widget_number) 34336 1 { 34337 2 case uaf$c_main_create: 34338 2 { 34339 3 AUTHORIZE$CREATE_ENTRY (widget_id, 34340 3 tag, 34341 3 reason); 34342 3 break; 34343 3 } 34344 2 case uaf$c_main_modify: 34345 2 { 34346 3 uaf_l_main_operation = widget_number; /* Set the operation (main window widget number) */ 34347 3 AUTHORIZE$MODIFY_ENTRY (widget_id, 34348 3 tag, 34349 3 reason); 34350 3 break; 34351 3 } 34352 2 case uaf$c_main_reset: 34353 2 { 34354 3 uaf_l_main_operation = widget_number; /* Set the operation (main window widget number) */ 34355 3 AUTHORIZE$RESET_ENTRY (widget_id, 34356 3 tag, 34357 3 reason); 34358 3 break; 34359 3 } 34360 2 case uaf$c_main_select: 34361 2 { 34362 3 uaf_l_main_operation = widget_number; /* Set the operation (main window widget number) */ 34363 3 AUTHORIZE$SELECT_ENTRY (widget_id, 34364 3 tag, 34365 3 reason); 34366 3 break; 34367 3 } 34368 2 case uaf$c_main_delete: 34369 2 { 34370 3 uaf_l_main_operation = widget_number; /* Set the operation (main window widget number) */ 34371 3 AUTHORIZE$DELETE_ENTRY (widget_id, 34372 3 tag, 34373 3 reason); 34374 3 break; 34375 3 } 34376 2 } 34377 1 } 34378 UAF_DW_MAIN 22-NOV-1993 11:28:21 VAX C V3.2-044 Page 16 X-2 25-JUN-1993 14:50:36 [PILANT.HACK.DWAUTH.BL2]UAF_DW_MAIN.C;58 (8) 34379 extern void AUTHORIZE$MODIFY_ENTRY (widget_id, tag, reason) 34380 34381 Widget widget_id; 34382 int *tag; 34383 XmAnyCallbackStruct *reason; 34384 { 34385 1 /* 34386 1 **++ 34387 1 ** FUNCTIONAL DESCRIPTION: 34388 1 ** 34389 1 ** This routine is called when it is necessary to modify an existing 34390 1 ** authorization entry. It will be necesary to get the username (or 34391 1 ** UIC) from the main window to determine which authorization entries 34392 1 ** are to be affected. 34393 1 ** 34394 1 ** FORMAL PARAMETERS: 34395 1 ** 34396 1 ** {@subtags@} 34397 1 ** 34398 1 ** RETURN VALUE: 34399 1 ** 34400 1 ** None 34401 1 ** 34402 1 ** SIDE EFFECTS: 34403 1 ** 34404 1 ** {@description or none@} 34405 1 ** 34406 1 **-- 34407 1 */ 34408 1 34409 1 /* External routines. */ 34410 1 34411 1 extern void AUTHORIZE$DECW_ERROR (); 34412 1 extern unsigned int AUTHORIZE$FIND_USER_ENTRY (); 34413 1 extern void AUTHORIZE$GET_USER_INFO (); 34414 1 extern void AUTHORIZE$SET_UP_ENTRY (); 34415 1 34416 1 /* Global references. */ 34417 1 34418 1 globalref struct ITMDEF (*uaf_r_current_user_info)[]; /* Current user UAF info */ 34419 1 globalref Widget uaf_r_entry_window_widget; /* Entry window widget info */ 34420 1 globalref struct USRLSTDEF uaf_r_master_list; /* Complete user list (from the file) */ 34421 1 globalref Widget uaf_r_widget_id_array[]; /* Array of Widget IDs in use */ 34422 1 globalref char uaf_t_current_username[]; /* Current username */ 34423 1 34424 1 /* Local storage. */ 34425 1 34426 1 int index; /* General index */ 34427 1 unsigned int status; /* Routine exit status */ 34428 1 char *temp_string; /* Temp string pointer */ 34429 1 char text_string [MAX_USERNAME]; /* Text string (from main window) storage */ 34430 1 struct USRLSTDEF *user_entry; /* Current user list entry */ 34431 1 int widget_number = *tag; 34432 1 short int wildcard_name = 0; /* Wildcard indicator */ 34433 1 34434 1 /* Debug information. */ UAF_DW_MAIN 22-NOV-1993 11:28:21 VAX C V3.2-044 Page 17 X-2 25-JUN-1993 14:50:36 [PILANT.HACK.DWAUTH.BL2]UAF_DW_MAIN.C;58 (8) 34435 1 34436 1 #ifdef DEBUGGING 34437 X printf ("modify entry\n"); 34438 1 #endif /* DEBUGGING */ 34439 1 34440 1 /* Get the supplied username from the main window, convert it to all upper case 34441 1 ** characters and see if there are wildcards present. */ 34442 1 34443 1 temp_string = XmTextGetString (uaf_r_widget_id_array[uaf$c_main_username]); 34444 1 strcpy (text_string, temp_string); /* Copy the widget text */ 34445 1 for (index = 0; index < strlen (text_string); index++) 34446 1 { 34447 2 text_string[index] = toupper (text_string[index]); /* Upcase character */ 34448 2 if (text_string[index] == '*') wildcard_name = 1; /* Check for */ 34449 2 if (text_string[index] == '%') wildcard_name = 1; /* wildcards */ 34450 2 } 34451 1 XtFree (temp_string); 34452 1 34453 1 /* Since the name is now uppercased, reflect it in the main window. */ 34454 1 34455 1 XmTextSetString (uaf_r_widget_id_array[uaf$c_main_username], 34456 1 text_string); 34457 1 34458 1 /* If there are any wildcards, complain and abort the operation. */ 34459 1 34460 1 if (wildcard_name != 0) 34461 1 { 34462 2 AUTHORIZE$DECW_ERROR (UAF$_NOWILDCARDS); 34463 2 return; 34464 2 } 34465 1 34466 1 /* Note the current username for later use. */ 34467 1 34468 1 strcpy (uaf_t_current_username, text_string); 34469 1 34470 1 /* Make sure the user exists. */ 34471 1 34472 1 if (FALSE (AUTHORIZE$FIND_USER_ENTRY (&uaf_r_master_list.uaf$l_usrlst_flink, 34473 1 uaf_t_current_username, 34474 1 FIND_NAME_EQUAL, 34475 1 0, 34476 1 0))) 34477 1 { 34478 2 34479 2 /* The user does not exist. Let the user know, and return. */ 34480 2 34481 2 AUTHORIZE$DECW_ERROR (UAF$_NOSUCHUSER); 34482 2 return; 34483 2 } 34484 1 34485 1 /* Since an existing entry is being modified, set the initial state of all the 34486 1 ** information in the window. */ 34487 1 34488 1 AUTHORIZE$GET_USER_INFO (uaf_t_current_username, 34489 1 &uaf_r_current_user_info); 34490 1 AUTHORIZE$SET_UP_ENTRY (uaf_r_current_user_info); 34491 1 UAF_DW_MAIN 22-NOV-1993 11:28:21 VAX C V3.2-044 Page 18 X-2 25-JUN-1993 14:50:36 [PILANT.HACK.DWAUTH.BL2]UAF_DW_MAIN.C;58 (8) 34492 1 /* Make the entry window visible. */ 34493 1 34494 1 XtManageChild (uaf_r_entry_window_widget); 34495 1 } 34496 UAF_DW_MAIN 22-NOV-1993 11:28:21 VAX C V3.2-044 Page 19 X-2 25-JUN-1993 14:50:36 [PILANT.HACK.DWAUTH.BL2]UAF_DW_MAIN.C;58 (9) 34497 extern void AUTHORIZE$RESET_ENTRY (widget_id, tag, reason) 34498 34499 Widget widget_id; 34500 int *tag; 34501 XmAnyCallbackStruct *reason; 34502 { 34503 1 /* 34504 1 **++ 34505 1 ** FUNCTIONAL DESCRIPTION: 34506 1 ** 34507 1 ** This routine is called when it is necessary to reset the main window 34508 1 ** to an initial state. 34509 1 ** 34510 1 ** FORMAL PARAMETERS: 34511 1 ** 34512 1 ** {@subtags@} 34513 1 ** 34514 1 ** RETURN VALUE: 34515 1 ** 34516 1 ** None 34517 1 ** 34518 1 ** SIDE EFFECTS: 34519 1 ** 34520 1 ** {@description or none@} 34521 1 ** 34522 1 **-- 34523 1 */ 34524 1 34525 1 /* External routines. */ 34526 1 34527 1 extern void AUTHORIZE$BUILD_USER_LIST (); 34528 1 extern void AUTHORIZE$SET_DEFAULT_FILTER (); 34529 1 extern void AUTHORIZE$SET_UP_USERNAME (); 34530 1 extern void AUTHORIZE$WATCH_CURSOR_ON (); 34531 1 extern void AUTHORIZE$WATCH_CURSOR_OFF (); 34532 1 34533 1 /* Global references. */ 34534 1 34535 1 globalref Widget uaf_r_main_top_level_widget; /* Main window widget shell info */ 34536 1 globalref Widget uaf_r_main_window_widget; /* Main window widget info */ 34537 1 globalref Cursor uaf_r_wait_cursor_main; /* Main window wait cursor id */ 34538 1 globalref char *uaf_t_default_filter; /* Default username filter */ 34539 1 34540 1 /* Local storage. */ 34541 1 34542 1 unsigned int status; /* Routine exit status */ 34543 1 int widget_number = *tag; 34544 1 34545 1 /* Debug information. */ 34546 1 34547 1 #ifdef DEBUGGING 34548 X printf ("reset entry\n"); 34549 1 #endif /* DEBUGGING */ 34550 1 34551 1 /* Since building the user list may take some time, set up the wait cursor. */ 34552 1 UAF_DW_MAIN 22-NOV-1993 11:28:21 VAX C V3.2-044 Page 20 X-2 25-JUN-1993 14:50:36 [PILANT.HACK.DWAUTH.BL2]UAF_DW_MAIN.C;58 (9) 34553 1 AUTHORIZE$WATCH_CURSOR_ON (uaf_r_main_top_level_widget, 34554 1 uaf_r_main_window_widget, 34555 1 uaf_r_wait_cursor_main); 34556 1 34557 1 /* Set up the default username filter. */ 34558 1 34559 1 AUTHORIZE$SET_DEFAULT_FILTER (uaf_t_default_filter); 34560 1 34561 1 /* Get a list of the user's and groups. */ 34562 1 34563 1 AUTHORIZE$BUILD_USER_LIST (); 34564 1 34565 1 /* If possible, set up for the first username in the list. */ 34566 1 34567 1 AUTHORIZE$SET_UP_USERNAME (NULL, 34568 1 1); 34569 1 34570 1 /* Reset the cursor. */ 34571 1 34572 1 AUTHORIZE$WATCH_CURSOR_OFF (uaf_r_main_top_level_widget, 34573 1 uaf_r_main_window_widget); 34574 1 } 34575 UAF_DW_MAIN 22-NOV-1993 11:28:21 VAX C V3.2-044 Page 21 X-2 25-JUN-1993 14:50:36 UAF_DW_MAIN.C;58 (10) 34576 extern void AUTHORIZE$SELECT_ENTRY (widget_id, tag, reason) 34577 34578 Widget widget_id; 34579 int *tag; 34580 XmAnyCallbackStruct *reason; 34581 { 34582 1 /* 34583 1 **++ 34584 1 ** FUNCTIONAL DESCRIPTION: 34585 1 ** 34586 1 ** This routine is called when it is necessary to select a new set of 34587 1 ** authorization entries. These will be reflected in the user and group 34588 1 ** lists. 34589 1 ** 34590 1 ** FORMAL PARAMETERS: 34591 1 ** 34592 1 ** {@subtags@} 34593 1 ** 34594 1 ** RETURN VALUE: 34595 1 ** 34596 1 ** None 34597 1 ** 34598 1 ** SIDE EFFECTS: 34599 1 ** 34600 1 ** {@description or none@} 34601 1 ** 34602 1 **-- 34603 1 */ 34604 1 34605 1 /* External routines. */ 34606 1 34607 1 extern void AUTHORIZE$BUILD_USER_LIST (); 34608 1 extern void AUTHORIZE$SET_DEFAULT_FILTER (); 34609 1 extern void AUTHORIZE$SET_UP_USERNAME (); 34610 1 extern void AUTHORIZE$WATCH_CURSOR_ON (); 34611 1 extern void AUTHORIZE$WATCH_CURSOR_OFF (); 34612 1 34613 1 /* Global references. */ 34614 1 34615 1 globalref Widget uaf_r_main_top_level_widget; /* Main window widget shell info */ 34616 1 globalref Widget uaf_r_main_window_widget; /* Main window widget info */ 34617 1 globalref Cursor uaf_r_wait_cursor_main; /* Main window wait cursor id */ 34618 1 globalref Widget uaf_r_widget_id_array[]; /* Array of Widget IDs in use */ 34619 1 34620 1 /* Local storage. */ 34621 1 34622 1 int index; /* General index */ 34623 1 char *temp_string; /* Temp string pointer */ 34624 1 char text_string [MAX_USERNAME]; /* Text string (from main window) storage */ 34625 1 int widget_number = *tag; 34626 1 34627 1 /* Debug information. */ 34628 1 34629 1 #ifdef DEBUGGING 34630 X printf ("select entry\n"); 34631 1 #endif /* DEBUGGING */ UAF_DW_MAIN 22-NOV-1993 11:28:21 VAX C V3.2-044 Page 22 X-2 25-JUN-1993 14:50:36 UAF_DW_MAIN.C;58 (10) 34632 1 34633 1 /* Get the supplied filter string from the main window and convert it to all upper 34634 1 ** case characters. */ 34635 1 34636 1 temp_string = XmTextGetString (uaf_r_widget_id_array[uaf$c_main_filter]); 34637 1 strcpy (text_string, temp_string); /* Copy the widget text */ 34638 1 for (index = 0; index < sizeof text_string; index++) 34639 1 text_string[index] = toupper (text_string[index]); /* Upcase character */ 34640 1 34641 1 XmTextSetString (uaf_r_widget_id_array[uaf$c_main_filter], /* Reflect upcasing */ 34642 1 text_string); 34643 1 XtFree (temp_string); 34644 1 34645 1 /* Since building the user list may take some time, set up the wait cursor. */ 34646 1 34647 1 AUTHORIZE$WATCH_CURSOR_ON (uaf_r_main_top_level_widget, 34648 1 uaf_r_main_window_widget, 34649 1 uaf_r_wait_cursor_main); 34650 1 34651 1 /* Set up the new filter and build the new lists using the supplied filter. */ 34652 1 34653 1 AUTHORIZE$SET_DEFAULT_FILTER (text_string); 34654 1 AUTHORIZE$BUILD_USER_LIST (); 34655 1 AUTHORIZE$SET_UP_USERNAME (NULL, 34656 1 1); 34657 1 34658 1 /* Reset the cursor. */ 34659 1 34660 1 AUTHORIZE$WATCH_CURSOR_OFF (uaf_r_main_top_level_widget, 34661 1 uaf_r_main_window_widget); 34662 1 } 34663 UAF_DW_MAIN 22-NOV-1993 11:28:21 VAX C V3.2-044 Page 23 X-2 25-JUN-1993 14:50:36 UAF_DW_MAIN.C;58 (11) 34664 extern void AUTHORIZE$SET_DEFAULT_FILTER (filter) 34665 34666 char *filter; 34667 { 34668 1 /* 34669 1 **++ 34670 1 ** FUNCTIONAL DESCRIPTION: 34671 1 ** 34672 1 ** This routine is called to set up the default username filter 34673 1 ** string. This string may contain wildcards. 34674 1 ** 34675 1 ** FORMAL PARAMETERS: 34676 1 ** 34677 1 ** FILTER - pointer to the filter text 34678 1 ** 34679 1 ** RETURN VALUE: 34680 1 ** 34681 1 ** None. 34682 1 ** 34683 1 ** SIDE EFFECTS: 34684 1 ** 34685 1 ** {@description or none@} 34686 1 ** 34687 1 **-- 34688 1 */ 34689 1 34690 1 /* Global references. */ 34691 1 34692 1 globalref Widget uaf_r_widget_id_array[]; /* Array of Widget IDs in use */ 34693 1 globalref char uaf_t_username_filter[]; /* Current username filter string */ 34694 1 34695 1 /* Local storage. */ 34696 1 34697 1 unsigned int status; /* Routine exit status */ 34698 1 34699 1 /* Debug information. */ 34700 1 34701 1 #ifdef DEBUGGING 34702 X printf ("set default filter\n"); 34703 1 #endif /* DEBUGGING */ 34704 1 34705 1 /* Set up the filter in the main window. */ 34706 1 34707 1 XmTextSetString (uaf_r_widget_id_array[uaf$c_main_filter], 34708 1 filter); 34709 1 34710 1 /* Stash a copy of the new default filter. */ 34711 1 34712 1 strcpy (uaf_t_username_filter, filter); 34713 1 } 34714 UAF_DW_MAIN 22-NOV-1993 11:28:21 VAX C V3.2-044 Page 24 X-2 25-JUN-1993 14:50:36 UAF_DW_MAIN.C;58 (12) 34715 extern void AUTHORIZE$SET_UP_GROUP (group, position) 34716 34717 char *group; 34718 int position; 34719 { 34720 1 /* 34721 1 **++ 34722 1 ** FUNCTIONAL DESCRIPTION: 34723 1 ** 34724 1 ** {@tbs@} 34725 1 ** 34726 1 ** FORMAL PARAMETERS: 34727 1 ** 34728 1 ** {@subtags@} 34729 1 ** 34730 1 ** RETURN VALUE: 34731 1 ** 34732 1 ** None 34733 1 ** 34734 1 ** SIDE EFFECTS: 34735 1 ** 34736 1 ** {@description or none@} 34737 1 ** 34738 1 **-- 34739 1 */ 34740 1 34741 1 /* Global references. */ 34742 1 34743 1 globalref Widget uaf_r_widget_id_array[uaf$c_max_widget_code]; /* Array of Widget IDs in use */ 34744 1 34745 1 /* Local storage. */ 34746 1 34747 1 XmString compound_string; /* General compound string */ 34748 1 unsigned int status; /* Routine exit status */ 34749 1 34750 1 /* Debug information. */ 34751 1 34752 1 #ifdef DEBUGGING 34753 X printf ("set up group\n"); 34754 1 #endif /* DEBUGGING */ 34755 1 34756 1 /* If the set up is being done by group name, set the position in the list 34757 1 ** to the specified group name. Otherwise, set the position in the list 34758 1 ** to the specified (numeric) position. In addition, select the list item 34759 1 ** to simulate a mouse button click. */ 34760 1 34761 1 if (group != 0) 34762 1 { 34763 2 34764 2 /* See if the specified name exists in the list. (This is done by checking 34765 2 ** the actual list rather than the in-memory queue. Either method would work, 34766 2 ** but I wanted to practice with Motif.) If it is in the list, select it. */ 34767 2 34768 2 compound_string = XmStringCreateSimple (group); 34769 2 if (XmListItemExists (uaf_r_widget_id_array[uaf$c_main_group_list], 34770 2 compound_string)) UAF_DW_MAIN 22-NOV-1993 11:28:21 VAX C V3.2-044 Page 25 X-2 25-JUN-1993 14:50:36 UAF_DW_MAIN.C;58 (12) 34771 2 { 34772 3 XmListSetItem (uaf_r_widget_id_array[uaf$c_main_group_list], 34773 3 compound_string); 34774 3 XmListSelectItem (uaf_r_widget_id_array[uaf$c_main_group_list], 34775 3 compound_string, 34776 3 1); 34777 3 } 34778 2 XtFree (compound_string); 34779 2 } 34780 1 else 34781 1 { 34782 2 34783 2 /* Otherwise, get the first entry in the list and use it. */ 34784 2 34785 2 XmListSetPos (uaf_r_widget_id_array[uaf$c_main_group_list], 34786 2 position); 34787 2 XmListSelectPos (uaf_r_widget_id_array[uaf$c_main_group_list], 34788 2 position, 34789 2 1); 34790 2 } 34791 1 } 34792 UAF_DW_MAIN 22-NOV-1993 11:28:21 VAX C V3.2-044 Page 26 X-2 25-JUN-1993 14:50:36 UAF_DW_MAIN.C;58 (13) 34793 extern void AUTHORIZE$SET_UP_USERNAME (username, position) 34794 34795 char *username; 34796 int position; 34797 { 34798 1 /* 34799 1 **++ 34800 1 ** FUNCTIONAL DESCRIPTION: 34801 1 ** 34802 1 ** {@tbs@} 34803 1 ** 34804 1 ** FORMAL PARAMETERS: 34805 1 ** 34806 1 ** {@subtags@} 34807 1 ** 34808 1 ** RETURN VALUE: 34809 1 ** 34810 1 ** None 34811 1 ** 34812 1 ** SIDE EFFECTS: 34813 1 ** 34814 1 ** {@description or none@} 34815 1 ** 34816 1 **-- 34817 1 */ 34818 1 34819 1 /* Global references. */ 34820 1 34821 1 globalref unsigned int uaf_l_current_user_index; /* Index of current user */ 34822 1 globalref Widget uaf_r_widget_id_array[uaf$c_max_widget_code]; /* Array of Widget IDs in use */ 34823 1 globalref char uaf_t_current_username[]; /* Current username */ 34824 1 34825 1 /* Local storage. */ 34826 1 34827 1 XmString compound_string; /* General compound string */ 34828 1 char *temp_string; /* Temp string pointer */ 34829 1 34830 1 /* Debug information. */ 34831 1 34832 1 #ifdef DEBUGGING 34833 X printf ("set up username\n"); 34834 1 #endif /* DEBUGGING */ 34835 1 34836 1 /* If the set up is being done by username, set the position in the list 34837 1 ** to the specified username. Otherwise, set the position in the list 34838 1 ** to the specified (numeric) position. In addition, select the list item 34839 1 ** to simulate a mouse button click. */ 34840 1 34841 1 if (username != 0) 34842 1 { 34843 2 34844 2 /* See if the specified name exists in the list. (This is done by checking 34845 2 ** the actual list rather than the in-memory queue. Either method would work, 34846 2 ** but I wanted to practice with Motif.) If it is in the list, select it. */ 34847 2 34848 2 compound_string = XmStringCreateSimple (username); UAF_DW_MAIN 22-NOV-1993 11:28:21 VAX C V3.2-044 Page 27 X-2 25-JUN-1993 14:50:36 UAF_DW_MAIN.C;58 (13) 34849 2 if (XmListItemExists (uaf_r_widget_id_array[uaf$c_main_user_list], 34850 2 compound_string)) 34851 2 { 34852 3 uaf_l_current_user_index = XmListItemPos (uaf_r_widget_id_array[uaf$c_main_user_list], 34853 3 compound_string); 34854 3 XmListSetItem (uaf_r_widget_id_array[uaf$c_main_user_list], 34855 3 compound_string); 34856 3 XmListSelectItem (uaf_r_widget_id_array[uaf$c_main_user_list], 34857 3 compound_string, 34858 3 1); 34859 3 } 34860 2 XtFree (compound_string); 34861 2 } 34862 1 else 34863 1 { 34864 2 34865 2 /* Otherwise, get the position in the list and use it. */ 34866 2 34867 2 uaf_l_current_user_index = position; /* Get specified position */ 34868 2 if (uaf_l_current_user_index == 0) uaf_l_current_user_index = 1; /* Default to 1 */ 34869 2 XmListSetPos (uaf_r_widget_id_array[uaf$c_main_user_list], 34870 2 uaf_l_current_user_index); 34871 2 XmListSelectPos (uaf_r_widget_id_array[uaf$c_main_user_list], 34872 2 uaf_l_current_user_index, 34873 2 1); 34874 2 } 34875 1 34876 1 /* Since the current username in the main window has been set, get the value 34877 1 ** back and set it up in memory. This will be used later. */ 34878 1 34879 1 temp_string = XmTextGetString (uaf_r_widget_id_array[uaf$c_main_username]); 34880 1 strcpy (uaf_t_current_username, temp_string); /* Copy the widget text */ 34881 1 XtFree (temp_string); 34882 1 } Command Line ------------ CC/LIST=UAF_DW_MAIN/OBJECT=UAF_DW_MAIN UAF_DW_MAIN