blob: 6c56eee8bbf95e0cf8c518606e203e2ecf19a91f [file] [log] [blame]
Dieter Baron6360c002004-12-22 17:01:27 +00001#!/bin/sh
2
Dieter Baroncd55f272005-01-20 21:03:36 +00003# $NiH: make_zip_errors.sh,v 1.2 2004/12/26 14:21:06 dillo Exp $
Dieter Baron6360c002004-12-22 17:01:27 +00004#
5# make_zip_errrors.sh: create zip_errors.mdoc from zip.h
Dieter Baroncd55f272005-01-20 21:03:36 +00006# Copyright (C) 1999, 2003, 2004, 2005 Dieter Baron and Thomas Klausner
Dieter Baron6360c002004-12-22 17:01:27 +00007#
8# This file is part of libzip, a library to manipulate ZIP archives.
9# The authors can be contacted at <nih@giga.or.at>
10#
11# Redistribution and use in source and binary forms, with or without
12# modification, are permitted provided that the following conditions
13# are met:
14# 1. Redistributions of source code must retain the above copyright
15# notice, this list of conditions and the following disclaimer.
16# 2. Redistributions in binary form must reproduce the above copyright
17# notice, this list of conditions and the following disclaimer in
18# the documentation and/or other materials provided with the
19# distribution.
20# 3. The names of the authors may not be used to endorse or promote
21# products derived from this software without specific prior
22# written permission.
23#
24# THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS
25# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
26# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
28# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
30# GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
31# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
32# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
33# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
34# IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
35
36
37if [ "$#" -ne 2 ]
38then
39 echo "Usage: $0 in_file out_file" >&2
40 echo " e.g. $0 zip.h zip_err_str.c" >&2
41 exit 1
42fi
43
44if [ "$1" = "$2" ]
45then
46 echo "$0: error: output file = input file" >&2
47 exit 1
48fi
49
Dieter Baroncd55f272005-01-20 21:03:36 +000050rcsid=`echo '$NiH: make_zip_errors.sh,v 1.2 2004/12/26 14:21:06 dillo Exp $' | tr -d '$'`
Dieter Baron6360c002004-12-22 17:01:27 +000051inrcsid=`sed -n 's/^ \$\([^$]*[^ ]\) *\$$/\1/p' "$1"`
52date=`date '+%B %e, %Y' | sed 's/ / /'`
53
54cat <<EOF >> "$2.$$" || exit 1
55.\" \$NiH\$
56.\"
57.\" zip_errors.mdoc -- list of all libzip error codes
Dieter Baroncd55f272005-01-20 21:03:36 +000058.\" Copyright (C) 2004, 2005 Dieter Baron and Thomas Klausner
Dieter Baron6360c002004-12-22 17:01:27 +000059.\"
60.\" This file is part of libzip, a library to manipulate ZIP archives.
61.\" The authors can be contacted at <nih@giga.or.at>
62.\"
63.\" Redistribution and use in source and binary forms, with or without
64.\" modification, are permitted provided that the following conditions
65.\" are met:
66.\" 1. Redistributions of source code must retain the above copyright
67.\" notice, this list of conditions and the following disclaimer.
68.\" 2. Redistributions in binary form must reproduce the above copyright
69.\" notice, this list of conditions and the following disclaimer in
70.\" the documentation and/or other materials provided with the
71.\" distribution.
72.\" 3. The names of the authors may not be used to endorse or promote
73.\" products derived from this software without specific prior
74.\" written permission.
75.\"
Dieter Baron58922932004-12-26 14:21:06 +000076.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS \`\`AS IS'' AND ANY EXPRESS
Dieter Baron6360c002004-12-22 17:01:27 +000077.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
78.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
79.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
80.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
81.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
82.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
83.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
84.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
85.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
86.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
87.\"
88.\" This file was generated automatically by $0
89.\" from $1; make changes there.
90.\" $rcsid
91.\" $inrcsid
92.\"
93.Dd $date
94.Dt ZIP_ERRORS 3
95.Os
96.Sh NAME
97.Nm zip_errors
98.Nd list of all libzip error codes
99.Sh LIBRARY
100libzip (-lzip)
101.Sh SYNOPSIS
102.In zip.h
103.Sh DESCRIPTION
104The following error codes are used by libzip:
105.Bl -tag -width XZIPXERXCOMPNOTSUPPXX
106EOF
107
108sed -n 's/^#define \(ZIP_ER_[A-Z_0-9]*\).*\/\* \(.\) \([^*]*\) \*\//.It Bq Er \1@\3./p' "$1" \
109 | tr @ '\012' \
110 >> "$2.$$" || exit 1
111
112cat <<EOF >> "$2.$$" || exit 1
113.El
114EOF
115
116mv "$2.$$" "$2" || exit 1