home *** CD-ROM | disk | FTP | other *** search
/ PC World 2000 February / PCWorld_2000-02_cd.bin / live / usr / include / dpkg / dpkg.h < prev    next >
C/C++ Source or Header  |  1999-03-02  |  7KB  |  205 lines

  1. /*
  2.  * libdpkg - Debian packaging suite library routines
  3.  * dpkg.h - general header for Debian package handling
  4.  *
  5.  * Copyright (C) 1994,1995 Ian Jackson <iwj10@cus.cam.ac.uk>
  6.  *
  7.  * This is free software; you can redistribute it and/or modify
  8.  * it under the terms of the GNU General Public License as
  9.  * published by the Free Software Foundation; either version 2,
  10.  * or (at your option) any later version.
  11.  *
  12.  * This is distributed in the hope that it will be useful, but
  13.  * WITHOUT ANY WARRANTY; without even the implied warranty of
  14.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  15.  * GNU General Public License for more details.
  16.  *
  17.  * You should have received a copy of the GNU General Public
  18.  * License along with dpkg; if not, write to the Free Software
  19.  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  20.  */
  21.  
  22. #ifndef DPKG_H
  23. #define DPKG_H
  24.  
  25. #include <setjmp.h>
  26. #include <stdarg.h>
  27. #include <stdio.h>
  28. #include <sys/types.h>
  29. #include <sys/sysinfo.h>
  30.  
  31. #define ARCHIVEVERSION     "2.0"
  32. #define SPLITVERSION       "2.1"
  33. #define OLDARCHIVEVERSION  "0.939000"
  34. #define SPLITPARTDEFMAX    (450*1024)
  35. #define MAXFIELDNAME        200
  36. #define MAXCONFFILENAME     1000
  37. #define MAXDIVERTFILENAME   1024
  38. #define MAXCONTROLFILENAME  100
  39. #define BUILDCONTROLDIR    "DEBIAN"
  40. #define EXTRACTCONTROLDIR   BUILDCONTROLDIR
  41. #define DEBEXT             ".deb"
  42. #define OLDDBEXT           "-old"
  43. #define NEWDBEXT           "-new"
  44. #define OLDOLDDEBDIR       ".DEBIAN"
  45. #define OLDDEBDIR          "DEBIAN"
  46. #define REMOVECONFFEXTS    "~", ".bak", "%", \
  47.                            DPKGTEMPEXT, DPKGNEWEXT, DPKGOLDEXT, DPKGDISTEXT
  48.  
  49. #ifndef ARCHBINFMT
  50. #define ARCHBINFMT
  51. #endif
  52. #define DPKG_VERSION_ARCH  DPKG_VERSION " (" ARCHITECTURE ARCHBINFMT ")"
  53.  
  54. #define NEWCONFFILEFLAG    "newconffile"
  55. #define NONEXISTENTFLAG    "nonexistent"
  56.  
  57. #define DPKGTEMPEXT        ".dpkg-tmp"
  58. #define DPKGNEWEXT         ".dpkg-new"
  59. #define DPKGOLDEXT         ".dpkg-old"
  60. #define DPKGDISTEXT        ".dpkg-dist"
  61.  
  62. #define CONTROLFILE        "control"
  63. #define CONFFILESFILE      "conffiles"
  64. #define PREINSTFILE        "preinst"
  65. #define POSTINSTFILE       "postinst"
  66. #define PRERMFILE          "prerm"
  67. #define POSTRMFILE         "postrm"
  68. #define LISTFILE           "list"
  69.  
  70. #define ADMINDIR        "/var/lib/dpkg"
  71. #define STATUSFILE      "status"
  72. #define AVAILFILE       "available"
  73. #define LOCKFILE        "lock"
  74. #define CMETHOPTFILE    "cmethopt"
  75. #define METHLOCKFILE    "methlock"
  76. #define DIVERSIONSFILE  "diversions"
  77. #define UPDATESDIR      "updates/"
  78. #define INFODIR         "info/"
  79. #define PARTSDIR        "parts/"
  80. #define CONTROLDIRTMP   "tmp.ci/"
  81. #define IMPORTANTTMP    "tmp.i"
  82. #define REASSEMBLETMP   "reassemble" DEBEXT
  83. #define IMPORTANTMAXLEN  10
  84. #define IMPORTANTFMT    "%04d" /* change => also change lib/database.c:cleanup_updates */
  85. #define MAXUPDATES       50
  86.  
  87. #define LIBDIR              "/usr/lib/dpkg/"
  88. #define LOCALLIBDIR         "/usr/local/lib/dpkg"
  89. #define METHODSDIR          "methods"
  90.  
  91. #define NOJOBCTRLSTOPENV    "DPKG_NO_TSTP"
  92. #define SHELLENV            "SHELL"
  93. #define DEFAULTSHELL        "sh"
  94.  
  95. #define IMETHODMAXLEN        50
  96. #define IOPTIONMAXLEN        IMETHODMAXLEN
  97. #define METHODOPTIONSFILE   "names"
  98. #define METHODSETUPSCRIPT   "setup"
  99. #define METHODUPDATESCRIPT  "update"
  100. #define METHODINSTALLSCRIPT "install"
  101. #define OPTIONSDESCPFX      "desc."
  102. #define OPTIONINDEXMAXLEN    5
  103.  
  104. #define PKGSCRIPTMAXARGS     10
  105. #define MD5HASHLEN           32
  106.  
  107. #define CONFFOPTCELLS  /* int conffoptcells[2] {* 1= user edited *}              \
  108.                                            [2] {* 1= distributor edited *} = */  \
  109.                                   /* dist not */     /* dist edited */           \
  110.    /* user did not edit */    {     cfo_keep,           cfo_install    },        \
  111.    /* user did edit     */    {     cfo_keep,         cfo_prompt_keep  }
  112.  
  113. #define ARCHIVE_FILENAME_PATTERN "*.deb"
  114.  
  115. #define BACKEND      "dpkg-deb"
  116. #define SPLITTER     "dpkg-split"
  117. #define MD5SUM       "md5sum"
  118. #define DSELECT      "dselect"
  119. #define DPKG         "dpkg"
  120.  
  121. #define TAR          "tar"
  122. #define GZIP         "gzip"
  123. #define CAT          "cat"
  124. #define RM           "rm"
  125. #define FIND         "find"
  126. #define SHELL        "sh"
  127.  
  128. #define SHELLENVIR   "SHELL"
  129.  
  130. #define FIND_EXPRSTARTCHARS "-(),!"
  131.  
  132. #define TARBLKSZ     512
  133.  
  134. /* Take care of NLS matters.  */
  135.  
  136. #if HAVE_LOCALE_H
  137. # include <locale.h>
  138. #endif
  139. #if !HAVE_SETLOCALE
  140. # define setlocale(Category, Locale) /* empty */
  141. #endif
  142.  
  143. #if ENABLE_NLS
  144. # include <libintl.h>
  145. # define _(Text) gettext (Text)
  146. # define N_(Text) Text
  147. #else
  148. # undef bindtextdomain
  149. # define bindtextdomain(Domain, Directory) /* empty */
  150. # undef textdomain
  151. # define textdomain(Domain) /* empty */
  152. # define _(Text) Text
  153. # define N_(Text) Text
  154. #endif
  155.  
  156. extern const char thisname[]; /* defined separately in each program */
  157. extern const char printforhelp[];
  158.  
  159. /*** from ehandle.c ***/
  160.  
  161. void push_error_handler(jmp_buf *jbufp,
  162.                         void (*printerror)(const char *, const char *),
  163.                         const char *contextstring);
  164. void set_error_display(void (*printerror)(const char *, const char *),
  165.                        const char *contextstring);
  166. void print_error_fatal(const char *emsg, const char *contextstring);
  167. void error_unwind(int flagset);
  168. void push_cleanup(void (*f1)(int argc, void **argv), int flagmask1,
  169.                   void (*f2)(int argc, void **argv), int flagmask2,
  170.                   int nargs, ...);
  171. void push_checkpoint(int mask, int value);
  172. void pop_cleanup(int flagset);
  173. enum { ehflag_normaltidy=01, ehflag_bombout=02, ehflag_recursiveerror=04 };
  174.  
  175. void do_internerr(const char *string, int line, const char *file) NONRETURNING;
  176. #define internerr(s) do_internerr(s,__LINE__,__FILE__)
  177.  
  178. struct varbuf;
  179. void ohshit(const char *fmt, ...) NONRETURNPRINTFFORMAT(1,2);
  180. void ohshitv(const char *fmt, va_list al) NONRETURNING;
  181. void ohshite(const char *fmt, ...) NONRETURNPRINTFFORMAT(1,2);
  182. void ohshitvb(struct varbuf*) NONRETURNING;
  183. void badusage(const char *fmt, ...) NONRETURNPRINTFFORMAT(1,2);
  184. void werr(const char *what) NONRETURNING;
  185.  
  186. /*** from mlib.c ***/
  187.  
  188. void *m_malloc(size_t);
  189. void *m_realloc(void*, size_t);
  190. int m_fork(void);
  191. void m_dup2(int oldfd, int newfd);
  192. void m_pipe(int fds[2]);
  193.  
  194. void checksubprocerr(int status, const char *description, int sigpipeok);
  195. void waitsubproc(pid_t pid, const char *description, int sigpipeok);
  196.  
  197. extern volatile int onerr_abort;
  198.  
  199. /*** from showcright.c ***/
  200.  
  201. struct cmdinfo;
  202. void showcopyright(const struct cmdinfo*, const char*);
  203.  
  204. #endif /* DPKG_H */
  205.