.if !'po4a'hide' .ds mC CW .\" Man page for lexgrog .\" .\" Copyright (c) 2001 Colin Watson .\" .\" You may distribute under the terms of the GNU General Public .\" License as specified in the file docs/COPYING.GPLv2 that comes with the .\" man-db distribution. .\" .if t .if \n(.g .ds mC CR .if n .ds mC R . .\" in an example (EX/EE)? .nr mE 0 . .if !\n(.g \{\ .de EX . br . if !\\n(mE \{\ . nr mF \\n(.f . nr mP \\n(PD . nr PD 1v . nf . ft \\*(mC . nr mE 1 . \} .. .\} . . .if !\n(.g \{\ .de EE . br . if \\n(mE \{\ . ft \\n(mF . nr PD \\n(mP . fi . nr mE 0 . \} .. .\} .\" End example. . .pc "" .\"******************************************************************* .\" .\" This file was generated with po4a. Translate the source file. .\" .\"******************************************************************* .TH LEXGROG 1 2026-11-16 2.13.3 手動分頁工具 .SH 名稱 lexgrog \- 剖析 man 頁面的標頭資訊 .SH 語法 \fBlexgrog\fP [\|\fB\-m\fP\||\|\fB\-c\fP\|] [\|\fB\-dfw?V\fP\|] [\|\fB\-E\fP \fIencoding\fP\|] \fIfile\fP \&.\|.\|. .SH 描述 \fBlexgrog\fP 是傳統 \(lqgroff guess\(rq 工具在 \fBlex\fP 中的實作。它讀取其命令列上的檔案清單作為 man 頁面源檔案或預先格式化的 \(lqcat\(rq 頁面,並顯示它們的名稱和描述(如同 \fBapropos\fP 和 \fBwhatis\fP 所使用的),以及 man 頁面在傳遞給 \fBnroff\fP 或 \fBtroff\fP 之前所需的預處理篩選器清單,或者兩者都顯示。 .PP 如果其輸入格式不正確,\fBlexgrog\fP 將顯示 \(lqparse failed\(rq;這對於需要檢查 man 頁面正確性的外部程式可能很有用。如果 \fBlexgrog\fP 的輸入檔案之一是 \(lq\-\(rq,它將從標準輸入讀取;如果有任何輸入檔案被壓縮,將自動讀取解壓縮的版本。 .SH 選項 .TP .if !'po4a'hide' .BR \-d ", " \-\-debug 列印除錯資訊。 .TP .if !'po4a'hide' .BR \-m ", " \-\-man 將輸入剖析為 man 頁面源檔案。如果未指定 \fB\-\-man\fP 或 \fB\-\-cat\fP,這是預設值。 .TP .if !'po4a'hide' .BR \-c ", " \-\-cat 將輸入剖析為預先格式化的 man 頁面 (\(lqcat pages\(rq)。\fB\-\-man\fP 和 \fB\-\-cat\fP 不可同時指定。 .TP .if !'po4a'hide' .BR \-w ", " \-\-whatis 顯示 man 頁面標頭中的名稱和描述(如同 \fBapropos\fP 和 \fBwhatis\fP 所使用的)。如果未指定 \fB\-\-whatis\fP 或 \fB\-\-filters\fP,這是預設值。 .TP .if !'po4a'hide' .BR \-f ", " \-\-filters 顯示在使用 \fBnroff\fP 或 \fBtroff\fP 格式化之前預處理 man 頁面所需的篩選器清單。 .TP \fB\-E\fP \fIencoding\fP, \fB\-\-encoding\fP \fIencoding\fP 覆寫頁面猜測的字元集為 \fIencoding\fP。 .TP .if !'po4a'hide' .BR \-? ", " \-\-help 列印說明訊息並退出。 .TP .if !'po4a'hide' .B \-\-usage 列印簡短用法訊息並退出。 .TP .if !'po4a'hide' .BR \-V ", " \-\-version 顯示版本資訊。 .SH 結束狀態 .TP .if !'po4a'hide' .B 0 程式執行成功。 .TP .if !'po4a'hide' .B 1 用法錯誤。 .TP .if !'po4a'hide' .B 2 \fBlexgrog\fP 無法剖析一或多個輸入檔案。 .SH 範例 .nf $ lexgrog man.1 man.1: "man \- an interface to the system reference manuals" $ lexgrog \-fw man.1 man.1 (t): "man \- an interface to the system reference manuals" $ lexgrog \-c whatis.cat1 whatis.cat1: "whatis \- display manual page descriptions" $ lexgrog broken.1 broken.1: parse failed .fi .SH "WHATIS 剖析" \fBmandb\fP(使用與 \fBlexgrog\fP 相同的程式碼)剖析每個手動分頁頂部的 \fBNAME\fP 區段,尋找每個分頁中記錄的功能名稱和描述。雖然剖析器相當寬容,因為它必須處理歷史上使用的多種不同形式,但它有時可能無法擷取所需的資訊。 .PP 使用傳統的 \fIman\fP 巨集集時,正確的 \fBNAME\fP 區段大致如下: .PP .RS .EX \&.SH NAME foo \e\- program to do something .EE .RE .PP 某些手動分頁器要求 \(oq\e\-\(cq 必須如所示;\fBmandb\fP 較為寬容,但為了與其他系統相容,保留反斜線仍是個好主意。 .PP 左側可以有多個名稱,以逗號分隔。包含空白字元的名稱將被忽略,以避免在某些格式不佳的 \fBNAME\fP 區段上出現病態行為。右側的文字是自由格式,可以跨越多行。如果同一手動分頁中記錄了多個具有不同描述的功能,則使用以下格式: .PP .RS .EX \&.SH NAME foo, bar \e\- programs to do something \&.br baz \e\- program to do nothing .EE .RE .PP (開始新段落的巨集,如 \fB.PP\fP,可用來代替換行巨集 \fB.br\fP。) .PP 使用 BSD 衍生的 \fImdoc\fP 巨集集時,正確的 \fBNAME\fP 區段大致如下: .PP .RS .EX \&.Sh NAME \&.Nm foo \&.Nd program to do something .EE .RE whatis 剖析失敗的常見原因有幾個。有時手動分頁的作者將 \(oq.SH NAME\(cq 替換為 \(oq.SH MYPROGRAM\(cq,然後 \fBmandb\fP 就無法找到要從中擷取所需資訊的區段。有時作者包含 NAME 區段,但放置自由格式的文字而非 \(oqname \e\- description\(cq。然而,任何類似上述的語法都應被接受。 .SH 請參閱 .if !'po4a'hide' .IR apropos (1), .if !'po4a'hide' .IR man (1), .if !'po4a'hide' .IR whatis (1), .if !'po4a'hide' .IR mandb (8) .SH 注意事項 \fBlexgrog\fP 嘗試剖析包含 .so 要求的檔案,但只有在檔案正確安裝在手動分頁階層中時才能正確剖析。 .SH 作者 \fBlexgrog\fP 用來掃描 man 頁面的程式碼是由: .PP .nf .if !'po4a'hide' Wilf.\& (G.Wilford@ee.surrey.ac.uk). .if !'po4a'hide' Fabrizio Polacco (fpolacco@debian.org). .if !'po4a'hide' Colin Watson (cjwatson@debian.org). .fi .PP Colin Watson 撰寫了命令列前端的目前版本,以及此 man 頁面。 .SH 錯誤 .if !'po4a'hide' https://gitlab.com/man-db/man-db/\-/issues .br .if !'po4a'hide' https://savannah.nongnu.org/bugs/?group=man\-db