got installs/removes working with new file lists
[platform/upstream/rpm.git] / lib / misc.h
1 #ifndef H_MISC
2 #define H_MISC
3
4 #include <unistd.h>
5 #include <sys/types.h>
6
7 #include "header.h"
8
9 #ifdef __cplusplus
10 extern "C" {
11 #endif
12
13 /*@only@*/ char ** splitString(const char * str, int length, char sep);
14 void freeSplitString( /*@only@*/ char ** list);
15 void stripTrailingSlashes(char * str);
16
17 int rpmfileexists(const char * filespec);
18
19 int rpmvercmp(const char * one, const char * two);
20
21 /* these are like the normal functions, but they malloc() the space which
22    is needed */
23 int dosetenv(const char *name, const char *value, int overwrite);
24 int doputenv(const char * str);
25
26 /* These may be called w/ a NULL argument to flush the cache -- they return
27    -1 if the user can't be found */
28 int unameToUid(const char * thisUname, /*@out@*/ uid_t * uid);
29 int gnameToGid(const char * thisGname, /*@out@*/ gid_t * gid);
30
31 /* Call w/ -1 to flush the cache, returns NULL if the user can't be found */
32 /*@observer@*/ /*@null@*/ char * uidToUname(uid_t uid);
33 /*@observer@*/ /*@null@*/ char * gidToGname(gid_t gid);
34
35 int makeTempFile(const char * prefix, /*@out@*/ const char ** fnptr,
36         /*@out@*/ FD_t * fdptr);
37 char * currentDirectory(void);          /* result needs to be freed */
38 void compressFilelist(Header h);
39 void buildFileList(Header h, /*@out@*/ char *** fileListPtr, 
40                     /*@out@*/ int * fileCountPtr);
41 void buildOrigFileList(Header h, /*@out@*/ char *** fileListPtr, 
42                         /*@out@*/ int * fileCountPtr);
43
44 #ifdef __cplusplus
45 }
46 #endif
47
48 #endif  /* H_MISC */