1 /* *********************************************************** 2 * * 3 * Copyright, (C) Honeywell Bull Inc., 1987 * 4 * * 5 * Copyright, (C) Honeywell Information Systems Inc., 1986 * 6 * * 7 *********************************************************** */ 8 9 /* HISTORY COMMENTS: 10 1) change(86-05-07,Lee), approve(87-07-13,MCR7580), audit(87-07-13,Leskiw), 11 install(87-08-07,MR12.1-1072): 12 Created. 13 END HISTORY COMMENTS */ 14 15 /* : PROCEDURE FUNCTION (i_fndcna) 16 17 Interrupt routine which searches either the local or remote CAT for the 18 capability name given the capability number. Encoded in the capability 19 number will be the system to search. 20 */ 21 22 /* : RETURNS 23 24 Returns 0 if successful, an ws_error otherwise. 25 */ 26 27 #include <dos.h> 28 #include <cat.h> 29 #include <ws_dcls.h> 30 #include <ws_error.h> 31 32 #define NULL 0 33 34 extern local_cat l_CAT[]; 35 extern remote_cat r_CAT[]; 36 extern char mysystem; 37 38 i_fndcna (p_param) 39 40 struct findname_param_struct *p_param; 41 { 42 int sysid; /* system id of CAT entry to be used */ 43 int cap_num; /* CAT entry to be found */ 44 int code; /* return code */ 45 int maj_number; /* major capability number stored in mcb */ 46 47 /* : extract the system id and CAT index 48 - if error in extracting, return the error code */ 49 50 code = c_unpack (&sysid, &cap_num, p_param -> major_capability_number); 51 if (code != 0) 52 return (code); 53 54 /* : if local cat then 55 - check for validity of capability found 56 - if invalid, set error code to invalid capability and return 57 -- copy the capability name into the output parameter */ 58 59 if (sysid == mysystem) { 60 cap_num = cap_num - MIN_CAPABILITY_NUMBER; 61 62 if (cap_num < 0 || cap_num >= NUMBER_OF_CAT_ENTRIES) 63 return (WSINVNUM); /* OUT OF RANGE */ 64 65 if (l_CAT[cap_num].mcb_ptr == NULL) 66 return (WSINVNUM); /* MCB NOT ALLOCATED */ 67 68 code = get_mcb_values (&(l_CAT[cap_num]),&(p_param -> capability_name[0]), 69 &maj_number); 70 return(code); 71 } 72 73 /* : else search the remote cat 74 - check for validity of capability found 75 - if invalid, set error code to invalid capability and return 76 -- copy capability name into caller's buffer */ 77 78 else { 79 cap_num = cap_num - MIN_CAPABILITY_NUMBER; 80 81 if ((cap_num < 0) || (cap_num >= NUMBER_OF_CAT_ENTRIES)) 82 return (WSINVNUM); /* OUT OF RANGE */ 83 84 if (r_CAT[cap_num].major_capability == 0 ) 85 return (WSINVNUM); /* MOWSE HAS NO INFORMATION */ 86 87 stccpy (p_param -> capability_name, r_CAT[cap_num].capability_name, CAPABILITY_NAME_LENGTH); 88 return(0); 89 } 90 } 91 ^Z