Package: remind
Version: 03.01.05-2
Severity: normal
Tags: patch

Hi.

putting "INCLUDE ~/.somethingelse" into ~/.reminders yields
".reminders(1): Can't open file: ~/.somethingelse" when executing
remind -c .reminders.

this seems like a bug to me, since ~ is where a user probably wants to
put his reminders...

the attached patch simply replaces ^~ by $HOME just before fopen is
called. i hope it's not too much a hack...

regards
felix

-- System Information:
Debian Release: squeeze/sid
  APT prefers testing
  APT policy: (990, 'testing'), (500, 'unstable'), (500, 'stable')
Architecture: i386 (i686)

Kernel: Linux 2.6.30-7-owl (SMP w/2 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages remind depends on:
ii  libc6                         2.10.2-6   Embedded GNU C Library: Shared lib

remind recommends no packages.

Versions of packages remind suggests:
ii  tkremind                      03.01.05-2 Tk GUI interface to remind
ii  wyrd                          1.4.4-1    text-based calendar application

-- no debconf information
--- src.orig/files.c	2008-03-25 04:12:37.000000000 +0100
+++ src/files.c	2010-06-02 00:53:33.715406754 +0200
@@ -1,3 +1,4 @@
+//  vim:ts=8:sw=4:
 /***************************************************************/
 /*                                                             */
 /*  FILES.C                                                    */
@@ -239,8 +240,18 @@ int OpenFile(char const *fname)
 	if (DebugFlag & DB_TRACE_FILES) {
 	    fprintf(ErrFp, "Reading `-': Reading stdin\n");
 	}
+/* Resolve tilde */
     } else {
-	fp = fopen(fname, "r");
+	if( fname[0] == '~' ) { 
+	    char* home = getenv("HOME");
+	    int n = strlen(fname) + strlen(home);
+	    char* fnametmp = (char*) malloc( n*sizeof(char) );
+	    sprintf( fnametmp, "%s%s", home, fname+1 );
+	    fp = fopen(fnametmp, "r");
+	    free(fnametmp);
+	} else {
+	    fp = fopen(fname, "r");
+	}
 	if (DebugFlag & DB_TRACE_FILES) {
 	    fprintf(ErrFp, "Reading `%s': Opening file on disk\n", fname);
 	}

Reply via email to