UAF_DW_INIT 22-NOV-1993 11:28:09 VAX C V3.2-044 Page 1 X-1 3-NOV-1993 09:58:57 [PILANT.HACK.DWAUTH.BL2]UAF_DW_INIT.C;67 (1) 1 #module UAF_DW_INIT "X-1" 2 3 /* 4 **++ 5 ** FACILITY: Authorization record maintenance utility 6 ** 7 ** MODULE DESCRIPTION: 8 ** 9 ** This module contains the main processing routine for the 10 ** DECwindows AUTHORIZE utility. 11 ** 12 ** AUTHORS: L. Mark Pilant CREATION DATE: 25-Nov-1992 13 ** 14 ** MODIFICATION HISTORY: 15 ** 16 ** X-1 LMP L. Mark Pilant, 6-Apr-1993 17 ** Original version. 18 ** 19 **-- 20 */ 21 22 /* 23 ** 24 ** INCLUDE FILES 25 ** 26 */ 27 28 #include 175 176 #include string 222 223 #include 32282 #include 32521 #include 32553 32554 #include "uaf_header" 33974 33975 /* 33976 ** 33977 ** FORWARD ROUTINES. 33978 ** 33979 */ 33980 33981 #pragma noinline (AUTHORIZE$DECW_INIT) 33982 #pragma noinline (AUTHORIZE$DECW_MAIN_LOOP) 33983 UAF_DW_INIT 22-NOV-1993 11:28:09 VAX C V3.2-044 Page 2 X-1 3-NOV-1993 09:58:57 [PILANT.HACK.DWAUTH.BL2]UAF_DW_INIT.C;67 (2) 33984 extern unsigned int AUTHORIZE$DECW_INIT () 33985 33986 { 33987 1 /* 33988 1 **++ 33989 1 ** FUNCTIONAL DESCRIPTION: 33990 1 ** 33991 1 ** This routine initializes the DECwindows environment for the 33992 1 ** DECwindows authorization utility. 33993 1 ** 33994 1 ** FORMAL PARAMETERS: 33995 1 ** 33996 1 ** None. 33997 1 ** 33998 1 ** RETURN VALUE: 33999 1 ** 34000 1 ** SS$_NORMAL if successful, error code otherwise. 34001 1 ** 34002 1 ** SIDE EFFECTS: 34003 1 ** 34004 1 ** None. 34005 1 ** 34006 1 **-- 34007 1 */ 34008 1 UAF_DW_INIT 22-NOV-1993 11:28:09 VAX C V3.2-044 Page 3 X-1 3-NOV-1993 09:58:57 [PILANT.HACK.DWAUTH.BL2]UAF_DW_INIT.C;67 (3) 34009 1 /* Required constants. */ 34010 1 34011 1 #define ARG_COUNT 1 /* Number of X arguments in list */ 34012 1 34013 1 /* External routines. */ 34014 1 34015 1 extern void AUTHORIZE$DECW_ACTIVATE_PROC (); 34016 1 extern void AUTHORIZE$DECW_BUTTON_PROC (); 34017 1 extern void AUTHORIZE$DECW_CREATE_PROC (); 34018 1 extern void AUTHORIZE$DECW_LIST_PROC (); 34019 1 extern void AUTHORIZE$DECW_PULL_PROC (); 34020 1 extern void AUTHORIZE$DECW_TOGGLE_PROC (); 34021 1 34022 1 /* Global references. */ 34023 1 34024 1 globalref Widget uaf_r_access_pri_window_widget; /* Primary access restriction window widget info */ 34025 1 globalref Widget uaf_r_access_sec_window_widget; /* Secondary access restriction window widget info */ 34026 1 globalref XtAppContext uaf_r_app_context; /* Application context */ 34027 1 globalref Display *uaf_r_entry_display; /* Display id for authorization entry window */ 34028 1 globalref Widget uaf_r_entry_popup_menu_widget; /* Entry window popup menu */ 34029 1 globalref Widget uaf_r_entry_top_level_widget; /* Entry window widget shell info */ 34030 1 globalref Widget uaf_r_entry_window_widget; /* Entry window widget info */ 34031 1 globalref Display *uaf_r_file_display; /* Display id for file selection window */ 34032 1 globalref Widget uaf_r_file_top_level_widget; /* File selction widget shell info */ 34033 1 globalref Widget uaf_r_file_window_widget; /* File selection widget info */ 34034 1 globalref Widget uaf_r_id_popup_menu_widget; /* Identifier window popup menu */ 34035 1 globalref Widget uaf_r_identifier_window_widget; /* Identifier window widget info */ 34036 1 globalref Display *uaf_r_main_display; /* Display id for main window */ 34037 1 globalref Widget uaf_r_main_top_level_widget; /* Main window widget shell info */ 34038 1 globalref Widget uaf_r_main_window_widget; /* Main window widget info */ 34039 1 globalref MrmHierarchy uaf_r_mrm_hierarchy; /* Hierarchy info for .UID file(s) */ 34040 1 globalref Widget uaf_r_system_id_window_widget; /* System identifier window widget info */ 34041 1 globalref Cursor uaf_r_wait_cursor_entry; /* Entry window wait cursor id */ 34042 1 globalref Cursor uaf_r_wait_cursor_main; /* Main window wait cursor id */ 34043 1 globalref Widget uaf_r_widget_id_array[]; /* Array of Widget IDs in use */ 34044 1 34045 1 /* Local storage. */ 34046 1 34047 1 #define app_class "DECW$AUTHORIZE" 34048 1 #define app_name "Authorize Utility" 34049 1 34050 1 Arg args[ARG_COUNT]; /* Genral X argument list */ 34051 1 MrmType *class; /* Widget class */ 34052 1 unsigned int status; /* Routine exit status */ 34053 1 char *uid_filename_vec[] = /* Heirachy file list. */ 34054 1 {"decw$authorize.uid" /* There is only one UID file for */ 34055 1 }; /* this application. */ 34056 1 int uid_filename_num = (sizeof uid_filename_vec / sizeof uid_filename_vec [0]); 34057 1 34058 1 /* Mrm bindings */ 34059 1 34060 1 static MrmRegisterArg mrm_resource_list[] = /* Resource list for Mrm callbacks */ 34061 1 { 34062 1 {"activate_proc", (caddr_t) AUTHORIZE$DECW_ACTIVATE_PROC}, /* Button callback */ 34063 1 {"create_proc", (caddr_t) AUTHORIZE$DECW_CREATE_PROC}, /* Widget creation callback */ 34064 1 {"list_proc", (caddr_t) AUTHORIZE$DECW_LIST_PROC}, /* List creation callback */ UAF_DW_INIT 22-NOV-1993 11:28:09 VAX C V3.2-044 Page 4 X-1 3-NOV-1993 09:58:57 [PILANT.HACK.DWAUTH.BL2]UAF_DW_INIT.C;67 (3) 34065 1 {"pull_proc", (caddr_t) AUTHORIZE$DECW_PULL_PROC}, /* */ 34066 1 {"toggle_proc", (caddr_t) AUTHORIZE$DECW_TOGGLE_PROC} /* */ 34067 1 }; 34068 1 static int mrm_resource_list_count = (sizeof mrm_resource_list / sizeof mrm_resource_list[0]); 34069 1 UAF_DW_INIT 22-NOV-1993 11:28:09 VAX C V3.2-044 Page 5 X-1 3-NOV-1993 09:58:57 [PILANT.HACK.DWAUTH.BL2]UAF_DW_INIT.C;67 (4) 34070 1 /* Initialize the resource manager. */ 34071 1 34072 1 MrmInitialize (); 34073 1 34074 1 /* Initialize the X tool kit. */ 34075 1 34076 1 XtToolkitInitialize (); 34077 1 34078 1 /* Create an application context. */ 34079 1 34080 1 uaf_r_app_context = XtCreateApplicationContext (); 34081 1 34082 1 /* Create the display and top level widget for the main window. */ 34083 1 34084 1 uaf_r_main_display = XtOpenDisplay (uaf_r_app_context, 34085 1 NULL, 34086 1 app_name, 34087 1 app_class, 34088 1 NULL, 34089 1 NULL, 34090 1 &NULL, 34091 1 NULL); 34092 1 if (uaf_r_main_display == 0) return UAF$_INITDISPLAY; 34093 1 34094 1 uaf_r_main_top_level_widget = XtAppCreateShell (app_name, 34095 1 app_class, 34096 1 applicationShellWidgetClass, 34097 1 uaf_r_main_display, 34098 1 NULL, 34099 1 NULL); 34100 1 if (uaf_r_main_top_level_widget == 0) return UAF$_INITDISPLAY; 34101 1 34102 1 /* Create the display and top level widget for the entry window. */ 34103 1 34104 1 uaf_r_entry_display = XtOpenDisplay (uaf_r_app_context, 34105 1 NULL, 34106 1 app_name, 34107 1 app_class, 34108 1 NULL, 34109 1 NULL, 34110 1 &NULL, 34111 1 NULL); 34112 1 if (uaf_r_entry_display == 0) return UAF$_INITDISPLAY; 34113 1 34114 1 uaf_r_entry_top_level_widget = XtCreatePopupShell (app_name, 34115 1 topLevelShellWidgetClass, 34116 1 uaf_r_main_top_level_widget, 34117 1 NULL, 34118 1 NULL); 34119 1 if (uaf_r_entry_top_level_widget == 0) return UAF$_INITDISPLAY; 34120 1 34121 1 /* Create the display and top level widget for the file selection window. */ 34122 1 34123 1 uaf_r_file_display = XtOpenDisplay (uaf_r_app_context, 34124 1 NULL, 34125 1 app_name, UAF_DW_INIT 22-NOV-1993 11:28:09 VAX C V3.2-044 Page 6 X-1 3-NOV-1993 09:58:57 [PILANT.HACK.DWAUTH.BL2]UAF_DW_INIT.C;67 (4) 34126 1 app_class, 34127 1 NULL, 34128 1 NULL, 34129 1 &NULL, 34130 1 NULL); 34131 1 if (uaf_r_file_display == 0) return UAF$_INITDISPLAY; 34132 1 34133 1 uaf_r_file_top_level_widget = XtCreatePopupShell (app_name, 34134 1 topLevelShellWidgetClass, 34135 1 uaf_r_main_top_level_widget, 34136 1 NULL, 34137 1 NULL); 34138 1 if (uaf_r_file_top_level_widget == 0) return UAF$_INITDISPLAY; 34139 1 34140 1 /* Open the hierarchy file. */ 34141 1 34142 1 CHECK_RETURN (MrmOpenHierarchy (uid_filename_num, 34143 1 uid_filename_vec, 34144 1 NULL, 34145 1 &uaf_r_mrm_hierarchy)); 34146 1 34147 1 /* Register the resources. */ 34148 1 34149 1 CHECK_RETURN (MrmRegisterNames (mrm_resource_list, 34150 1 mrm_resource_list_count)); 34151 1 34152 1 /* Fetch the main window widget. */ 34153 1 34154 1 CHECK_RETURN (MrmFetchWidget (uaf_r_mrm_hierarchy, 34155 1 "mainwindow", 34156 1 uaf_r_main_top_level_widget, 34157 1 &uaf_r_main_window_widget, 34158 1 &class)); 34159 1 34160 1 /* Fetch the identifier window widget. */ 34161 1 34162 1 CHECK_RETURN (MrmFetchWidget (uaf_r_mrm_hierarchy, 34163 1 "identifier_window", 34164 1 uaf_r_main_top_level_widget, 34165 1 &uaf_r_identifier_window_widget, 34166 1 &class)); 34167 1 34168 1 /* Fetch the identifier popup menu widget. */ 34169 1 34170 1 CHECK_RETURN (MrmFetchWidget (uaf_r_mrm_hierarchy, 34171 1 "identifier_popup_menu", 34172 1 uaf_r_entry_top_level_widget, 34173 1 &uaf_r_id_popup_menu_widget, 34174 1 &class)); 34175 1 34176 1 /* Extablish an event handler for the identifier window. */ 34177 1 34178 1 XtAddEventHandler (uaf_r_identifier_window_widget, 34179 1 ButtonPressMask, 34180 1 /* False, */ 34181 1 True, 34182 1 (caddr_t) AUTHORIZE$DECW_BUTTON_PROC, UAF_DW_INIT 22-NOV-1993 11:28:09 VAX C V3.2-044 Page 7 X-1 3-NOV-1993 09:58:57 [PILANT.HACK.DWAUTH.BL2]UAF_DW_INIT.C;67 (4) 34183 1 NULL); 34184 1 34185 1 /* Fetch the system identifier window widget. */ 34186 1 34187 1 CHECK_RETURN (MrmFetchWidget (uaf_r_mrm_hierarchy, 34188 1 "system_identifier_window", 34189 1 uaf_r_main_top_level_widget, 34190 1 &uaf_r_system_id_window_widget, 34191 1 &class)); 34192 1 34193 1 /* Fetch the entry window widget. */ 34194 1 34195 1 CHECK_RETURN (MrmFetchWidget (uaf_r_mrm_hierarchy, 34196 1 "entry_window", 34197 1 uaf_r_entry_top_level_widget, 34198 1 &uaf_r_entry_window_widget, 34199 1 &class)); 34200 1 34201 1 /* Fetch the entry popup menu widget. */ 34202 1 34203 1 CHECK_RETURN (MrmFetchWidget (uaf_r_mrm_hierarchy, 34204 1 "entry_popup_menu", 34205 1 uaf_r_entry_top_level_widget, 34206 1 &uaf_r_entry_popup_menu_widget, 34207 1 &class)); 34208 1 34209 1 /* Extablish an event handler for the entry window. */ 34210 1 34211 1 XtAddEventHandler (uaf_r_entry_window_widget, 34212 1 ButtonPressMask, 34213 1 /* False, */ 34214 1 True, 34215 1 (caddr_t) AUTHORIZE$DECW_BUTTON_PROC, 34216 1 NULL); 34217 1 34218 1 /* Fetch the primary access restriction window widget. */ 34219 1 34220 1 CHECK_RETURN (MrmFetchWidget (uaf_r_mrm_hierarchy, 34221 1 "pri_access_restriction_window", 34222 1 uaf_r_entry_top_level_widget, 34223 1 &uaf_r_access_pri_window_widget, 34224 1 &class)); 34225 1 34226 1 /* Fetch the secondary access restriction window widget. */ 34227 1 34228 1 CHECK_RETURN (MrmFetchWidget (uaf_r_mrm_hierarchy, 34229 1 "sec_access_restriction_window", 34230 1 uaf_r_entry_top_level_widget, 34231 1 &uaf_r_access_sec_window_widget, 34232 1 &class)); 34233 1 34234 1 /* Fetch the file selection window widget. */ 34235 1 34236 1 CHECK_RETURN (MrmFetchWidget (uaf_r_mrm_hierarchy, 34237 1 "file_selection_window", 34238 1 uaf_r_file_top_level_widget, 34239 1 &uaf_r_file_window_widget, UAF_DW_INIT 22-NOV-1993 11:28:09 VAX C V3.2-044 Page 8 X-1 3-NOV-1993 09:58:57 [PILANT.HACK.DWAUTH.BL2]UAF_DW_INIT.C;67 (4) 34240 1 &class)); 34241 1 34242 1 /* Create the wait (watch) cursor. */ 34243 1 34244 1 uaf_r_wait_cursor_main = DXmCreateCursor (uaf_r_main_top_level_widget, 34245 1 decw$c_wait_cursor); 34246 1 uaf_r_wait_cursor_entry = DXmCreateCursor (uaf_r_entry_top_level_widget, 34247 1 decw$c_wait_cursor); 34248 1 34249 1 /* If the INITIAL_OPEN symbol is defined, disable the OPEN option in 34250 1 ** the file menu. This is because the various $xxxUAI utilities do not 34251 1 ** know how to deal with a file other than SYS$SYSTEM:SYSUAF.DAT. */ 34252 1 34253 1 #ifdef INITIAL_OPEN 34254 1 XtSetArg (args[0], 34255 1 XmNsensitive, 34256 1 0); /* false */ 34257 1 XtSetValues (uaf_r_widget_id_array[uaf$c_ctl_open], 34258 1 args, 34259 1 ARG_COUNT); 34260 1 #endif /* INITIAL_OPEN */ 34261 1 34262 1 /* Return to caller, all set. */ 34263 1 34264 1 return SS$_NORMAL; 34265 1 } 34266 UAF_DW_INIT 22-NOV-1993 11:28:09 VAX C V3.2-044 Page 9 X-1 3-NOV-1993 09:58:57 [PILANT.HACK.DWAUTH.BL2]UAF_DW_INIT.C;67 (5) 34267 extern void AUTHORIZE$DECW_MAIN_LOOP () 34268 34269 { 34270 1 /* 34271 1 **++ 34272 1 ** FUNCTIONAL DESCRIPTION: 34273 1 ** 34274 1 ** This routine makes the main window visible and sits in a loop 34275 1 ** processing X events. 34276 1 ** 34277 1 ** FORMAL PARAMETERS: 34278 1 ** 34279 1 ** None. 34280 1 ** 34281 1 ** RETURN VALUE: 34282 1 ** 34283 1 ** None. 34284 1 ** 34285 1 ** SIDE EFFECTS: 34286 1 ** 34287 1 ** None. 34288 1 ** 34289 1 **-- 34290 1 */ 34291 1 34292 1 /* Global references. */ 34293 1 34294 1 globalref XtAppContext uaf_r_app_context; /* Application context */ 34295 1 globalref Widget uaf_r_main_top_level_widget; /* Main window widget shell info */ 34296 1 globalref Widget uaf_r_main_window_widget; /* Main window widget info */ 34297 1 34298 1 /* Manage the main part of the display and realize everything. This will bring 34299 1 ** up the DECwindows interface. */ 34300 1 34301 1 XtManageChild (uaf_r_main_window_widget); 34302 1 XtRealizeWidget (uaf_r_main_top_level_widget); 34303 1 34304 1 /* Sit in a loop processing the X-events. */ 34305 1 34306 1 XtAppMainLoop (uaf_r_app_context); 34307 1 34308 1 /* Should never get here. */ 34309 1 } Command Line ------------ CC/LIST=UAF_DW_INIT/OBJECT=UAF_DW_INIT UAF_DW_INIT