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