aboutsummaryrefslogtreecommitdiffstats
path: root/jnlib
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2003-11-17 12:20:11 +0000
committerWerner Koch <[email protected]>2003-11-17 12:20:11 +0000
commitfbb2d9de15df27c26a1c17fbd714c54597e92677 (patch)
tree1db0b1145a5113c06cb88aefcf6d610f1804570d /jnlib
parent2003-11-16 Moritz Schulte <[email protected]> (diff)
downloadgnupg-fbb2d9de15df27c26a1c17fbd714c54597e92677.tar.gz
gnupg-fbb2d9de15df27c26a1c17fbd714c54597e92677.zip
Preparing for 1.9.2 release.V1-9-2
Diffstat (limited to 'jnlib')
-rw-r--r--jnlib/ChangeLog6
-rw-r--r--jnlib/dotlock.c16
-rw-r--r--jnlib/strlist.c65
-rw-r--r--jnlib/strlist.h2
4 files changed, 67 insertions, 22 deletions
diff --git a/jnlib/ChangeLog b/jnlib/ChangeLog
index 7888ff18d..e12dd8e00 100644
--- a/jnlib/ChangeLog
+++ b/jnlib/ChangeLog
@@ -1,3 +1,9 @@
+2003-11-13 Werner Koch <[email protected]>
+
+ * strlist.c (strlist_copy): New.
+
+ * dotlock.c: Define DIRSEP_C et al. if not defined.
+
2003-11-06 Werner Koch <[email protected]>
* strlist.h (strlist_t): New. STRLIST is now deprecated.
diff --git a/jnlib/dotlock.c b/jnlib/dotlock.c
index 7240fafeb..a50a0ee99 100644
--- a/jnlib/dotlock.c
+++ b/jnlib/dotlock.c
@@ -37,6 +37,22 @@
#include "libjnlib-config.h"
#include "dotlock.h"
+#if !defined(DIRSEP_C) && !defined(EXTSEP_C) \
+ && !defined(DIRSEP_S) && !defined(EXTSEP_S)
+#ifdef HAVE_DOSISH_SYSTEM
+#define DIRSEP_C '\\'
+#define EXTSEP_C '.'
+#define DIRSEP_S "\\"
+#define EXTSEP_S "."
+#else
+#define DIRSEP_C '/'
+#define EXTSEP_C '.'
+#define DIRSEP_S "/"
+#define EXTSEP_S "."
+#endif
+#endif
+
+
struct dotlock_handle {
struct dotlock_handle *next;
char *tname; /* name of lockfile template */
diff --git a/jnlib/strlist.c b/jnlib/strlist.c
index 063c89c7e..49b510666 100644
--- a/jnlib/strlist.c
+++ b/jnlib/strlist.c
@@ -29,9 +29,9 @@
void
-free_strlist( STRLIST sl )
+free_strlist( strlist_t sl )
{
- STRLIST sl2;
+ strlist_t sl2;
for(; sl; sl = sl2 ) {
sl2 = sl->next;
@@ -40,10 +40,10 @@ free_strlist( STRLIST sl )
}
-STRLIST
-add_to_strlist( STRLIST *list, const char *string )
+strlist_t
+add_to_strlist( strlist_t *list, const char *string )
{
- STRLIST sl;
+ strlist_t sl;
sl = jnlib_xmalloc( sizeof *sl + strlen(string));
sl->flags = 0;
@@ -58,10 +58,10 @@ add_to_strlist( STRLIST *list, const char *string )
* same as add_to_strlist() but if is_utf8 is *not* set a conversion
* to UTF8 is done
*/
-STRLIST
-add_to_strlist2( STRLIST *list, const char *string, int is_utf8 )
+strlist_t
+add_to_strlist2( strlist_t *list, const char *string, int is_utf8 )
{
- STRLIST sl;
+ strlist_t sl;
if( is_utf8 )
sl = add_to_strlist( list, string );
@@ -74,10 +74,10 @@ add_to_strlist2( STRLIST *list, const char *string, int is_utf8 )
}
#endif
-STRLIST
-append_to_strlist( STRLIST *list, const char *string )
+strlist_t
+append_to_strlist( strlist_t *list, const char *string )
{
- STRLIST r, sl;
+ strlist_t r, sl;
sl = jnlib_xmalloc( sizeof *sl + strlen(string));
sl->flags = 0;
@@ -94,10 +94,10 @@ append_to_strlist( STRLIST *list, const char *string )
}
#if 0
-STRLIST
-append_to_strlist2( STRLIST *list, const char *string, int is_utf8 )
+strlist_t
+append_to_strlist2( strlist_t *list, const char *string, int is_utf8 )
{
- STRLIST sl;
+ strlist_t sl;
if( is_utf8 )
sl = append_to_strlist( list, string );
@@ -110,18 +110,40 @@ append_to_strlist2( STRLIST *list, const char *string, int is_utf8 )
}
#endif
-STRLIST
-strlist_prev( STRLIST head, STRLIST node )
+
+/* Return a copy of LIST. */
+strlist_t
+strlist_copy (strlist_t list)
+{
+ strlist_t newlist = NULL, sl, *last;
+
+ last = &newlist;
+ for (; list; list = list->next)
+ {
+ sl = jnlib_xmalloc (sizeof *sl + strlen (list->d));
+ sl->flags = list->flags;
+ strcpy(sl->d, list->d);
+ sl->next = NULL;
+ *last = sl;
+ last = &sl;
+ }
+ return newlist;
+}
+
+
+
+strlist_t
+strlist_prev( strlist_t head, strlist_t node )
{
- STRLIST n;
+ strlist_t n;
for(n=NULL; head && head != node; head = head->next )
n = head;
return n;
}
-STRLIST
-strlist_last( STRLIST node )
+strlist_t
+strlist_last( strlist_t node )
{
if( node )
for( ; node->next ; node = node->next )
@@ -131,10 +153,10 @@ strlist_last( STRLIST node )
char *
-strlist_pop (STRLIST *list)
+strlist_pop (strlist_t *list)
{
char *str=NULL;
- STRLIST sl=*list;
+ strlist_t sl=*list;
if(sl)
{
@@ -148,4 +170,3 @@ strlist_pop (STRLIST *list)
return str;
}
-
diff --git a/jnlib/strlist.h b/jnlib/strlist.h
index ea459d006..72da241bc 100644
--- a/jnlib/strlist.h
+++ b/jnlib/strlist.h
@@ -37,6 +37,8 @@ strlist_t add_to_strlist (strlist_t *list, const char *string);
strlist_t append_to_strlist (strlist_t *list, const char *string);
+strlist_t strlist_copy (strlist_t list);
+
/*strlist_t append_to_strlist2( strlist_t *list, const char *string,
int is_utf8);*/
strlist_t strlist_prev (strlist_t head, strlist_t node);