chkarg (2) --- parse single-letter arguments 03/23/80 _C_a_l_l_i_n_g _I_n_f_o_r_m_a_t_i_o_n integer function chkarg (arg_num, result) integer arg_num, result (26) Library: vswtlb (standard Subsystem library) _F_u_n_c_t_i_o_n 'Chkarg' scans the list of arguments supplied on the command line, starting at position 'arg_num', looking for arguments that contain a dash followed by a string of letters. For each letter in such an argument, 'chkarg' looks at the corresponding element in the 'result' array (the letters "A" and "a" correspond to element 1, "Z" and "z" to element 26). If the element is non-negative, it is set to a positive value equal to the order in which the letter was encountered in scanning the arguments, counting from 1. Otherwise, the element is left unchanged and a value of ERR is returned as the result of the function. Thus, illegal letters may be detected by setting the corresponding elements in 'result' to a negative value before calling 'chkarg'. Scanning continues, incrementing 'arg_num', until the end of the argument list is reached, an argument not beginning with a dash is found, or an argument beginning with a dash but containing a subsequent character other than a letter is found. In the first two cases, 'chkarg' returns with the number of letters encountered as its result. In the third case, a result of ERR is returned. _I_m_p_l_e_m_e_n_t_a_t_i_o_n 'Chkarg' does a straightforward argument scan, using 'getarg' to fetch each argument in turn. The actions taken for each argument are simply those mentioned above. _A_r_g_u_m_e_n_t_s _M_o_d_i_f_i_e_d arg_num, result _C_a_l_l_s getarg _S_e_e _A_l_s_o getarg (2), getkwd (2) chkarg (2) - 1 - chkarg (2)