xref: /netbsd-src/usr.bin/xlint/lint1/makeman (revision 6bdf3212f349a80d7860fe27e76bddb515bfca2c)
1#!/bin/sh
2#	$NetBSD: makeman,v 1.11 2024/06/08 20:47:00 rillig Exp $
3#
4# Copyright (c) 2000 The NetBSD Foundation, Inc.
5# All rights reserved.
6#
7# This code is derived from software contributed to The NetBSD Foundation
8# by Christos Zoulas.
9#
10# Redistribution and use in source and binary forms, with or without
11# modification, are permitted provided that the following conditions
12# are met:
13# 1. Redistributions of source code must retain the above copyright
14#    notice, this list of conditions and the following disclaimer.
15# 2. Redistributions in binary form must reproduce the above copyright
16#    notice, this list of conditions and the following disclaimer in the
17#    documentation and/or other materials provided with the distribution.
18#
19# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22# PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29# POSSIBILITY OF SUCH DAMAGE.
30
31: ${SED:=sed}
32
33tab='	'
34
35list_messages() {
36	${SED} -E -n \
37	    -e 's|^'"$tab"'"(.+)",.*// '"$2"'([0-9]+)$|\2'"$tab"'\1|p' \
38	    -e 's|^'"$tab"'"",.*// '"$2"'[0-9]+$|---'"$tab"'(no longer used)|p' \
39	    "$1" \
40	| ${SED} -E \
41	    -e 's,%ld|%lld|%jd,%d,g' \
42	    -e 's,%lu|%llu|%ju,%u,g' \
43	    -e 's,%Lg,%g,g' \
44	    -e 's|%.\*s|%s|g' \
45	    -e 's|\\"|"|g' \
46	    -e 's|\\\\|\\e|g' \
47	    -e "s|'|\\'|g" \
48	    -e 's|^|.It |'
49}
50
51# shellcheck disable=SC2016
52cvsid='$NetBSD: makeman,v 1.11 2024/06/08 20:47:00 rillig Exp $'
53date="$1"
54year="${date##* }"
55messages="$(list_messages "$2" "")"
56queries="$(list_messages "$2" "Q")"
57
58cat << EOF
59.\"	$cvsid
60.\"
61.\" Copyright (c) 2000,$year The NetBSD Foundation, Inc.
62.\" All rights reserved.
63.\"
64.\" This code is derived from software contributed to The NetBSD Foundation
65.\" by Christos Zoulas.
66.\"
67.\" Redistribution and use in source and binary forms, with or without
68.\" modification, are permitted provided that the following conditions
69.\" are met:
70.\" 1. Redistributions of source code must retain the above copyright
71.\"    notice, this list of conditions and the following disclaimer.
72.\" 2. Redistributions in binary form must reproduce the above copyright
73.\"    notice, this list of conditions and the following disclaimer in the
74.\"    documentation and/or other materials provided with the distribution.
75.\"
76.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
77.\" \`\`AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
78.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
79.\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
80.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
81.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
82.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
83.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
84.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
85.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
86.\" POSSIBILITY OF SUCH DAMAGE.
87.Dd $date
88.Dt LINT 7
89.Os
90.Sh NAME
91.Nm lint
92.Nd Error, warning and query messages from lint
93.Sh DESCRIPTION
94The following is a list of message IDs and messages produced by
95.Xr lint 1 .
96It is intended to be used with the
97.Fl X
98flag of
99.Xr lint 1 .
100.Pp
101.Bd -ragged -offset indent -compact
102.Bl -column "XXXX"
103$messages
104.El
105.Ed
106.Pp
107The following is a list of query IDs and their messages produced by
108.Xr lint 1 .
109It is intended to be used with the
110.Fl q
111flag of
112.Xr lint 1 .
113.Pp
114.Bd -ragged -offset indent -compact
115.Bl -column "XXXX"
116$queries
117.El
118.Ed
119EOF
120