FNMATCH(3) BSD Programmer's Manual FNMATCH(3) NNAAMMEE ffnnmmaattcchh - match filename or pathname SSYYNNOOPPSSIISS ##iinncclluuddee <<ffnnmmaattcchh..hh>> _i_n_t ffnnmmaattcchh(_c_o_n_s_t _c_h_a_r _*_p_a_t_t_e_r_n, _c_o_n_s_t _c_h_a_r _*_s_t_r_i_n_g, _i_n_t _f_l_a_g_s); DDEESSCCRRIIPPTTIIOONN The ffnnmmaattcchh() function matches patterns according to the rules used by the shell. It checks the string specified by the _s_t_r_i_n_g argument to see if it matches the pattern specified by the _p_a_t_t_e_r_n argument. The _f_l_a_g_s argument modifies the interpretation of _p_a_t_t_e_r_n and _s_t_r_i_n_g. The value of _f_l_a_g_s is the bitwise inclusive OR of any of the following con- stants, which are defined in the include file _f_n_m_a_t_c_h_._h. FNM_NOESCAPE Normally, every occurrence of a backslash (`\') followed by a character in _p_a_t_t_e_r_n is replaced by that character. This is done to negate any special meaning for the character. If the FNM_NOESCAPE flag is set, a backslash character is treated as an ordinary character. FNM_PATHNAME Slash characters in _s_t_r_i_n_g must be explicitly matched by slashes in _p_a_t_t_e_r_n. If this flag is not set, then slashes are treated as regular characters. FNM_PERIOD Leading periods in strings match periods in patterns. The definition of ``leading'' is related to the specification of FNM_PATHNAME. A period is always ``leading'' if it is the first character in _s_t_r_i_n_g. Additionally, if FNM_PATHNAME is set, a period is ``leading'' if it immedi- ately follows a slash. _T_h_i_s _f_l_a_g _i_s _n_o_t _c_u_r_r_e_n_t_l_y _i_m_p_l_e_m_e_n_t_e_d_. RREETTUURRNN VVAALLUUEESS The ffnnmmaattcchh() function returns zero if _s_t_r_i_n_g matches the pattern speci- fied by _p_a_t_t_e_r_n, otherwise, it returns the value FNM_NOMATCH. SSEEEE AALLSSOO sh(1), glob(3), wordexp(3), regexp(3) HHIISSTTOORRYY The ffnnmmaattcchh() function first appeared in 4.4BSD. BBUUGGSS Quotes and slashes in range patterns are not handled correctly by this implementation. The FNM_PERIOD flag is not implemented. The pattern `*' matches the empty string, even if FNM_PATHNAME is speci- fied. 4.4BSD June 9, 1993 1