# lib/misc.h

Go to the documentation of this file.

    00001 #ifndef H_MISC
    00002 #define H_MISC
    00003
    00009 #ifdef __cplusplus
    00010 extern "C" {
    00011 #endif
    00012
    00020 /*@only@*/ char ** splitString(const char * str, int length, char sep)
    00021         /*@*/;
    00022
    00027 void freeSplitString( /*@only@*/ char ** list)
    00028         /*@modifies list @*/;
    00029
    00036 /*@unused@*/ static inline
    00037 /*@only@*/ char * stripTrailingChar(/*@only@*/ char * s, char c)
    00038         /*@modifies *s */
    00039 {
    00040     char * t;
    00041     for (t = s + strlen(s) - 1; *t == c && t >= s; t--)
    00042         *t = '\0';
    00043     return s;
    00044 }
    00045
    00053 int dosetenv(const char * name, const char * value, int overwrite)
    00054         /*@globals environ@*/
    00055         /*@modifies *environ @*/;
    00056
    00062 int doputenv(const char * str)
    00063         /*@globals environ@*/
    00064         /*@modifies *environ @*/;
    00065
    00079 int makeTempFile(/*@null@*/ const char * prefix,
    00080                 /*@null@*/ /*@out@*/ const char ** fnptr,
    00081                 /*@out@*/ FD_t * fdptr)
    00082         /*@globals rpmGlobalMacroContext,
    00083                 fileSystem, internalState @*/
    00084         /*@modifies *fnptr, *fdptr, rpmGlobalMacroContext,
    00085                 fileSystem, internalState @*/;
    00086
    00091 /*@only@*/ char * currentDirectory(void)
    00092         /*@globals fileSystem @*/
    00093         /*@modifies fileSystem @*/;
    00094
    00099 void compressFilelist(Header h)
    00100         /*@modifies h @*/;
    00101
    00106 void expandFilelist(Header h)
    00107         /*@modifies h @*/;
    00108
    00112 void buildOrigFileList(Header h, /*@out@*/ const char *** fileListPtr,
    00113                         /*@out@*/ int * fileCountPtr)
    00114         /*@modifies *fileListPtr, *fileCountPtr @*/;
    00115
    00118 /*@-exportlocal@*/
    00119 int myGlobPatternP (const char *patternURL)
    00120         /*@*/;
    00121 /*@=exportlocal@*/
    00122
    00125 int rpmGlob(const char * patterns, /*@out@*/ int * argcPtr,
    00126                 /*@out@*/ const char *** argvPtr)
    00127         /*@globals fileSystem @*/
    00128         /*@modifies *argcPtr, *argvPtr, fileSystem @*/;
    00129
    00135 void providePackageNVR(Header h)
    00136         /*@modifies h @*/;
    00137
    00146 /*@-exportlocal@*/
    00147 int domd5(const char * fn, /*@out@*/ unsigned char * digest, int asAscii)
    00148         /*@globals fileSystem@*/
    00149         /*@modifies digest, fileSystem @*/;
    00150 /*@=exportlocal@*/
    00151
    00159 /*@unused@*/ static inline
    00160 int mdfile(const char * fn, /*@out@*/ unsigned char * digest)
    00161         /*@globals fileSystem@*/
    00162         /*@modifies digest, fileSystem @*/
    00163 {
    00164     return domd5(fn, digest, 1);
    00165 }
    00166
    00174 /*@unused@*/ static inline
    00175 int mdbinfile(const char * fn, /*@out@*/ unsigned char * bindigest)
    00176         /*@globals fileSystem@*/
    00177         /*@modifies bindigest, fileSystem @*/
    00178 {
    00179     return domd5(fn, bindigest, 0);
    00180 }
    00181
    00182 #ifdef __cplusplus
    00183 }
    00184 #endif
    00185
    00186 #endif  /* H_MISC */