1 /* $Id: lib.h,v 1.3 1993/09/05 04:54:21 jkh Exp $ */
4 * FreeBSD install - a package for the installation and maintainance
5 * of non-core utilities.
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
19 * Include and define various things wanted by the library routines.
23 #ifndef _INST_LIB_LIB_H_
24 #define _INST_LIB_LIB_H_
35 #include <sys/types.h>
50 /* Usually "rm", but often "echo" during debugging! */
51 #define REMOVE_CMD "rm"
53 /* Usually "rm", but often "echo" during debugging! */
54 #define RMDIR_CMD "rmdir"
56 /* Where we put logging information */
57 #define LOG_DIR "/var/db/pkg"
59 /* The names of our "special" files */
60 #define CONTENTS_FNAME "+CONTENTS"
61 #define COMMENT_FNAME "+COMMENT"
62 #define DESC_FNAME "+DESC"
63 #define INSTALL_FNAME "+INSTALL"
64 #define DEINSTALL_FNAME "+DEINSTALL"
65 #define REQUIRE_FNAME "+REQUIRE"
67 #define CMD_CHAR '@' /* prefix for extended PLIST cmd */
71 PLIST_FILE, PLIST_CWD, PLIST_CMD, PLIST_CHMOD,
72 PLIST_CHOWN, PLIST_CHGRP, PLIST_COMMENT,
73 PLIST_IGNORE, PLIST_NAME, PLIST_UNEXEC
75 typedef enum _plist_t plist_t;
78 typedef unsigned int Boolean;
81 struct _plist *prev, *next;
86 typedef struct _plist *PackingList;
89 struct _plist *head, *tail;
91 typedef struct _pack Package;
95 int vsystem(const char *, ...);
97 char *make_playpen(char *);
98 void leave_playpen(void);
99 char *where_playpen(void);
102 char *get_dash_string(char **);
103 char *copy_string(char *);
104 Boolean suffix(char *, char *);
105 void nuke_suffix(char *);
106 void str_lowercase(char *);
109 Boolean fexists(char *);
110 Boolean isdir(char *);
111 Boolean isempty(char *);
112 char *get_file_contents(char *);
113 void write_file(char *, char *);
114 void copy_file(char *, char *, char *);
115 void copy_hierarchy(char *, char *, Boolean);
116 int delete_hierarchy(char *, Boolean);
117 int unpack(char *, char *);
118 void format_cmd(char *, char *, char *, char *);
121 void upchuck(const char *);
122 void barf(const char *, ...);
123 void whinge(const char *, ...);
124 Boolean y_or_n(Boolean, const char *, ...);
127 PackingList new_plist_entry(void);
128 PackingList last_plist(Package *);
129 Boolean in_plist(Package *, plist_t);
130 void plist_delete(Package *, Boolean, plist_t, char *);
131 void free_plist(Package *);
132 void mark_plist(Package *);
133 void csum_plist_entry(char *, PackingList);
134 void add_plist(Package *, plist_t, char *);
135 void add_plist_top(Package *, plist_t, char *);
136 void write_plist(Package *, FILE *);
137 void read_plist(Package *, FILE *);
138 int plist_cmd(char *, char **);
139 void delete_package(Boolean, Package *);
142 void usage(const char *, const char *, ...);
143 int pkg_perform(char **);
146 extern Boolean Verbose;
149 #endif /* _INST_LIB_LIB_H_ */