rpm  4.18.0
rpmfileutil.h
Go to the documentation of this file.
1 #ifndef _RPMFILEUTIL_H
2 #define _RPMFILEUTIL_H
3 
9 #include <rpm/rpmutil.h>
10 #include <rpm/rpmio.h>
11 #include <rpm/argv.h>
12 
13 #ifdef __cplusplus
14 extern "C" {
15 #endif
16 
19 typedef enum rpmCompressedMagic_e {
30  COMPRESSED_ZSTD = 10
32 
41 int rpmDoDigest(int algo, const char * fn,int asAscii, unsigned char * digest);
42 
48 FD_t rpmMkTemp(char *templ);
49 
60 FD_t rpmMkTempFile(const char * prefix, char **fn);
61 
70 int rpmioMkpath(const char * path, mode_t mode, uid_t uid, gid_t gid);
71 
80 int rpmMkdirs(const char *root, const char *pathstr);
81 
87 char * rpmCleanPath (char * path);
88 
99 char * rpmGenPath (const char * urlroot,
100  const char * urlmdir,
101  const char * urlfile);
102 
108 char * rpmGetPath (const char * path, ...) RPM_GNUC_NULL_TERMINATED;
109 
116 int rpmIsGlob(const char * pattern, int quote);
117 
125 int rpmGlob(const char * patterns, int * argcPtr, ARGV_t * argvPtr);
126 
132 char * rpmEscapeSpaces(const char * s);
133 
140 int rpmFileIsCompressed (const char * file, rpmCompressedMagic * compressed);
141 
148 int rpmFileHasSuffix(const char *path, const char *suffix);
149 
154 char * rpmGetCwd(void);
155 
156 #ifdef __cplusplus
157 }
158 #endif
159 #endif /* _RPMFILEUTIL_H */
Argument Manipulation API.
char ** ARGV_t
Definition: argv.h:17
char * rpmEscapeSpaces(const char *s)
Escape isspace(3) characters in string.
char * rpmGetPath(const char *path,...) RPM_GNUC_NULL_TERMINATED
Return (malloc'ed) expanded, canonicalized, file path.
int rpmIsGlob(const char *pattern, int quote)
Check whether pattern contains any glob metacharacters.
char * rpmCleanPath(char *path)
Canonicalize file path.
FD_t rpmMkTempFile(const char *prefix, char **fn)
Return file handle for a temporaray file.
int rpmFileIsCompressed(const char *file, rpmCompressedMagic *compressed)
Return type of compression used in file.
int rpmioMkpath(const char *path, mode_t mode, uid_t uid, gid_t gid)
Insure that directories in path exist, creating as needed.
enum rpmCompressedMagic_e rpmCompressedMagic
int rpmGlob(const char *patterns, int *argcPtr, ARGV_t *argvPtr)
Return URL path(s) from a (URL prefixed) pattern glob.
rpmCompressedMagic_e
Definition: rpmfileutil.h:19
char * rpmGenPath(const char *urlroot, const char *urlmdir, const char *urlfile)
Merge 3 args into path, any or all of which may be a url.
int rpmDoDigest(int algo, const char *fn, int asAscii, unsigned char *digest)
Calculate a file digest and size.
FD_t rpmMkTemp(char *templ)
Thin wrapper for mkstemp(3).
char * rpmGetCwd(void)
Like getcwd() but the result is malloced.
int rpmMkdirs(const char *root, const char *pathstr)
Create several directories (including parents if needed) in one go.
int rpmFileHasSuffix(const char *path, const char *suffix)
Check if path (string) ends with given suffix.
@ COMPRESSED_OTHER
Definition: rpmfileutil.h:21
@ COMPRESSED_ZIP
Definition: rpmfileutil.h:23
@ COMPRESSED_XZ
Definition: rpmfileutil.h:25
@ COMPRESSED_NOT
Definition: rpmfileutil.h:20
@ COMPRESSED_ZSTD
Definition: rpmfileutil.h:30
@ COMPRESSED_LZIP
Definition: rpmfileutil.h:26
@ COMPRESSED_7ZIP
Definition: rpmfileutil.h:28
@ COMPRESSED_LRZIP
Definition: rpmfileutil.h:27
@ COMPRESSED_LZMA
Definition: rpmfileutil.h:24
@ COMPRESSED_BZIP2
Definition: rpmfileutil.h:22
@ COMPRESSED_GEM
Definition: rpmfileutil.h:29
struct _FD_s * FD_t
RPM IO file descriptor type.
Definition: rpmtypes.h:99
RPM I/O API (Fd_t is RPM equivalent to libc's FILE)
Miscellaneous utility macros:
#define RPM_GNUC_NULL_TERMINATED
Definition: rpmutil.h:49