Commit Graph

98 Commits

Author SHA1 Message Date
abhinav
e108642273 We don't need to parse the sections we don't index, so stop early. Saves few
instructions.
2016-10-03 16:11:11 +00:00
abhinav
150a47b73e With the latest release of mandoc, makemandb(8) started to parse some
sections multiple times. This started to happen because, pmdoc_Sh(), the handler function
responsible for parsing the Sh macros, used to recursively go through all the child
nodes and then the next nodes starting from top level Sh block node.
Now, once it has processed all the child nodes of the top level block node,
it moves to the next node, which is the top level block node of the next section and
in this way one call to pmdoc_Sh() was causing a complete pass through the
man page. Since, mandoc(3) calls pmdoc_Sh() for each .Sh macro in the man
page, it would result in parsing some of the sections multiple times.
This never happened with the previous versions of mandoc, so we never noticed.

I've fixed this by starting the parse sequence of the Sh macro from its body, which gurantees
that we will stop once that section ends.

ok christos@
2016-10-03 13:53:39 +00:00
abhinav
1c4ff59f37 Mark the section and md5_hash columns as unindexed in the FTS table, as they are not used for search 2016-10-03 13:36:35 +00:00
christos
330a03324f Add -lz to makefile to fix the build. 2016-07-21 12:24:54 +00:00
abhinav
ee829d24f5 Use deroff() from mandoc(3) to directly parse the Nd macro rather
than parsing it by hand.

With the latest mandoc(3), the .Nd macro was getting parsed twice. This fixes
that problem and cleans up the code as well.

ok christos@
2016-07-17 15:56:14 +00:00
abhinav
19584ea1f8 Fix extraction of section number and machine architecture from man pages.
With the latest API, mdoc_validate()/man_validate() needs to be called before
reading the roff_man.meta field, otherwise it is NULL.

Also, if a man page doesn't specify machine architecture, don't default to '?'
, let it be stored as null in the db. Otherwise, the output of apropos(1) shows
the names of the results as \?/<title>
2016-07-17 12:18:12 +00:00
christos
00e4117929 Sync with API changes. 2016-07-15 19:41:33 +00:00
abhinav
e4c681d955 Fix an off by one issue when concatenating strings. 2016-07-06 18:03:27 +00:00
abhinav
d5630c9cd6 Avoid possible buffer overflow while parsing NAME section of man(7) pages.
Also, simplify copyging of strings, use estrdupn instead of emalloc + memcpy.

Patch from christos@, XXX comment by me
2016-07-06 08:52:01 +00:00
abhinav
84549e3f9b Fix possible buffer overflow when concatenating strings.
Patch from christos@
2016-07-06 06:57:40 +00:00
abhinav
168510ab07 Reuse variable from previous line. 2016-07-05 16:24:18 +00:00
abhinav
5646f914ca Improve wording, and add reference to mandoc(3)
Ok from wiz@
2016-06-18 06:36:18 +00:00
abhinav
3dbd2466c0 Fix grammar/spelling at few places. 2016-06-17 18:48:07 +00:00
abhinav
77fd34aa9f Add man.conf(5) and man(1) in the SEE ALSO section. 2016-06-16 14:07:16 +00:00
abhinav
4647c1ec31 Refactor the function for executing the search SQL query into two parts.
One part is responsible for generating the SQL query
The other part is responsible for executing the generated query.

While there, also remove a comment which is not valid anymore.
And, don't call the snippet function when doing legacy mode search as we are
not using the full text feature there.
2016-06-01 15:59:18 +00:00
abhinav
c995cb6b03 Add 'a' to the stopwords list. Ok from christos 2016-05-30 19:35:29 +00:00
abhinav
40d75a907b Bring man pages in sync with reality.
Remove man pages run_query_html.3 and run_query_pager.3 as the corresponding
functions have been removed from apropos-utils.c
Ok by wiz@
2016-05-24 18:06:42 +00:00
abhinav
e92872065a Add options to whatis and apropos to accept custom man.conf.
makemandb(8), man(1) already use -C as an option to take man.conf path,
	so use the same option for whatis(1) and apropos(1) for consitency.
	apropos was using -C/-c to disable/enable context of the search
	matches, change that to -M/-m respectively.
2016-05-22 19:26:04 +00:00
abhinav
a9a3a72028 Remove a trailing white space after .Nm (mandoc -Tlint was complaining about it) 2016-05-22 05:03:17 +00:00
christos
2c6689d2dc CID 1358675: Wrong variable test 2016-04-24 18:11:43 +00:00
christos
d8ea5c36d1 add a newline 2016-04-23 14:15:36 +00:00
christos
5e64704ab9 PR/51062: Abhinav Upadhyay: Allow non numeric sections to be indexed and
searched by apropos(1).
Fold long lines.
2016-04-13 11:48:29 +00:00
christos
0fc86a7786 PR/51040: Abhinav Upadhyay: Fix memory leak 2016-04-13 01:41:18 +00:00
christos
b3b58d82a5 PR/51039: Abhinav Upadhyay: Check for return value of chdir(2) 2016-04-13 01:40:09 +00:00
christos
90f8d04e63 PR/51038: Abhinav Upadhyay: check for access permissions to the sqlite database 2016-04-13 01:37:50 +00:00
christos
88453a2aaf PR/51034: Abhinav Upadhyay: Close database connection when failed to commit 2016-04-13 01:32:00 +00:00
christos
8896183565 PR/51034: Abhinav Upadhyay: makemandb(8): Close database connection when
failed to commit
2016-03-31 20:17:58 +00:00
christos
b7d6e6d52a PR/51025: Abhinav Upadhyay: Remove unused includes from apropos-utils.c 2016-03-31 20:16:58 +00:00
christos
c97f735da9 update with the final list 2016-03-31 20:15:49 +00:00
christos
79f5688eb8 PR/51018: Abhinav Upadhyay: Update stopwords list for apropos(1) 2016-03-31 20:14:36 +00:00
christos
041c892aee PR/51007: Abhinav Upadhyay: apropos.c: Remove unused includes 2016-03-31 20:13:37 +00:00
christos
8fb426c83c PR/51006: Abhinav Upadhyay: makemandb(8) should parse escape sequences
in the NAME section
2016-03-24 17:28:03 +00:00
christos
751d5fc660 PR/51004: Abhinav Upadhyay: apropos html mode doesn't handle especial
characters in the short description
2016-03-24 16:07:13 +00:00
christos
533b5973e2 PR/50460: Abhinav Upadhyay: Fix legacy apropos query to match both the name
and the one line description and delete extra args.
2016-03-20 17:31:09 +00:00
christos
91708124b8 Don't crash if we have a missing section. 2016-01-28 03:32:29 +00:00
christos
f8250039db if we only asked for stopwords, use the original query. 2015-12-20 19:45:29 +00:00
christos
0f635f7225 Adjust to the new mdocml 2015-12-18 14:30:16 +00:00
christos
48e922c8f8 CID 1341551: Don't bother formatting if ti == NULL 2015-12-03 21:01:50 +00:00
christos
62025e09ce PR/50344: Stephen Fisher: apropos shows formatting on console with vt100 term
type. Can't print terminfo sequences directly; need to process them with
ti_puts() to handle padding. This removes the padding delays, and stricly
could break on slow terminal hardware, but they way the code is structured
makes it impossible to fix properly (since the formatting strings are
passed in the query).
XXX: pullup-7
2015-11-23 22:34:00 +00:00
plunky
877e528c4e largely apply patch from PR bin/47392 by Abhinav Upadhyay
change some comments to reflect reality, a variable name to enhance
readability, and adds an assert for safety.
2015-04-07 17:47:10 +00:00
joerg
a23fab26e8 MDOC_MAX is a valid token if the type is text. Adjust. 2015-03-12 14:57:18 +00:00
christos
704de17457 - handle section numbers that are not single digits
- don't allocate and free needlessly
2015-03-04 02:02:15 +00:00
christos
ce5cbf49e1 mention that this replaces makewhatis(8) 2015-03-03 18:04:33 +00:00
joerg
5a02bfcb09 Explicitly deal with end of lists. PR 49708. 2015-03-02 13:51:24 +00:00
snj
6f0923dea4 Thankfully, apropos returns all results by default these days. Remove
outdated sentence referring to the original (well, old new) limit of 10.
2014-11-04 08:05:21 +00:00
snj
f0a7346d21 src is too big these days to tolerate superfluous apostrophes. It's
"its", people!
2014-10-18 08:33:23 +00:00
wiz
fc7115c3f4 Fix an off by one bug in apropos.
The bug is in the html output where some garbage characters are
seen in the context match output.

From Abhinav Upadhyay in PR 49058.
2014-08-01 12:55:00 +00:00
wiz
82d04f72be Fix a bug that caused an error about a UNIQUE constraint violation.
Patch from Abhinav Upadhyay.
2014-06-03 14:42:41 +00:00
wiz
6dc3f341a8 Replace non-breaking space with hyphen, and call hyphen replacement
from one more place.
Improves 'man -k midi' output.

From Abhinav Upadhyay.
2014-05-24 21:01:58 +00:00
chs
49d6a7c368 in update_db(), extract the full list of files to update from the db
before actually updating anything, since changing the db while the query
that extracts the list of files is still in progress results in
the extraction query failing before it finds everything.
2014-02-10 00:23:36 +00:00