Tue Jan 7 02:15:27 2014 UTC ()
xasprintf uses format strings.


(joerg)
diff -r1.6 -r1.7 src/external/bsd/pkg_install/dist/lib/lib.h

cvs diff -r1.6 -r1.7 src/external/bsd/pkg_install/dist/lib/lib.h (switch to unified diff)

--- src/external/bsd/pkg_install/dist/lib/lib.h 2010/06/26 00:17:13 1.6
+++ src/external/bsd/pkg_install/dist/lib/lib.h 2014/01/07 02:15:27 1.7
@@ -1,457 +1,457 @@ @@ -1,457 +1,457 @@
1/* $NetBSD: lib.h,v 1.6 2010/06/26 00:17:13 joerg Exp $ */ 1/* $NetBSD: lib.h,v 1.7 2014/01/07 02:15:27 joerg Exp $ */
2 2
3/* from FreeBSD Id: lib.h,v 1.25 1997/10/08 07:48:03 charnier Exp */ 3/* from FreeBSD Id: lib.h,v 1.25 1997/10/08 07:48:03 charnier Exp */
4 4
5/* 5/*
6 * FreeBSD install - a package for the installation and maintainance 6 * FreeBSD install - a package for the installation and maintainance
7 * of non-core utilities. 7 * of non-core utilities.
8 * 8 *
9 * Redistribution and use in source and binary forms, with or without 9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions 10 * modification, are permitted provided that the following conditions
11 * are met: 11 * are met:
12 * 1. Redistributions of source code must retain the above copyright 12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer. 13 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright 14 * 2. Redistributions in binary form must reproduce the above copyright
15 * notice, this list of conditions and the following disclaimer in the 15 * notice, this list of conditions and the following disclaimer in the
16 * documentation and/or other materials provided with the distribution. 16 * documentation and/or other materials provided with the distribution.
17 * 17 *
18 * Jordan K. Hubbard 18 * Jordan K. Hubbard
19 * 18 July 1993 19 * 18 July 1993
20 * 20 *
21 * Include and define various things wanted by the library routines. 21 * Include and define various things wanted by the library routines.
22 * 22 *
23 */ 23 */
24 24
25#ifndef _INST_LIB_LIB_H_ 25#ifndef _INST_LIB_LIB_H_
26#define _INST_LIB_LIB_H_ 26#define _INST_LIB_LIB_H_
27 27
28#if HAVE_CONFIG_H 28#if HAVE_CONFIG_H
29#include "config.h" 29#include "config.h"
30#endif 30#endif
31#include <nbcompat.h> 31#include <nbcompat.h>
32#if HAVE_SYS_PARAM_H 32#if HAVE_SYS_PARAM_H
33#include <sys/param.h> 33#include <sys/param.h>
34#endif 34#endif
35#if HAVE_SYS_STAT_H 35#if HAVE_SYS_STAT_H
36#include <sys/stat.h> 36#include <sys/stat.h>
37#endif 37#endif
38#if HAVE_SYS_FILE_H 38#if HAVE_SYS_FILE_H
39#include <sys/file.h> 39#include <sys/file.h>
40#endif 40#endif
41#if HAVE_SYS_QUEUE_H 41#if HAVE_SYS_QUEUE_H
42#include <sys/queue.h> 42#include <sys/queue.h>
43#endif 43#endif
44 44
45#if HAVE_CTYPE_H 45#if HAVE_CTYPE_H
46#include <ctype.h> 46#include <ctype.h>
47#endif 47#endif
48#if HAVE_DIRENT_H 48#if HAVE_DIRENT_H
49#include <dirent.h> 49#include <dirent.h>
50#endif 50#endif
51#if HAVE_STDIO_H 51#if HAVE_STDIO_H
52#include <stdio.h> 52#include <stdio.h>
53#endif 53#endif
54#if HAVE_STDLIB_H 54#if HAVE_STDLIB_H
55#include <stdlib.h> 55#include <stdlib.h>
56#endif 56#endif
57#if HAVE_STDARG_H 57#if HAVE_STDARG_H
58#include <stdarg.h> 58#include <stdarg.h>
59#endif 59#endif
60#if HAVE_STRING_H 60#if HAVE_STRING_H
61#include <string.h> 61#include <string.h>
62#endif 62#endif
63#if HAVE_UNISTD_H 63#if HAVE_UNISTD_H
64#include <unistd.h> 64#include <unistd.h>
65#endif 65#endif
66 66
67/* Macros */ 67/* Macros */
68#ifndef __UNCONST 68#ifndef __UNCONST
69#define __UNCONST(a) ((void *)(unsigned long)(const void *)(a)) 69#define __UNCONST(a) ((void *)(unsigned long)(const void *)(a))
70#endif 70#endif
71 71
72#define SUCCESS (0) 72#define SUCCESS (0)
73#define FAIL (-1) 73#define FAIL (-1)
74 74
75#ifndef TRUE 75#ifndef TRUE
76#define TRUE (1) 76#define TRUE (1)
77#endif 77#endif
78 78
79#ifndef FALSE 79#ifndef FALSE
80#define FALSE (0) 80#define FALSE (0)
81#endif 81#endif
82 82
83#ifndef OPSYS_NAME 83#ifndef OPSYS_NAME
84#define OPSYS_NAME "NetBSD" 84#define OPSYS_NAME "NetBSD"
85#endif 85#endif
86 86
87#ifndef DEF_UMASK 87#ifndef DEF_UMASK
88#define DEF_UMASK 022 88#define DEF_UMASK 022
89#endif 89#endif
90 90
91#ifndef PATH_MAX 91#ifndef PATH_MAX
92# ifdef MAXPATHLEN 92# ifdef MAXPATHLEN
93# define PATH_MAX MAXPATHLEN 93# define PATH_MAX MAXPATHLEN
94# else 94# else
95# define PATH_MAX 1024 95# define PATH_MAX 1024
96# endif 96# endif
97#endif 97#endif
98 98
99enum { 99enum {
100 MaxPathSize = PATH_MAX 100 MaxPathSize = PATH_MAX
101}; 101};
102 102
103/* The names of our "special" files */ 103/* The names of our "special" files */
104#define CONTENTS_FNAME "+CONTENTS" 104#define CONTENTS_FNAME "+CONTENTS"
105#define COMMENT_FNAME "+COMMENT" 105#define COMMENT_FNAME "+COMMENT"
106#define DESC_FNAME "+DESC" 106#define DESC_FNAME "+DESC"
107#define INSTALL_FNAME "+INSTALL" 107#define INSTALL_FNAME "+INSTALL"
108#define DEINSTALL_FNAME "+DEINSTALL" 108#define DEINSTALL_FNAME "+DEINSTALL"
109#define REQUIRED_BY_FNAME "+REQUIRED_BY" 109#define REQUIRED_BY_FNAME "+REQUIRED_BY"
110#define REQUIRED_BY_FNAME_TMP "+REQUIRED_BY.tmp" 110#define REQUIRED_BY_FNAME_TMP "+REQUIRED_BY.tmp"
111#define DISPLAY_FNAME "+DISPLAY" 111#define DISPLAY_FNAME "+DISPLAY"
112#define MTREE_FNAME "+MTREE_DIRS" 112#define MTREE_FNAME "+MTREE_DIRS"
113#define BUILD_VERSION_FNAME "+BUILD_VERSION" 113#define BUILD_VERSION_FNAME "+BUILD_VERSION"
114#define BUILD_INFO_FNAME "+BUILD_INFO" 114#define BUILD_INFO_FNAME "+BUILD_INFO"
115#define INSTALLED_INFO_FNAME "+INSTALLED_INFO" 115#define INSTALLED_INFO_FNAME "+INSTALLED_INFO"
116#define SIZE_PKG_FNAME "+SIZE_PKG" 116#define SIZE_PKG_FNAME "+SIZE_PKG"
117#define SIZE_ALL_FNAME "+SIZE_ALL" 117#define SIZE_ALL_FNAME "+SIZE_ALL"
118#define PRESERVE_FNAME "+PRESERVE" 118#define PRESERVE_FNAME "+PRESERVE"
119#define VIEWS_FNAME "+VIEWS" 119#define VIEWS_FNAME "+VIEWS"
120#define VIEWS_FNAME_TMP "+VIEWS.tmp" 120#define VIEWS_FNAME_TMP "+VIEWS.tmp"
121#define DEPOT_FNAME "+DEPOT" 121#define DEPOT_FNAME "+DEPOT"
122 122
123/* The names of special variables */ 123/* The names of special variables */
124#define AUTOMATIC_VARNAME "automatic" 124#define AUTOMATIC_VARNAME "automatic"
125 125
126/* Prefix for extended PLIST cmd */ 126/* Prefix for extended PLIST cmd */
127#define CMD_CHAR '@'  127#define CMD_CHAR '@'
128 128
129/* The name of the "prefix" environment variable given to scripts */ 129/* The name of the "prefix" environment variable given to scripts */
130#define PKG_PREFIX_VNAME "PKG_PREFIX" 130#define PKG_PREFIX_VNAME "PKG_PREFIX"
131 131
132/* The name of the "destdir" environment variable given to scripts */ 132/* The name of the "destdir" environment variable given to scripts */
133#define PKG_DESTDIR_VNAME "PKG_DESTDIR" 133#define PKG_DESTDIR_VNAME "PKG_DESTDIR"
134 134
135/* 135/*
136 * The name of the "metadatadir" environment variable given to scripts. 136 * The name of the "metadatadir" environment variable given to scripts.
137 * This variable holds the location of the +-files for this package. 137 * This variable holds the location of the +-files for this package.
138 */ 138 */
139#define PKG_METADATA_DIR_VNAME "PKG_METADATA_DIR" 139#define PKG_METADATA_DIR_VNAME "PKG_METADATA_DIR"
140 140
141/* 141/*
142 * The name of the environment variable holding the location to the 142 * The name of the environment variable holding the location to the
143 * reference-counts database directory. 143 * reference-counts database directory.
144 */ 144 */
145#define PKG_REFCOUNT_DBDIR_VNAME "PKG_REFCOUNT_DBDIR" 145#define PKG_REFCOUNT_DBDIR_VNAME "PKG_REFCOUNT_DBDIR"
146 146
147#define PKG_PATTERN_MAX MaxPathSize /* max length of pattern, including nul */ 147#define PKG_PATTERN_MAX MaxPathSize /* max length of pattern, including nul */
148#define PKG_SUFFIX_MAX 10 /* max length of suffix, including nul */ 148#define PKG_SUFFIX_MAX 10 /* max length of suffix, including nul */
149 149
150enum { 150enum {
151 ReadWrite, 151 ReadWrite,
152 ReadOnly 152 ReadOnly
153}; 153};
154 154
155 155
156/* Enumerated constants for plist entry types */ 156/* Enumerated constants for plist entry types */
157typedef enum pl_ent_t { 157typedef enum pl_ent_t {
158 PLIST_SHOW_ALL = -1, 158 PLIST_SHOW_ALL = -1,
159 PLIST_FILE, /* 0 */ 159 PLIST_FILE, /* 0 */
160 PLIST_CWD, /* 1 */ 160 PLIST_CWD, /* 1 */
161 PLIST_CMD, /* 2 */ 161 PLIST_CMD, /* 2 */
162 PLIST_CHMOD, /* 3 */ 162 PLIST_CHMOD, /* 3 */
163 PLIST_CHOWN, /* 4 */ 163 PLIST_CHOWN, /* 4 */
164 PLIST_CHGRP, /* 5 */ 164 PLIST_CHGRP, /* 5 */
165 PLIST_COMMENT, /* 6 */ 165 PLIST_COMMENT, /* 6 */
166 PLIST_IGNORE, /* 7 */ 166 PLIST_IGNORE, /* 7 */
167 PLIST_NAME, /* 8 */ 167 PLIST_NAME, /* 8 */
168 PLIST_UNEXEC, /* 9 */ 168 PLIST_UNEXEC, /* 9 */
169 PLIST_SRC, /* 10 */ 169 PLIST_SRC, /* 10 */
170 PLIST_DISPLAY, /* 11 */ 170 PLIST_DISPLAY, /* 11 */
171 PLIST_PKGDEP, /* 12 */ 171 PLIST_PKGDEP, /* 12 */
172 PLIST_DIR_RM, /* 13 */ 172 PLIST_DIR_RM, /* 13 */
173 PLIST_OPTION, /* 14 */ 173 PLIST_OPTION, /* 14 */
174 PLIST_PKGCFL, /* 15 */ 174 PLIST_PKGCFL, /* 15 */
175 PLIST_BLDDEP, /* 16 */ 175 PLIST_BLDDEP, /* 16 */
176 PLIST_PKGDIR /* 17 */ 176 PLIST_PKGDIR /* 17 */
177} pl_ent_t; 177} pl_ent_t;
178 178
179/* Enumerated constants for build info */ 179/* Enumerated constants for build info */
180typedef enum bi_ent_t { 180typedef enum bi_ent_t {
181 BI_OPSYS, /* 0 */ 181 BI_OPSYS, /* 0 */
182 BI_OS_VERSION, /* 1 */ 182 BI_OS_VERSION, /* 1 */
183 BI_MACHINE_ARCH, /* 2 */ 183 BI_MACHINE_ARCH, /* 2 */
184 BI_IGNORE_RECOMMENDED, /* 3 */ 184 BI_IGNORE_RECOMMENDED, /* 3 */
185 BI_USE_ABI_DEPENDS, /* 4 */ 185 BI_USE_ABI_DEPENDS, /* 4 */
186 BI_LICENSE, /* 5 */ 186 BI_LICENSE, /* 5 */
187 BI_PKGTOOLS_VERSION, /* 6 */ 187 BI_PKGTOOLS_VERSION, /* 6 */
188 BI_ENUM_COUNT /* 7 */ 188 BI_ENUM_COUNT /* 7 */
189} bi_ent_t; 189} bi_ent_t;
190 190
191/* Types */ 191/* Types */
192typedef unsigned int Boolean; 192typedef unsigned int Boolean;
193 193
194/* This structure describes a packing list entry */ 194/* This structure describes a packing list entry */
195typedef struct plist_t { 195typedef struct plist_t {
196 struct plist_t *prev; /* previous entry */ 196 struct plist_t *prev; /* previous entry */
197 struct plist_t *next; /* next entry */ 197 struct plist_t *next; /* next entry */
198 char *name; /* name of entry */ 198 char *name; /* name of entry */
199 Boolean marked; /* whether entry has been marked */ 199 Boolean marked; /* whether entry has been marked */
200 pl_ent_t type; /* type of entry */ 200 pl_ent_t type; /* type of entry */
201} plist_t; 201} plist_t;
202 202
203/* This structure describes a package's complete packing list */ 203/* This structure describes a package's complete packing list */
204typedef struct package_t { 204typedef struct package_t {
205 plist_t *head; /* head of list */ 205 plist_t *head; /* head of list */
206 plist_t *tail; /* tail of list */ 206 plist_t *tail; /* tail of list */
207} package_t; 207} package_t;
208 208
209#define SYMLINK_HEADER "Symlink:" 209#define SYMLINK_HEADER "Symlink:"
210#define CHECKSUM_HEADER "MD5:" 210#define CHECKSUM_HEADER "MD5:"
211 211
212enum { 212enum {
213 ChecksumHeaderLen = 4, /* strlen(CHECKSUM_HEADER) */ 213 ChecksumHeaderLen = 4, /* strlen(CHECKSUM_HEADER) */
214 SymlinkHeaderLen = 8, /* strlen(SYMLINK_HEADER) */ 214 SymlinkHeaderLen = 8, /* strlen(SYMLINK_HEADER) */
215 ChecksumLen = 16, 215 ChecksumLen = 16,
216 LegibleChecksumLen = 33 216 LegibleChecksumLen = 33
217}; 217};
218 218
219/* List of files */ 219/* List of files */
220typedef struct _lfile_t { 220typedef struct _lfile_t {
221 TAILQ_ENTRY(_lfile_t) lf_link; 221 TAILQ_ENTRY(_lfile_t) lf_link;
222 char *lf_name; 222 char *lf_name;
223} lfile_t; 223} lfile_t;
224TAILQ_HEAD(_lfile_head_t, _lfile_t); 224TAILQ_HEAD(_lfile_head_t, _lfile_t);
225typedef struct _lfile_head_t lfile_head_t; 225typedef struct _lfile_head_t lfile_head_t;
226#define LFILE_ADD(lfhead,lfp,str) do { \ 226#define LFILE_ADD(lfhead,lfp,str) do { \
227 lfp = xmalloc(sizeof(lfile_t)); \ 227 lfp = xmalloc(sizeof(lfile_t)); \
228 lfp->lf_name = str; \ 228 lfp->lf_name = str; \
229 TAILQ_INSERT_TAIL(lfhead,lfp,lf_link); \ 229 TAILQ_INSERT_TAIL(lfhead,lfp,lf_link); \
230 } while(0) 230 } while(0)
231 231
232/* List of packages */ 232/* List of packages */
233typedef struct _lpkg_t { 233typedef struct _lpkg_t {
234 TAILQ_ENTRY(_lpkg_t) lp_link; 234 TAILQ_ENTRY(_lpkg_t) lp_link;
235 char *lp_name; 235 char *lp_name;
236} lpkg_t; 236} lpkg_t;
237TAILQ_HEAD(_lpkg_head_t, _lpkg_t); 237TAILQ_HEAD(_lpkg_head_t, _lpkg_t);
238typedef struct _lpkg_head_t lpkg_head_t; 238typedef struct _lpkg_head_t lpkg_head_t;
239 239
240struct pkg_vulnerabilities { 240struct pkg_vulnerabilities {
241 size_t entries; 241 size_t entries;
242 char **vulnerability; 242 char **vulnerability;
243 char **classification; 243 char **classification;
244 char **advisory; 244 char **advisory;
245}; 245};
246 246
247/* If URLlength()>0, then there is a ftp:// or http:// in the string, 247/* If URLlength()>0, then there is a ftp:// or http:// in the string,
248 * and this must be an URL. Hide this behind a more obvious name. */ 248 * and this must be an URL. Hide this behind a more obvious name. */
249#define IS_URL(str) (URLlength(str) > 0) 249#define IS_URL(str) (URLlength(str) > 0)
250 250
251#define IS_STDIN(str) ((str) != NULL && !strcmp((str), "-")) 251#define IS_STDIN(str) ((str) != NULL && !strcmp((str), "-"))
252#define IS_FULLPATH(str) ((str) != NULL && (str)[0] == '/') 252#define IS_FULLPATH(str) ((str) != NULL && (str)[0] == '/')
253 253
254/* Conflict handling (conflicts.c) */ 254/* Conflict handling (conflicts.c) */
255int some_installed_package_conflicts_with(const char *, const char *, char **, char **); 255int some_installed_package_conflicts_with(const char *, const char *, char **, char **);
256 256
257 257
258/* Prototypes */ 258/* Prototypes */
259/* Misc */ 259/* Misc */
260void show_version(void); 260void show_version(void);
261int fexec(const char *, ...); 261int fexec(const char *, ...);
262int fexec_skipempty(const char *, ...); 262int fexec_skipempty(const char *, ...);
263int fcexec(const char *, const char *, ...); 263int fcexec(const char *, const char *, ...);
264int pfcexec(const char *, const char *, const char **); 264int pfcexec(const char *, const char *, const char **);
265 265
266/* variables file handling */ 266/* variables file handling */
267 267
268char *var_get(const char *, const char *); 268char *var_get(const char *, const char *);
269char *var_get_memory(const char *, const char *); 269char *var_get_memory(const char *, const char *);
270int var_set(const char *, const char *, const char *); 270int var_set(const char *, const char *, const char *);
271int var_copy_list(const char *, const char **); 271int var_copy_list(const char *, const char **);
272 272
273/* automatically installed as dependency */ 273/* automatically installed as dependency */
274 274
275Boolean is_automatic_installed(const char *); 275Boolean is_automatic_installed(const char *);
276int mark_as_automatic_installed(const char *, int); 276int mark_as_automatic_installed(const char *, int);
277 277
278/* String */ 278/* String */
279const char *basename_of(const char *); 279const char *basename_of(const char *);
280const char *dirname_of(const char *); 280const char *dirname_of(const char *);
281const char *suffix_of(const char *); 281const char *suffix_of(const char *);
282int pkg_match(const char *, const char *); 282int pkg_match(const char *, const char *);
283int pkg_order(const char *, const char *, const char *); 283int pkg_order(const char *, const char *, const char *);
284int ispkgpattern(const char *); 284int ispkgpattern(const char *);
285int quick_pkg_match(const char *, const char *); 285int quick_pkg_match(const char *, const char *);
286 286
287/* Iterator functions */ 287/* Iterator functions */
288int iterate_pkg_generic_src(int (*)(const char *, void *), void *, 288int iterate_pkg_generic_src(int (*)(const char *, void *), void *,
289 const char *(*)(void *),void *); 289 const char *(*)(void *),void *);
290int iterate_local_pkg_dir(const char *, int, int, int (*)(const char *, void *), 290int iterate_local_pkg_dir(const char *, int, int, int (*)(const char *, void *),
291 void *); 291 void *);
292int iterate_pkg_db(int (*)(const char *, void *), void *); 292int iterate_pkg_db(int (*)(const char *, void *), void *);
293 293
294int add_installed_pkgs_by_basename(const char *, lpkg_head_t *); 294int add_installed_pkgs_by_basename(const char *, lpkg_head_t *);
295int add_installed_pkgs_by_pattern(const char *, lpkg_head_t *); 295int add_installed_pkgs_by_pattern(const char *, lpkg_head_t *);
296char *find_best_matching_installed_pkg(const char *); 296char *find_best_matching_installed_pkg(const char *);
297char *find_best_matching_file(const char *, const char *, int, int); 297char *find_best_matching_file(const char *, const char *, int, int);
298int match_installed_pkgs(const char *, int (*)(const char *, void *), void *); 298int match_installed_pkgs(const char *, int (*)(const char *, void *), void *);
299int match_local_files(const char *, int, int, const char *, int (*cb)(const char *, void *), void *); 299int match_local_files(const char *, int, int, const char *, int (*cb)(const char *, void *), void *);
300 300
301/* File */ 301/* File */
302Boolean fexists(const char *); 302Boolean fexists(const char *);
303Boolean isdir(const char *); 303Boolean isdir(const char *);
304Boolean islinktodir(const char *); 304Boolean islinktodir(const char *);
305Boolean isemptydir(const char *); 305Boolean isemptydir(const char *);
306Boolean isemptyfile(const char *); 306Boolean isemptyfile(const char *);
307Boolean isfile(const char *); 307Boolean isfile(const char *);
308Boolean isbrokenlink(const char *); 308Boolean isbrokenlink(const char *);
309Boolean isempty(const char *); 309Boolean isempty(const char *);
310int URLlength(const char *); 310int URLlength(const char *);
311Boolean make_preserve_name(char *, size_t, const char *, const char *); 311Boolean make_preserve_name(char *, size_t, const char *, const char *);
312void remove_files(const char *, const char *); 312void remove_files(const char *, const char *);
313int format_cmd(char *, size_t, const char *, const char *, const char *); 313int format_cmd(char *, size_t, const char *, const char *, const char *);
314 314
315int recursive_remove(const char *, int); 315int recursive_remove(const char *, int);
316 316
317void add_pkgdir(const char *, const char *, const char *); 317void add_pkgdir(const char *, const char *, const char *);
318void delete_pkgdir(const char *, const char *, const char *); 318void delete_pkgdir(const char *, const char *, const char *);
319int has_pkgdir(const char *); 319int has_pkgdir(const char *);
320 320
321/* pkg_io.c: Local and remote archive handling */ 321/* pkg_io.c: Local and remote archive handling */
322struct archive; 322struct archive;
323struct archive_entry; 323struct archive_entry;
324 324
325struct archive *open_archive(const char *, char **); 325struct archive *open_archive(const char *, char **);
326struct archive *find_archive(const char *, int, char **); 326struct archive *find_archive(const char *, int, char **);
327void process_pkg_path(void); 327void process_pkg_path(void);
328struct url *find_best_package(const char *, const char *, int); 328struct url *find_best_package(const char *, const char *, int);
329 329
330/* Packing list */ 330/* Packing list */
331plist_t *new_plist_entry(void); 331plist_t *new_plist_entry(void);
332plist_t *last_plist(package_t *); 332plist_t *last_plist(package_t *);
333plist_t *find_plist(package_t *, pl_ent_t); 333plist_t *find_plist(package_t *, pl_ent_t);
334char *find_plist_option(package_t *, const char *); 334char *find_plist_option(package_t *, const char *);
335void plist_delete(package_t *, Boolean, pl_ent_t, char *); 335void plist_delete(package_t *, Boolean, pl_ent_t, char *);
336void free_plist(package_t *); 336void free_plist(package_t *);
337void mark_plist(package_t *); 337void mark_plist(package_t *);
338void csum_plist_entry(char *, plist_t *); 338void csum_plist_entry(char *, plist_t *);
339void add_plist(package_t *, pl_ent_t, const char *); 339void add_plist(package_t *, pl_ent_t, const char *);
340void add_plist_top(package_t *, pl_ent_t, const char *); 340void add_plist_top(package_t *, pl_ent_t, const char *);
341void delete_plist(package_t *, Boolean, pl_ent_t, char *); 341void delete_plist(package_t *, Boolean, pl_ent_t, char *);
342void write_plist(package_t *, FILE *, char *); 342void write_plist(package_t *, FILE *, char *);
343void stringify_plist(package_t *, char **, size_t *, const char *); 343void stringify_plist(package_t *, char **, size_t *, const char *);
344void parse_plist(package_t *, const char *); 344void parse_plist(package_t *, const char *);
345void read_plist(package_t *, FILE *); 345void read_plist(package_t *, FILE *);
346void append_plist(package_t *, FILE *); 346void append_plist(package_t *, FILE *);
347int delete_package(Boolean, package_t *, Boolean, const char *); 347int delete_package(Boolean, package_t *, Boolean, const char *);
348 348
349/* Package Database */ 349/* Package Database */
350int pkgdb_open(int); 350int pkgdb_open(int);
351void pkgdb_close(void); 351void pkgdb_close(void);
352int pkgdb_store(const char *, const char *); 352int pkgdb_store(const char *, const char *);
353char *pkgdb_retrieve(const char *); 353char *pkgdb_retrieve(const char *);
354int pkgdb_dump(void); 354int pkgdb_dump(void);
355int pkgdb_remove(const char *); 355int pkgdb_remove(const char *);
356int pkgdb_remove_pkg(const char *); 356int pkgdb_remove_pkg(const char *);
357char *pkgdb_refcount_dir(void); 357char *pkgdb_refcount_dir(void);
358char *pkgdb_get_database(void); 358char *pkgdb_get_database(void);
359const char *pkgdb_get_dir(void); 359const char *pkgdb_get_dir(void);
360/* 360/*
361 * Priorities: 361 * Priorities:
362 * 0 builtin default 362 * 0 builtin default
363 * 1 config file 363 * 1 config file
364 * 2 environment 364 * 2 environment
365 * 3 command line 365 * 3 command line
366 * 4 destdir/views reset 366 * 4 destdir/views reset
367 */ 367 */
368void pkgdb_set_dir(const char *, int); 368void pkgdb_set_dir(const char *, int);
369char *pkgdb_pkg_dir(const char *); 369char *pkgdb_pkg_dir(const char *);
370char *pkgdb_pkg_file(const char *, const char *); 370char *pkgdb_pkg_file(const char *, const char *);
371 371
372/* List of packages functions */ 372/* List of packages functions */
373lpkg_t *alloc_lpkg(const char *); 373lpkg_t *alloc_lpkg(const char *);
374lpkg_t *find_on_queue(lpkg_head_t *, const char *); 374lpkg_t *find_on_queue(lpkg_head_t *, const char *);
375void free_lpkg(lpkg_t *); 375void free_lpkg(lpkg_t *);
376 376
377/* Read pkg_vulnerabilities from file */ 377/* Read pkg_vulnerabilities from file */
378struct pkg_vulnerabilities *read_pkg_vulnerabilities_file(const char *, int, int); 378struct pkg_vulnerabilities *read_pkg_vulnerabilities_file(const char *, int, int);
379/* Read pkg_vulnerabilities from memory */ 379/* Read pkg_vulnerabilities from memory */
380struct pkg_vulnerabilities *read_pkg_vulnerabilities_memory(void *, size_t, int); 380struct pkg_vulnerabilities *read_pkg_vulnerabilities_memory(void *, size_t, int);
381void free_pkg_vulnerabilities(struct pkg_vulnerabilities *); 381void free_pkg_vulnerabilities(struct pkg_vulnerabilities *);
382int audit_package(struct pkg_vulnerabilities *, const char *, const char *, 382int audit_package(struct pkg_vulnerabilities *, const char *, const char *,
383 int); 383 int);
384 384
385/* Parse configuration file */ 385/* Parse configuration file */
386void pkg_install_config(void); 386void pkg_install_config(void);
387/* Print configuration variable */ 387/* Print configuration variable */
388void pkg_install_show_variable(const char *); 388void pkg_install_show_variable(const char *);
389 389
390/* Package signature creation and validation */ 390/* Package signature creation and validation */
391int pkg_verify_signature(const char *, struct archive **, struct archive_entry **, char **); 391int pkg_verify_signature(const char *, struct archive **, struct archive_entry **, char **);
392int pkg_full_signature_check(const char *, struct archive **); 392int pkg_full_signature_check(const char *, struct archive **);
393#ifdef HAVE_SSL 393#ifdef HAVE_SSL
394void pkg_sign_x509(const char *, const char *, const char *, const char *); 394void pkg_sign_x509(const char *, const char *, const char *, const char *);
395#endif 395#endif
396 396
397void pkg_sign_gpg(const char *, const char *); 397void pkg_sign_gpg(const char *, const char *);
398 398
399#ifdef HAVE_SSL 399#ifdef HAVE_SSL
400/* PKCS7 signing/verification */ 400/* PKCS7 signing/verification */
401int easy_pkcs7_verify(const char *, size_t, const char *, size_t, 401int easy_pkcs7_verify(const char *, size_t, const char *, size_t,
402 const char *, int); 402 const char *, int);
403int easy_pkcs7_sign(const char *, size_t, char **, size_t *, const char *, 403int easy_pkcs7_sign(const char *, size_t, char **, size_t *, const char *,
404 const char *); 404 const char *);
405#endif 405#endif
406 406
407int inline_gpg_verify(const char *, size_t, const char *); 407int inline_gpg_verify(const char *, size_t, const char *);
408int detached_gpg_verify(const char *, size_t, const char *, size_t, 408int detached_gpg_verify(const char *, size_t, const char *, size_t,
409 const char *); 409 const char *);
410int detached_gpg_sign(const char *, size_t, char **, size_t *, const char *, 410int detached_gpg_sign(const char *, size_t, char **, size_t *, const char *,
411 const char *); 411 const char *);
412 412
413/* License handling */ 413/* License handling */
414int add_licenses(const char *); 414int add_licenses(const char *);
415int acceptable_license(const char *); 415int acceptable_license(const char *);
416int acceptable_pkg_license(const char *); 416int acceptable_pkg_license(const char *);
417void load_license_lists(void); 417void load_license_lists(void);
418 418
419/* Helper functions for memory allocation */ 419/* Helper functions for memory allocation */
420char *xstrdup(const char *); 420char *xstrdup(const char *);
421void *xrealloc(void *, size_t); 421void *xrealloc(void *, size_t);
422void *xcalloc(size_t, size_t); 422void *xcalloc(size_t, size_t);
423void *xmalloc(size_t); 423void *xmalloc(size_t);
424char *xasprintf(const char *, ...); 424char *xasprintf(const char *, ...) __printflike(1, 2);
425 425
426/* Externs */ 426/* Externs */
427extern Boolean Verbose; 427extern Boolean Verbose;
428extern Boolean Fake; 428extern Boolean Fake;
429extern Boolean Force; 429extern Boolean Force;
430extern const char *cert_chain_file; 430extern const char *cert_chain_file;
431extern const char *certs_packages; 431extern const char *certs_packages;
432extern const char *certs_pkg_vulnerabilities; 432extern const char *certs_pkg_vulnerabilities;
433extern const char *check_eol; 433extern const char *check_eol;
434extern const char *check_vulnerabilities; 434extern const char *check_vulnerabilities;
435extern const char *config_file; 435extern const char *config_file;
436extern const char *config_pkg_dbdir; 436extern const char *config_pkg_dbdir;
437extern const char *config_pkg_path; 437extern const char *config_pkg_path;
438extern const char *config_pkg_refcount_dbdir; 438extern const char *config_pkg_refcount_dbdir;
439extern const char *do_license_check; 439extern const char *do_license_check;
440extern const char *verified_installation; 440extern const char *verified_installation;
441extern const char *gpg_cmd; 441extern const char *gpg_cmd;
442extern const char *gpg_keyring_pkgvuln; 442extern const char *gpg_keyring_pkgvuln;
443extern const char *gpg_keyring_sign; 443extern const char *gpg_keyring_sign;
444extern const char *gpg_keyring_verify; 444extern const char *gpg_keyring_verify;
445extern const char *gpg_sign_as; 445extern const char *gpg_sign_as;
446extern char fetch_flags[]; 446extern char fetch_flags[];
447 447
448extern const char *pkg_vulnerabilities_dir; 448extern const char *pkg_vulnerabilities_dir;
449extern const char *pkg_vulnerabilities_file; 449extern const char *pkg_vulnerabilities_file;
450extern const char *pkg_vulnerabilities_url; 450extern const char *pkg_vulnerabilities_url;
451extern const char *ignore_advisories; 451extern const char *ignore_advisories;
452extern const char tnf_vulnerability_base[]; 452extern const char tnf_vulnerability_base[];
453 453
454extern const char *acceptable_licenses; 454extern const char *acceptable_licenses;
455extern const char *default_acceptable_licenses; 455extern const char *default_acceptable_licenses;
456 456
457#endif /* _INST_LIB_LIB_H_ */ 457#endif /* _INST_LIB_LIB_H_ */