Hi, * Martin Schulze <[EMAIL PROTECTED]> [2005-05-13 09:58]: > Nico Golde wrote: > > Package: screen > > Version: 4.0.2-4.1 > > Severity: wishlist > > Tags: patch > > Hi, > > screen isn't able to handle ~/ if you want to load a > > configuration file via source in the command line. > > I hate this because it is short and good :) > > However, I attached a patch which fixes this. > > Please include it. > > Please don't. > > At least not literally.
[...] I reworked the patch. Have a look at the attachment, I hope this is secure. Regards Nico -- Nico Golde - [EMAIL PROTECTED] | GPG: 1024D/73647CFF http://www.ngolde.de | http://www.muttng.org | http://grml.org VIM has two modes - the one in which it beeps and the one in which it doesn't -- encrypted mail preferred
--- /tmp/screen-4.0.2/fileio.c 2003-09-08 16:25:28.000000000 +0200
+++ fileio.c 2005-05-13 10:32:23.000000000 +0200
@@ -2,6 +2,8 @@
* Juergen Weigert ([EMAIL PROTECTED])
* Michael Schroeder ([EMAIL PROTECTED])
* Copyright (c) 1987 Oliver Laumann
+ * A part for the configuration file loading was written by
+ * Nico Golde <[EMAIL PROTECTED]>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -291,13 +293,23 @@
do_source(rcfilename)
char *rcfilename;
{
+ char * home = getenv("HOME");
+
if (rc_recursion > 10)
{
Msg(0, "%s: source: recursion limit reached", rc_name);
return;
}
rc_recursion++;
- FinishRc(rcfilename);
+ if(!home)
+ FinishRc(rcfilename);
+ else{
+ if (strncmp(rcfilename,"~/",2)==0) {
+ char * tmp_file = alloca(_POSIX_PATH_MAX+1);
+ snprintf(tmp_file,_POSIX_PATH_MAX+1,"%s/%s",home,rcfilename+2);
+ FinishRc(tmp_file);
+ }
+ }
rc_recursion--;
}
pgpCLFOn5ioKB.pgp
Description: PGP signature

