3315e8b3 |
1 | /* -*-c-*- |
2 | * |
3 | * $Id: sw_info.h,v 1.1 1999/06/02 16:53:35 mdw Exp $ |
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 | |
29 | /*----- Revision history --------------------------------------------------* |
30 | * |
31 | * $Log: sw_info.h,v $ |
32 | * Revision 1.1 1999/06/02 16:53:35 mdw |
33 | * Initial revision |
34 | * |
35 | */ |
36 | |
37 | #ifndef SW_INFO_H |
38 | #define SW_INFO_H |
39 | |
40 | #ifdef __cplusplus |
41 | extern "C" { |
42 | #endif |
43 | |
44 | /*----- Data structures ---------------------------------------------------*/ |
45 | |
46 | typedef struct swinfo { |
47 | char *package; |
48 | char *version; |
49 | char *maintainer; |
50 | char *date; |
51 | char *only_arch; |
52 | char *arch; |
53 | } swinfo; |
54 | |
55 | /*----- Functions provided ------------------------------------------------*/ |
56 | |
57 | /* --- @swinfo_clear@ --- * |
58 | * |
59 | * Arguments: @swinfo *sw@ = pointe to info block |
60 | * |
61 | * Returns: --- |
62 | * |
63 | * Use: Clears an info block so that it doesn't contain anything. |
64 | * This is mainly useful when building skeletons to apply using |
65 | * @swinfo_update@. |
66 | */ |
67 | |
68 | extern void swinfo_clear(swinfo */*sw*/); |
69 | |
70 | /* --- @swinfo_fetch@ --- * |
71 | * |
72 | * Arguments: @swinfo *sw@ = pointer to info block to fill in |
73 | * |
74 | * Returns: Zero if OK, else nonzero. |
75 | * |
76 | * Use: Fills in the info block if it can. |
77 | */ |
78 | |
79 | extern int swinfo_fetch(swinfo */*sw*/); |
80 | |
81 | /* --- @swinfo_sanity@ --- * |
82 | * |
83 | * Arguments: @swinfo *sw@ = pointer to an info block |
84 | * |
85 | * Returns: Yes, if the block is OK. |
86 | * |
87 | * Use: Objects if the information in the info block is bad. |
88 | */ |
89 | |
90 | extern void swinfo_sanity(swinfo */*sw*/); |
91 | |
92 | /* --- @swinfo_put@ --- * |
93 | * |
94 | * Arguments: @swinfo *sw@ = pointer to an info block |
95 | * |
96 | * Returns: Zero if it worked, nonzero if not. |
97 | * |
98 | * Use: Writes an info block to the appropriate file. |
99 | */ |
100 | |
101 | extern int swinfo_put(swinfo */*sw*/); |
102 | |
103 | /* --- @swinfo_destroy@ --- * |
104 | * |
105 | * Arguments: @swinfo *sw@ = pointer to info block |
106 | * |
107 | * Returns: --- |
108 | * |
109 | * Use: Destroys an info block when it's not useful any more. |
110 | */ |
111 | |
112 | extern void swinfo_destroy(swinfo */*sw*/); |
113 | |
114 | /* --- @swinfo_update@ --- * |
115 | * |
116 | * Arguments: @swinfo *sw@ = pointer to info block |
117 | * @swinfo *skel@ = pointer to skeleton values |
118 | * |
119 | * Returns: --- |
120 | * |
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. |
124 | */ |
125 | |
126 | extern void swinfo_update(swinfo */*sw*/, swinfo */*skel*/); |
127 | |
128 | /* --- Subcommands --- */ |
129 | |
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*/[]); |
133 | |
134 | #ifdef CMD_LINK |
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" |
139 | }; |
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" |
144 | }; |
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" |
151 | }; |
152 | # undef CMD_LINK |
153 | # define CMD_LINK &cmd_setup |
154 | #endif |
155 | |
156 | /*----- That's all, folks -------------------------------------------------*/ |
157 | |
158 | #ifdef __cplusplus |
159 | } |
160 | #endif |
161 | |
162 | #endif |