libextractor

GNU libextractor
Log | Files | Refs | Submodules | README | LICENSE

rpmlib.html (89607B)


      1 <HTML
      2 ><HEAD
      3 ><TITLE
      4 >rpmlib Functions</TITLE
      5 ><META
      6 NAME="GENERATOR"
      7 CONTENT="Modular DocBook HTML Stylesheet Version 1.59"><LINK
      8 REL="HOME"
      9 TITLE="Maximum RPM"
     10 HREF="index.html"><LINK
     11 REL="UP"
     12 TITLE="A Guide to the RPM Library API"
     13 HREF="ch-rpm-rpmlib.html"><LINK
     14 REL="PREVIOUS"
     15 TITLE="A Guide to the RPM Library API"
     16 HREF="ch-rpm-rpmlib.html"><LINK
     17 REL="NEXT"
     18 TITLE="Example Code"
     19 HREF="s1-rpm-rpmlib-example-code.html"></HEAD
     20 ><BODY
     21 CLASS="SECT1"
     22 BGCOLOR="#FFFFFF"
     23 TEXT="#000000"
     24 LINK="#0000FF"
     25 VLINK="#840084"
     26 ALINK="#0000FF"
     27 ><DIV
     28 CLASS="NAVHEADER"
     29 ><TABLE
     30 WIDTH="100%"
     31 BORDER="0"
     32 CELLPADDING="0"
     33 CELLSPACING="0"
     34 ><TR
     35 ><TH
     36 COLSPAN="3"
     37 ALIGN="center"
     38 >Maximum RPM: Taking the Red Hat Package Manager to the Limit</TH
     39 ></TR
     40 ><TR
     41 ><TD
     42 WIDTH="10%"
     43 ALIGN="left"
     44 VALIGN="bottom"
     45 ><A
     46 HREF="ch-rpm-rpmlib.html"
     47 >Prev</A
     48 ></TD
     49 ><TD
     50 WIDTH="80%"
     51 ALIGN="center"
     52 VALIGN="bottom"
     53 >Chapter 21. A Guide to the RPM Library API</TD
     54 ><TD
     55 WIDTH="10%"
     56 ALIGN="right"
     57 VALIGN="bottom"
     58 ><A
     59 HREF="s1-rpm-rpmlib-example-code.html"
     60 >Next</A
     61 ></TD
     62 ></TR
     63 ></TABLE
     64 ><HR
     65 ALIGN="LEFT"
     66 WIDTH="100%"></DIV
     67 ><DIV
     68 CLASS="SECT1"
     69 ><H1
     70 CLASS="SECT1"
     71 ><A
     72 NAME="S1-RPM-RPMLIB-FUNCTIONS"
     73 >rpmlib Functions</A
     74 ></H1
     75 ><P
     76 >        There are more than sixty different functions in rpmlib.  The tasks they
     77         perform range from low-level database record traversal, to high-level
     78         package manipulation.  We've grouped the functions into different
     79         categories for easy reference.
     80       </P
     81 ><DIV
     82 CLASS="SECT2"
     83 ><H2
     84 CLASS="SECT2"
     85 ><A
     86 NAME="S2-RPM-RPMLIB-ERROR-HANDLING"
     87 >Error Handling</A
     88 ></H2
     89 ><P
     90 >          The functions in this section perform rpmlib's basic error handling.
     91           All error handling centers on the use of specific status codes.  The
     92           status codes are defined in <TT
     93 CLASS="FILENAME"
     94 >rpmlib.h</TT
     95 > and are of
     96           the form <SPAN
     97 CLASS="SYMBOL"
     98 >RPMERR_<TT
     99 CLASS="REPLACEABLE"
    100 ><I
    101 >xxx</I
    102 ></TT
    103 ></SPAN
    104 >, where
    105           <SPAN
    106 CLASS="SYMBOL"
    107 ><TT
    108 CLASS="REPLACEABLE"
    109 ><I
    110 >xxx</I
    111 ></TT
    112 ></SPAN
    113 > is the name of the error.
    114         </P
    115 ><DIV
    116 CLASS="SECT3"
    117 ><H3
    118 CLASS="SECT3"
    119 ><A
    120 NAME="S3-RPM-RPMLIB-RPMERRORCODE"
    121 >Return Error Code &#8212; <TT
    122 CLASS="FUNCTION"
    123 >rpmErrorCode()</TT
    124 ></A
    125 ></H3
    126 ><TABLE
    127 BORDER="0"
    128 BGCOLOR="#E0E0E0"
    129 WIDTH="100%"
    130 ><TR
    131 ><TD
    132 ><PRE
    133 CLASS="SCREEN"
    134 ><TT
    135 CLASS="COMPUTEROUTPUT"
    136 >#include &#60;rpm/rpmlib.h&#62;
    137 
    138 int rpmErrorCode(void);</TT
    139 >
    140           </PRE
    141 ></TD
    142 ></TR
    143 ></TABLE
    144 ><P
    145 >            This function returns the error code set by the last rpmlib function
    146             that failed.  Should only be used in an error callback function
    147             defined by <TT
    148 CLASS="FUNCTION"
    149 >rpmErrorSetCallBack()</TT
    150 >.
    151           </P
    152 ></DIV
    153 ><DIV
    154 CLASS="SECT3"
    155 ><H3
    156 CLASS="SECT3"
    157 ><A
    158 NAME="S3-RPM-RPMLIB-RPMERRORSTRING"
    159 >Return Error String &#8212; <TT
    160 CLASS="FUNCTION"
    161 >rpmErrorString()</TT
    162 ></A
    163 ></H3
    164 ><TABLE
    165 BORDER="0"
    166 BGCOLOR="#E0E0E0"
    167 WIDTH="100%"
    168 ><TR
    169 ><TD
    170 ><PRE
    171 CLASS="SCREEN"
    172 ><TT
    173 CLASS="COMPUTEROUTPUT"
    174 >#include &#60;rpm/rpmlib.h&#62;
    175 
    176 char *rpmErrorString(void);</TT
    177 >
    178           </PRE
    179 ></TD
    180 ></TR
    181 ></TABLE
    182 ><P
    183 >            This function returns the error string set by the last rpmlib
    184             function that failed.  Should only be used in an error callback
    185             function defined by <TT
    186 CLASS="FUNCTION"
    187 >rpmErrorSetCallBack()</TT
    188 >.
    189           </P
    190 ></DIV
    191 ><DIV
    192 CLASS="SECT3"
    193 ><H3
    194 CLASS="SECT3"
    195 ><A
    196 NAME="S3-RPM-RPMLIB-RPMERRORSETCALLBACK"
    197 >Set Error CallBack Function &#8212;
    198             <TT
    199 CLASS="FUNCTION"
    200 >rpmErrorSetCallback()</TT
    201 ></A
    202 ></H3
    203 ><TABLE
    204 BORDER="0"
    205 BGCOLOR="#E0E0E0"
    206 WIDTH="100%"
    207 ><TR
    208 ><TD
    209 ><PRE
    210 CLASS="SCREEN"
    211 ><TT
    212 CLASS="COMPUTEROUTPUT"
    213 >#include &#60;rpm/rpmlib.h&#62;
    214 
    215 rpmErrorCallBackType rpmErrorSetCallback(rpmErrorCallBackType);</TT
    216 >
    217           </PRE
    218 ></TD
    219 ></TR
    220 ></TABLE
    221 ><P
    222 >            This function sets the current error callback function to the error
    223             callback function passed to it.  The previous error callback
    224             function is returned.
    225           </P
    226 ></DIV
    227 ></DIV
    228 ><DIV
    229 CLASS="SECT2"
    230 ><H2
    231 CLASS="SECT2"
    232 ><A
    233 NAME="S2-RPM-RPMLIB-GETTING-PACKAGE-INFORMATION"
    234 >Getting Package Information</A
    235 ></H2
    236 ><P
    237 >          The following functions are used to obtain information about a package
    238           file.
    239         </P
    240 ><P
    241 >          It should be noted that most information is returned in the form of a
    242           <SPAN
    243 CLASS="STRUCTNAME"
    244 >Header</SPAN
    245 > structure.  This data structure is
    246           widely used throughout rpmlib.  We will discuss more header-related
    247           functions in <A
    248 HREF="s1-rpm-rpmlib-functions.html#S2-RPM-RPMLIB-HEADER-MANIPULATION"
    249 >the section called <I
    250 >Header Manipulation</I
    251 ></A
    252 > and
    253           <A
    254 HREF="s1-rpm-rpmlib-functions.html#S2-RPM-RPMLIB-HEADER-ENTRY-MANIPULATION"
    255 >the section called <I
    256 >Header Entry Manipulation</I
    257 ></A
    258 >.
    259         </P
    260 ><DIV
    261 CLASS="SECT3"
    262 ><H3
    263 CLASS="SECT3"
    264 ><A
    265 NAME="S3-RPM-RPMLIB-RPMREADPACKAGEINFO"
    266 >Read Package Information &#8212;
    267             <TT
    268 CLASS="FUNCTION"
    269 >rpmReadPackageInfo()</TT
    270 ></A
    271 ></H3
    272 ><TABLE
    273 BORDER="0"
    274 BGCOLOR="#E0E0E0"
    275 WIDTH="100%"
    276 ><TR
    277 ><TD
    278 ><PRE
    279 CLASS="SCREEN"
    280 ><TT
    281 CLASS="COMPUTEROUTPUT"
    282 >#include &#60;rpm/rpmlib.h&#62;
    283 #include &#60;rpm/header.h&#62;
    284 
    285 int rpmReadPackageInfo(int fd,
    286                        Header * signatures,
    287                        Header * hdr);</TT
    288 >
    289           </PRE
    290 ></TD
    291 ></TR
    292 ></TABLE
    293 ><P
    294 >            Given an open package on <TT
    295 CLASS="PARAMETER"
    296 ><I
    297 >fd</I
    298 ></TT
    299 >, read in the
    300             header and signature.  This function operates as expected with both
    301             socket and pipe file descriptors passed as
    302             <TT
    303 CLASS="PARAMETER"
    304 ><I
    305 >fd</I
    306 ></TT
    307 >.  Safe on nonseekable
    308             <TT
    309 CLASS="PARAMETER"
    310 ><I
    311 >fd</I
    312 ></TT
    313 >s.  When the function returns,
    314             <TT
    315 CLASS="PARAMETER"
    316 ><I
    317 >fd</I
    318 ></TT
    319 > is left positioned at the start of the
    320             package's archive section.
    321           </P
    322 ><P
    323 >            If either <TT
    324 CLASS="PARAMETER"
    325 ><I
    326 >signatures</I
    327 ></TT
    328 > or
    329             <TT
    330 CLASS="PARAMETER"
    331 ><I
    332 >hdr</I
    333 ></TT
    334 > are <SPAN
    335 CLASS="SYMBOL"
    336 >NULL</SPAN
    337 >, information
    338             for the <SPAN
    339 CLASS="SYMBOL"
    340 >NULL</SPAN
    341 > parameter will not be passed back to
    342             the caller.  Otherwise, they will return the package's signatures
    343             and header, respectively.
    344           </P
    345 ><P
    346 >            This function returns the following status values:
    347 
    348             <P
    349 ></P
    350 ><UL
    351 ><LI
    352 STYLE="list-style-type: disc"
    353 ><P
    354 >                  <SPAN
    355 CLASS="RETURNVALUE"
    356 >0</SPAN
    357 > &#8212; Success.
    358                 </P
    359 ></LI
    360 ><LI
    361 STYLE="list-style-type: disc"
    362 ><P
    363 >                  <SPAN
    364 CLASS="RETURNVALUE"
    365 >1</SPAN
    366 > &#8212; Bad magic numbers found
    367                   in package.
    368                 </P
    369 ></LI
    370 ><LI
    371 STYLE="list-style-type: disc"
    372 ><P
    373 >                  <SPAN
    374 CLASS="RETURNVALUE"
    375 >2</SPAN
    376 > &#8212; Other error.
    377                 </P
    378 ></LI
    379 ></UL
    380 >
    381           </P
    382 ></DIV
    383 ><DIV
    384 CLASS="SECT3"
    385 ><H3
    386 CLASS="SECT3"
    387 ><A
    388 NAME="S3-RPM-RPMLIB-RPMREADPACKAGEHEADER"
    389 >Read Package Header &#8212;
    390             <TT
    391 CLASS="FUNCTION"
    392 >rpmReadPackageHeader()</TT
    393 ></A
    394 ></H3
    395 ><TABLE
    396 BORDER="0"
    397 BGCOLOR="#E0E0E0"
    398 WIDTH="100%"
    399 ><TR
    400 ><TD
    401 ><PRE
    402 CLASS="SCREEN"
    403 ><TT
    404 CLASS="COMPUTEROUTPUT"
    405 >#include &#60;rpm/rpmlib.h&#62;
    406 #include &#60;rpm/header.h&#62;
    407 
    408 int rpmReadPackageHeader(int fd,
    409                          Header * hdr,
    410                          int * isSource,
    411                          int * major,
    412                          int * minor);</TT
    413 >
    414           </PRE
    415 ></TD
    416 ></TR
    417 ></TABLE
    418 ><P
    419 >            Given an open package on <TT
    420 CLASS="PARAMETER"
    421 ><I
    422 >fd</I
    423 ></TT
    424 >, read in the
    425             header.  This function operates as expected with both socket and
    426             pipe file descriptors passed as <TT
    427 CLASS="PARAMETER"
    428 ><I
    429 >fd</I
    430 ></TT
    431 >.  Safe on
    432             nonseekable <TT
    433 CLASS="PARAMETER"
    434 ><I
    435 >fd</I
    436 ></TT
    437 >s.  When the function returns,
    438             <TT
    439 CLASS="PARAMETER"
    440 ><I
    441 >fd</I
    442 ></TT
    443 > is left positioned at the start of the
    444             package's archive section.
    445           </P
    446 ><P
    447 >            If <TT
    448 CLASS="PARAMETER"
    449 ><I
    450 >hdr</I
    451 ></TT
    452 >, <TT
    453 CLASS="PARAMETER"
    454 ><I
    455 >isSource</I
    456 ></TT
    457 >,
    458             <TT
    459 CLASS="PARAMETER"
    460 ><I
    461 >major</I
    462 ></TT
    463 >, or <TT
    464 CLASS="PARAMETER"
    465 ><I
    466 >minor</I
    467 ></TT
    468 > are
    469             <SPAN
    470 CLASS="SYMBOL"
    471 >NULL</SPAN
    472 >, information for the <SPAN
    473 CLASS="SYMBOL"
    474 >NULL</SPAN
    475 >
    476             parameter(s) will not be passed back to the caller.  Otherwise, they
    477             will return the package's header (<TT
    478 CLASS="PARAMETER"
    479 ><I
    480 >hdr</I
    481 ></TT
    482 >),
    483             information on whether the package is a source package file or not
    484             (<TT
    485 CLASS="PARAMETER"
    486 ><I
    487 >isSource</I
    488 ></TT
    489 >), and the package format's major
    490             and minor revision number (<TT
    491 CLASS="PARAMETER"
    492 ><I
    493 >major</I
    494 ></TT
    495 > and
    496             <TT
    497 CLASS="PARAMETER"
    498 ><I
    499 >minor</I
    500 ></TT
    501 >, respectively).
    502           </P
    503 ><P
    504 >            This function returns the following status values:
    505 
    506             <P
    507 ></P
    508 ><UL
    509 ><LI
    510 STYLE="list-style-type: disc"
    511 ><P
    512 >                  <SPAN
    513 CLASS="RETURNVALUE"
    514 >0</SPAN
    515 > &#8212; Success.
    516                 </P
    517 ></LI
    518 ><LI
    519 STYLE="list-style-type: disc"
    520 ><P
    521 >                  <SPAN
    522 CLASS="RETURNVALUE"
    523 >1</SPAN
    524 > &#8212; Bad magic numbers found
    525                   in package.
    526                 </P
    527 ></LI
    528 ><LI
    529 STYLE="list-style-type: disc"
    530 ><P
    531 >                  <SPAN
    532 CLASS="RETURNVALUE"
    533 >2</SPAN
    534 > &#8212; Other error.
    535                 </P
    536 ></LI
    537 ></UL
    538 >
    539           </P
    540 ></DIV
    541 ></DIV
    542 ><DIV
    543 CLASS="SECT2"
    544 ><H2
    545 CLASS="SECT2"
    546 ><A
    547 NAME="S2-RPM-RPMLIB-VARIABLE-MANIPULATION"
    548 >Variable Manipulation</A
    549 ></H2
    550 ><P
    551 >          The following functions are used to get, set, and interpret RPM's
    552           internal variables.  Variables are set according to various pieces of
    553           system information, as well as from <TT
    554 CLASS="FILENAME"
    555 >rpmrc</TT
    556 > files.
    557           They control various aspects of RPM's operation.
    558         </P
    559 ><P
    560 >          The variables have symbolic names in the form
    561           <SPAN
    562 CLASS="SYMBOL"
    563 >RPMVAR_<TT
    564 CLASS="REPLACEABLE"
    565 ><I
    566 >xxx</I
    567 ></TT
    568 ></SPAN
    569 >, where
    570           <SPAN
    571 CLASS="SYMBOL"
    572 ><TT
    573 CLASS="REPLACEABLE"
    574 ><I
    575 >xxx</I
    576 ></TT
    577 ></SPAN
    578 > is the name of the
    579           variable.  All variable names are defined in
    580           <TT
    581 CLASS="FILENAME"
    582 >rpmlib.h</TT
    583 >.
    584         </P
    585 ><DIV
    586 CLASS="SECT3"
    587 ><H3
    588 CLASS="SECT3"
    589 ><A
    590 NAME="S3-RPM-RPMLIB-RPMGETVAR"
    591 >Return Value of RPM Variable &#8212;
    592             <TT
    593 CLASS="FUNCTION"
    594 >rpmGetVar()</TT
    595 ></A
    596 ></H3
    597 ><TABLE
    598 BORDER="0"
    599 BGCOLOR="#E0E0E0"
    600 WIDTH="100%"
    601 ><TR
    602 ><TD
    603 ><PRE
    604 CLASS="SCREEN"
    605 ><TT
    606 CLASS="COMPUTEROUTPUT"
    607 >#include &#60;rpm/rpmlib.h&#62;
    608 
    609 char *rpmGetVar(int var);</TT
    610 >
    611           </PRE
    612 ></TD
    613 ></TR
    614 ></TABLE
    615 ><P
    616 >            This function returns the value of the variable specified in
    617             <TT
    618 CLASS="PARAMETER"
    619 ><I
    620 >var</I
    621 ></TT
    622 >.
    623           </P
    624 ><P
    625 >           
    626             On error, the function returns <SPAN
    627 CLASS="SYMBOL"
    628 >NULL</SPAN
    629 >.
    630           </P
    631 ></DIV
    632 ><DIV
    633 CLASS="SECT3"
    634 ><H3
    635 CLASS="SECT3"
    636 ><A
    637 NAME="S3-RPM-RPMLIB-RPMGETBOOLEANVAR"
    638 >Return Boolean Value Of RPM Variable &#8212;
    639             <TT
    640 CLASS="FUNCTION"
    641 >rpmGetBooleanVar()</TT
    642 ></A
    643 ></H3
    644 ><TABLE
    645 BORDER="0"
    646 BGCOLOR="#E0E0E0"
    647 WIDTH="100%"
    648 ><TR
    649 ><TD
    650 ><PRE
    651 CLASS="SCREEN"
    652 ><TT
    653 CLASS="COMPUTEROUTPUT"
    654 >#include &#60;rpm/rpmlib.h&#62;
    655 
    656 int rpmGetBooleanVar(int var);</TT
    657 >
    658           </PRE
    659 ></TD
    660 ></TR
    661 ></TABLE
    662 ><P
    663 >            This function looks up the variable specified in
    664             <TT
    665 CLASS="PARAMETER"
    666 ><I
    667 >var</I
    668 ></TT
    669 > and returns a
    670             <SPAN
    671 CLASS="RETURNVALUE"
    672 >0</SPAN
    673 > or <SPAN
    674 CLASS="RETURNVALUE"
    675 >1</SPAN
    676 >
    677             depending on the variable's value.
    678           </P
    679 ><P
    680 >            On error, the function returns <SPAN
    681 CLASS="RETURNVALUE"
    682 >0</SPAN
    683 >.
    684           </P
    685 ></DIV
    686 ><DIV
    687 CLASS="SECT3"
    688 ><H3
    689 CLASS="SECT3"
    690 ><A
    691 NAME="S3-RPM-RPMLIB-RPMSETVAR"
    692 >Set Value Of RPM Variable &#8212; <TT
    693 CLASS="FUNCTION"
    694 >rpmSetVar()</TT
    695 ></A
    696 ></H3
    697 ><TABLE
    698 BORDER="0"
    699 BGCOLOR="#E0E0E0"
    700 WIDTH="100%"
    701 ><TR
    702 ><TD
    703 ><PRE
    704 CLASS="SCREEN"
    705 ><TT
    706 CLASS="COMPUTEROUTPUT"
    707 >#include &#60;rpm/rpmlib.h&#62;
    708 
    709 void rpmSetVar(int var,
    710                char *val);</TT
    711 >
    712           </PRE
    713 ></TD
    714 ></TR
    715 ></TABLE
    716 ><P
    717 >            This function sets the variable specified in
    718             <TT
    719 CLASS="PARAMETER"
    720 ><I
    721 >var</I
    722 ></TT
    723 > to the value passed in
    724             <TT
    725 CLASS="PARAMETER"
    726 ><I
    727 >val</I
    728 ></TT
    729 >.  It is also possible for
    730             <TT
    731 CLASS="PARAMETER"
    732 ><I
    733 >val</I
    734 ></TT
    735 > to be <SPAN
    736 CLASS="SYMBOL"
    737 >NULL</SPAN
    738 >.
    739           </P
    740 ></DIV
    741 ></DIV
    742 ><DIV
    743 CLASS="SECT2"
    744 ><H2
    745 CLASS="SECT2"
    746 ><A
    747 NAME="S2-RPM-RPMLIB-RPMRC-RELATED-INFO"
    748 ><TT
    749 CLASS="FILENAME"
    750 >rpmrc</TT
    751 >-Related Information</A
    752 ></H2
    753 ><P
    754 >          The functions in this section are all related to
    755           <TT
    756 CLASS="FILENAME"
    757 >rpmrc</TT
    758 > information &#8212; the
    759           <TT
    760 CLASS="FILENAME"
    761 >rpmrc</TT
    762 > files as well as the variables set from
    763           those files.  This information also includes the architecture and
    764           operating system information based on <TT
    765 CLASS="FILENAME"
    766 >rpmrc</TT
    767 > file
    768           entries.
    769         </P
    770 ><DIV
    771 CLASS="SECT3"
    772 ><H3
    773 CLASS="SECT3"
    774 ><A
    775 NAME="S3-RPM-RPMLIB-RPMREADCONFIGFILES"
    776 >Read <TT
    777 CLASS="FILENAME"
    778 >rpmrc</TT
    779 > Files &#8212;
    780             <TT
    781 CLASS="FUNCTION"
    782 >rpmReadConfigFiles()</TT
    783 ></A
    784 ></H3
    785 ><TABLE
    786 BORDER="0"
    787 BGCOLOR="#E0E0E0"
    788 WIDTH="100%"
    789 ><TR
    790 ><TD
    791 ><PRE
    792 CLASS="SCREEN"
    793 ><TT
    794 CLASS="COMPUTEROUTPUT"
    795 >#include &#60;rpm/rpmlib.h&#62;
    796 
    797 int rpmReadConfigFiles(char * file,
    798                        char * arch,
    799                        char * os,
    800                        int building);</TT
    801 >
    802           </PRE
    803 ></TD
    804 ></TR
    805 ></TABLE
    806 ><P
    807 >            This function reads <TT
    808 CLASS="FILENAME"
    809 >rpmrc</TT
    810 > files according to
    811             the following rules:
    812 
    813             <P
    814 ></P
    815 ><UL
    816 ><LI
    817 STYLE="list-style-type: disc"
    818 ><P
    819 >                  Always read <TT
    820 CLASS="FILENAME"
    821 >/usr/lib/rpmrc</TT
    822 >.
    823                 </P
    824 ></LI
    825 ><LI
    826 STYLE="list-style-type: disc"
    827 ><P
    828 >                  If <TT
    829 CLASS="PARAMETER"
    830 ><I
    831 >file</I
    832 ></TT
    833 > is specified, read it.
    834                 </P
    835 ></LI
    836 ><LI
    837 STYLE="list-style-type: disc"
    838 ><P
    839 >                  If <TT
    840 CLASS="PARAMETER"
    841 ><I
    842 >file</I
    843 ></TT
    844 > is not specified, read
    845                   <TT
    846 CLASS="FILENAME"
    847 >/etc/rpmrc</TT
    848 > and
    849                   <TT
    850 CLASS="FILENAME"
    851 >~/.rpmrc</TT
    852 >.
    853                 </P
    854 ></LI
    855 ></UL
    856 >
    857           </P
    858 ><P
    859 >            Every <TT
    860 CLASS="FILENAME"
    861 >rpmrc</TT
    862 > file entry is used with
    863             <TT
    864 CLASS="FUNCTION"
    865 >rpmSetVar()</TT
    866 > to set the appropriate RPM
    867             variable.  Part of the normal <TT
    868 CLASS="FILENAME"
    869 >rpmrc</TT
    870 > file
    871             processing also includes setting the architecture and operating
    872             system variables for the system executing this function.  These
    873             default settings can be overridden by entering architecture and/or
    874             operating system information in <TT
    875 CLASS="PARAMETER"
    876 ><I
    877 >arch</I
    878 ></TT
    879 > and
    880             <TT
    881 CLASS="PARAMETER"
    882 ><I
    883 >os</I
    884 ></TT
    885 >, respectively.  This information will
    886             still go through the normal <TT
    887 CLASS="FILENAME"
    888 >rpmrc</TT
    889 > translation
    890             process.
    891           </P
    892 ><P
    893 >            The <TT
    894 CLASS="PARAMETER"
    895 ><I
    896 >building</I
    897 ></TT
    898 > argument should be set to 1 only
    899             if a package is being built when this function is called.  Since
    900             most rpmlib-based applications will probably not duplicate RPM's
    901             package building capabilities, <TT
    902 CLASS="PARAMETER"
    903 ><I
    904 >building</I
    905 ></TT
    906 >
    907             should normally be set to 0.
    908           </P
    909 ></DIV
    910 ><DIV
    911 CLASS="SECT3"
    912 ><H3
    913 CLASS="SECT3"
    914 ><A
    915 NAME="S3-RPM-RPMLIB-RPMGETOSNAME"
    916 >Return Operating System Name &#8212;
    917             <TT
    918 CLASS="FUNCTION"
    919 >rpmGetOsName()</TT
    920 ></A
    921 ></H3
    922 ><TABLE
    923 BORDER="0"
    924 BGCOLOR="#E0E0E0"
    925 WIDTH="100%"
    926 ><TR
    927 ><TD
    928 ><PRE
    929 CLASS="SCREEN"
    930 ><TT
    931 CLASS="COMPUTEROUTPUT"
    932 >#include &#60;rpm/rpmlib.h&#62;
    933 
    934 char *rpmGetOsName(void);</TT
    935 >
    936           </PRE
    937 ></TD
    938 ></TR
    939 ></TABLE
    940 ><P
    941 >            This function returns the name of the operating system, as
    942             determined by rpmlib's normal <TT
    943 CLASS="FILENAME"
    944 >rpmrc</TT
    945 > file
    946             processing.
    947           </P
    948 ></DIV
    949 ><DIV
    950 CLASS="SECT3"
    951 ><H3
    952 CLASS="SECT3"
    953 ><A
    954 NAME="S3-RPM-RPMLIB-RPMGETARCHNAME"
    955 >Return Architecture Name &#8212;
    956             <TT
    957 CLASS="FUNCTION"
    958 >rpmGetArchName()</TT
    959 ></A
    960 ></H3
    961 ><TABLE
    962 BORDER="0"
    963 BGCOLOR="#E0E0E0"
    964 WIDTH="100%"
    965 ><TR
    966 ><TD
    967 ><PRE
    968 CLASS="SCREEN"
    969 ><TT
    970 CLASS="COMPUTEROUTPUT"
    971 >#include &#60;rpm/rpmlib.h&#62;
    972 
    973 char *rpmGetArchName(void);</TT
    974 >
    975           </PRE
    976 ></TD
    977 ></TR
    978 ></TABLE
    979 ><P
    980 >            This function returns the name of the architecture, as determined by
    981             rpmlib's normal <TT
    982 CLASS="FILENAME"
    983 >rpmrc</TT
    984 > file processing.
    985           </P
    986 ></DIV
    987 ><DIV
    988 CLASS="SECT3"
    989 ><H3
    990 CLASS="SECT3"
    991 ><A
    992 NAME="S3-RPM-RPMLIB-RPMSHOWRC"
    993 >Print all <TT
    994 CLASS="FILENAME"
    995 >rpmrc</TT
    996 >-Derived Variables &#8212;
    997             <TT
    998 CLASS="FUNCTION"
    999 >rpmShowRC()</TT
   1000 ></A
   1001 ></H3
   1002 ><TABLE
   1003 BORDER="0"
   1004 BGCOLOR="#E0E0E0"
   1005 WIDTH="100%"
   1006 ><TR
   1007 ><TD
   1008 ><PRE
   1009 CLASS="SCREEN"
   1010 ><TT
   1011 CLASS="COMPUTEROUTPUT"
   1012 >#include &#60;rpm/rpmlib.h&#62;
   1013 
   1014 int rpmShowRC(FILE *f);</TT
   1015 >
   1016           </PRE
   1017 ></TD
   1018 ></TR
   1019 ></TABLE
   1020 ><P
   1021 >            This function writes all variable names and their values to the file
   1022             <TT
   1023 CLASS="PARAMETER"
   1024 ><I
   1025 >f</I
   1026 ></TT
   1027 >.  Always returns
   1028             <SPAN
   1029 CLASS="RETURNVALUE"
   1030 >0</SPAN
   1031 >.
   1032           </P
   1033 ></DIV
   1034 ><DIV
   1035 CLASS="SECT3"
   1036 ><H3
   1037 CLASS="SECT3"
   1038 ><A
   1039 NAME="S3-RPM-RPMLIB-RPMARCHSCORE"
   1040 >Return Architecture Compatibility Score &#8212;
   1041             <TT
   1042 CLASS="FUNCTION"
   1043 >rpmArchScore()</TT
   1044 ></A
   1045 ></H3
   1046 ><TABLE
   1047 BORDER="0"
   1048 BGCOLOR="#E0E0E0"
   1049 WIDTH="100%"
   1050 ><TR
   1051 ><TD
   1052 ><PRE
   1053 CLASS="SCREEN"
   1054 ><TT
   1055 CLASS="COMPUTEROUTPUT"
   1056 >#include &#60;rpm/rpmlib.h&#62;
   1057 
   1058 int rpmArchScore(char * arch);</TT
   1059 >
   1060           </PRE
   1061 ></TD
   1062 ></TR
   1063 ></TABLE
   1064 ><P
   1065 >            This function returns the "distance" between the architecture whose
   1066             name is specified in <TT
   1067 CLASS="PARAMETER"
   1068 ><I
   1069 >arch</I
   1070 ></TT
   1071 >, and the current
   1072             architecture.  Returns <SPAN
   1073 CLASS="RETURNVALUE"
   1074 >0</SPAN
   1075 > if the two
   1076             architectures are incompatible.  The smaller the number returned,
   1077             the more compatible the two architectures are.
   1078           </P
   1079 ></DIV
   1080 ><DIV
   1081 CLASS="SECT3"
   1082 ><H3
   1083 CLASS="SECT3"
   1084 ><A
   1085 NAME="S3-RPM-RPMLIB-RPMOSSCORE"
   1086 >Return Operating System Compatibility Score &#8212;
   1087             <TT
   1088 CLASS="FUNCTION"
   1089 >rpmOsScore()</TT
   1090 ></A
   1091 ></H3
   1092 ><TABLE
   1093 BORDER="0"
   1094 BGCOLOR="#E0E0E0"
   1095 WIDTH="100%"
   1096 ><TR
   1097 ><TD
   1098 ><PRE
   1099 CLASS="SCREEN"
   1100 ><TT
   1101 CLASS="COMPUTEROUTPUT"
   1102 >#include &#60;rpm/rpmlib.h&#62;
   1103 
   1104 int rpmOsScore(char * os);</TT
   1105 >
   1106           </PRE
   1107 ></TD
   1108 ></TR
   1109 ></TABLE
   1110 ><P
   1111 >            This function returns the "distance" between the operating system
   1112             whose name is specified in <TT
   1113 CLASS="PARAMETER"
   1114 ><I
   1115 >os</I
   1116 ></TT
   1117 >, and the
   1118             current operating system.  Returns <SPAN
   1119 CLASS="RETURNVALUE"
   1120 >0</SPAN
   1121 > if
   1122             the two operating systems are incompatible.  The smaller the number
   1123             returned, the more compatible the two operating systems are.
   1124           </P
   1125 ></DIV
   1126 ></DIV
   1127 ><DIV
   1128 CLASS="SECT2"
   1129 ><H2
   1130 CLASS="SECT2"
   1131 ><A
   1132 NAME="S2-RPM-RPMLIB-RPM-DATABASE-MANIPULATION"
   1133 >RPM Database Manipulation</A
   1134 ></H2
   1135 ><P
   1136 >          The functions in this section perform the basic operations on the RPM
   1137           database.  This includes opening and closing the database, as well as
   1138           creating the database.  A function also exists to rebuild a database
   1139           that has been corrupted.
   1140         </P
   1141 ><P
   1142 >          Every function that accesses the RPM database in some fashion makes
   1143           use of the <SPAN
   1144 CLASS="STRUCTNAME"
   1145 >rpmdb</SPAN
   1146 > structure.  This structure
   1147           is used as a handle to refer to a particular RPM database.
   1148         </P
   1149 ><DIV
   1150 CLASS="SECT3"
   1151 ><H3
   1152 CLASS="SECT3"
   1153 ><A
   1154 NAME="S3-RPM-RPMLIB-RPMDBOPEN"
   1155 >Open RPM Database &#8212; <TT
   1156 CLASS="FUNCTION"
   1157 >rpmdbOpen()</TT
   1158 ></A
   1159 ></H3
   1160 ><TABLE
   1161 BORDER="0"
   1162 BGCOLOR="#E0E0E0"
   1163 WIDTH="100%"
   1164 ><TR
   1165 ><TD
   1166 ><PRE
   1167 CLASS="SCREEN"
   1168 ><TT
   1169 CLASS="COMPUTEROUTPUT"
   1170 >#include &#60;rpm/rpmlib.h&#62;
   1171 
   1172 int rpmdbOpen(char * root,
   1173                rpmdb * dbp,
   1174                int mode,
   1175                int perms);</TT
   1176 >
   1177           </PRE
   1178 ></TD
   1179 ></TR
   1180 ></TABLE
   1181 ><P
   1182 >            This function opens the RPM database located in
   1183             <SPAN
   1184 CLASS="SYMBOL"
   1185 >RPMVAR_DBPATH</SPAN
   1186 >, returning the
   1187             <SPAN
   1188 CLASS="STRUCTNAME"
   1189 >rpmdb</SPAN
   1190 > structure <TT
   1191 CLASS="PARAMETER"
   1192 ><I
   1193 >dbp</I
   1194 ></TT
   1195 >.
   1196             If <TT
   1197 CLASS="PARAMETER"
   1198 ><I
   1199 >root</I
   1200 ></TT
   1201 > is specified, it is prepended to
   1202             <SPAN
   1203 CLASS="SYMBOL"
   1204 >RPMVAR_DBPATH</SPAN
   1205 > prior to opening.  The
   1206             <TT
   1207 CLASS="PARAMETER"
   1208 ><I
   1209 >mode</I
   1210 ></TT
   1211 > and <TT
   1212 CLASS="PARAMETER"
   1213 ><I
   1214 >perms</I
   1215 ></TT
   1216 >
   1217             parameters are identical to <TT
   1218 CLASS="FUNCTION"
   1219 >open(2)</TT
   1220 >'s
   1221             <TT
   1222 CLASS="PARAMETER"
   1223 ><I
   1224 >flags</I
   1225 ></TT
   1226 > and <TT
   1227 CLASS="PARAMETER"
   1228 ><I
   1229 >mode</I
   1230 ></TT
   1231 >
   1232             parameters, respectively.
   1233           </P
   1234 ><P
   1235 >            The function returns <SPAN
   1236 CLASS="RETURNVALUE"
   1237 >1</SPAN
   1238 > on error,
   1239             <SPAN
   1240 CLASS="RETURNVALUE"
   1241 >0</SPAN
   1242 > on success.
   1243           </P
   1244 ></DIV
   1245 ><DIV
   1246 CLASS="SECT3"
   1247 ><H3
   1248 CLASS="SECT3"
   1249 ><A
   1250 NAME="S3-RPM-RPMLIB-RPMDBCLOSE"
   1251 >Close RPM Database &#8212; <TT
   1252 CLASS="FUNCTION"
   1253 >rpmdbClose()</TT
   1254 ></A
   1255 ></H3
   1256 ><TABLE
   1257 BORDER="0"
   1258 BGCOLOR="#E0E0E0"
   1259 WIDTH="100%"
   1260 ><TR
   1261 ><TD
   1262 ><PRE
   1263 CLASS="SCREEN"
   1264 ><TT
   1265 CLASS="COMPUTEROUTPUT"
   1266 >#include &#60;rpm/rpmlib.h&#62;
   1267 
   1268 void rpmdbClose(rpmdb db);</TT
   1269 >
   1270           </PRE
   1271 ></TD
   1272 ></TR
   1273 ></TABLE
   1274 ><P
   1275 >            This function closes the RPM database specified by the
   1276             <SPAN
   1277 CLASS="STRUCTNAME"
   1278 >rpmdb</SPAN
   1279 > structure <TT
   1280 CLASS="PARAMETER"
   1281 ><I
   1282 >db</I
   1283 ></TT
   1284 >.
   1285             The <TT
   1286 CLASS="PARAMETER"
   1287 ><I
   1288 >db</I
   1289 ></TT
   1290 > structure is also freed.
   1291           </P
   1292 ></DIV
   1293 ><DIV
   1294 CLASS="SECT3"
   1295 ><H3
   1296 CLASS="SECT3"
   1297 ><A
   1298 NAME="S3-RPM-RPMLIB-RPMDBINIT"
   1299 >Create RPM Database &#8212; <TT
   1300 CLASS="FUNCTION"
   1301 >rpmdbInit()</TT
   1302 ></A
   1303 ></H3
   1304 ><TABLE
   1305 BORDER="0"
   1306 BGCOLOR="#E0E0E0"
   1307 WIDTH="100%"
   1308 ><TR
   1309 ><TD
   1310 ><PRE
   1311 CLASS="SCREEN"
   1312 ><TT
   1313 CLASS="COMPUTEROUTPUT"
   1314 >#include &#60;rpm/rpmlib.h&#62;
   1315 
   1316 int rpmdbInit(char * root,
   1317               int perms);</TT
   1318 >
   1319           </PRE
   1320 ></TD
   1321 ></TR
   1322 ></TABLE
   1323 ><P
   1324 >            This function creates a new RPM database to be located in
   1325             <SPAN
   1326 CLASS="SYMBOL"
   1327 >RPMVAR_DBPATH</SPAN
   1328 >.  If the database already exists, it
   1329             is left unchanged.  If <TT
   1330 CLASS="PARAMETER"
   1331 ><I
   1332 >root</I
   1333 ></TT
   1334 > is specified, it
   1335             is prepended to <SPAN
   1336 CLASS="SYMBOL"
   1337 >RPMVAR_DBPATH</SPAN
   1338 > prior to creation.
   1339             The <TT
   1340 CLASS="PARAMETER"
   1341 ><I
   1342 >perms</I
   1343 ></TT
   1344 > parameter is identical to
   1345             <TT
   1346 CLASS="FUNCTION"
   1347 >open(2)</TT
   1348 >'s <TT
   1349 CLASS="PARAMETER"
   1350 ><I
   1351 >mode</I
   1352 ></TT
   1353 >
   1354             parameter.
   1355           </P
   1356 ><P
   1357 >            The function returns <SPAN
   1358 CLASS="RETURNVALUE"
   1359 >1</SPAN
   1360 > on error,
   1361             <SPAN
   1362 CLASS="RETURNVALUE"
   1363 >0</SPAN
   1364 > on success.
   1365           </P
   1366 ></DIV
   1367 ><DIV
   1368 CLASS="SECT3"
   1369 ><H3
   1370 CLASS="SECT3"
   1371 ><A
   1372 NAME="S3-RPM-RPMLIB-RPMDBREBUILD"
   1373 >Rebuild RPM Database &#8212; <TT
   1374 CLASS="FUNCTION"
   1375 >rpmdbRebuild()</TT
   1376 ></A
   1377 ></H3
   1378 ><TABLE
   1379 BORDER="0"
   1380 BGCOLOR="#E0E0E0"
   1381 WIDTH="100%"
   1382 ><TR
   1383 ><TD
   1384 ><PRE
   1385 CLASS="SCREEN"
   1386 ><TT
   1387 CLASS="COMPUTEROUTPUT"
   1388 >#include &#60;rpm/rpmlib.h&#62;
   1389 
   1390 int rpmdbRebuild(char * root);</TT
   1391 >
   1392           </PRE
   1393 ></TD
   1394 ></TR
   1395 ></TABLE
   1396 ><P
   1397 >            This function rebuilds the RPM database located in
   1398             <SPAN
   1399 CLASS="SYMBOL"
   1400 >RPMVAR_DBPATH</SPAN
   1401 >.  If <TT
   1402 CLASS="PARAMETER"
   1403 ><I
   1404 >root</I
   1405 ></TT
   1406 > is
   1407             specified, it is prepended to <SPAN
   1408 CLASS="SYMBOL"
   1409 >RPMVAR_DBPATH</SPAN
   1410 > prior
   1411             to rebuilding.
   1412           </P
   1413 ><P
   1414 >            The function returns <SPAN
   1415 CLASS="RETURNVALUE"
   1416 >1</SPAN
   1417 > on error,
   1418             <SPAN
   1419 CLASS="RETURNVALUE"
   1420 >0</SPAN
   1421 > on success.
   1422           </P
   1423 ></DIV
   1424 ></DIV
   1425 ><DIV
   1426 CLASS="SECT2"
   1427 ><H2
   1428 CLASS="SECT2"
   1429 ><A
   1430 NAME="S2-RPM-RPMLIB-RPM-DATABASE-TRAVERSAL"
   1431 >RPM Database Traversal</A
   1432 ></H2
   1433 ><P
   1434 >          The following functions are used to traverse the RPM database.  Also
   1435           described in this section is a function to retrieve a database record
   1436           by its record number.
   1437         </P
   1438 ><P
   1439 >          It should be noted that database records are returned in the form of a
   1440           <SPAN
   1441 CLASS="STRUCTNAME"
   1442 >Header</SPAN
   1443 > structure.  This data structure is
   1444           widely used throughout rpmlib.  We will discuss more header-related
   1445           functions in <A
   1446 HREF="s1-rpm-rpmlib-functions.html#S2-RPM-RPMLIB-HEADER-MANIPULATION"
   1447 >the section called <I
   1448 >Header Manipulation</I
   1449 ></A
   1450 > and
   1451           <A
   1452 HREF="s1-rpm-rpmlib-functions.html#S2-RPM-RPMLIB-HEADER-ENTRY-MANIPULATION"
   1453 >the section called <I
   1454 >Header Entry Manipulation</I
   1455 ></A
   1456 >.
   1457         </P
   1458 ><DIV
   1459 CLASS="SECT3"
   1460 ><H3
   1461 CLASS="SECT3"
   1462 ><A
   1463 NAME="S3-RPM-RPMLIB-RPMDBFIRSTRECNUM"
   1464 >Begin RPM Database Traversal &#8212;
   1465             <TT
   1466 CLASS="FUNCTION"
   1467 >rpmdbFirstRecNum()</TT
   1468 ></A
   1469 ></H3
   1470 ><TABLE
   1471 BORDER="0"
   1472 BGCOLOR="#E0E0E0"
   1473 WIDTH="100%"
   1474 ><TR
   1475 ><TD
   1476 ><PRE
   1477 CLASS="SCREEN"
   1478 ><TT
   1479 CLASS="COMPUTEROUTPUT"
   1480 >#include &#60;rpm/rpmlib.h&#62;
   1481 
   1482 unsigned int rpmdbFirstRecNum(rpmdb db);</TT
   1483 >
   1484           </PRE
   1485 ></TD
   1486 ></TR
   1487 ></TABLE
   1488 ><P
   1489 >            This function returns the record number of the first record in the
   1490             database specified by <TT
   1491 CLASS="PARAMETER"
   1492 ><I
   1493 >db</I
   1494 ></TT
   1495 >.
   1496           </P
   1497 ><P
   1498 >            On error, it returns <SPAN
   1499 CLASS="RETURNVALUE"
   1500 >0</SPAN
   1501 >.
   1502           </P
   1503 ></DIV
   1504 ><DIV
   1505 CLASS="SECT3"
   1506 ><H3
   1507 CLASS="SECT3"
   1508 ><A
   1509 NAME="S3-RPM-RPMLIB-RPMDBNEXTRECNUM"
   1510 >Traverse To Next RPM Database Record &#8212;
   1511             <TT
   1512 CLASS="FUNCTION"
   1513 >rpmdbNextRecNum()</TT
   1514 ></A
   1515 ></H3
   1516 ><TABLE
   1517 BORDER="0"
   1518 BGCOLOR="#E0E0E0"
   1519 WIDTH="100%"
   1520 ><TR
   1521 ><TD
   1522 ><PRE
   1523 CLASS="SCREEN"
   1524 ><TT
   1525 CLASS="COMPUTEROUTPUT"
   1526 >#include &#60;rpm/rpmlib.h&#62;
   1527 
   1528 unsigned int rpmdbNextRecNum(rpmdb db,
   1529                              unsigned int lastOffset);  </TT
   1530 >
   1531           </PRE
   1532 ></TD
   1533 ></TR
   1534 ></TABLE
   1535 ><P
   1536 >            This function returns the record number of the record following the
   1537             record number passed in <TT
   1538 CLASS="PARAMETER"
   1539 ><I
   1540 >lastOffset</I
   1541 ></TT
   1542 >, in the
   1543             database specified by <TT
   1544 CLASS="PARAMETER"
   1545 ><I
   1546 >db</I
   1547 ></TT
   1548 >.
   1549           </P
   1550 ><P
   1551 >            On error, this function returns <SPAN
   1552 CLASS="RETURNVALUE"
   1553 >0</SPAN
   1554 >.
   1555           </P
   1556 ></DIV
   1557 ><DIV
   1558 CLASS="SECT3"
   1559 ><H3
   1560 CLASS="SECT3"
   1561 ><A
   1562 NAME="S3-RPM-RPMLIB-RPMDBGETRECORD"
   1563 >Return Record From RPM Database &#8212;
   1564             <TT
   1565 CLASS="FUNCTION"
   1566 >rpmdbGetRecord()</TT
   1567 ></A
   1568 ></H3
   1569 ><TABLE
   1570 BORDER="0"
   1571 BGCOLOR="#E0E0E0"
   1572 WIDTH="100%"
   1573 ><TR
   1574 ><TD
   1575 ><PRE
   1576 CLASS="SCREEN"
   1577 ><TT
   1578 CLASS="COMPUTEROUTPUT"
   1579 >#include &#60;rpm/rpmlib.h&#62;
   1580 
   1581 Header rpmdbGetRecord(rpmdb db,
   1582                       unsigned int offset);</TT
   1583 >
   1584           </PRE
   1585 ></TD
   1586 ></TR
   1587 ></TABLE
   1588 ><P
   1589 >            This function returns the record at the record number specified by
   1590             <TT
   1591 CLASS="PARAMETER"
   1592 ><I
   1593 >offset</I
   1594 ></TT
   1595 > from the database specified by
   1596             <TT
   1597 CLASS="PARAMETER"
   1598 ><I
   1599 >db</I
   1600 ></TT
   1601 >.
   1602           </P
   1603 ><P
   1604 >            This function returns <SPAN
   1605 CLASS="SYMBOL"
   1606 >NULL</SPAN
   1607 > on error.
   1608           </P
   1609 ></DIV
   1610 ></DIV
   1611 ><DIV
   1612 CLASS="SECT2"
   1613 ><H2
   1614 CLASS="SECT2"
   1615 ><A
   1616 NAME="S2-RPM-RPMLIB-RPM-DATABASE-SEARCH"
   1617 >RPM Database Search</A
   1618 ></H2
   1619 ><P
   1620 >          The functions in this section search the various parts of the RPM
   1621           database.  They all return a structure of type
   1622           <SPAN
   1623 CLASS="STRUCTNAME"
   1624 >dbiIndexSet</SPAN
   1625 >, which contains the records that
   1626           match the search term.  Here is the definition of the structure, as
   1627           found in <TT
   1628 CLASS="FILENAME"
   1629 >&#60;rpm/dbindex.h&#62;</TT
   1630 >:
   1631 
   1632           <TABLE
   1633 BORDER="0"
   1634 BGCOLOR="#E0E0E0"
   1635 WIDTH="100%"
   1636 ><TR
   1637 ><TD
   1638 ><PRE
   1639 CLASS="SCREEN"
   1640 ><TT
   1641 CLASS="COMPUTEROUTPUT"
   1642 >typedef struct {
   1643     dbiIndexRecord * recs;
   1644     int count;
   1645 } dbiIndexSet;</TT
   1646 >
   1647           </PRE
   1648 ></TD
   1649 ></TR
   1650 ></TABLE
   1651 >
   1652         </P
   1653 ><P
   1654 >          Each <SPAN
   1655 CLASS="STRUCTNAME"
   1656 >dbiIndexRecord</SPAN
   1657 > is also defined in
   1658           <TT
   1659 CLASS="FILENAME"
   1660 >&#60;rpm/dbindex.h&#62;</TT
   1661 > as follows:
   1662 
   1663           <TABLE
   1664 BORDER="0"
   1665 BGCOLOR="#E0E0E0"
   1666 WIDTH="100%"
   1667 ><TR
   1668 ><TD
   1669 ><PRE
   1670 CLASS="SCREEN"
   1671 ><TT
   1672 CLASS="COMPUTEROUTPUT"
   1673 >typedef struct {
   1674     unsigned int recOffset;
   1675     unsigned int fileNumber;
   1676 } dbiIndexRecord;</TT
   1677 >
   1678           </PRE
   1679 ></TD
   1680 ></TR
   1681 ></TABLE
   1682 >
   1683         </P
   1684 ><P
   1685 >          The <TT
   1686 CLASS="STRUCTFIELD"
   1687 ><I
   1688 >recOffset</I
   1689 ></TT
   1690 > element is the offset of the
   1691           record from the start of the database file.  The
   1692           <TT
   1693 CLASS="STRUCTFIELD"
   1694 ><I
   1695 >fileNumber</I
   1696 ></TT
   1697 > element is only used by
   1698           <TT
   1699 CLASS="FUNCTION"
   1700 >rpmdbFindByFile()</TT
   1701 >.
   1702         </P
   1703 ><P
   1704 >          Keep in mind that the
   1705           <TT
   1706 CLASS="FUNCTION"
   1707 >rpmdbFind<TT
   1708 CLASS="REPLACEABLE"
   1709 ><I
   1710 >xxx</I
   1711 ></TT
   1712 ></TT
   1713 > search
   1714           functions each return <SPAN
   1715 CLASS="STRUCTNAME"
   1716 >dbiIndexSet</SPAN
   1717 > structures,
   1718           which must be freed with <TT
   1719 CLASS="FUNCTION"
   1720 >dbiFreeIndexRecord()</TT
   1721 >
   1722           when no longer needed.
   1723         </P
   1724 ><DIV
   1725 CLASS="SECT3"
   1726 ><H3
   1727 CLASS="SECT3"
   1728 ><A
   1729 NAME="S3-RPM-RPMLIB-DBIFREEINDEXRECORD"
   1730 >Free Database Index &#8212;
   1731             <TT
   1732 CLASS="FUNCTION"
   1733 >dbiFreeIndexRecord()</TT
   1734 ></A
   1735 ></H3
   1736 ><TABLE
   1737 BORDER="0"
   1738 BGCOLOR="#E0E0E0"
   1739 WIDTH="100%"
   1740 ><TR
   1741 ><TD
   1742 ><PRE
   1743 CLASS="SCREEN"
   1744 ><TT
   1745 CLASS="COMPUTEROUTPUT"
   1746 >#include &#60;rpm/rpmlib.h&#62;
   1747 #include &#60;rpm/dbindex.h&#62;
   1748 
   1749 void dbiFreeIndexRecord(dbiIndexSet set);</TT
   1750 >
   1751           </PRE
   1752 ></TD
   1753 ></TR
   1754 ></TABLE
   1755 ><P
   1756 >            This function frees the database index set specified by
   1757             <TT
   1758 CLASS="PARAMETER"
   1759 ><I
   1760 >set</I
   1761 ></TT
   1762 >.
   1763           </P
   1764 ></DIV
   1765 ><DIV
   1766 CLASS="SECT3"
   1767 ><H3
   1768 CLASS="SECT3"
   1769 ><A
   1770 NAME="S3-RPM-RPMLIB-RPMDBFINDBYFILE"
   1771 >Search RPM Database By File &#8212;
   1772             <TT
   1773 CLASS="FUNCTION"
   1774 >rpmdbFindByFile()</TT
   1775 ></A
   1776 ></H3
   1777 ><TABLE
   1778 BORDER="0"
   1779 BGCOLOR="#E0E0E0"
   1780 WIDTH="100%"
   1781 ><TR
   1782 ><TD
   1783 ><PRE
   1784 CLASS="SCREEN"
   1785 ><TT
   1786 CLASS="COMPUTEROUTPUT"
   1787 >#include &#60;rpm/rpmlib.h&#62;
   1788 #include &#60;rpm/dbindex.h&#62;
   1789 
   1790 int rpmdbFindByFile(rpmdb db,
   1791                     char * filespec,
   1792                     dbiIndexSet * matches);</TT
   1793 >
   1794           </PRE
   1795 ></TD
   1796 ></TR
   1797 ></TABLE
   1798 ><P
   1799 >            This function searches the RPM database specified by
   1800             <TT
   1801 CLASS="PARAMETER"
   1802 ><I
   1803 >db</I
   1804 ></TT
   1805 > for the package which owns the file
   1806             specified by <TT
   1807 CLASS="PARAMETER"
   1808 ><I
   1809 >filespec</I
   1810 ></TT
   1811 >.  It returns matching
   1812             records in <TT
   1813 CLASS="PARAMETER"
   1814 ><I
   1815 >matches</I
   1816 ></TT
   1817 >.
   1818           </P
   1819 ><P
   1820 >            This function returns the following status values:
   1821 
   1822             <P
   1823 ></P
   1824 ><UL
   1825 ><LI
   1826 STYLE="list-style-type: disc"
   1827 ><P
   1828 >                  <SPAN
   1829 CLASS="RETURNVALUE"
   1830 >-1</SPAN
   1831 > &#8212; An error occurred
   1832                   reading a database record.
   1833                 </P
   1834 ></LI
   1835 ><LI
   1836 STYLE="list-style-type: disc"
   1837 ><P
   1838 >                  <SPAN
   1839 CLASS="RETURNVALUE"
   1840 >0</SPAN
   1841 > &#8212; The search completed
   1842                   normally.
   1843                 </P
   1844 ></LI
   1845 ><LI
   1846 STYLE="list-style-type: disc"
   1847 ><P
   1848 >                  <SPAN
   1849 CLASS="RETURNVALUE"
   1850 >1</SPAN
   1851 > &#8212; The search term was not
   1852                   found.
   1853                 </P
   1854 ></LI
   1855 ></UL
   1856 >
   1857           </P
   1858 ></DIV
   1859 ><DIV
   1860 CLASS="SECT3"
   1861 ><H3
   1862 CLASS="SECT3"
   1863 ><A
   1864 NAME="S3-RPM-RPMLIB-RPMDBYFINDBYGROUP"
   1865 >Search RPM Database By Group &#8212;
   1866             <TT
   1867 CLASS="FUNCTION"
   1868 >rpmdbFindByGroup()</TT
   1869 ></A
   1870 ></H3
   1871 ><TABLE
   1872 BORDER="0"
   1873 BGCOLOR="#E0E0E0"
   1874 WIDTH="100%"
   1875 ><TR
   1876 ><TD
   1877 ><PRE
   1878 CLASS="SCREEN"
   1879 ><TT
   1880 CLASS="COMPUTEROUTPUT"
   1881 >#include &#60;rpm/rpmlib.h&#62;
   1882 #include &#60;rpm/dbindex.h&#62;
   1883 
   1884 int rpmdbFindByGroup(rpmdb db,
   1885                      char * group,
   1886                      dbiIndexSet * matches);</TT
   1887 >
   1888           </PRE
   1889 ></TD
   1890 ></TR
   1891 ></TABLE
   1892 ><P
   1893 >            This function searches the RPM database specified by
   1894             <TT
   1895 CLASS="PARAMETER"
   1896 ><I
   1897 >db</I
   1898 ></TT
   1899 > for the packages which are members of the
   1900             group specified by <TT
   1901 CLASS="PARAMETER"
   1902 ><I
   1903 >group</I
   1904 ></TT
   1905 >.  It returns
   1906             matching records in <TT
   1907 CLASS="PARAMETER"
   1908 ><I
   1909 >matches</I
   1910 ></TT
   1911 >.
   1912           </P
   1913 ><P
   1914 >            This function returns the following status values:
   1915 
   1916             <P
   1917 ></P
   1918 ><UL
   1919 ><LI
   1920 STYLE="list-style-type: disc"
   1921 ><P
   1922 >                  <SPAN
   1923 CLASS="RETURNVALUE"
   1924 >-1</SPAN
   1925 > &#8212; An error occurred
   1926                   reading a database record.
   1927                 </P
   1928 ></LI
   1929 ><LI
   1930 STYLE="list-style-type: disc"
   1931 ><P
   1932 >                  <SPAN
   1933 CLASS="RETURNVALUE"
   1934 >0</SPAN
   1935 > &#8212; The search completed
   1936                   normally.
   1937                 </P
   1938 ></LI
   1939 ><LI
   1940 STYLE="list-style-type: disc"
   1941 ><P
   1942 >                  <SPAN
   1943 CLASS="RETURNVALUE"
   1944 >1</SPAN
   1945 > &#8212; The search term was not
   1946                   found.
   1947                 </P
   1948 ></LI
   1949 ></UL
   1950 >
   1951           </P
   1952 ></DIV
   1953 ><DIV
   1954 CLASS="SECT3"
   1955 ><H3
   1956 CLASS="SECT3"
   1957 ><A
   1958 NAME="S3-RPM-RPMLIB-RPMDBFINDPACKAGE"
   1959 >Search RPM Database By Package &#8212;
   1960             <TT
   1961 CLASS="FUNCTION"
   1962 >rpmdbFindPackage()</TT
   1963 ></A
   1964 ></H3
   1965 ><TABLE
   1966 BORDER="0"
   1967 BGCOLOR="#E0E0E0"
   1968 WIDTH="100%"
   1969 ><TR
   1970 ><TD
   1971 ><PRE
   1972 CLASS="SCREEN"
   1973 ><TT
   1974 CLASS="COMPUTEROUTPUT"
   1975 >#include &#60;rpm/rpmlib.h&#62;
   1976 #include &#60;rpm/dbindex.h&#62;
   1977 
   1978 int rpmdbFindPackage(rpmdb db,
   1979                      char * name,
   1980                      dbiIndexSet * matches);</TT
   1981 >
   1982           </PRE
   1983 ></TD
   1984 ></TR
   1985 ></TABLE
   1986 ><P
   1987 >            This function searches the RPM database specified by
   1988             <TT
   1989 CLASS="PARAMETER"
   1990 ><I
   1991 >db</I
   1992 ></TT
   1993 > for the packages with the package name
   1994             (not label) specified by <TT
   1995 CLASS="PARAMETER"
   1996 ><I
   1997 >name</I
   1998 ></TT
   1999 >.  It returns
   2000             matching records in <TT
   2001 CLASS="PARAMETER"
   2002 ><I
   2003 >matches</I
   2004 ></TT
   2005 >.
   2006           </P
   2007 ><P
   2008 >            This function returns the following status values:
   2009 
   2010             <P
   2011 ></P
   2012 ><UL
   2013 ><LI
   2014 STYLE="list-style-type: disc"
   2015 ><P
   2016 >                  <SPAN
   2017 CLASS="RETURNVALUE"
   2018 >-1</SPAN
   2019 > &#8212; An error occurred
   2020                   reading a database record.
   2021                 </P
   2022 ></LI
   2023 ><LI
   2024 STYLE="list-style-type: disc"
   2025 ><P
   2026 >                  <SPAN
   2027 CLASS="RETURNVALUE"
   2028 >0</SPAN
   2029 > &#8212; The search completed
   2030                   normally.
   2031                 </P
   2032 ></LI
   2033 ><LI
   2034 STYLE="list-style-type: disc"
   2035 ><P
   2036 >                  <SPAN
   2037 CLASS="RETURNVALUE"
   2038 >1</SPAN
   2039 > &#8212; The search term was not
   2040                   found.
   2041                 </P
   2042 ></LI
   2043 ></UL
   2044 >
   2045           </P
   2046 ></DIV
   2047 ><DIV
   2048 CLASS="SECT3"
   2049 ><H3
   2050 CLASS="SECT3"
   2051 ><A
   2052 NAME="S3-RPM-RPMLIB-RPMDBFINDBYPROVIDES"
   2053 >Search RPM Database By Provides &#8212;
   2054             <TT
   2055 CLASS="FUNCTION"
   2056 >rpmdbFindByProvides()</TT
   2057 ></A
   2058 ></H3
   2059 ><TABLE
   2060 BORDER="0"
   2061 BGCOLOR="#E0E0E0"
   2062 WIDTH="100%"
   2063 ><TR
   2064 ><TD
   2065 ><PRE
   2066 CLASS="SCREEN"
   2067 ><TT
   2068 CLASS="COMPUTEROUTPUT"
   2069 >#include &#60;rpm/rpmlib.h&#62;
   2070 #include &#60;rpm/dbindex.h&#62;
   2071 
   2072 int rpmdbFindByProvides(rpmdb db,
   2073                         char * provides,
   2074                         dbiIndexSet * matches);</TT
   2075 >
   2076           </PRE
   2077 ></TD
   2078 ></TR
   2079 ></TABLE
   2080 ><P
   2081 >            This function searches the RPM database specified by
   2082             <TT
   2083 CLASS="PARAMETER"
   2084 ><I
   2085 >db</I
   2086 ></TT
   2087 > for the packages which provide the
   2088             provides information specified by <TT
   2089 CLASS="PARAMETER"
   2090 ><I
   2091 >provides</I
   2092 ></TT
   2093 >.
   2094             It returns matching records in <TT
   2095 CLASS="PARAMETER"
   2096 ><I
   2097 >matches</I
   2098 ></TT
   2099 >.
   2100           </P
   2101 ><P
   2102 >            This function returns the following status values:
   2103 
   2104             <P
   2105 ></P
   2106 ><UL
   2107 ><LI
   2108 STYLE="list-style-type: disc"
   2109 ><P
   2110 >                  <SPAN
   2111 CLASS="RETURNVALUE"
   2112 >-1</SPAN
   2113 > &#8212; An error occurred
   2114                   reading a database record.
   2115                 </P
   2116 ></LI
   2117 ><LI
   2118 STYLE="list-style-type: disc"
   2119 ><P
   2120 >                  <SPAN
   2121 CLASS="RETURNVALUE"
   2122 >0</SPAN
   2123 > &#8212; The search completed
   2124                   normally.
   2125                 </P
   2126 ></LI
   2127 ><LI
   2128 STYLE="list-style-type: disc"
   2129 ><P
   2130 >                  <SPAN
   2131 CLASS="RETURNVALUE"
   2132 >1</SPAN
   2133 > &#8212; The search term was not
   2134                   found.
   2135                 </P
   2136 ></LI
   2137 ></UL
   2138 >
   2139           </P
   2140 ></DIV
   2141 ><DIV
   2142 CLASS="SECT3"
   2143 ><H3
   2144 CLASS="SECT3"
   2145 ><A
   2146 NAME="S3-RPM-RPMLIB-RPMDBFINDBYREQUIREDBY"
   2147 >Search RPM Database By Requires &#8212;
   2148             <TT
   2149 CLASS="FUNCTION"
   2150 >rpmdbFindByRequiredBy()</TT
   2151 ></A
   2152 ></H3
   2153 ><TABLE
   2154 BORDER="0"
   2155 BGCOLOR="#E0E0E0"
   2156 WIDTH="100%"
   2157 ><TR
   2158 ><TD
   2159 ><PRE
   2160 CLASS="SCREEN"
   2161 ><TT
   2162 CLASS="COMPUTEROUTPUT"
   2163 >#include &#60;rpm/rpmlib.h&#62;
   2164 #include &#60;rpm/dbindex.h&#62;
   2165 
   2166 int rpmdbFindByRequiredBy(rpmdb db,
   2167                           char * requires,
   2168                           dbiIndexSet * matches);</TT
   2169 >
   2170           </PRE
   2171 ></TD
   2172 ></TR
   2173 ></TABLE
   2174 ><P
   2175 >            This function searches the RPM database specified by
   2176             <TT
   2177 CLASS="PARAMETER"
   2178 ><I
   2179 >db</I
   2180 ></TT
   2181 > for the packages which require the
   2182             requires information specified by <TT
   2183 CLASS="PARAMETER"
   2184 ><I
   2185 >requires</I
   2186 ></TT
   2187 >.
   2188             It returns matching records in <TT
   2189 CLASS="PARAMETER"
   2190 ><I
   2191 >matches</I
   2192 ></TT
   2193 >.
   2194           </P
   2195 ><P
   2196 >            This function returns the following status values:
   2197 
   2198             <P
   2199 ></P
   2200 ><UL
   2201 ><LI
   2202 STYLE="list-style-type: disc"
   2203 ><P
   2204 >                  <SPAN
   2205 CLASS="RETURNVALUE"
   2206 >-1</SPAN
   2207 > &#8212; An error occurred
   2208                   reading a database record.
   2209                 </P
   2210 ></LI
   2211 ><LI
   2212 STYLE="list-style-type: disc"
   2213 ><P
   2214 >                  <SPAN
   2215 CLASS="RETURNVALUE"
   2216 >0</SPAN
   2217 > &#8212; The search completed
   2218                   normally.
   2219                 </P
   2220 ></LI
   2221 ><LI
   2222 STYLE="list-style-type: disc"
   2223 ><P
   2224 >                  <SPAN
   2225 CLASS="RETURNVALUE"
   2226 >1</SPAN
   2227 > &#8212; The search term was not
   2228                   found.
   2229                 </P
   2230 ></LI
   2231 ></UL
   2232 >
   2233           </P
   2234 ></DIV
   2235 ><DIV
   2236 CLASS="SECT3"
   2237 ><H3
   2238 CLASS="SECT3"
   2239 ><A
   2240 NAME="S3-RPM-RPMLIB-RPMDBFINDBYCONFLICTS"
   2241 >Search RPM Database By Conflicts &#8212;
   2242             <TT
   2243 CLASS="FUNCTION"
   2244 >rpmdbFindByConflicts()</TT
   2245 ></A
   2246 ></H3
   2247 ><TABLE
   2248 BORDER="0"
   2249 BGCOLOR="#E0E0E0"
   2250 WIDTH="100%"
   2251 ><TR
   2252 ><TD
   2253 ><PRE
   2254 CLASS="SCREEN"
   2255 ><TT
   2256 CLASS="COMPUTEROUTPUT"
   2257 >#include &#60;rpm/rpmlib.h&#62;
   2258 #include &#60;rpm/dbindex.h&#62;
   2259 
   2260 int rpmdbFindByConflicts(rpmdb db,
   2261                          char * conflicts,
   2262                          dbiIndexSet * matches);</TT
   2263 >
   2264           </PRE
   2265 ></TD
   2266 ></TR
   2267 ></TABLE
   2268 ><P
   2269 >            This function searches the RPM database specified by
   2270             <TT
   2271 CLASS="PARAMETER"
   2272 ><I
   2273 >db</I
   2274 ></TT
   2275 > for the packages which conflict with the
   2276             conflicts information specified by <TT
   2277 CLASS="PARAMETER"
   2278 ><I
   2279 >conflicts</I
   2280 ></TT
   2281 >.
   2282             It returns matching records in <TT
   2283 CLASS="PARAMETER"
   2284 ><I
   2285 >matches</I
   2286 ></TT
   2287 >.
   2288           </P
   2289 ><P
   2290 >            This function returns the following status values:
   2291 
   2292             <P
   2293 ></P
   2294 ><UL
   2295 ><LI
   2296 STYLE="list-style-type: disc"
   2297 ><P
   2298 >                  <SPAN
   2299 CLASS="RETURNVALUE"
   2300 >-1</SPAN
   2301 > &#8212; An error occurred
   2302                   reading a database record.
   2303                 </P
   2304 ></LI
   2305 ><LI
   2306 STYLE="list-style-type: disc"
   2307 ><P
   2308 >                  <SPAN
   2309 CLASS="RETURNVALUE"
   2310 >0</SPAN
   2311 > &#8212; The search completed
   2312                   normally.
   2313                 </P
   2314 ></LI
   2315 ><LI
   2316 STYLE="list-style-type: disc"
   2317 ><P
   2318 >                  <SPAN
   2319 CLASS="RETURNVALUE"
   2320 >1</SPAN
   2321 > &#8212; The search term was not
   2322                   found.
   2323                 </P
   2324 ></LI
   2325 ></UL
   2326 >
   2327           </P
   2328 ></DIV
   2329 ></DIV
   2330 ><DIV
   2331 CLASS="SECT2"
   2332 ><H2
   2333 CLASS="SECT2"
   2334 ><A
   2335 NAME="S2-RPM-RPMLIB-PACKAGE-MANIPULATION"
   2336 >Package Manipulation</A
   2337 ></H2
   2338 ><P
   2339 >          These functions perform the operations most RPM users are familiar
   2340           with.  Functions that install and erase packages are here, along with
   2341           a few related lower-level support functions.
   2342         </P
   2343 ><DIV
   2344 CLASS="SECT3"
   2345 ><H3
   2346 CLASS="SECT3"
   2347 ><A
   2348 NAME="S3-RPM-RPMLIB-RPMINSTALLSOURCEPACKAGE"
   2349 >Install Source Package File &#8212;
   2350             <TT
   2351 CLASS="FUNCTION"
   2352 >rpmInstallSourcePackage()</TT
   2353 ></A
   2354 ></H3
   2355 ><TABLE
   2356 BORDER="0"
   2357 BGCOLOR="#E0E0E0"
   2358 WIDTH="100%"
   2359 ><TR
   2360 ><TD
   2361 ><PRE
   2362 CLASS="SCREEN"
   2363 ><TT
   2364 CLASS="COMPUTEROUTPUT"
   2365 >#include &#60;rpm/rpmlib.h&#62;
   2366 
   2367 int rpmInstallSourcePackage(char * root,
   2368                             int fd,
   2369                             char ** specFile,
   2370                             rpmNotifyFunction notify,
   2371                             char * labelFormat);</TT
   2372 >
   2373           </PRE
   2374 ></TD
   2375 ></TR
   2376 ></TABLE
   2377 ><P
   2378 >            This function installs the source package file specified by
   2379             <TT
   2380 CLASS="PARAMETER"
   2381 ><I
   2382 >fd</I
   2383 ></TT
   2384 >.  If <TT
   2385 CLASS="PARAMETER"
   2386 ><I
   2387 >root</I
   2388 ></TT
   2389 > is not
   2390             <SPAN
   2391 CLASS="SYMBOL"
   2392 >NULL</SPAN
   2393 >, it is prepended to the variables
   2394             <SPAN
   2395 CLASS="SYMBOL"
   2396 >RPMVAR_SOURCEDIR</SPAN
   2397 > and
   2398             <SPAN
   2399 CLASS="SYMBOL"
   2400 >RPMVAR_SPECDIR</SPAN
   2401 > prior to the actual installation.
   2402             If <TT
   2403 CLASS="PARAMETER"
   2404 ><I
   2405 >specFile</I
   2406 ></TT
   2407 > is not <SPAN
   2408 CLASS="SYMBOL"
   2409 >NULL</SPAN
   2410 >, the
   2411             complete path and filename of the just-installed spec file is
   2412             returned.
   2413           </P
   2414 ><P
   2415 >            The <TT
   2416 CLASS="PARAMETER"
   2417 ><I
   2418 >notify</I
   2419 ></TT
   2420 > parameter is used to specify a
   2421             progress-tracking function that will be called during the
   2422             installation.  Please refer to <A
   2423 HREF="s1-rpm-rpmlib-functions.html#S3-RPM-RPMLIB-RPMNOTIFYFUNCTION"
   2424 >the section called <I
   2425 >Track Package Installation Progress &#8212;
   2426             <TT
   2427 CLASS="FUNCTION"
   2428 >rpmNotifyFunction()</TT
   2429 ></I
   2430 ></A
   2431 > for more information on
   2432             this parameter.
   2433           </P
   2434 ><P
   2435 >            The <TT
   2436 CLASS="PARAMETER"
   2437 ><I
   2438 >labelFormat</I
   2439 ></TT
   2440 > parameter can be used to
   2441             specify how the package label should be formatted.  It is used when
   2442             printing the package label once the package install is ready to
   2443             proceed.  If <TT
   2444 CLASS="PARAMETER"
   2445 ><I
   2446 >labelformat</I
   2447 ></TT
   2448 > is
   2449             <SPAN
   2450 CLASS="SYMBOL"
   2451 >NULL</SPAN
   2452 >, the package label is not printed.
   2453           </P
   2454 ><P
   2455 >            This function returns the following status values:
   2456 
   2457             <P
   2458 ></P
   2459 ><UL
   2460 ><LI
   2461 STYLE="list-style-type: disc"
   2462 ><P
   2463 >                  <SPAN
   2464 CLASS="RETURNVALUE"
   2465 >0</SPAN
   2466 > &#8212; The source package was
   2467                   installed successfully.
   2468                 </P
   2469 ></LI
   2470 ><LI
   2471 STYLE="list-style-type: disc"
   2472 ><P
   2473 >                  <SPAN
   2474 CLASS="RETURNVALUE"
   2475 >1</SPAN
   2476 > &#8212; The source package file
   2477                   contained incorrect magic numbers.
   2478                 </P
   2479 ></LI
   2480 ><LI
   2481 STYLE="list-style-type: disc"
   2482 ><P
   2483 >                  <SPAN
   2484 CLASS="RETURNVALUE"
   2485 >2</SPAN
   2486 > &#8212; Another type of error
   2487                   occurred.
   2488                 </P
   2489 ></LI
   2490 ></UL
   2491 >
   2492           </P
   2493 ></DIV
   2494 ><DIV
   2495 CLASS="SECT3"
   2496 ><H3
   2497 CLASS="SECT3"
   2498 ><A
   2499 NAME="S3-RPM-RPMLIB-RPMINSTALLPACKAGE"
   2500 >Install Binary Package File &#8212;
   2501             <TT
   2502 CLASS="FUNCTION"
   2503 >rpmInstallPackage()</TT
   2504 ></A
   2505 ></H3
   2506 ><TABLE
   2507 BORDER="0"
   2508 BGCOLOR="#E0E0E0"
   2509 WIDTH="100%"
   2510 ><TR
   2511 ><TD
   2512 ><PRE
   2513 CLASS="SCREEN"
   2514 ><TT
   2515 CLASS="COMPUTEROUTPUT"
   2516 >#include &#60;rpm/rpmlib.h&#62;
   2517 
   2518 int rpmInstallPackage(char * rootdir,
   2519                       rpmdb db,
   2520                       int fd,
   2521                       char * prefix, 
   2522                       int flags,
   2523                       rpmNotifyFunction notify,
   2524                       char * labelFormat,
   2525                       char * netsharedPath);</TT
   2526 >
   2527           </PRE
   2528 ></TD
   2529 ></TR
   2530 ></TABLE
   2531 ><P
   2532 >            This function installs the binary package specified by
   2533             <TT
   2534 CLASS="PARAMETER"
   2535 ><I
   2536 >fd</I
   2537 ></TT
   2538 >.  If a path is specified in
   2539             <TT
   2540 CLASS="PARAMETER"
   2541 ><I
   2542 >rootdir</I
   2543 ></TT
   2544 >, the package will be installed with
   2545             that path acting as the root directory.  If a path is specified in
   2546             <TT
   2547 CLASS="PARAMETER"
   2548 ><I
   2549 >prefix</I
   2550 ></TT
   2551 >, it will be used as the prefix for
   2552             relocatable packages.  The RPM database specified by
   2553             <TT
   2554 CLASS="PARAMETER"
   2555 ><I
   2556 >db</I
   2557 ></TT
   2558 > is updated to reflect the newly installed
   2559             package.
   2560           </P
   2561 ><P
   2562 >            The <TT
   2563 CLASS="PARAMETER"
   2564 ><I
   2565 >flags</I
   2566 ></TT
   2567 > parameter is used to control the
   2568             installation behavior.  The flags are defined in
   2569             <TT
   2570 CLASS="FILENAME"
   2571 >rpmlib.h</TT
   2572 > and take the form
   2573             <SPAN
   2574 CLASS="SYMBOL"
   2575 >RPMINSTALL_<TT
   2576 CLASS="REPLACEABLE"
   2577 ><I
   2578 >xxx</I
   2579 ></TT
   2580 ></SPAN
   2581 >, where
   2582             <SPAN
   2583 CLASS="SYMBOL"
   2584 ><TT
   2585 CLASS="REPLACEABLE"
   2586 ><I
   2587 >xxx</I
   2588 ></TT
   2589 ></SPAN
   2590 > is the name of the
   2591             flag.
   2592           </P
   2593 ><P
   2594 >            The following flags are currently defined:
   2595 
   2596             <P
   2597 ></P
   2598 ><UL
   2599 ><LI
   2600 STYLE="list-style-type: disc"
   2601 ><P
   2602 >                  <SPAN
   2603 CLASS="SYMBOL"
   2604 >RPMINSTALL_REPLACEPKG</SPAN
   2605 > &#8212; Install the
   2606                   package even if it is already installed.
   2607                 </P
   2608 ></LI
   2609 ><LI
   2610 STYLE="list-style-type: disc"
   2611 ><P
   2612 >                  <SPAN
   2613 CLASS="SYMBOL"
   2614 >RPMINSTALL_REPLACEFILES</SPAN
   2615 > &#8212; Install the
   2616                   package even if it will replace files owned by another
   2617                   package.
   2618                 </P
   2619 ></LI
   2620 ><LI
   2621 STYLE="list-style-type: disc"
   2622 ><P
   2623 >                  <SPAN
   2624 CLASS="SYMBOL"
   2625 >RPMINSTALL_TEST</SPAN
   2626 > &#8212; Perform all
   2627                   install-time checks, but do not actually install the package.
   2628                 </P
   2629 ></LI
   2630 ><LI
   2631 STYLE="list-style-type: disc"
   2632 ><P
   2633 >                  <SPAN
   2634 CLASS="SYMBOL"
   2635 >RPMINSTALL_UPGRADE</SPAN
   2636 > &#8212; Install the
   2637                   package, and remove all older versions of the package.
   2638                 </P
   2639 ></LI
   2640 ><LI
   2641 STYLE="list-style-type: disc"
   2642 ><P
   2643 >                  <SPAN
   2644 CLASS="SYMBOL"
   2645 >RPMINSTALL_UPGRADETOOLD</SPAN
   2646 > &#8212; Install the
   2647                   package, even if the package is an older version of an
   2648                   already-installed package.
   2649                 </P
   2650 ></LI
   2651 ><LI
   2652 STYLE="list-style-type: disc"
   2653 ><P
   2654 >                  <SPAN
   2655 CLASS="SYMBOL"
   2656 >RPMINSTALL_NODOCS</SPAN
   2657 > &#8212; Do not install the
   2658                   package's documentation files.
   2659                 </P
   2660 ></LI
   2661 ><LI
   2662 STYLE="list-style-type: disc"
   2663 ><P
   2664 >                  <SPAN
   2665 CLASS="SYMBOL"
   2666 >RPMINSTALL_NOSCRIPTS</SPAN
   2667 > &#8212; Do not execute
   2668                   the package's install- and erase-time (in the case of an
   2669                   upgrade) scripts.
   2670                 </P
   2671 ></LI
   2672 ><LI
   2673 STYLE="list-style-type: disc"
   2674 ><P
   2675 >                  <SPAN
   2676 CLASS="SYMBOL"
   2677 >RPMINSTALL_NOARCH</SPAN
   2678 > &#8212; Do not perform
   2679                   architecture compatibility tests.
   2680                 </P
   2681 ></LI
   2682 ><LI
   2683 STYLE="list-style-type: disc"
   2684 ><P
   2685 >                  <SPAN
   2686 CLASS="SYMBOL"
   2687 >RPMINSTALL_NOOS</SPAN
   2688 > &#8212; Do not perform
   2689                   operating system compatibility tests.
   2690                 </P
   2691 ></LI
   2692 ></UL
   2693 >
   2694           </P
   2695 ><P
   2696 >            The <TT
   2697 CLASS="PARAMETER"
   2698 ><I
   2699 >notify</I
   2700 ></TT
   2701 > parameter is used to specify a
   2702             progress tracking function that will be called during the
   2703             installation.  Please refer to <A
   2704 HREF="s1-rpm-rpmlib-functions.html#S3-RPM-RPMLIB-RPMNOTIFYFUNCTION"
   2705 >the section called <I
   2706 >Track Package Installation Progress &#8212;
   2707             <TT
   2708 CLASS="FUNCTION"
   2709 >rpmNotifyFunction()</TT
   2710 ></I
   2711 ></A
   2712 > for more information on
   2713             this parameter.
   2714           </P
   2715 ><P
   2716 >            The <TT
   2717 CLASS="PARAMETER"
   2718 ><I
   2719 >labelFormat</I
   2720 ></TT
   2721 > parameter can be used to
   2722             specify how the package label should be formatted.  This information
   2723             is used when printing the package label once the package install is
   2724             ready to proceed.  It is used when printing the package label once
   2725             the package install is ready to proceed.  If
   2726             <TT
   2727 CLASS="PARAMETER"
   2728 ><I
   2729 >labelformat</I
   2730 ></TT
   2731 > is <SPAN
   2732 CLASS="SYMBOL"
   2733 >NULL</SPAN
   2734 >, the
   2735             package label is not printed.
   2736           </P
   2737 ><P
   2738 >            The <TT
   2739 CLASS="PARAMETER"
   2740 ><I
   2741 >netsharedPath</I
   2742 ></TT
   2743 > parameter is used to
   2744             specify that part of the local filesystem that is shared with other
   2745             systems.  If there is more than one path that is shared, the paths
   2746             should be separated with a colon.
   2747           </P
   2748 ><P
   2749 >            This function returns the following status values:
   2750 
   2751             <P
   2752 ></P
   2753 ><UL
   2754 ><LI
   2755 STYLE="list-style-type: disc"
   2756 ><P
   2757 >                  <SPAN
   2758 CLASS="RETURNVALUE"
   2759 >0</SPAN
   2760 > &#8212; The binary package was
   2761                   installed successfully.
   2762                 </P
   2763 ></LI
   2764 ><LI
   2765 STYLE="list-style-type: disc"
   2766 ><P
   2767 >                  <SPAN
   2768 CLASS="RETURNVALUE"
   2769 >1</SPAN
   2770 > &#8212; The binary package file
   2771                   contained incorrect magic numbers.
   2772                 </P
   2773 ></LI
   2774 ><LI
   2775 STYLE="list-style-type: disc"
   2776 ><P
   2777 >                  <SPAN
   2778 CLASS="RETURNVALUE"
   2779 >2</SPAN
   2780 > &#8212; Another type of error
   2781                   occurred.
   2782                 </P
   2783 ></LI
   2784 ></UL
   2785 >
   2786           </P
   2787 ></DIV
   2788 ><DIV
   2789 CLASS="SECT3"
   2790 ><H3
   2791 CLASS="SECT3"
   2792 ><A
   2793 NAME="S3-RPM-RPMLIB-RPMNOTIFYFUNCTION"
   2794 >Track Package Installation Progress &#8212;
   2795             <TT
   2796 CLASS="FUNCTION"
   2797 >rpmNotifyFunction()</TT
   2798 ></A
   2799 ></H3
   2800 ><TABLE
   2801 BORDER="0"
   2802 BGCOLOR="#E0E0E0"
   2803 WIDTH="100%"
   2804 ><TR
   2805 ><TD
   2806 ><PRE
   2807 CLASS="SCREEN"
   2808 ><TT
   2809 CLASS="COMPUTEROUTPUT"
   2810 >#include &#60;rpm/rpmlib.h&#62;
   2811 
   2812 typedef void (*rpmNotifyFunction)(const unsigned long amount,
   2813                                   const unsigned long total);</TT
   2814 >
   2815           </PRE
   2816 ></TD
   2817 ></TR
   2818 ></TABLE
   2819 ><P
   2820 >            A function can be passed to
   2821             <TT
   2822 CLASS="FUNCTION"
   2823 >rpmIstallSourcePackage</TT
   2824 > or
   2825             <TT
   2826 CLASS="FUNCTION"
   2827 >rpmInstallPackage</TT
   2828 > via the
   2829             <TT
   2830 CLASS="PARAMETER"
   2831 ><I
   2832 >notify</I
   2833 ></TT
   2834 > parameter.  The function will be
   2835             called at regular intervals during the installation, and will have
   2836             two parameters passed to it:
   2837 
   2838             <P
   2839 ></P
   2840 ><OL
   2841 TYPE="1"
   2842 ><LI
   2843 ><P
   2844 >                  <TT
   2845 CLASS="PARAMETER"
   2846 ><I
   2847 >amount</I
   2848 ></TT
   2849 > &#8212; The number of bytes of
   2850                   the install that have been completed so far.
   2851                 </P
   2852 ></LI
   2853 ><LI
   2854 ><P
   2855 >                  <TT
   2856 CLASS="PARAMETER"
   2857 ><I
   2858 >total</I
   2859 ></TT
   2860 > &#8212; The total number of bytes
   2861                   that will be installed.
   2862                 </P
   2863 ></LI
   2864 ></OL
   2865 >
   2866           </P
   2867 ><P
   2868 >            This function permits the creation of a dynamically updating
   2869             progress meter during package installation.
   2870           </P
   2871 ></DIV
   2872 ><DIV
   2873 CLASS="SECT3"
   2874 ><H3
   2875 CLASS="SECT3"
   2876 ><A
   2877 NAME="S3-RPM-RPMLIB-RPMREMOVEPACKAGE"
   2878 >Remove Installed Package &#8212;
   2879             <TT
   2880 CLASS="FUNCTION"
   2881 >rpmRemovePackage()</TT
   2882 ></A
   2883 ></H3
   2884 ><TABLE
   2885 BORDER="0"
   2886 BGCOLOR="#E0E0E0"
   2887 WIDTH="100%"
   2888 ><TR
   2889 ><TD
   2890 ><PRE
   2891 CLASS="SCREEN"
   2892 ><TT
   2893 CLASS="COMPUTEROUTPUT"
   2894 >#include &#60;rpm/rpmlib.h&#62;
   2895 
   2896 int rpmRemovePackage(char * root,
   2897                      rpmdb db,
   2898                      unsigned int offset,
   2899                      int flags);</TT
   2900 >
   2901           </PRE
   2902 ></TD
   2903 ></TR
   2904 ></TABLE
   2905 ><P
   2906 >            This function removes the package at record number
   2907             <TT
   2908 CLASS="PARAMETER"
   2909 ><I
   2910 >offset</I
   2911 ></TT
   2912 > in the RPM database specified by
   2913             <TT
   2914 CLASS="PARAMETER"
   2915 ><I
   2916 >db</I
   2917 ></TT
   2918 >.  If <TT
   2919 CLASS="PARAMETER"
   2920 ><I
   2921 >root</I
   2922 ></TT
   2923 > is
   2924             specified, it is used as the path to a directory that will serve as
   2925             the root directory while the package is being removed.
   2926           </P
   2927 ><P
   2928 >            The <TT
   2929 CLASS="PARAMETER"
   2930 ><I
   2931 >flags</I
   2932 ></TT
   2933 > parameter is used to control the
   2934             package removal behavior.  The flags that may be passed are defined
   2935             in <TT
   2936 CLASS="FILENAME"
   2937 >rpmlib.h</TT
   2938 >, and are of the form
   2939             <SPAN
   2940 CLASS="SYMBOL"
   2941 >RPMUNINSTALL_<TT
   2942 CLASS="REPLACEABLE"
   2943 ><I
   2944 >xxx</I
   2945 ></TT
   2946 ></SPAN
   2947 >, where
   2948             <SPAN
   2949 CLASS="SYMBOL"
   2950 ><TT
   2951 CLASS="REPLACEABLE"
   2952 ><I
   2953 >xxx</I
   2954 ></TT
   2955 ></SPAN
   2956 > is the name of the
   2957             flag.
   2958           </P
   2959 ><P
   2960 >            The following flags are currently defined:
   2961 
   2962             <P
   2963 ></P
   2964 ><UL
   2965 ><LI
   2966 STYLE="list-style-type: disc"
   2967 ><P
   2968 >                  <SPAN
   2969 CLASS="SYMBOL"
   2970 >RPMUNINSTALL_TEST</SPAN
   2971 > &#8212; Perform all
   2972                   erase-time checks, but do not actually remove the package.
   2973                 </P
   2974 ></LI
   2975 ><LI
   2976 STYLE="list-style-type: disc"
   2977 ><P
   2978 >                  <SPAN
   2979 CLASS="SYMBOL"
   2980 >RPMUNINSTALL_NOSCRIPTS</SPAN
   2981 > &#8212; Do not execute
   2982                   the package's erase-time scripts.
   2983                 </P
   2984 ></LI
   2985 ></UL
   2986 >
   2987           </P
   2988 ><P
   2989 >            This function returns the following status values:
   2990 
   2991             <P
   2992 ></P
   2993 ><UL
   2994 ><LI
   2995 STYLE="list-style-type: disc"
   2996 ><P
   2997 >                  <SPAN
   2998 CLASS="RETURNVALUE"
   2999 >0</SPAN
   3000 > &#8212; The package was removed
   3001                   successfully.
   3002                 </P
   3003 ></LI
   3004 ><LI
   3005 STYLE="list-style-type: disc"
   3006 ><P
   3007 >                  <SPAN
   3008 CLASS="RETURNVALUE"
   3009 >1</SPAN
   3010 > &#8212; The package removal
   3011                   failed.
   3012                 </P
   3013 ></LI
   3014 ></UL
   3015 >
   3016           </P
   3017 ></DIV
   3018 ></DIV
   3019 ><DIV
   3020 CLASS="SECT2"
   3021 ><H2
   3022 CLASS="SECT2"
   3023 ><A
   3024 NAME="S2-RPM-RPMLIB-PACKAGE-FILE-VERIFICATION"
   3025 >Package And File Verification</A
   3026 ></H2
   3027 ><P
   3028 >          The functions in this section perform the verification operations
   3029           necessary to ensure that the files comprising a package have not been
   3030           modified since they were installed.
   3031         </P
   3032 ><P
   3033 >          Verification takes place on three distinct levels:
   3034 
   3035           <P
   3036 ></P
   3037 ><OL
   3038 TYPE="1"
   3039 ><LI
   3040 ><P
   3041 >                On the file-by-file level.
   3042               </P
   3043 ></LI
   3044 ><LI
   3045 ><P
   3046 >                On a package-wide level, through the use of the
   3047                 <B
   3048 CLASS="COMMAND"
   3049 >%verifyscript</B
   3050 > verification script.
   3051               </P
   3052 ></LI
   3053 ><LI
   3054 ><P
   3055 >                On an inter-package level, through RPM's normal dependency
   3056                 processing.
   3057               </P
   3058 ></LI
   3059 ></OL
   3060 >
   3061         </P
   3062 ><P
   3063 >          Because of this, there are two functions to perform each specific
   3064           verification operation.
   3065         </P
   3066 ><DIV
   3067 CLASS="SECT3"
   3068 ><H3
   3069 CLASS="SECT3"
   3070 ><A
   3071 NAME="S3-RPM-RPMLIB-RPMVERIFYFILE"
   3072 >Verify File &#8212; <TT
   3073 CLASS="FUNCTION"
   3074 >rpmVerifyFile()</TT
   3075 ></A
   3076 ></H3
   3077 ><TABLE
   3078 BORDER="0"
   3079 BGCOLOR="#E0E0E0"
   3080 WIDTH="100%"
   3081 ><TR
   3082 ><TD
   3083 ><PRE
   3084 CLASS="SCREEN"
   3085 ><TT
   3086 CLASS="COMPUTEROUTPUT"
   3087 >#include &#60;rpm/rpmlib.h&#62;
   3088 #include &#60;rpm/header.h&#62;
   3089 
   3090 int rpmVerifyFile(char * root,
   3091                   Header h,
   3092                   int filenum,
   3093                   int * result);</TT
   3094 >
   3095           </PRE
   3096 ></TD
   3097 ></TR
   3098 ></TABLE
   3099 ><P
   3100 >            This function verifies the <TT
   3101 CLASS="PARAMETER"
   3102 ><I
   3103 >filenum</I
   3104 ></TT
   3105 >'th file
   3106             from the package whose header is <TT
   3107 CLASS="PARAMETER"
   3108 ><I
   3109 >h</I
   3110 ></TT
   3111 >.  If
   3112             <TT
   3113 CLASS="PARAMETER"
   3114 ><I
   3115 >root</I
   3116 ></TT
   3117 > is specified, it is used as the path to
   3118             a directory that will serve as the root directory while the file is
   3119             being verified.  The results of the file verification are returned
   3120             in <TT
   3121 CLASS="PARAMETER"
   3122 ><I
   3123 >result</I
   3124 ></TT
   3125 >, and consist of a number of flags.
   3126             Each flag that is set indicates a verification failure.
   3127           </P
   3128 ><P
   3129 >            The flags are defined in <TT
   3130 CLASS="FILENAME"
   3131 >rpmlib.h</TT
   3132 >, and are of
   3133             the form <SPAN
   3134 CLASS="SYMBOL"
   3135 >RPMVERIFY_<TT
   3136 CLASS="REPLACEABLE"
   3137 ><I
   3138 >xxx</I
   3139 ></TT
   3140 ></SPAN
   3141 >,
   3142             where <SPAN
   3143 CLASS="SYMBOL"
   3144 ><TT
   3145 CLASS="REPLACEABLE"
   3146 ><I
   3147 >xxx</I
   3148 ></TT
   3149 ></SPAN
   3150 > is the name of
   3151             the data that failed verification.
   3152           </P
   3153 ><P
   3154 >            This function returns <SPAN
   3155 CLASS="RETURNVALUE"
   3156 >0</SPAN
   3157 > on success, and
   3158             <SPAN
   3159 CLASS="RETURNVALUE"
   3160 >1</SPAN
   3161 > on failure.
   3162           </P
   3163 ></DIV
   3164 ><DIV
   3165 CLASS="SECT3"
   3166 ><H3
   3167 CLASS="SECT3"
   3168 ><A
   3169 NAME="S3-RPM-RPMLIB-RPMVERIFYSCRIPT"
   3170 >Execute Package's <B
   3171 CLASS="COMMAND"
   3172 >%verifyscript</B
   3173 > Verification
   3174             Script &#8212; <TT
   3175 CLASS="FUNCTION"
   3176 >rpmVerifyScript()</TT
   3177 ></A
   3178 ></H3
   3179 ><TABLE
   3180 BORDER="0"
   3181 BGCOLOR="#E0E0E0"
   3182 WIDTH="100%"
   3183 ><TR
   3184 ><TD
   3185 ><PRE
   3186 CLASS="SCREEN"
   3187 ><TT
   3188 CLASS="COMPUTEROUTPUT"
   3189 >#include &#60;rpm/rpmlib.h&#62;
   3190 #include &#60;rpm/header.h&#62;
   3191 
   3192 int rpmVerifyScript(char * root,
   3193                     Header h,
   3194                     int err);</TT
   3195 >
   3196           </PRE
   3197 ></TD
   3198 ></TR
   3199 ></TABLE
   3200 ><P
   3201 >            This function executes the <B
   3202 CLASS="COMMAND"
   3203 >%verifyscript</B
   3204 >
   3205             verification script for the package whose header is
   3206             <TT
   3207 CLASS="PARAMETER"
   3208 ><I
   3209 >h</I
   3210 ></TT
   3211 >.  <TT
   3212 CLASS="PARAMETER"
   3213 ><I
   3214 >err</I
   3215 ></TT
   3216 > must contain a
   3217             valid file descriptor.  If <TT
   3218 CLASS="FUNCTION"
   3219 >rpmIsVerbose()</TT
   3220 >
   3221             returns <SPAN
   3222 CLASS="RETURNVALUE"
   3223 >true</SPAN
   3224 >, the
   3225             <B
   3226 CLASS="COMMAND"
   3227 >%verifyscript</B
   3228 > verification script will direct all
   3229             status messages to <TT
   3230 CLASS="PARAMETER"
   3231 ><I
   3232 >err</I
   3233 ></TT
   3234 >.
   3235           </P
   3236 ><P
   3237 >            This function returns <SPAN
   3238 CLASS="RETURNVALUE"
   3239 >0</SPAN
   3240 > on success,
   3241             <SPAN
   3242 CLASS="RETURNVALUE"
   3243 >1</SPAN
   3244 > on failure.
   3245           </P
   3246 ></DIV
   3247 ></DIV
   3248 ><DIV
   3249 CLASS="SECT2"
   3250 ><H2
   3251 CLASS="SECT2"
   3252 ><A
   3253 NAME="S2-RPM-RPMLIB-DEPENDENCY-RELATED-OPS"
   3254 >Dependency-Related Operations</A
   3255 ></H2
   3256 ><P
   3257 >          The functions in this section are used to perform the various
   3258           dependency-related operations supported by rpmlib.
   3259         </P
   3260 ><P
   3261 >          Dependency processing is entirely separate from normal package-based
   3262           operations.  The package installation and removal functions do not
   3263           perform any dependency processing themselves.  Therefore, dependency
   3264           processing is somewhat different from other aspects of rpmlib's
   3265           operation.
   3266         </P
   3267 ><P
   3268 >          Dependency processing centers around the
   3269           <SPAN
   3270 CLASS="STRUCTNAME"
   3271 >rpmDependencies</SPAN
   3272 > data structure.  The
   3273           operations that are to be performed against the RPM database (adding,
   3274           removing, and upgrading packages) are performed against this data
   3275           structure, using functions that are described below.  These functions
   3276           simply populate the data structure according to the operation being
   3277           performed.  They do <I
   3278 CLASS="EMPHASIS"
   3279 >not</I
   3280 > perform the actual
   3281           operation on the package.  This is an important point to keep in mind.
   3282         </P
   3283 ><P
   3284 >          Once the data structure has been completely populated, a dependency
   3285           check function is called to determine if there are any
   3286           dependency-related problems.  The result is a structure of dependency
   3287           conflicts.  This structure,
   3288           <SPAN
   3289 CLASS="STRUCTNAME"
   3290 >rpmDependencyConflict</SPAN
   3291 >, is defined in
   3292           <TT
   3293 CLASS="FILENAME"
   3294 >rpmlib.h</TT
   3295 >.
   3296         </P
   3297 ><P
   3298 >          Note that it is necessary to free both the conflicts structure
   3299           <I
   3300 CLASS="EMPHASIS"
   3301 >and</I
   3302 > the <SPAN
   3303 CLASS="STRUCTNAME"
   3304 >rpmDependencies</SPAN
   3305 >
   3306           structure when they are no longer needed.  However,
   3307           <TT
   3308 CLASS="FUNCTION"
   3309 >free()</TT
   3310 > should <I
   3311 CLASS="EMPHASIS"
   3312 >not</I
   3313 > be used
   3314           &#8212; special functions for this are provided, and will be discussed
   3315           in this section.
   3316         </P
   3317 ><DIV
   3318 CLASS="SECT3"
   3319 ><H3
   3320 CLASS="SECT3"
   3321 ><A
   3322 NAME="S3-RPM-RPMLIB-RPMDEPDEPENDENCIES"
   3323 >Create a New Dependency Data Structure &#8212;
   3324             <TT
   3325 CLASS="FUNCTION"
   3326 >rpmdepDependencies()</TT
   3327 ></A
   3328 ></H3
   3329 ><TABLE
   3330 BORDER="0"
   3331 BGCOLOR="#E0E0E0"
   3332 WIDTH="100%"
   3333 ><TR
   3334 ><TD
   3335 ><PRE
   3336 CLASS="SCREEN"
   3337 ><TT
   3338 CLASS="COMPUTEROUTPUT"
   3339 >#include &#60;rpm/rpmlib.h&#62;
   3340 
   3341 rpmDependencies rpmdepDependencies(rpmdb db);</TT
   3342 >
   3343           </PRE
   3344 ></TD
   3345 ></TR
   3346 ></TABLE
   3347 ><P
   3348 >            This function returns an initialized
   3349             <SPAN
   3350 CLASS="STRUCTNAME"
   3351 >rpmDependencies</SPAN
   3352 > structure.  The dependency
   3353             checking to be done will be based on the RPM database specified in
   3354             the <TT
   3355 CLASS="PARAMETER"
   3356 ><I
   3357 >db</I
   3358 ></TT
   3359 > parameter.  If this parameter is
   3360             <SPAN
   3361 CLASS="SYMBOL"
   3362 >NULL</SPAN
   3363 >, the dependency checking will be done as if an
   3364             empty RPM database was being used.
   3365           </P
   3366 ></DIV
   3367 ><DIV
   3368 CLASS="SECT3"
   3369 ><H3
   3370 CLASS="SECT3"
   3371 ><A
   3372 NAME="S3-RPM-RPMLIB-RPMDEPADDPACKAGE"
   3373 >Add a Package Install To the Dependency Data Structure &#8212;
   3374             <TT
   3375 CLASS="FUNCTION"
   3376 >rpmdepAddPackage()</TT
   3377 ></A
   3378 ></H3
   3379 ><TABLE
   3380 BORDER="0"
   3381 BGCOLOR="#E0E0E0"
   3382 WIDTH="100%"
   3383 ><TR
   3384 ><TD
   3385 ><PRE
   3386 CLASS="SCREEN"
   3387 ><TT
   3388 CLASS="COMPUTEROUTPUT"
   3389 >#include &#60;rpm/rpmlib.h&#62;
   3390 #include &#60;rpm/header.h&#62;
   3391 
   3392 void rpmdepAddPackage(rpmDependencies rpmdep,
   3393                       Header h);</TT
   3394 >
   3395           </PRE
   3396 ></TD
   3397 ></TR
   3398 ></TABLE
   3399 ><P
   3400 >            This function adds the installation of the package whose header is
   3401             <TT
   3402 CLASS="PARAMETER"
   3403 ><I
   3404 >h</I
   3405 ></TT
   3406 >, to the
   3407             <SPAN
   3408 CLASS="STRUCTNAME"
   3409 >rpmDependencies</SPAN
   3410 > data structure,
   3411             <TT
   3412 CLASS="PARAMETER"
   3413 ><I
   3414 >rpmdep</I
   3415 ></TT
   3416 >.
   3417           </P
   3418 ></DIV
   3419 ><DIV
   3420 CLASS="SECT3"
   3421 ><H3
   3422 CLASS="SECT3"
   3423 ><A
   3424 NAME="S3-RPM-RPMLIB-RPMDEPUPGRADEPACKAGE"
   3425 >Add a Package Upgrade To the Dependency Data Structure &#8212;
   3426             <TT
   3427 CLASS="FUNCTION"
   3428 >rpmdepUpgradePackage()</TT
   3429 ></A
   3430 ></H3
   3431 ><TABLE
   3432 BORDER="0"
   3433 BGCOLOR="#E0E0E0"
   3434 WIDTH="100%"
   3435 ><TR
   3436 ><TD
   3437 ><PRE
   3438 CLASS="SCREEN"
   3439 ><TT
   3440 CLASS="COMPUTEROUTPUT"
   3441 >#include &#60;rpm/rpmlib.h&#62;
   3442 #include &#60;rpm/header.h&#62;
   3443 
   3444 void rpmdepUpgradePackage(rpmDependencies rpmdep,
   3445                           Header h);</TT
   3446 >
   3447           </PRE
   3448 ></TD
   3449 ></TR
   3450 ></TABLE
   3451 ><P
   3452 >            This function adds the upgrading of the package whose header is
   3453             <TT
   3454 CLASS="PARAMETER"
   3455 ><I
   3456 >h</I
   3457 ></TT
   3458 >, to the
   3459             <SPAN
   3460 CLASS="STRUCTNAME"
   3461 >rpmDependencies</SPAN
   3462 > data structure,
   3463             <TT
   3464 CLASS="PARAMETER"
   3465 ><I
   3466 >rpmdep</I
   3467 ></TT
   3468 >.  It is similar to
   3469             <TT
   3470 CLASS="FUNCTION"
   3471 >rpmdepAddPackage()</TT
   3472 >, but older versions of the
   3473             package are removed.
   3474           </P
   3475 ></DIV
   3476 ><DIV
   3477 CLASS="SECT3"
   3478 ><H3
   3479 CLASS="SECT3"
   3480 ><A
   3481 NAME="S3-RPM-RPMLIB-RPMDEPREMOVEPACKAGE"
   3482 >Add a Package Removal To the Dependency Data Structure &#8212;
   3483             <TT
   3484 CLASS="FUNCTION"
   3485 >rpmdepRemovePackage()</TT
   3486 ></A
   3487 ></H3
   3488 ><TABLE
   3489 BORDER="0"
   3490 BGCOLOR="#E0E0E0"
   3491 WIDTH="100%"
   3492 ><TR
   3493 ><TD
   3494 ><PRE
   3495 CLASS="SCREEN"
   3496 ><TT
   3497 CLASS="COMPUTEROUTPUT"
   3498 >#include &#60;rpm/rpmlib.h&#62;
   3499 
   3500 void rpmdepRemovePackage(rpmDependencies rpmdep,
   3501                          int dboffset);</TT
   3502 >
   3503           </PRE
   3504 ></TD
   3505 ></TR
   3506 ></TABLE
   3507 ><P
   3508 >            This function adds the removal of the package whose RPM database
   3509             offset is <TT
   3510 CLASS="PARAMETER"
   3511 ><I
   3512 >dboffset</I
   3513 ></TT
   3514 >, to the
   3515             <SPAN
   3516 CLASS="STRUCTNAME"
   3517 >rpmDependencies</SPAN
   3518 > data structure,
   3519             <TT
   3520 CLASS="PARAMETER"
   3521 ><I
   3522 >rpmdep</I
   3523 ></TT
   3524 >.
   3525           </P
   3526 ></DIV
   3527 ><DIV
   3528 CLASS="SECT3"
   3529 ><H3
   3530 CLASS="SECT3"
   3531 ><A
   3532 NAME="S3-RPM-RPMLIB-RPMDEPAVAILABLEPACKAGE"
   3533 >Add an Available Package To the Dependency Data Structure &#8212;
   3534             <TT
   3535 CLASS="FUNCTION"
   3536 >rpmdepAvailablePackage()</TT
   3537 ></A
   3538 ></H3
   3539 ><TABLE
   3540 BORDER="0"
   3541 BGCOLOR="#E0E0E0"
   3542 WIDTH="100%"
   3543 ><TR
   3544 ><TD
   3545 ><PRE
   3546 CLASS="SCREEN"
   3547 ><TT
   3548 CLASS="COMPUTEROUTPUT"
   3549 >#include &#60;rpm/rpmlib.h&#62;
   3550 #include &#60;rpm/header.h&#62;
   3551 
   3552 void rpmdepAvailablePackage(rpmDependencies rpmdep,
   3553                             Header h,
   3554                             void * key);</TT
   3555 >
   3556           </PRE
   3557 ></TD
   3558 ></TR
   3559 ></TABLE
   3560 ><P
   3561 >            This function adds the package whose header is
   3562             <TT
   3563 CLASS="PARAMETER"
   3564 ><I
   3565 >h</I
   3566 ></TT
   3567 >, to the
   3568             <SPAN
   3569 CLASS="STRUCTNAME"
   3570 >rpmDependencies</SPAN
   3571 > structure,
   3572             <TT
   3573 CLASS="PARAMETER"
   3574 ><I
   3575 >rpmdep</I
   3576 ></TT
   3577 >.
   3578           </P
   3579 ><P
   3580 >            The <TT
   3581 CLASS="PARAMETER"
   3582 ><I
   3583 >key</I
   3584 ></TT
   3585 > parameter can be anything that
   3586             uniquely identifies the package being added.  It will be returned as
   3587             part of the <SPAN
   3588 CLASS="STRUCTNAME"
   3589 >rpmDependencyConflict</SPAN
   3590 > structure
   3591             returned by <TT
   3592 CLASS="FUNCTION"
   3593 >rpmdepCheck()</TT
   3594 >, specifically in that
   3595             structure's <TT
   3596 CLASS="STRUCTFIELD"
   3597 ><I
   3598 >suggestedPackage</I
   3599 ></TT
   3600 > element.
   3601           </P
   3602 ></DIV
   3603 ><DIV
   3604 CLASS="SECT3"
   3605 ><H3
   3606 CLASS="SECT3"
   3607 ><A
   3608 NAME="S3-RPM-RPMLIB-RPMDEPCHECK"
   3609 >Perform a Dependency Check &#8212;
   3610             <TT
   3611 CLASS="FUNCTION"
   3612 >rpmdepCheck()</TT
   3613 ></A
   3614 ></H3
   3615 ><TABLE
   3616 BORDER="0"
   3617 BGCOLOR="#E0E0E0"
   3618 WIDTH="100%"
   3619 ><TR
   3620 ><TD
   3621 ><PRE
   3622 CLASS="SCREEN"
   3623 ><TT
   3624 CLASS="COMPUTEROUTPUT"
   3625 >#include &#60;rpm/rpmlib.h&#62;
   3626 
   3627 int rpmdepCheck(rpmDependencies rpmdep,
   3628                 struct rpmDependencyConflict ** conflicts,
   3629                 int * numConflicts);</TT
   3630 >
   3631           </PRE
   3632 ></TD
   3633 ></TR
   3634 ></TABLE
   3635 ><P
   3636 >            This function performs a dependency check on the
   3637             <SPAN
   3638 CLASS="STRUCTNAME"
   3639 >rpmDependencies</SPAN
   3640 > structure
   3641             <TT
   3642 CLASS="PARAMETER"
   3643 ><I
   3644 >rpmdep</I
   3645 ></TT
   3646 >.  It returns an array of size
   3647             <TT
   3648 CLASS="PARAMETER"
   3649 ><I
   3650 >numConflicts</I
   3651 ></TT
   3652 >, pointed to by
   3653             <TT
   3654 CLASS="PARAMETER"
   3655 ><I
   3656 >conflicts</I
   3657 ></TT
   3658 >.
   3659           </P
   3660 ><P
   3661 >            This function returns <SPAN
   3662 CLASS="RETURNVALUE"
   3663 >0</SPAN
   3664 > on success, and
   3665             <SPAN
   3666 CLASS="RETURNVALUE"
   3667 >1</SPAN
   3668 > on error.
   3669           </P
   3670 ></DIV
   3671 ><DIV
   3672 CLASS="SECT3"
   3673 ><H3
   3674 CLASS="SECT3"
   3675 ><A
   3676 NAME="S3-RPM-RPMLIB-RPMDEPFREECONFLICTS"
   3677 >Free Results of <TT
   3678 CLASS="FUNCTION"
   3679 >rpmdepCheck()</TT
   3680 > &#8212;
   3681             <TT
   3682 CLASS="FUNCTION"
   3683 >rpmdepFreeConflicts()</TT
   3684 ></A
   3685 ></H3
   3686 ><TABLE
   3687 BORDER="0"
   3688 BGCOLOR="#E0E0E0"
   3689 WIDTH="100%"
   3690 ><TR
   3691 ><TD
   3692 ><PRE
   3693 CLASS="SCREEN"
   3694 ><TT
   3695 CLASS="COMPUTEROUTPUT"
   3696 >#include &#60;rpm/rpmlib.h&#62;
   3697 
   3698 void rpmdepFreeConflicts(struct rpmDependencyConflict * conflicts,
   3699                          int numConflicts);</TT
   3700 >
   3701           </PRE
   3702 ></TD
   3703 ></TR
   3704 ></TABLE
   3705 ><P
   3706 >            This function frees the dependency conflict information of size
   3707             <TT
   3708 CLASS="PARAMETER"
   3709 ><I
   3710 >numConflicts</I
   3711 ></TT
   3712 > pointed to by
   3713             <TT
   3714 CLASS="PARAMETER"
   3715 ><I
   3716 >conflicts</I
   3717 ></TT
   3718 >.
   3719           </P
   3720 ></DIV
   3721 ><DIV
   3722 CLASS="SECT3"
   3723 ><H3
   3724 CLASS="SECT3"
   3725 ><A
   3726 NAME="S3-RPM-RPMLIB-RPMDEPDONE"
   3727 >Free a Dependency Data Structure &#8212;
   3728             <TT
   3729 CLASS="FUNCTION"
   3730 >rpmdepDone()</TT
   3731 ></A
   3732 ></H3
   3733 ><TABLE
   3734 BORDER="0"
   3735 BGCOLOR="#E0E0E0"
   3736 WIDTH="100%"
   3737 ><TR
   3738 ><TD
   3739 ><PRE
   3740 CLASS="SCREEN"
   3741 ><TT
   3742 CLASS="COMPUTEROUTPUT"
   3743 >#include &#60;rpm/rpmlib.h&#62;
   3744 
   3745 void rpmdepDone(rpmDependencies rpmdep);</TT
   3746 >
   3747           </PRE
   3748 ></TD
   3749 ></TR
   3750 ></TABLE
   3751 ><P
   3752 >            This function frees the <SPAN
   3753 CLASS="STRUCTNAME"
   3754 >rpmDependencies</SPAN
   3755 >
   3756             structure pointed to by <TT
   3757 CLASS="PARAMETER"
   3758 ><I
   3759 >rpmdep</I
   3760 ></TT
   3761 >.
   3762           </P
   3763 ></DIV
   3764 ></DIV
   3765 ><DIV
   3766 CLASS="SECT2"
   3767 ><H2
   3768 CLASS="SECT2"
   3769 ><A
   3770 NAME="S2-RPM-RPMLIB-DIAGNOSTIC-OUTPUT-CONTROL"
   3771 >Diagnostic Output Control</A
   3772 ></H2
   3773 ><P
   3774 >          The functions in this section are used to control the amount of
   3775           diagnostic output produced by other rpmlib functions.  The rpmlib
   3776           library can produce a wealth of diagnostic output, making it easy to
   3777           see what is going on at any given time.
   3778         </P
   3779 ><P
   3780 >          There are several different verbosity levels defined in
   3781           <TT
   3782 CLASS="FILENAME"
   3783 >rpmlib.h</TT
   3784 >.  Their symbolic names are of the form
   3785           <SPAN
   3786 CLASS="SYMBOL"
   3787 >RPMMESS_<TT
   3788 CLASS="REPLACEABLE"
   3789 ><I
   3790 >xxx</I
   3791 ></TT
   3792 ></SPAN
   3793 >, where
   3794           <SPAN
   3795 CLASS="SYMBOL"
   3796 ><TT
   3797 CLASS="REPLACEABLE"
   3798 ><I
   3799 >xxx</I
   3800 ></TT
   3801 ></SPAN
   3802 > is the name of the
   3803           verbosity level.  It should be noted that the numeric values of the
   3804           verbosity levels <I
   3805 CLASS="EMPHASIS"
   3806 >increase</I
   3807 > with a
   3808           <I
   3809 CLASS="EMPHASIS"
   3810 >decrease</I
   3811 > in verbosity.
   3812         </P
   3813 ><P
   3814 >          Unless otherwise set, the default verbosity level is
   3815           <SPAN
   3816 CLASS="SYMBOL"
   3817 >RPMMESS_NORMAL</SPAN
   3818 >.
   3819         </P
   3820 ><DIV
   3821 CLASS="SECT3"
   3822 ><H3
   3823 CLASS="SECT3"
   3824 ><A
   3825 NAME="S3-RPM-RPMLIB-RPMINCREASEVERBOSITY"
   3826 >Increase Verbosity Level &#8212;
   3827             <TT
   3828 CLASS="FUNCTION"
   3829 >rpmIncreaseVerbosity()</TT
   3830 ></A
   3831 ></H3
   3832 ><TABLE
   3833 BORDER="0"
   3834 BGCOLOR="#E0E0E0"
   3835 WIDTH="100%"
   3836 ><TR
   3837 ><TD
   3838 ><PRE
   3839 CLASS="SCREEN"
   3840 ><TT
   3841 CLASS="COMPUTEROUTPUT"
   3842 >#include &#60;rpm/rpmlib.h&#62;
   3843 
   3844 void rpmIncreaseVerbosity(void);</TT
   3845 >
   3846           </PRE
   3847 ></TD
   3848 ></TR
   3849 ></TABLE
   3850 ><P
   3851 >            This function is used to increase the current verbosity level by
   3852             one.
   3853           </P
   3854 ></DIV
   3855 ><DIV
   3856 CLASS="SECT3"
   3857 ><H3
   3858 CLASS="SECT3"
   3859 ><A
   3860 NAME="S3-RPM-RPMLIB-RPMSETVERBOSITY"
   3861 >Set Verbosity Level &#8212; <TT
   3862 CLASS="FUNCTION"
   3863 >rpmSetVerbosity()</TT
   3864 ></A
   3865 ></H3
   3866 ><TABLE
   3867 BORDER="0"
   3868 BGCOLOR="#E0E0E0"
   3869 WIDTH="100%"
   3870 ><TR
   3871 ><TD
   3872 ><PRE
   3873 CLASS="SCREEN"
   3874 ><TT
   3875 CLASS="COMPUTEROUTPUT"
   3876 >#include &#60;rpm/rpmlib.h&#62;
   3877 
   3878 void rpmSetVerbosity(int level);</TT
   3879 >
   3880           </PRE
   3881 ></TD
   3882 ></TR
   3883 ></TABLE
   3884 ><P
   3885 >            This function is used to set the current verbosity level to
   3886             <TT
   3887 CLASS="PARAMETER"
   3888 ><I
   3889 >level</I
   3890 ></TT
   3891 >.  Note that no range checking is done
   3892             to <TT
   3893 CLASS="PARAMETER"
   3894 ><I
   3895 >level</I
   3896 ></TT
   3897 >.
   3898           </P
   3899 ></DIV
   3900 ><DIV
   3901 CLASS="SECT3"
   3902 ><H3
   3903 CLASS="SECT3"
   3904 ><A
   3905 NAME="S3-RPM-RPMLIB-RPMGETVERBOSITY"
   3906 >Return Verbosity Level &#8212;
   3907             <TT
   3908 CLASS="FUNCTION"
   3909 >rpmGetVerbosity()</TT
   3910 ></A
   3911 ></H3
   3912 ><TABLE
   3913 BORDER="0"
   3914 BGCOLOR="#E0E0E0"
   3915 WIDTH="100%"
   3916 ><TR
   3917 ><TD
   3918 ><PRE
   3919 CLASS="SCREEN"
   3920 ><TT
   3921 CLASS="COMPUTEROUTPUT"
   3922 >#include &#60;rpm/rpmlib.h&#62;
   3923 
   3924 int rpmGetVerbosity(void);</TT
   3925 >
   3926           </PRE
   3927 ></TD
   3928 ></TR
   3929 ></TABLE
   3930 ><P
   3931 >            This function returns the current verbosity level.
   3932           </P
   3933 ></DIV
   3934 ><DIV
   3935 CLASS="SECT3"
   3936 ><H3
   3937 CLASS="SECT3"
   3938 ><A
   3939 NAME="S3-RPM-RPMLIB-RPMISVERBOSE"
   3940 >Check Verbosity Level &#8212; <TT
   3941 CLASS="FUNCTION"
   3942 >rpmIsVerbose()</TT
   3943 ></A
   3944 ></H3
   3945 ><TABLE
   3946 BORDER="0"
   3947 BGCOLOR="#E0E0E0"
   3948 WIDTH="100%"
   3949 ><TR
   3950 ><TD
   3951 ><PRE
   3952 CLASS="SCREEN"
   3953 ><TT
   3954 CLASS="COMPUTEROUTPUT"
   3955 >#include &#60;rpm/rpmlib.h&#62;
   3956 
   3957 int rpmIsVerbose(void);</TT
   3958 >
   3959           </PRE
   3960 ></TD
   3961 ></TR
   3962 ></TABLE
   3963 ><P
   3964 >            This function checks the current verbosity level and returns
   3965             <SPAN
   3966 CLASS="RETURNVALUE"
   3967 >1</SPAN
   3968 > if the current level is set to
   3969             <SPAN
   3970 CLASS="SYMBOL"
   3971 >RPMMESS_VERBOSE</SPAN
   3972 > or a level of higher verbosity.
   3973             Otherwise, it returns <SPAN
   3974 CLASS="RETURNVALUE"
   3975 >0</SPAN
   3976 >.
   3977           </P
   3978 ></DIV
   3979 ><DIV
   3980 CLASS="SECT3"
   3981 ><H3
   3982 CLASS="SECT3"
   3983 ><A
   3984 NAME="S3-RPM-RPMLIB-RPMISDEBUG"
   3985 >Check Debug Level &#8212; <TT
   3986 CLASS="FUNCTION"
   3987 >rpmIsDebug()</TT
   3988 ></A
   3989 ></H3
   3990 ><TABLE
   3991 BORDER="0"
   3992 BGCOLOR="#E0E0E0"
   3993 WIDTH="100%"
   3994 ><TR
   3995 ><TD
   3996 ><PRE
   3997 CLASS="SCREEN"
   3998 ><TT
   3999 CLASS="COMPUTEROUTPUT"
   4000 >#include &#60;rpm/rpmlib.h&#62;
   4001 
   4002 int rpmIsDebug(void);</TT
   4003 >
   4004           </PRE
   4005 ></TD
   4006 ></TR
   4007 ></TABLE
   4008 ><P
   4009 >            This function checks the current verbosity level and returns
   4010             <SPAN
   4011 CLASS="RETURNVALUE"
   4012 >1</SPAN
   4013 > if the current level is set to
   4014             <SPAN
   4015 CLASS="SYMBOL"
   4016 >RPMMESS_DEBUG</SPAN
   4017 >, or a level of higher verbosity.
   4018             Otherwise, it returns <SPAN
   4019 CLASS="RETURNVALUE"
   4020 >0</SPAN
   4021 >.
   4022           </P
   4023 ></DIV
   4024 ></DIV
   4025 ><DIV
   4026 CLASS="SECT2"
   4027 ><H2
   4028 CLASS="SECT2"
   4029 ><A
   4030 NAME="S2-RPM-RPMLIB-SIGNATURE-VERIFICATION"
   4031 >Signature Verification</A
   4032 ></H2
   4033 ><P
   4034 >          The functions in this section deal with the verification of package
   4035           signatures.  A package file may contain more than one type of
   4036           signature.  For example, a package may contain a signature that
   4037           contains the package's size, as well as a signature that contains
   4038           cryptographically-derived data that can be used to prove the package's
   4039           origin.
   4040         </P
   4041 ><P
   4042 >          Each type of signature has its own tag value.  These tag values are
   4043           defined in <TT
   4044 CLASS="FILENAME"
   4045 >rpmlib.h</TT
   4046 > and are of the form
   4047           <SPAN
   4048 CLASS="SYMBOL"
   4049 >RPMSIGTAG_<TT
   4050 CLASS="REPLACEABLE"
   4051 ><I
   4052 >xxx</I
   4053 ></TT
   4054 ></SPAN
   4055 >, where
   4056           <SPAN
   4057 CLASS="SYMBOL"
   4058 ><TT
   4059 CLASS="REPLACEABLE"
   4060 ><I
   4061 >xxx</I
   4062 ></TT
   4063 ></SPAN
   4064 > is the type of
   4065           signature.
   4066         </P
   4067 ><DIV
   4068 CLASS="SECT3"
   4069 ><H3
   4070 CLASS="SECT3"
   4071 ><A
   4072 NAME="S3-RPM-RPMLIB-RPMVERIFYSIGNATURE"
   4073 >Verify A Package File's Signature &#8212;
   4074             <TT
   4075 CLASS="FUNCTION"
   4076 >rpmVerifySignature()</TT
   4077 ></A
   4078 ></H3
   4079 ><TABLE
   4080 BORDER="0"
   4081 BGCOLOR="#E0E0E0"
   4082 WIDTH="100%"
   4083 ><TR
   4084 ><TD
   4085 ><PRE
   4086 CLASS="SCREEN"
   4087 ><TT
   4088 CLASS="COMPUTEROUTPUT"
   4089 >#include &#60;rpm/rpmlib.h&#62;
   4090 
   4091 int rpmVerifySignature(char *file,
   4092                        int_32 sigTag,
   4093                        void *sig,
   4094                        int count,
   4095                        char *result);</TT
   4096 >
   4097           </PRE
   4098 ></TD
   4099 ></TR
   4100 ></TABLE
   4101 ><P
   4102 >            This function verifies the signature of the package pointed to by
   4103             <TT
   4104 CLASS="PARAMETER"
   4105 ><I
   4106 >file</I
   4107 ></TT
   4108 >.  The result of the verification is
   4109             stored in <TT
   4110 CLASS="PARAMETER"
   4111 ><I
   4112 >result</I
   4113 ></TT
   4114 >, in a format suitable for
   4115             printing.
   4116           </P
   4117 ><P
   4118 >            The <TT
   4119 CLASS="PARAMETER"
   4120 ><I
   4121 >sigTag</I
   4122 ></TT
   4123 > parameter specifies the type of
   4124             signature to be checked.  The <TT
   4125 CLASS="PARAMETER"
   4126 ><I
   4127 >sig</I
   4128 ></TT
   4129 > parameter
   4130             specifies the signature against which the package is to be verified.
   4131             The <TT
   4132 CLASS="PARAMETER"
   4133 ><I
   4134 >count</I
   4135 ></TT
   4136 > parameter specifies the size of the
   4137             signature; at present, this parameter is only used for PGP-based
   4138             signatures.
   4139           </P
   4140 ><P
   4141 >            This function returns the following values:
   4142 
   4143             <P
   4144 ></P
   4145 ><UL
   4146 ><LI
   4147 STYLE="list-style-type: disc"
   4148 ><P
   4149 >                  <SPAN
   4150 CLASS="SYMBOL"
   4151 >RPMSIG_OK</SPAN
   4152 > &#8212; The signature verified
   4153                   correctly.
   4154                 </P
   4155 ></LI
   4156 ><LI
   4157 STYLE="list-style-type: disc"
   4158 ><P
   4159 >                  <SPAN
   4160 CLASS="SYMBOL"
   4161 >RPMSIG_UNKNOWN</SPAN
   4162 > &#8212; The signature type is
   4163                   unknown.
   4164                 </P
   4165 ></LI
   4166 ><LI
   4167 STYLE="list-style-type: disc"
   4168 ><P
   4169 >                  <SPAN
   4170 CLASS="SYMBOL"
   4171 >RPMSIG_BAD</SPAN
   4172 > &#8212; The signature did not
   4173                   verify correctly.
   4174                 </P
   4175 ></LI
   4176 ><LI
   4177 STYLE="list-style-type: disc"
   4178 ><P
   4179 >                  <SPAN
   4180 CLASS="SYMBOL"
   4181 >RPMSIG_NOKEY</SPAN
   4182 > &#8212; The key required to
   4183                   check this signature is not available.
   4184                 </P
   4185 ></LI
   4186 ></UL
   4187 >
   4188           </P
   4189 ></DIV
   4190 ><DIV
   4191 CLASS="SECT3"
   4192 ><H3
   4193 CLASS="SECT3"
   4194 ><A
   4195 NAME="S3-RPM-RPMLIB-RPMFREESIGNATURE"
   4196 >Free Signature Read By <TT
   4197 CLASS="FUNCTION"
   4198 >rpmReadPackageInfo()</TT
   4199 >
   4200             &#8212; <TT
   4201 CLASS="FUNCTION"
   4202 >rpmFreeSignature()</TT
   4203 ></A
   4204 ></H3
   4205 ><TABLE
   4206 BORDER="0"
   4207 BGCOLOR="#E0E0E0"
   4208 WIDTH="100%"
   4209 ><TR
   4210 ><TD
   4211 ><PRE
   4212 CLASS="SCREEN"
   4213 ><TT
   4214 CLASS="COMPUTEROUTPUT"
   4215 >#include &#60;rpm/rpmlib.h&#62;
   4216 #include &#60;rpm/header.h&#62;
   4217 
   4218 void rpmFreeSignature(Header h);</TT
   4219 >
   4220           </PRE
   4221 ></TD
   4222 ></TR
   4223 ></TABLE
   4224 ><P
   4225 >            This function frees the signature <TT
   4226 CLASS="PARAMETER"
   4227 ><I
   4228 >h</I
   4229 ></TT
   4230 >.
   4231           </P
   4232 ></DIV
   4233 ></DIV
   4234 ><DIV
   4235 CLASS="SECT2"
   4236 ><H2
   4237 CLASS="SECT2"
   4238 ><A
   4239 NAME="S2-RPM-RPMLIB-HEADER-MANIPULATION"
   4240 >Header Manipulation</A
   4241 ></H2
   4242 ><P
   4243 >          The header is one of the key data structures in rpmlib.  The functions
   4244           in this section perform basic manipulations of the header.
   4245         </P
   4246 ><P
   4247 >          The header is actually a data structure.  It is not necessary to fully
   4248           understand the actual data structure.  However, it
   4249           <I
   4250 CLASS="EMPHASIS"
   4251 >is</I
   4252 > necessary to understand the basic concepts on
   4253           which the header is based.
   4254         </P
   4255 ><P
   4256 >          The header serves as a kind of miniature database.  The header can be
   4257           searched for specific information, which can be retrieved easily.
   4258           Like a database, the information contained in the header can be of
   4259           varying sizes.
   4260         </P
   4261 ><DIV
   4262 CLASS="SECT3"
   4263 ><H3
   4264 CLASS="SECT3"
   4265 ><A
   4266 NAME="S3-RPM-RPMLIB-HEADERREAD"
   4267 >Read A Header &#8212; <TT
   4268 CLASS="FUNCTION"
   4269 >headerRead()</TT
   4270 ></A
   4271 ></H3
   4272 ><TABLE
   4273 BORDER="0"
   4274 BGCOLOR="#E0E0E0"
   4275 WIDTH="100%"
   4276 ><TR
   4277 ><TD
   4278 ><PRE
   4279 CLASS="SCREEN"
   4280 ><TT
   4281 CLASS="COMPUTEROUTPUT"
   4282 >#include &#60;rpm/rpmlib.h&#62;
   4283 #include &#60;rpm/header.h&#62;
   4284 
   4285 Header headerRead(int fd,
   4286                   int magicp);</TT
   4287 >
   4288           </PRE
   4289 ></TD
   4290 ></TR
   4291 ></TABLE
   4292 ><P
   4293 >            This function reads a header from file <TT
   4294 CLASS="PARAMETER"
   4295 ><I
   4296 >fd</I
   4297 ></TT
   4298 >,
   4299             converting it from network byte order to the host system's byte
   4300             order.  If <TT
   4301 CLASS="PARAMETER"
   4302 ><I
   4303 >magicp</I
   4304 ></TT
   4305 > is defined to be
   4306             <SPAN
   4307 CLASS="SYMBOL"
   4308 >HEADER_MAGIC_YES</SPAN
   4309 >, <TT
   4310 CLASS="FUNCTION"
   4311 >headerRead()</TT
   4312 >
   4313             will expect header magic numbers, and will return an error if they
   4314             are not present.  Likewise, if <TT
   4315 CLASS="PARAMETER"
   4316 ><I
   4317 >magicp</I
   4318 ></TT
   4319 > is
   4320             defined to be <SPAN
   4321 CLASS="SYMBOL"
   4322 >HEADER_MAGIC_NO</SPAN
   4323 >,
   4324             <TT
   4325 CLASS="FUNCTION"
   4326 >headerRead()</TT
   4327 > will not check the header's magic
   4328             numbers, and will return an error if they are present.
   4329           </P
   4330 ><P
   4331 >            On error, this function returns <SPAN
   4332 CLASS="SYMBOL"
   4333 >NULL</SPAN
   4334 >.
   4335           </P
   4336 ></DIV
   4337 ><DIV
   4338 CLASS="SECT3"
   4339 ><H3
   4340 CLASS="SECT3"
   4341 ><A
   4342 NAME="S3-RPM-RPMLIB-HEADERWRITE"
   4343 >Write A Header &#8212; <TT
   4344 CLASS="FUNCTION"
   4345 >headerWrite()</TT
   4346 ></A
   4347 ></H3
   4348 ><TABLE
   4349 BORDER="0"
   4350 BGCOLOR="#E0E0E0"
   4351 WIDTH="100%"
   4352 ><TR
   4353 ><TD
   4354 ><PRE
   4355 CLASS="SCREEN"
   4356 ><TT
   4357 CLASS="COMPUTEROUTPUT"
   4358 >#include &#60;rpm/rpmlib.h&#62;
   4359 #include &#60;rpm/header.h&#62;
   4360 
   4361 void headerWrite(int fd,
   4362                  Header h,
   4363                  int magicp);</TT
   4364 >
   4365           </PRE
   4366 ></TD
   4367 ></TR
   4368 ></TABLE
   4369 ><P
   4370 >            This function writes the header <TT
   4371 CLASS="PARAMETER"
   4372 ><I
   4373 >h</I
   4374 ></TT
   4375 >, to file
   4376             <TT
   4377 CLASS="PARAMETER"
   4378 ><I
   4379 >fd</I
   4380 ></TT
   4381 >, converting it from host byte order to
   4382             network byte order.  If <TT
   4383 CLASS="PARAMETER"
   4384 ><I
   4385 >magicp</I
   4386 ></TT
   4387 > is defined to
   4388             be <SPAN
   4389 CLASS="SYMBOL"
   4390 >HEADER_MAGIC_YES</SPAN
   4391 >,
   4392             <TT
   4393 CLASS="FUNCTION"
   4394 >headerWrite()</TT
   4395 > will add the appropriate magic
   4396             numbers to the header being written.  If
   4397             <TT
   4398 CLASS="PARAMETER"
   4399 ><I
   4400 >magicp</I
   4401 ></TT
   4402 > is defined to be
   4403             <SPAN
   4404 CLASS="SYMBOL"
   4405 >HEADER_MAGIC_NO</SPAN
   4406 >, <TT
   4407 CLASS="FUNCTION"
   4408 >headerWrite()</TT
   4409 >
   4410             will not include magic numbers.
   4411           </P
   4412 ></DIV
   4413 ><DIV
   4414 CLASS="SECT3"
   4415 ><H3
   4416 CLASS="SECT3"
   4417 ><A
   4418 NAME="S3-RPM-RPMLIB-HEADERCOPY"
   4419 >Copy A Header &#8212; <TT
   4420 CLASS="FUNCTION"
   4421 >headerCopy()</TT
   4422 ></A
   4423 ></H3
   4424 ><TABLE
   4425 BORDER="0"
   4426 BGCOLOR="#E0E0E0"
   4427 WIDTH="100%"
   4428 ><TR
   4429 ><TD
   4430 ><PRE
   4431 CLASS="SCREEN"
   4432 ><TT
   4433 CLASS="COMPUTEROUTPUT"
   4434 >#include &#60;rpm/rpmlib.h&#62;
   4435 #include &#60;rpm/header.h&#62;
   4436 
   4437 Header headerCopy(Header h);</TT
   4438 >
   4439           </PRE
   4440 ></TD
   4441 ></TR
   4442 ></TABLE
   4443 ><P
   4444 >            This function returns a copy of header <TT
   4445 CLASS="PARAMETER"
   4446 ><I
   4447 >h</I
   4448 ></TT
   4449 >.
   4450           </P
   4451 ></DIV
   4452 ><DIV
   4453 CLASS="SECT3"
   4454 ><H3
   4455 CLASS="SECT3"
   4456 ><A
   4457 NAME="S3-RPM-RPMLIB-HEADERSIZEOF"
   4458 >Calculate A Header's Size &#8212;
   4459             <TT
   4460 CLASS="FUNCTION"
   4461 >headerSizeof()</TT
   4462 ></A
   4463 ></H3
   4464 ><TABLE
   4465 BORDER="0"
   4466 BGCOLOR="#E0E0E0"
   4467 WIDTH="100%"
   4468 ><TR
   4469 ><TD
   4470 ><PRE
   4471 CLASS="SCREEN"
   4472 ><TT
   4473 CLASS="COMPUTEROUTPUT"
   4474 >#include &#60;rpm/rpmlib.h&#62;
   4475 #include &#60;rpm/header.h&#62;
   4476 
   4477 unsigned int headerSizeof(Header h,
   4478                           int magicp);</TT
   4479 >
   4480           </PRE
   4481 ></TD
   4482 ></TR
   4483 ></TABLE
   4484 ><P
   4485 >            This function returns the number of bytes the header
   4486             <TT
   4487 CLASS="PARAMETER"
   4488 ><I
   4489 >h</I
   4490 ></TT
   4491 > takes up on disk.  Note that in versions of
   4492             RPM prior to 2.3.3, this function also changes the location of the
   4493             data in the header.  The result is that pointers from
   4494             <TT
   4495 CLASS="FUNCTION"
   4496 >headerGetEntry()</TT
   4497 > will no longer be valid.
   4498             Therefore, any pointers acquired before calling
   4499             <TT
   4500 CLASS="FUNCTION"
   4501 >headerSizeof()</TT
   4502 > should be discarded.
   4503           </P
   4504 ></DIV
   4505 ><DIV
   4506 CLASS="SECT3"
   4507 ><H3
   4508 CLASS="SECT3"
   4509 ><A
   4510 NAME="S3-RPM-RPMLIB-HEADERNEW"
   4511 >Create A New Header &#8212; <TT
   4512 CLASS="FUNCTION"
   4513 >headerNew()</TT
   4514 ></A
   4515 ></H3
   4516 ><TABLE
   4517 BORDER="0"
   4518 BGCOLOR="#E0E0E0"
   4519 WIDTH="100%"
   4520 ><TR
   4521 ><TD
   4522 ><PRE
   4523 CLASS="SCREEN"
   4524 ><TT
   4525 CLASS="COMPUTEROUTPUT"
   4526 >#include &#60;rpm/rpmlib.h&#62;
   4527 #include &#60;rpm/header.h&#62;
   4528 
   4529 Header headerNew(void);</TT
   4530 >
   4531           </PRE
   4532 ></TD
   4533 ></TR
   4534 ></TABLE
   4535 ><P
   4536 >            This function returns a new header.
   4537           </P
   4538 ></DIV
   4539 ><DIV
   4540 CLASS="SECT3"
   4541 ><H3
   4542 CLASS="SECT3"
   4543 ><A
   4544 NAME="S3-RPM-RPMLIB-HEADERFREE"
   4545 >Deallocate A Header &#8212; <TT
   4546 CLASS="FUNCTION"
   4547 >headerFree()</TT
   4548 ></A
   4549 ></H3
   4550 ><TABLE
   4551 BORDER="0"
   4552 BGCOLOR="#E0E0E0"
   4553 WIDTH="100%"
   4554 ><TR
   4555 ><TD
   4556 ><PRE
   4557 CLASS="SCREEN"
   4558 ><TT
   4559 CLASS="COMPUTEROUTPUT"
   4560 >#include &#60;rpm/rpmlib.h&#62;
   4561 #include &#60;rpm/header.h&#62;
   4562 
   4563 void headerFree(Header h);</TT
   4564 >
   4565           </PRE
   4566 ></TD
   4567 ></TR
   4568 ></TABLE
   4569 ><P
   4570 >            This function deallocates the header specified by
   4571             <TT
   4572 CLASS="PARAMETER"
   4573 ><I
   4574 >h</I
   4575 ></TT
   4576 >.
   4577           </P
   4578 ></DIV
   4579 ><DIV
   4580 CLASS="SECT3"
   4581 ><H3
   4582 CLASS="SECT3"
   4583 ><A
   4584 NAME="S3-RPM-RPMLIB-HEADERDUMP"
   4585 >Print Header Structure In Human-Readable Form &#8212;
   4586             <TT
   4587 CLASS="FUNCTION"
   4588 >headerDump()</TT
   4589 ></A
   4590 ></H3
   4591 ><TABLE
   4592 BORDER="0"
   4593 BGCOLOR="#E0E0E0"
   4594 WIDTH="100%"
   4595 ><TR
   4596 ><TD
   4597 ><PRE
   4598 CLASS="SCREEN"
   4599 ><TT
   4600 CLASS="COMPUTEROUTPUT"
   4601 >#include &#60;rpm/rpmlib.h&#62;
   4602 #include &#60;rpm/header.h&#62;
   4603 
   4604 void headerDump(Header h,
   4605                 FILE *f,
   4606                 int flags);</TT
   4607 >
   4608           </PRE
   4609 ></TD
   4610 ></TR
   4611 ></TABLE
   4612 ><P
   4613 >            This function prints the structure of the header
   4614             <TT
   4615 CLASS="PARAMETER"
   4616 ><I
   4617 >h</I
   4618 ></TT
   4619 >, to the file <TT
   4620 CLASS="PARAMETER"
   4621 ><I
   4622 >f</I
   4623 ></TT
   4624 >.  If
   4625             the <TT
   4626 CLASS="PARAMETER"
   4627 ><I
   4628 >flags</I
   4629 ></TT
   4630 > parameter is defined to be
   4631             <SPAN
   4632 CLASS="SYMBOL"
   4633 >HEADER_DUMP_INLINE</SPAN
   4634 >, the header's data is also
   4635             printed.
   4636           </P
   4637 ></DIV
   4638 ></DIV
   4639 ><DIV
   4640 CLASS="SECT2"
   4641 ><H2
   4642 CLASS="SECT2"
   4643 ><A
   4644 NAME="S2-RPM-RPMLIB-HEADER-ENTRY-MANIPULATION"
   4645 >Header Entry Manipulation</A
   4646 ></H2
   4647 ><P
   4648 >          The functions in this section provide the basic operations necessary
   4649           to manipulate header entries.  The following header entry types are
   4650           currently defined:
   4651 
   4652           <P
   4653 ></P
   4654 ><UL
   4655 ><LI
   4656 STYLE="list-style-type: disc"
   4657 ><P
   4658 >                <SPAN
   4659 CLASS="SYMBOL"
   4660 >RPM_NULL_TYPE</SPAN
   4661 > &#8212; This type is not used.
   4662               </P
   4663 ></LI
   4664 ><LI
   4665 STYLE="list-style-type: disc"
   4666 ><P
   4667 >                <SPAN
   4668 CLASS="SYMBOL"
   4669 >RPM_CHAR_TYPE</SPAN
   4670 > &#8212; The entry contains a
   4671                 single character.
   4672               </P
   4673 ></LI
   4674 ><LI
   4675 STYLE="list-style-type: disc"
   4676 ><P
   4677 >                <SPAN
   4678 CLASS="SYMBOL"
   4679 >RPM_INT8_TYPE</SPAN
   4680 > &#8212; The entry contains an
   4681                 eight-bit integer.
   4682               </P
   4683 ></LI
   4684 ><LI
   4685 STYLE="list-style-type: disc"
   4686 ><P
   4687 >                <SPAN
   4688 CLASS="SYMBOL"
   4689 >RPM_INT16_TYPE</SPAN
   4690 > &#8212; The entry contains a
   4691                 sixteen-bit integer.
   4692               </P
   4693 ></LI
   4694 ><LI
   4695 STYLE="list-style-type: disc"
   4696 ><P
   4697 >                <SPAN
   4698 CLASS="SYMBOL"
   4699 >RPM_INT32_TYPE</SPAN
   4700 > &#8212; The entry contains a
   4701                 thirty-two-bit integer.
   4702               </P
   4703 ></LI
   4704 ><LI
   4705 STYLE="list-style-type: disc"
   4706 ><P
   4707 >                <SPAN
   4708 CLASS="SYMBOL"
   4709 >RPM_INT64_TYPE</SPAN
   4710 > &#8212; The entry contains a
   4711                 sixty-four-bit integer.
   4712               </P
   4713 ></LI
   4714 ><LI
   4715 STYLE="list-style-type: disc"
   4716 ><P
   4717 >                <SPAN
   4718 CLASS="SYMBOL"
   4719 >RPM_STRING_TYPE</SPAN
   4720 > &#8212; The entry contains a
   4721                 null-terminated character string.
   4722               </P
   4723 ></LI
   4724 ><LI
   4725 STYLE="list-style-type: disc"
   4726 ><P
   4727 >                <SPAN
   4728 CLASS="SYMBOL"
   4729 >RPM_BIN_TYPE</SPAN
   4730 > &#8212; The entry contains binary
   4731                 data that will not be interpreted by rpmlib.
   4732               </P
   4733 ></LI
   4734 ><LI
   4735 STYLE="list-style-type: disc"
   4736 ><P
   4737 >                <SPAN
   4738 CLASS="SYMBOL"
   4739 >RPM_STRING_ARRAY_TYPE</SPAN
   4740 > &#8212; The entry
   4741                 contains an array of null-terminated strings.
   4742               </P
   4743 ></LI
   4744 ></UL
   4745 >
   4746         </P
   4747 ><DIV
   4748 CLASS="SECT3"
   4749 ><H3
   4750 CLASS="SECT3"
   4751 ><A
   4752 NAME="S3-RPM-RPMLIB-HEADERGETENTRY"
   4753 >Get Entry From Header &#8212; <TT
   4754 CLASS="FUNCTION"
   4755 >headerGetEntry()</TT
   4756 ></A
   4757 ></H3
   4758 ><TABLE
   4759 BORDER="0"
   4760 BGCOLOR="#E0E0E0"
   4761 WIDTH="100%"
   4762 ><TR
   4763 ><TD
   4764 ><PRE
   4765 CLASS="SCREEN"
   4766 ><TT
   4767 CLASS="COMPUTEROUTPUT"
   4768 >#include &#60;rpm/rpmlib.h&#62;
   4769 #include &#60;rpm/header.h&#62;
   4770 
   4771 int headerGetEntry(Header h,
   4772                    int_32 tag,
   4773                    int_32 *type,
   4774                    void **p,
   4775                    int_32 *c);</TT
   4776 >
   4777           </PRE
   4778 ></TD
   4779 ></TR
   4780 ></TABLE
   4781 ><P
   4782 >            This function retrieves the entry matching
   4783             <TT
   4784 CLASS="PARAMETER"
   4785 ><I
   4786 >tag</I
   4787 ></TT
   4788 > from header <TT
   4789 CLASS="PARAMETER"
   4790 ><I
   4791 >h</I
   4792 ></TT
   4793 >.
   4794             The type of the entry is returned in <TT
   4795 CLASS="PARAMETER"
   4796 ><I
   4797 >type</I
   4798 ></TT
   4799 >, a
   4800             pointer to the data is returned in <TT
   4801 CLASS="PARAMETER"
   4802 ><I
   4803 >p</I
   4804 ></TT
   4805 >, and the
   4806             size of the data is returned in <TT
   4807 CLASS="PARAMETER"
   4808 ><I
   4809 >c</I
   4810 ></TT
   4811 >.  Both
   4812             <TT
   4813 CLASS="PARAMETER"
   4814 ><I
   4815 >type</I
   4816 ></TT
   4817 > and <TT
   4818 CLASS="PARAMETER"
   4819 ><I
   4820 >c</I
   4821 ></TT
   4822 > may be
   4823             null, in which case that data will not be returned.  Note that if
   4824             the entry type is <SPAN
   4825 CLASS="SYMBOL"
   4826 >RPM_STRING_ARRAY_TYPE</SPAN
   4827 >, you must
   4828             issue a <TT
   4829 CLASS="FUNCTION"
   4830 >free()</TT
   4831 > on <TT
   4832 CLASS="PARAMETER"
   4833 ><I
   4834 >p</I
   4835 ></TT
   4836 > when
   4837             done with the data.
   4838           </P
   4839 ><P
   4840 >            This function returns <SPAN
   4841 CLASS="RETURNVALUE"
   4842 >1</SPAN
   4843 > on sucess, and
   4844             <SPAN
   4845 CLASS="RETURNVALUE"
   4846 >0</SPAN
   4847 > on failure.
   4848           </P
   4849 ></DIV
   4850 ><DIV
   4851 CLASS="SECT3"
   4852 ><H3
   4853 CLASS="SECT3"
   4854 ><A
   4855 NAME="S3-RPM-RPMLIB-HEADERADDENTRY"
   4856 >Add Entry To Header &#8212; <TT
   4857 CLASS="FUNCTION"
   4858 >headerAddEntry()</TT
   4859 ></A
   4860 ></H3
   4861 ><TABLE
   4862 BORDER="0"
   4863 BGCOLOR="#E0E0E0"
   4864 WIDTH="100%"
   4865 ><TR
   4866 ><TD
   4867 ><PRE
   4868 CLASS="SCREEN"
   4869 ><TT
   4870 CLASS="COMPUTEROUTPUT"
   4871 >#include &#60;rpm/rpmlib.h&#62;
   4872 #include &#60;rpm/header.h&#62;
   4873 
   4874 int headerAddEntry(Header h,
   4875                    int_32 tag,
   4876                    int_32 type,
   4877                    void *p,
   4878                    int_32 c);</TT
   4879 >
   4880           </PRE
   4881 ></TD
   4882 ></TR
   4883 ></TABLE
   4884 ><P
   4885 >            This function adds a new entry to the header
   4886             <TT
   4887 CLASS="PARAMETER"
   4888 ><I
   4889 >h</I
   4890 ></TT
   4891 >.  The entry's tag is specified by the
   4892             <TT
   4893 CLASS="PARAMETER"
   4894 ><I
   4895 >tag</I
   4896 ></TT
   4897 > parameter, and the entry's type is
   4898             specified by the <TT
   4899 CLASS="PARAMETER"
   4900 ><I
   4901 >type</I
   4902 ></TT
   4903 > parameter.
   4904           </P
   4905 ><P
   4906 >            The entry's data is pointed to by <TT
   4907 CLASS="PARAMETER"
   4908 ><I
   4909 >p</I
   4910 ></TT
   4911 >, and the
   4912             size of the data is specified by <TT
   4913 CLASS="PARAMETER"
   4914 ><I
   4915 >c</I
   4916 ></TT
   4917 >.
   4918           </P
   4919 ><P
   4920 >            This function always returns <SPAN
   4921 CLASS="RETURNVALUE"
   4922 >1</SPAN
   4923 >.
   4924           </P
   4925 ><P
   4926 >            Note: In versions of RPM prior to 2.3.3,
   4927             <TT
   4928 CLASS="FUNCTION"
   4929 >headerAddEntry()</TT
   4930 > will only work successfully
   4931             with headers produced by <TT
   4932 CLASS="FUNCTION"
   4933 >headerCopy()</TT
   4934 > and
   4935             <TT
   4936 CLASS="FUNCTION"
   4937 >headerNew()</TT
   4938 >.  In particular,
   4939             <TT
   4940 CLASS="FUNCTION"
   4941 >headerAddEntry()</TT
   4942 > is not supported when used to
   4943             add entries to a header produced by
   4944             <TT
   4945 CLASS="FUNCTION"
   4946 >headerRead()</TT
   4947 >.  Later versions of RPM lift this
   4948             restriction.
   4949           </P
   4950 ></DIV
   4951 ><DIV
   4952 CLASS="SECT3"
   4953 ><H3
   4954 CLASS="SECT3"
   4955 ><A
   4956 NAME="S3-RPM-RPMLIB-HEADERISENTRY"
   4957 >Determine If Entry Is In Header &#8212;
   4958             <TT
   4959 CLASS="FUNCTION"
   4960 >headerIsEntry()</TT
   4961 ></A
   4962 ></H3
   4963 ><TABLE
   4964 BORDER="0"
   4965 BGCOLOR="#E0E0E0"
   4966 WIDTH="100%"
   4967 ><TR
   4968 ><TD
   4969 ><PRE
   4970 CLASS="SCREEN"
   4971 ><TT
   4972 CLASS="COMPUTEROUTPUT"
   4973 >#include &#60;rpm/rpmlib.h&#62;
   4974 #include &#60;rpm/header.h&#62;
   4975 
   4976 int headerIsEntry(Header h,
   4977                   int_32 tag);</TT
   4978 >
   4979           </PRE
   4980 ></TD
   4981 ></TR
   4982 ></TABLE
   4983 ><P
   4984 >            This function returns <SPAN
   4985 CLASS="RETURNVALUE"
   4986 >1</SPAN
   4987 > if an entry with
   4988             tag <TT
   4989 CLASS="PARAMETER"
   4990 ><I
   4991 >tag</I
   4992 ></TT
   4993 > is present in header
   4994             <TT
   4995 CLASS="PARAMETER"
   4996 ><I
   4997 >h</I
   4998 ></TT
   4999 >.  If the tag is not present, this function
   5000             returns <SPAN
   5001 CLASS="RETURNVALUE"
   5002 >0</SPAN
   5003 >.
   5004           </P
   5005 ></DIV
   5006 ></DIV
   5007 ><DIV
   5008 CLASS="SECT2"
   5009 ><H2
   5010 CLASS="SECT2"
   5011 ><A
   5012 NAME="S2-RPM-RPMLIB-HEADER-ITERATOR-SUPPORT"
   5013 >Header Iterator Support</A
   5014 ></H2
   5015 ><P
   5016 >          Iterators are used as a means to step from entry to entry, through an
   5017           entire header.  The functions in this section are used to create, use,
   5018           and free iterators.
   5019         </P
   5020 ><DIV
   5021 CLASS="SECT3"
   5022 ><H3
   5023 CLASS="SECT3"
   5024 ><A
   5025 NAME="S3-RPM-RPMLIB-HEADERINITITERATOR"
   5026 >Create an Iterator &#8212; <TT
   5027 CLASS="FUNCTION"
   5028 >headerInitIterator()</TT
   5029 ></A
   5030 ></H3
   5031 ><TABLE
   5032 BORDER="0"
   5033 BGCOLOR="#E0E0E0"
   5034 WIDTH="100%"
   5035 ><TR
   5036 ><TD
   5037 ><PRE
   5038 CLASS="SCREEN"
   5039 ><TT
   5040 CLASS="COMPUTEROUTPUT"
   5041 >#include &#60;rpm/rpmlib.h&#62;
   5042 #include &#60;rpm/header.h&#62;
   5043 
   5044 HeaderIterator headerInitIterator(Header h);</TT
   5045 >
   5046           </PRE
   5047 ></TD
   5048 ></TR
   5049 ></TABLE
   5050 ><P
   5051 >            This function returns a newly-created iterator for the header
   5052             <TT
   5053 CLASS="PARAMETER"
   5054 ><I
   5055 >h</I
   5056 ></TT
   5057 >.
   5058           </P
   5059 ></DIV
   5060 ><DIV
   5061 CLASS="SECT3"
   5062 ><H3
   5063 CLASS="SECT3"
   5064 ><A
   5065 NAME="S3-RPM-RPMLIB-HEADERNEXTITERATOR"
   5066 >Step To the Next Entry &#8212;
   5067             <TT
   5068 CLASS="FUNCTION"
   5069 >headerNextIterator()</TT
   5070 ></A
   5071 ></H3
   5072 ><TABLE
   5073 BORDER="0"
   5074 BGCOLOR="#E0E0E0"
   5075 WIDTH="100%"
   5076 ><TR
   5077 ><TD
   5078 ><PRE
   5079 CLASS="SCREEN"
   5080 ><TT
   5081 CLASS="COMPUTEROUTPUT"
   5082 >#include &#60;rpm/rpmlib.h&#62;
   5083 #include &#60;rpm/header.h&#62;
   5084 
   5085 int headerNextIterator(HeaderIterator iter,
   5086                        int_32 *tag,
   5087                        int_32 *type,
   5088                        void **p,
   5089                        int_32 *c);</TT
   5090 >
   5091           </PRE
   5092 ></TD
   5093 ></TR
   5094 ></TABLE
   5095 ><P
   5096 >            This function steps to the next entry in the header specified when
   5097             the iterator <TT
   5098 CLASS="PARAMETER"
   5099 ><I
   5100 >iter</I
   5101 ></TT
   5102 > was created with
   5103             <TT
   5104 CLASS="FUNCTION"
   5105 >headerInitIterator()</TT
   5106 >.  The next entry's tag,
   5107             type, data, and size are returned in <TT
   5108 CLASS="PARAMETER"
   5109 ><I
   5110 >tag</I
   5111 ></TT
   5112 >,
   5113             <TT
   5114 CLASS="PARAMETER"
   5115 ><I
   5116 >type</I
   5117 ></TT
   5118 >, <TT
   5119 CLASS="PARAMETER"
   5120 ><I
   5121 >p</I
   5122 ></TT
   5123 >, and
   5124             <TT
   5125 CLASS="PARAMETER"
   5126 ><I
   5127 >c</I
   5128 ></TT
   5129 >, respectively.  Note that if the entry type
   5130             is <SPAN
   5131 CLASS="SYMBOL"
   5132 >RPM_STRING_ARRAY_TYPE</SPAN
   5133 >, you must issue a
   5134             <TT
   5135 CLASS="FUNCTION"
   5136 >free()</TT
   5137 > on <TT
   5138 CLASS="PARAMETER"
   5139 ><I
   5140 >p</I
   5141 ></TT
   5142 > when done
   5143             with the data.
   5144           </P
   5145 ><P
   5146 >            This function returns <SPAN
   5147 CLASS="RETURNVALUE"
   5148 >1</SPAN
   5149 > if successful,
   5150             and <SPAN
   5151 CLASS="RETURNVALUE"
   5152 >0</SPAN
   5153 > if there are no more entries in the
   5154             header.
   5155           </P
   5156 ></DIV
   5157 ><DIV
   5158 CLASS="SECT3"
   5159 ><H3
   5160 CLASS="SECT3"
   5161 ><A
   5162 NAME="S3-RPM-RPMLIB-HEADERFREEITERATOR"
   5163 >Free An Iterator &#8212; <TT
   5164 CLASS="FUNCTION"
   5165 >headerFreeIterator()</TT
   5166 ></A
   5167 ></H3
   5168 ><TABLE
   5169 BORDER="0"
   5170 BGCOLOR="#E0E0E0"
   5171 WIDTH="100%"
   5172 ><TR
   5173 ><TD
   5174 ><PRE
   5175 CLASS="SCREEN"
   5176 ><TT
   5177 CLASS="COMPUTEROUTPUT"
   5178 >#include &#60;rpm/rpmlib.h&#62;
   5179 #include &#60;rpm/header.h&#62;
   5180 
   5181 void headerFreeIterator(HeaderIterator iter);</TT
   5182 >
   5183           </PRE
   5184 ></TD
   5185 ></TR
   5186 ></TABLE
   5187 ><P
   5188 >            This function frees the resources used by the iterator
   5189             <TT
   5190 CLASS="PARAMETER"
   5191 ><I
   5192 >iter</I
   5193 ></TT
   5194 >.
   5195           </P
   5196 ></DIV
   5197 ></DIV
   5198 ></DIV
   5199 ><DIV
   5200 CLASS="NAVFOOTER"
   5201 ><HR
   5202 ALIGN="LEFT"
   5203 WIDTH="100%"><TABLE
   5204 WIDTH="100%"
   5205 BORDER="0"
   5206 CELLPADDING="0"
   5207 CELLSPACING="0"
   5208 ><TR
   5209 ><TD
   5210 WIDTH="33%"
   5211 ALIGN="left"
   5212 VALIGN="top"
   5213 ><A
   5214 HREF="ch-rpm-rpmlib.html"
   5215 >Prev</A
   5216 ></TD
   5217 ><TD
   5218 WIDTH="34%"
   5219 ALIGN="center"
   5220 VALIGN="top"
   5221 ><A
   5222 HREF="index.html"
   5223 >Home</A
   5224 ></TD
   5225 ><TD
   5226 WIDTH="33%"
   5227 ALIGN="right"
   5228 VALIGN="top"
   5229 ><A
   5230 HREF="s1-rpm-rpmlib-example-code.html"
   5231 >Next</A
   5232 ></TD
   5233 ></TR
   5234 ><TR
   5235 ><TD
   5236 WIDTH="33%"
   5237 ALIGN="left"
   5238 VALIGN="top"
   5239 >A Guide to the RPM Library API</TD
   5240 ><TD
   5241 WIDTH="34%"
   5242 ALIGN="center"
   5243 VALIGN="top"
   5244 ><A
   5245 HREF="ch-rpm-rpmlib.html"
   5246 >Up</A
   5247 ></TD
   5248 ><TD
   5249 WIDTH="33%"
   5250 ALIGN="right"
   5251 VALIGN="top"
   5252 >Example Code</TD
   5253 ></TR
   5254 ></TABLE
   5255 ></DIV
   5256 ></BODY
   5257 ></HTML
   5258 >