From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from krisdoz.my.domain (kristaps@localhost [127.0.0.1]) by krisdoz.my.domain (8.14.3/8.14.3) with ESMTP id pA9ArnJh014759 for ; Wed, 9 Nov 2011 05:53:49 -0500 (EST) Received: (from kristaps@localhost) by krisdoz.my.domain (8.14.3/8.14.3/Submit) id pA9ArmQi027953; Wed, 9 Nov 2011 05:53:48 -0500 (EST) Date: Wed, 9 Nov 2011 05:53:48 -0500 (EST) Message-Id: <201111091053.pA9ArmQi027953@krisdoz.my.domain> X-Mailinglist: mdocml-source Reply-To: source@mdocml.bsd.lv MIME-Version: 1.0 From: kristaps@mdocml.bsd.lv To: source@mdocml.bsd.lv Subject: mdocml: Change getopt() to be more like schwarze@'s suggestions. X-Mailer: activitymail 1.26, http://search.cpan.org/dist/activitymail/ Content-Type: text/plain; charset=utf-8 Log Message: ----------- Change getopt() to be more like schwarze@'s suggestions. Modified Files: -------------- mdocml: apropos.1 apropos.c Revision Data ------------- Index: apropos.c =================================================================== RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/apropos.c,v retrieving revision 1.8 retrieving revision 1.9 diff -Lapropos.c -Lapropos.c -u -p -r1.8 -r1.9 --- apropos.c +++ apropos.c @@ -72,12 +72,12 @@ main(int argc, char *argv[]) else ++progname; - while (-1 != (ch = getopt(argc, argv, "a:c:I:t:"))) + while (-1 != (ch = getopt(argc, argv, "S:s:It:"))) switch (ch) { - case ('a'): + case ('S'): opts.arch = optarg; break; - case ('c'): + case ('s'): opts.cat = optarg; break; case ('I'): @@ -159,8 +159,8 @@ usage(void) fprintf(stderr, "usage: %s " "[-I] " - "[-a arch] " - "[-c cat] " + "[-S arch] " + "[-s section] " "[-t type[,...]] " "key\n", progname); } Index: apropos.1 =================================================================== RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/apropos.1,v retrieving revision 1.2 retrieving revision 1.3 diff -Lapropos.1 -Lapropos.1 -u -p -r1.2 -r1.3 --- apropos.1 +++ apropos.1 @@ -22,45 +22,26 @@ .Nd search the manual page database .Sh SYNOPSIS .Nm -.Op Fl eIr -.Op Fl a Ar arch -.Op Fl c Ar cat -.Op Fl s Ar sort +.Op Fl I +.Op Fl S Ar arch +.Op Fl s Ar section .Op Fl t Ar types -.Ar key +.Ar pattern .Sh DESCRIPTION The .Nm utility queries the manual page database. Its arguments are as follows: .Bl -tag -width Ds -.It Fl a Ar arch +.It Fl S Ar arch Search only for a particular architecture. -.It Fl c Ar cat -Search only for a category (manual section). +.It Fl s Ar cat +Search only for a manual section. See .Xr man 1 -for a listing of categories. -.It Fl e -Search only for exact matches (subject to -.Fl I ) . +for a listing of manual sections. .It Fl I -Case-insensitive matching. -.It Fl r -Consider -.Ar key -to be a POSIX regular expression (subject to -.Fl I ) . -See -.Xr re_format 7 -for a description of regular expressions. -.It Fl s Ar sort -Sorting type. -Accepts -.Ar cat -to sort by category and then by title or -.Ar title -to sort by title (which is the default). +Case-insensitive pattern matching. .It Fl t Ar types Consider only types of keyword match, where .Ar types @@ -100,20 +81,20 @@ The search key. .Pp By default, .Nm -searches for substring matches of -.Ar key +searches for pattern matches of +.Ar pattern in manual names and descriptions -and displays results by manual title. +and displays results sorted by manual title. Output is formatted as .Pp -.D1 title(cat) \- description +.D1 title(sec) \- description .Pp Where .Qq title is the manual's title (note multiple manual names may exist for one title), -.Qq cat -is the category, and +.Qq sec +is the manual section, and .Qq description is the manual's short description. If an architecture is specified for the manual, it is displayed as @@ -122,11 +103,11 @@ If an architecture is specified for the .Pp Resulting manuals may be accessed as .Pp -.Dl $ man -s cat title +.Dl $ man \-s sec title .Pp If an architecture is specified in the output, use .Pp -.Dl $ man -s cat -S arch title +.Dl $ man \-s sec \-S arch title .\" .Sh IMPLEMENTATION NOTES .\" Not used in OpenBSD. .\" .Sh RETURN VALUES @@ -141,13 +122,13 @@ Search for .Qq optind as a variable name in the library category: .Pp -.Dl $ apropos -tvar -c 3 optind +.Dl $ apropos \-tvar \-s 3 optind .Pp Search for all manuals referencing the term .Qq POSIX in any letter case: .Pp -.Dl $ apropos -tall -I posix +.Dl $ apropos \-tall \-I posix .\" .Sh DIAGNOSTICS .\" For sections 1, 4, 6, 7, & 8 only. .\" .Sh ERRORS -- To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv