示例#1
0
文件: compress.c 项目: darnir/neomutt
/**
 * find_hook - Find a hook to match a path
 * @param type Type of hook, see #HookFlags
 * @param path Filename to test
 * @retval ptr  Matching hook command
 * @retval NULL No matches
 *
 * Each hook has a type and a pattern.
 * Find a command that matches the type and path supplied. e.g.
 *
 * User config:
 *      open-hook '\.gz$' "gzip -cd '%f' > '%t'"
 *
 * Call:
 *      find_hook (#MUTT_OPEN_HOOK, "myfile.gz");
 */
static const char *find_hook(HookFlags type, const char *path)
{
  if (!path)
    return NULL;

  const char *c = mutt_find_hook(type, path);
  if (!c || !*c)
    return NULL;

  return c;
}
示例#2
0
static const char *find_compress_hook (int type, const char *path)
{
    const char *c = mutt_find_hook (type, path);

    return (!c || !*c) ? NULL : c;
}