3 * $Id: sw_info.h,v 1.1 1999/06/02 16:53:35 mdw Exp $
5 * Maintenance of `.sw-info' files
10 /*----- Licensing notice --------------------------------------------------*
12 * This file is part of sw-tools.
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.
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.
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.
29 /*----- Revision history --------------------------------------------------*
32 * Revision 1.1 1999/06/02 16:53:35 mdw
44 /*----- Data structures ---------------------------------------------------*/
46 typedef struct swinfo
{
55 /*----- Functions provided ------------------------------------------------*/
57 /* --- @swinfo_clear@ --- *
59 * Arguments: @swinfo *sw@ = pointe to info block
63 * Use: Clears an info block so that it doesn't contain anything.
64 * This is mainly useful when building skeletons to apply using
68 extern void swinfo_clear(swinfo */
*sw*/
);
70 /* --- @swinfo_fetch@ --- *
72 * Arguments: @swinfo *sw@ = pointer to info block to fill in
74 * Returns: Zero if OK, else nonzero.
76 * Use: Fills in the info block if it can.
79 extern int swinfo_fetch(swinfo */
*sw*/
);
81 /* --- @swinfo_sanity@ --- *
83 * Arguments: @swinfo *sw@ = pointer to an info block
85 * Returns: Yes, if the block is OK.
87 * Use: Objects if the information in the info block is bad.
90 extern void swinfo_sanity(swinfo */
*sw*/
);
92 /* --- @swinfo_put@ --- *
94 * Arguments: @swinfo *sw@ = pointer to an info block
96 * Returns: Zero if it worked, nonzero if not.
98 * Use: Writes an info block to the appropriate file.
101 extern int swinfo_put(swinfo */
*sw*/
);
103 /* --- @swinfo_destroy@ --- *
105 * Arguments: @swinfo *sw@ = pointer to info block
109 * Use: Destroys an info block when it's not useful any more.
112 extern void swinfo_destroy(swinfo */
*sw*/
);
114 /* --- @swinfo_update@ --- *
116 * Arguments: @swinfo *sw@ = pointer to info block
117 * @swinfo *skel@ = pointer to skeleton values
121 * Use: Updates the fields in an information block, except for the
122 * architecture names stuff. (I'll leave that for later,
123 * because it's rather more involved.
126 extern void swinfo_update(swinfo */
*sw*/
, swinfo */
*skel*/
);
128 /* --- Subcommands --- */
130 extern int sw_commit(int /*argc*/, char */
*argv*/
[]);
131 extern int sw_setup(int /*argc*/, char */
*argv*/
[]);
132 extern int sw_status(int /*argc*/, char */
*argv*/
[]);
135 static cmd cmd_commit
= {
136 CMD_LINK
, "commit", sw_commit
,
137 "commit\tWrites completed version information to the index file. This\n\
138 be the last step of an installation.\n"
140 static cmd cmd_status
= {
141 &cmd_commit
, "status", sw_status
,
142 "status\tDisplays information from the package status file. The output is\n\
143 slightly more readable than `cat .sw-info'.\n"
145 static cmd cmd_setup
= {
146 &cmd_status
, "setup", sw_setup
,
147 "setup PACKAGE VERSION [MAINTAINER]\n\
148 Persistently configures the package and version number. This\n\
149 information is used by the later build and install steps. If you\n\
150 omit the maintainer's name, it's assumed to be your username.\n"
153 # define CMD_LINK &cmd_setup
156 /*----- That's all, folks -------------------------------------------------*/