upgrade rpm version to 4.14.1
[platform/upstream/rpm.git] / build / rpmbuild_misc.h
1 #ifndef _RPMBUILD_MISC_H
2 #define _RPMBUILD_MISC_H
3
4 #include <sys/types.h>
5 #include <rpm/rpmtypes.h>
6 #include <rpm/rpmds.h>
7
8 #ifdef __cplusplus
9 extern "C" {
10 #endif
11
12 /** \ingroup rpmbuild
13  * Truncate comment lines.
14  * @param s             skip white space, truncate line at '#'
15  * @return              1 on comment lines, 0 otherwise
16  */
17 RPM_GNUC_INTERNAL
18 int handleComments(char * s);
19
20 /** \ingroup rpmstring
21  */
22 typedef struct StringBufRec *StringBuf;
23
24 /** \ingroup rpmstring
25  */
26 RPM_GNUC_INTERNAL
27 StringBuf newStringBuf(void);
28
29 /** \ingroup rpmstring
30  */
31 RPM_GNUC_INTERNAL
32 StringBuf freeStringBuf( StringBuf sb);
33
34 /** \ingroup rpmstring
35  */
36 RPM_GNUC_INTERNAL
37 const char * getStringBuf(StringBuf sb);
38
39 /** \ingroup rpmstring
40  */
41 RPM_GNUC_INTERNAL
42 void stripTrailingBlanksStringBuf(StringBuf sb);
43
44 /** \ingroup rpmstring
45  */
46 #define appendStringBuf(sb, s)     appendStringBufAux(sb, s, 0)
47
48 /** \ingroup rpmstring
49  */
50 #define appendLineStringBuf(sb, s) appendStringBufAux(sb, s, 1)
51
52 /** \ingroup rpmstring
53  */
54 RPM_GNUC_INTERNAL
55 void appendStringBufAux(StringBuf sb, const char * s, int nl);
56
57 /** \ingroup rpmbuild
58  * Parse an unsigned number.
59  * @param               line from spec file
60  * @retval res          pointer to uint32_t
61  * @return              0 on success, 1 on failure
62  */
63 RPM_GNUC_INTERNAL
64 uint32_t parseUnsignedNum(const char * line, uint32_t * res);
65
66 #ifdef __cplusplus
67 }
68 #endif
69
70 #endif /* _RPMBUILD_MISC_H */