Expunge revision histories in files.
[sw-tools] / src / sw_info.h
CommitLineData
3315e8b3 1/* -*-c-*-
2 *
9796a787 3 * $Id: sw_info.h,v 1.2 2004/04/08 01:52:19 mdw Exp $
3315e8b3 4 *
5 * Maintenance of `.sw-info' files
6 *
7 * (c) 1999 EBI
8 */
9
10/*----- Licensing notice --------------------------------------------------*
11 *
12 * This file is part of sw-tools.
13 *
14 * sw-tools is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation; either version 2 of the License, or
17 * (at your option) any later version.
18 *
19 * sw-tools is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
23 *
24 * You should have received a copy of the GNU General Public License
25 * along with sw-tools; if not, write to the Free Software Foundation,
26 * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
27 */
28
3315e8b3 29#ifndef SW_INFO_H
30#define SW_INFO_H
31
32#ifdef __cplusplus
33 extern "C" {
34#endif
35
36/*----- Data structures ---------------------------------------------------*/
37
38typedef struct swinfo {
39 char *package;
40 char *version;
41 char *maintainer;
42 char *date;
43 char *only_arch;
44 char *arch;
45} swinfo;
46
47/*----- Functions provided ------------------------------------------------*/
48
49/* --- @swinfo_clear@ --- *
50 *
51 * Arguments: @swinfo *sw@ = pointe to info block
52 *
53 * Returns: ---
54 *
55 * Use: Clears an info block so that it doesn't contain anything.
56 * This is mainly useful when building skeletons to apply using
57 * @swinfo_update@.
58 */
59
60extern void swinfo_clear(swinfo */*sw*/);
61
62/* --- @swinfo_fetch@ --- *
63 *
64 * Arguments: @swinfo *sw@ = pointer to info block to fill in
65 *
66 * Returns: Zero if OK, else nonzero.
67 *
68 * Use: Fills in the info block if it can.
69 */
70
71extern int swinfo_fetch(swinfo */*sw*/);
72
73/* --- @swinfo_sanity@ --- *
74 *
75 * Arguments: @swinfo *sw@ = pointer to an info block
76 *
77 * Returns: Yes, if the block is OK.
78 *
79 * Use: Objects if the information in the info block is bad.
80 */
81
82extern void swinfo_sanity(swinfo */*sw*/);
83
84/* --- @swinfo_put@ --- *
85 *
86 * Arguments: @swinfo *sw@ = pointer to an info block
87 *
88 * Returns: Zero if it worked, nonzero if not.
89 *
90 * Use: Writes an info block to the appropriate file.
91 */
92
93extern int swinfo_put(swinfo */*sw*/);
94
95/* --- @swinfo_destroy@ --- *
96 *
97 * Arguments: @swinfo *sw@ = pointer to info block
98 *
99 * Returns: ---
100 *
101 * Use: Destroys an info block when it's not useful any more.
102 */
103
104extern void swinfo_destroy(swinfo */*sw*/);
105
106/* --- @swinfo_update@ --- *
107 *
108 * Arguments: @swinfo *sw@ = pointer to info block
109 * @swinfo *skel@ = pointer to skeleton values
110 *
111 * Returns: ---
112 *
113 * Use: Updates the fields in an information block, except for the
114 * architecture names stuff. (I'll leave that for later,
115 * because it's rather more involved.
116 */
117
118extern void swinfo_update(swinfo */*sw*/, swinfo */*skel*/);
119
120/* --- Subcommands --- */
121
122extern int sw_commit(int /*argc*/, char */*argv*/[]);
123extern int sw_setup(int /*argc*/, char */*argv*/[]);
124extern int sw_status(int /*argc*/, char */*argv*/[]);
125
126#ifdef CMD_LINK
127 static cmd cmd_commit = {
128 CMD_LINK, "commit", sw_commit,
129"commit\tWrites completed version information to the index file. This\n\
130 be the last step of an installation.\n"
131 };
132 static cmd cmd_status = {
133 &cmd_commit, "status", sw_status,
134"status\tDisplays information from the package status file. The output is\n\
135 slightly more readable than `cat .sw-info'.\n"
136 };
137 static cmd cmd_setup = {
138 &cmd_status, "setup", sw_setup,
139"setup PACKAGE VERSION [MAINTAINER]\n\
140 Persistently configures the package and version number. This\n\
141 information is used by the later build and install steps. If you\n\
142 omit the maintainer's name, it's assumed to be your username.\n"
143 };
144# undef CMD_LINK
145# define CMD_LINK &cmd_setup
146#endif
147
148/*----- That's all, folks -------------------------------------------------*/
149
150#ifdef __cplusplus
151 }
152#endif
153
154#endif