#include "buildio.h"
#include "legacy.h" /* XXX domd5, expandFileList, compressFileList */
-#include "misc.h" /* for splitString, freeSplitString */
#include <rpmlog.h>
#include "debug.h"
#include <rpmbuild.h>
#include <rpmlog.h>
-#include "misc.h" /* XXX for splitString */
#include "debug.h"
/* These have to be global to make up for stupid compilers */
return RPMRC_OK;
}
-char ** splitString(const char * str, int length, char sep)
-{
- const char * source;
- char * s, * dest;
- char ** list;
- int i;
- int fields;
-
- s = xmalloc(length + 1);
-
- fields = 1;
- for (source = str, dest = s, i = 0; i < length; i++, source++, dest++) {
- *dest = *source;
- if (*dest == sep) fields++;
- }
-
- *dest = '\0';
-
- list = xmalloc(sizeof(*list) * (fields + 1));
-
- dest = s;
- list[0] = dest;
- i = 1;
- while (i < fields) {
- if (*dest == sep) {
- list[i++] = dest + 1;
- *dest = 0;
- }
- dest++;
- }
-
- list[i] = NULL;
-
-/* FIX: list[i] is NULL */
- return list;
-}
-
-void freeSplitString(char ** list)
-{
- list[0] = _free(list[0]);
- list = _free(list);
-}
-
int doputenv(const char *str)
{
char * a;
rpmRC rpmMkdirPath (const char * dpath, const char * dname);
/**
- * Split string into fields separated by a character.
- * @param str string
- * @param length length of string
- * @param sep separator character
- * @return (malloc'd) argv array
- */
-char ** splitString(const char * str, int length, char sep);
-
-/**
- * Free split string argv array.
- * @param list argv array
- */
-void freeSplitString( char ** list);
-
-/**
- * Remove occurences of trailing character from string.
- * @param s string
- * @param c character to strip
- * @return string
- */
-static inline
-char * stripTrailingChar(char * s, char c)
-{
- char * t;
- for (t = s + strlen(s) - 1; *t == c && t >= s; t--)
- *t = '\0';
- return s;
-}
-
-/**
* Like the libc function, but malloc()'s the space needed.
* @param name variable name
* @param value variable value
#include <rpmts.h>
#include "legacy.h" /* XXX domd5 */
-#include "misc.h" /* XXX stripTrailingChar */
+#include <rpmstring.h>
#include <rpmmacro.h> /* XXX rpmCleanPath */
#include "debug.h"
#include "cpio.h"
#include "fprint.h"
#include "legacy.h" /* XXX domd5 */
-#include "misc.h" /* XXX (free)splitString, currentDirectory */
+#include <rpmstring.h>
+#include "misc.h" /* currentDirectory */
#include "debug.h"
#include "rpmio_internal.h" /* XXX fdInitDigest, fdFiniDigest */
#include <rpmlib.h>
#include <rpmmacro.h>
-#include "misc.h" /* XXX stripTrailingChar */
+#include <rpmstring.h>
#include "legacy.h"
#include "debug.h"
return (c == ' ' || c == '\t' || c == '\n' || c == '\r' || c == '\f' || c == '\v');
}
+char * stripTrailingChar(char * s, char c)
+{
+ char * t;
+ for (t = s + strlen(s) - 1; *t == c && t >= s; t--)
+ *t = '\0';
+ return s;
+}
+
+char ** splitString(const char * str, int length, char sep)
+{
+ const char * source;
+ char * s, * dest;
+ char ** list;
+ int i;
+ int fields;
+
+ s = xmalloc(length + 1);
+
+ fields = 1;
+ for (source = str, dest = s, i = 0; i < length; i++, source++, dest++) {
+ *dest = *source;
+ if (*dest == sep) fields++;
+ }
+
+ *dest = '\0';
+
+ list = xmalloc(sizeof(*list) * (fields + 1));
+
+ dest = s;
+ list[0] = dest;
+ i = 1;
+ while (i < fields) {
+ if (*dest == sep) {
+ list[i++] = dest + 1;
+ *dest = 0;
+ }
+ dest++;
+ }
+
+ list[i] = NULL;
+
+/* FIX: list[i] is NULL */
+ return list;
+}
+
+void freeSplitString(char ** list)
+{
+ list[0] = _free(list[0]);
+ list = _free(list);
+}
+
StringBuf newStringBuf(void)
{
StringBuf sb = xmalloc(sizeof(*sb));
#endif
/**
+ * Split string into fields separated by a character.
+ * @param str string
+ * @param length length of string
+ * @param sep separator character
+ * @return (malloc'd) argv array
+ */
+char ** splitString(const char * str, int length, char sep);
+
+/**
+ * Free split string argv array.
+ * @param list argv array
+ */
+void freeSplitString( char ** list);
+
+/**
+ * Remove occurences of trailing character from string.
+ * @param s string
+ * @param c character to strip
+ * @return string
+ */
+char * stripTrailingChar(char * s, char c);
+
+/**
*/
typedef struct StringBufRec *StringBuf;