Perl bindings need
[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 #ifdef __cplusplus
8 extern "C" {
9 #endif
10
11 char ** splitString(const char * str, int length, char sep);
12 void freeSplitString(char ** list);
13 void stripTrailingSlashes(char * str);
14
15 int rpmfileexists(const char * filespec);
16
17 int rpmvercmp(const char * one, const char * two);
18
19 /* these are like the normal functions, but they malloc() the space which
20    is needed */
21 int dosetenv(const char *name, const char *value, int overwrite);
22 int doputenv(const char * str);
23
24 /* These may be called w/ a NULL argument to flush the cache -- they return
25    -1 if the user can't be found */
26 int unameToUid(char * thisUname, uid_t * uid);
27 int gnameToGid(char * thisGname, gid_t * gid);
28
29 /* Call w/ -1 to flush the cache, returns NULL if the user can't be found */
30 char * uidToUname(uid_t uid);
31 char * gidToGname(gid_t gid);
32
33 int makeTempFile(const char * prefix, /*@out@*/const char ** fnptr, /*@out@*/FD_t * fdptr);
34 char * currentDirectory(void);          /* result needs to be freed */
35
36 #ifdef __cplusplus
37 }
38 #endif
39
40 #endif  /* H_MISC */