From 7eba87a5fd2f971ba9c0cd6cb0db96ae643dc9e7 Mon Sep 17 00:00:00 2001 From: Ingo Schwarze Date: Sun, 17 Aug 2014 03:24:47 +0000 Subject: Fully integrate apropos(1) into mandoc(1). Switch the argmode on the progname, including man(1). Provide -f and -k options to switch the argmode. Store the argmode inside struct search, generalizing the flags. Derive the deftype from the argmode when needed instead of storing it. Store the outkey inside struct search instead of passing it alone. While here, get rid of the trailing blanks in Makefile.depend. --- cgi.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'cgi.c') diff --git a/cgi.c b/cgi.c index b995a746..0ea3179d 100644 --- a/cgi.c +++ b/cgi.c @@ -1,4 +1,4 @@ -/* $Id: cgi.c,v 1.93 2014/08/10 23:54:41 schwarze Exp $ */ +/* $Id: cgi.c,v 1.94 2014/08/17 03:24:47 schwarze Exp $ */ /* * Copyright (c) 2011, 2012 Kristaps Dzonsons * Copyright (c) 2014 Ingo Schwarze @@ -973,8 +973,8 @@ pg_search(const struct req *req) search.arch = req->q.arch; search.sec = req->q.sec; - search.deftype = req->q.equal ? TYPE_Nm : (TYPE_Nm | TYPE_Nd); - search.flags = req->q.equal ? MANSEARCH_MAN : 0; + search.outkey = "Nd"; + search.argmode = req->q.equal ? ARG_NAME : ARG_EXPR; paths.sz = 1; paths.paths = mandoc_malloc(sizeof(char *)); @@ -1003,7 +1003,7 @@ pg_search(const struct req *req) ep++; } - if (0 == mansearch(&search, &paths, sz, cp, "Nd", &res, &ressz)) + if (0 == mansearch(&search, &paths, sz, cp, &res, &ressz)) pg_noresult(req, "You entered an invalid query."); else if (0 == ressz) pg_noresult(req, "No results found."); -- cgit v1.2.3