Package: hnb
Version: 1.9.18-3.1
Severity: normal

The default format for autosave is a binary dump of the working
document. Unfortunately, this does not always work very well and
occasionally the recovery file would be empty. Additionally, one could
not simply do a diff of the recover file and the save file in order to
check for differences.

Lastly, the autosave file uses a non-standard naming convention causing
CVS and Nautilus not ignore the recovery file. Something like 
"#filename.hnb#" would follow the more common naming convention.

Attached is a patch that:

* saves recovery files in hnb's native format to prevent binary
  corruption.
* names recovery files "#file.hnb#" instead of "file.hnb_hnb_rescue"

-- System Information:
Debian Release: testing/unstable
  APT prefers testing
  APT policy: (700, 'testing')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.14
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)

Versions of packages hnb depends on:
ii  libc6                         2.3.5-6    GNU C Library: Shared libraries an
ii  libncurses5                   5.4-9      Shared libraries for terminal hand

hnb recommends no packages.

-- no debconf information
diff -Naur original/hnb-1.9.18/src/autosave.c hnb-1.9.18/src/autosave.c
--- original/hnb-1.9.18/src/autosave.c	2005-11-20 11:45:03.000000000 -0500
+++ hnb-1.9.18/src/autosave.c	2005-11-20 11:12:41.000000000 -0500
@@ -38,7 +38,7 @@
 		{
 			char buf[4096];
 			
-			sprintf (buf, "export_binary %s_hnb_rescue", prefs.db_file);		
+			sprintf (buf, "export_hnb #%s#", prefs.db_file);		
 			docmd (node_root(pos), buf);
 			cli_outfunf("autosaved, %i nodes changed\n",nodes_changed);
 		}
diff -Naur original/hnb-1.9.18/src/file.c hnb-1.9.18/src/file.c
--- original/hnb-1.9.18/src/file.c	2005-11-20 11:45:03.000000000 -0500
+++ hnb-1.9.18/src/file.c	2005-11-20 11:23:43.000000000 -0500
@@ -164,7 +164,7 @@
 			char buf[4096];
 			char swapfile[4096];
 
-			sprintf(swapfile,"%s_hnb_rescue",prefs.db_file);
+			sprintf(swapfile,"#%s#",prefs.db_file);
 			remove(swapfile);
 			docmd (pos, "autosave_threshold_nodes_changed 0");
 
diff -Naur original/hnb-1.9.18/src/hnb.c hnb-1.9.18/src/hnb.c
--- original/hnb-1.9.18/src/hnb.c	2003-08-26 22:50:58.000000000 -0400
+++ hnb-1.9.18/src/hnb.c	2005-11-20 11:39:11.000000000 -0500
@@ -239,7 +239,7 @@
 	   	  stat(prefs.db_file, &statbuf);
 		  file_modified=statbuf.st_ctime;
 		  
-		  sprintf(recovery_file, "%s_hnb_rescue", prefs.db_file);
+		  sprintf(recovery_file, "#%s#", prefs.db_file);
 		  tfile = fopen(recovery_file, "r");
 		  if(tfile){
 			  char response[1024]="_";
@@ -314,7 +314,7 @@
 		{
 			char buf[4096];
 			if(recover)
-			sprintf (buf, "import_binary %s", file_to_load);
+			sprintf (buf, "import_hnb %s", file_to_load);
 			else
 			sprintf (buf, "import_%s %s", prefs.format,  file_to_load);
 

Reply via email to