Man Глубже Чем Я Думал
Почему-то я думал, что руководства по системным утилитам это простые текстовые файлики, которые лежат где-то в системе. man
просто открывает эти файлы и показывает их пользователю.
А они, оказывается, создаются на лету.
MAN(1)
code snippet start
NAME
man, apropos, whatis – display online manual documentation pages
code snippet end
man - это шелл скрипт
sh code snippet start
% which man
/usr/bin/man
% file /usr/bin/man
/usr/bin/man: POSIX shell script text executable, ASCII text
% head -n 7 /usr/bin/man
#! /bin/sh
#
# SPDX-License-Identifier: BSD-2-Clause-FreeBSD
#
# Copyright (c) 2010 Gordon Tetlow
# All rights reserved.
#
%
sh code snippet end
который использует (/usr/bin/man:479) утилиты
sh code snippet start
...
local _toolpath
for tool in EQN NROFF PIC TBL TROFF REFER VGRIND; do
eval "_toolpath=\${${tool}}"
...
sh code snippet end
NROFF TROFF TROFF
nroff and the related troff were both developed from the original roff. While nroff was intended to produce output on terminals and line printers, troff was intended to produce output on typesetting systems. Both used the same underlying markup and a single source file could normally be used by nroff or troff without change. [https://en.wikipedia.org/wiki/Nroff](wiki: nroff)
Препроцессоры
EQN NROFF PIC TBL TROFF REFER VGRIND
- системные утилиты
Формат файлов
mdoc – semantic markup language for formatting manual pages — man mdoc
code snippet start
% cat /usr/share/man/man1/passwd.1
.\" Copyright (c) 1990, 1993
.\" The Regents of the University of California. All rights reserved.
...
.\" SUCH DAMAGE.
.\"
.\" @(#)passwd.1 8.1 (Berkeley) 6/6/93
.\"
.Dd August 18, 2008
.Dt PASSWD 1
.Os "macOS"
.Sh NAME
.Nm passwd
.Nd modify a user's password
.Sh SYNOPSIS
.Nm passwd
.Op Fl i Ar infosystem Op Fl l Ar location
.Op Fl u Ar authname
...
.Xr passwd 5 ,
.Xr pwd_mkdb 8 ,
.Xr vipw 8
.Rs
.%A Robert Morris
.%A Ken Thompson
.%T "UNIX password security"
.Re
.Sh HISTORY
A
.Nm passwd
command appeared in
.At v6 .
code snippet end