Sophie

Sophie

distrib > Mageia > 1 > i586 > media > core-updates-src > by-pkgid > 7909056b8d318a670bd2044d8ef97cd5 > files > 12

links-2.2-10.1.mga1.src.rpm

diff -p -up links-2.2/bookmarks.c.convert-old-bookmarks-in-new-format links-2.2/bookmarks.c
--- links-2.2/bookmarks.c.convert-old-bookmarks-in-new-format	2008-08-01 00:02:23.000000000 +0200
+++ links-2.2/bookmarks.c	2009-08-17 16:30:41.000000000 +0200
@@ -722,6 +722,18 @@ void init_bookmarks(void)
 	if (!*bookmarks_file)
 		snprintf(bookmarks_file,MAX_STR_LEN,"%sbookmarks.html",links_home?links_home:(unsigned char*)"");
 
+	/* try to create bookmarks.html based on old bookmarks (from links <= 0.97) */
+	if (access(bookmarks_file, R_OK) != 0) {
+	  char *prev;
+	  if ((prev = get_current_dir_name()) && chdir(links_home) == 0) {
+	    if (access("bookmarks", R_OK) == 0 && access("/usr/bin/perl", X_OK) == 0) {
+	      system("/usr/bin/perl -lne '@l = split(q(\\|)); print qq(<dt><a href=\"$l[1]\">$l[0]</a>)' bookmarks > bookmarks.html");
+	    }
+	    chdir(prev);
+	    free(prev);
+	  }
+	}
+
 	bookmark_ld.codepage=get_cp_index("utf-8");
 	load_bookmarks();
 }