3 * $Id: sw_info.h,v 1.2 2004/04/08 01:52:19 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.
36 /*----- Data structures ---------------------------------------------------*/
38 typedef struct swinfo
{
47 /*----- Functions provided ------------------------------------------------*/
49 /* --- @swinfo_clear@ --- *
51 * Arguments: @swinfo *sw@ = pointe to info block
55 * Use: Clears an info block so that it doesn't contain anything.
56 * This is mainly useful when building skeletons to apply using
60 extern void swinfo_clear(swinfo */
*sw*/
);
62 /* --- @swinfo_fetch@ --- *
64 * Arguments: @swinfo *sw@ = pointer to info block to fill in
66 * Returns: Zero if OK, else nonzero.
68 * Use: Fills in the info block if it can.
71 extern int swinfo_fetch(swinfo */
*sw*/
);
73 /* --- @swinfo_sanity@ --- *
75 * Arguments: @swinfo *sw@ = pointer to an info block
77 * Returns: Yes, if the block is OK.
79 * Use: Objects if the information in the info block is bad.
82 extern void swinfo_sanity(swinfo */
*sw*/
);
84 /* --- @swinfo_put@ --- *
86 * Arguments: @swinfo *sw@ = pointer to an info block
88 * Returns: Zero if it worked, nonzero if not.
90 * Use: Writes an info block to the appropriate file.
93 extern int swinfo_put(swinfo */
*sw*/
);
95 /* --- @swinfo_destroy@ --- *
97 * Arguments: @swinfo *sw@ = pointer to info block
101 * Use: Destroys an info block when it's not useful any more.
104 extern void swinfo_destroy(swinfo */
*sw*/
);
106 /* --- @swinfo_update@ --- *
108 * Arguments: @swinfo *sw@ = pointer to info block
109 * @swinfo *skel@ = pointer to skeleton values
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.
118 extern void swinfo_update(swinfo */
*sw*/
, swinfo */
*skel*/
);
120 /* --- Subcommands --- */
122 extern int sw_commit(int /*argc*/, char */
*argv*/
[]);
123 extern int sw_setup(int /*argc*/, char */
*argv*/
[]);
124 extern int sw_status(int /*argc*/, char */
*argv*/
[]);
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"
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"
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"
145 # define CMD_LINK &cmd_setup
148 /*----- That's all, folks -------------------------------------------------*/