dpkg 1.21.11
dpkg.h
Go to the documentation of this file.
1/*
2 * libdpkg - Debian packaging suite library routines
3 * dpkg.h - general header for Debian package handling
4 *
5 * Copyright © 1994,1995 Ian Jackson <ijackson@chiark.greenend.org.uk>
6 * Copyright © 2000,2001 Wichert Akkerman <wichert@debian.org>
7 * Copyright © 2006-2015 Guillem Jover <guillem@debian.org>
8 *
9 * This is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program. If not, see <https://www.gnu.org/licenses/>.
21 */
22
23#ifndef LIBDPKG_DPKG_H
24#define LIBDPKG_DPKG_H
25
26#include <sys/types.h>
27
28#include <stddef.h>
29#include <stdio.h>
30
31#include <dpkg/macros.h>
32
34
52#define MAXCONFFILENAME 1000
53#define MAXDIVERTFILENAME 1024
54#define MAXCONTROLFILENAME 100
55#define DEBEXT ".deb"
56#define REMOVECONFFEXTS "~", ".bak", "%", \
57 DPKGTEMPEXT, DPKGNEWEXT, DPKGOLDEXT, DPKGDISTEXT
58
59#define NEWCONFFILEFLAG "newconffile"
60#define NONEXISTENTFLAG "nonexistent"
61#define EMPTYHASHFLAG "-"
62
63#define DPKGTEMPEXT ".dpkg-tmp"
64#define DPKGNEWEXT ".dpkg-new"
65#define DPKGOLDEXT ".dpkg-old"
66#define DPKGDISTEXT ".dpkg-dist"
67
68#define CONTROLFILE "control"
69#define CONFFILESFILE "conffiles"
70#define PREINSTFILE "preinst"
71#define POSTINSTFILE "postinst"
72#define PRERMFILE "prerm"
73#define POSTRMFILE "postrm"
74/* Debconf config maintainer script. */
75#define MAINTSCRIPT_FILE_CONFIG "config"
76#define TRIGGERSCIFILE "triggers"
77
78#define STATUSFILE "status"
79#define AVAILFILE "available"
80#define LOCKFILE "lock"
81#define FRONTENDLOCKFILE "lock-frontend"
82#define DIVERSIONSFILE "diversions"
83#define STATOVERRIDEFILE "statoverride"
84#define UPDATESDIR "updates"
85#define INFODIR "info"
86#define TRIGGERSDIR "triggers"
87#define TRIGGERSFILEFILE "File"
88#define TRIGGERSDEFERREDFILE "Unincorp"
89#define TRIGGERSLOCKFILE "Lock"
90#define CONTROLDIRTMP "tmp.ci"
91#define IMPORTANTTMP "tmp.i"
92#define REASSEMBLETMP "reassemble" DEBEXT
93#define IMPORTANTMAXLEN 10
94#define IMPORTANTFMT "%04d"
95#define MAXUPDATES 250
96
97#define DEFAULTSHELL "sh"
98#define DEFAULTPAGER "pager"
99
100#define MD5HASHLEN 32
101#define MAXTRIGDIRECTIVE 256
102
103#define BACKEND "dpkg-deb"
104#define SPLITTER "dpkg-split"
105#define DPKGQUERY "dpkg-query"
106#define DPKGDIVERT "dpkg-divert"
107#define DPKGSTAT "dpkg-statoverride"
108#define DPKGTRIGGER "dpkg-trigger"
109#define DPKG "dpkg"
110#define DEBSIGVERIFY "debsig-verify"
111
112#define RM "rm"
113#define CAT "cat"
114#define DIFF "diff"
115
116#include <dpkg/progname.h>
117#include <dpkg/ehandle.h>
118#include <dpkg/report.h>
119#include <dpkg/string.h>
120#include <dpkg/program.h>
121
122/*** log.c ***/
123
124extern const char *log_file;
125void log_message(const char *fmt, ...) DPKG_ATTR_PRINTF(1);
126
127void statusfd_add(int fd);
128void statusfd_send(const char *fmt, ...) DPKG_ATTR_PRINTF(1);
129
130/*** cleanup.c ***/
131
132void cu_closestream(int argc, void **argv);
133void cu_closepipe(int argc, void **argv);
134void cu_closedir(int argc, void **argv);
135void cu_closefd(int argc, void **argv);
136void cu_filename(int argc, void **argv);
137
138/*** from mlib.c ***/
139
140void setcloexec(int fd, const char *fn);
141void *m_malloc(size_t);
142void *m_calloc(size_t nmemb, size_t size);
143void *m_realloc(void *, size_t);
144char *m_strdup(const char *str);
145char *m_strndup(const char *str, size_t n);
146int m_asprintf(char **strp, const char *fmt, ...) DPKG_ATTR_PRINTF(2);
147int m_vasprintf(char **strp, const char *fmt, va_list args)
149int m_dup(int oldfd);
150void m_dup2(int oldfd, int newfd);
151void m_pipe(int fds[2]);
152void m_output(FILE *f, const char *name);
153
154/*** from utils.c ***/
155
156int fgets_checked(char *buf, size_t bufsz, FILE *f, const char *fn);
157int fgets_must(char *buf, size_t bufsz, FILE *f, const char *fn);
158
160
161#endif /* LIBDPKG_DPKG_H */
int m_asprintf(char **strp, const char *fmt,...) DPKG_ATTR_PRINTF(2)
Definition: mlib.c:87
void cu_closefd(int argc, void **argv)
Definition: cleanup.c:56
void statusfd_send(const char *fmt,...) DPKG_ATTR_PRINTF(1)
Definition: log.c:107
void cu_closepipe(int argc, void **argv)
Definition: cleanup.c:31
void log_message(const char *fmt,...) DPKG_ATTR_PRINTF(1)
Definition: log.c:41
void * m_malloc(size_t)
Definition: mlib.c:47
void statusfd_add(int fd)
Definition: log.c:94
void setcloexec(int fd, const char *fn)
Definition: mlib.c:139
char * m_strdup(const char *str)
Definition: mlib.c:62
void cu_closestream(int argc, void **argv)
Definition: cleanup.c:40
int m_vasprintf(char **strp, const char *fmt, va_list args) DPKG_ATTR_VPRINTF(2)
Definition: mlib.c:74
void * m_realloc(void *, size_t)
Definition: mlib.c:57
void cu_closedir(int argc, void **argv)
Definition: cleanup.c:48
void * m_calloc(size_t nmemb, size_t size)
Definition: mlib.c:52
int fgets_checked(char *buf, size_t bufsz, FILE *f, const char *fn)
Definition: utils.c:30
void m_dup2(int oldfd, int newfd)
Definition: mlib.c:112
int fgets_must(char *buf, size_t bufsz, FILE *f, const char *fn)
Definition: utils.c:50
char * m_strndup(const char *str, size_t n)
Definition: mlib.c:68
void cu_filename(int argc, void **argv)
Definition: cleanup.c:64
void m_pipe(int fds[2])
Definition: mlib.c:123
void m_output(FILE *f, const char *name)
Definition: mlib.c:131
int m_dup(int oldfd)
Definition: mlib.c:100
const char * log_file
Definition: log.c:38
void * args[20]
Definition: ehandle.c:89
#define DPKG_BEGIN_DECLS
Definition: macros.h:86
#define DPKG_ATTR_VPRINTF(n)
Definition: macros.h:57
#define DPKG_ATTR_PRINTF(n)
Definition: macros.h:56
#define DPKG_END_DECLS
Definition: macros.h:87