Hi Guys,

I was looking for this feature in screen - (so that I can display the
currently logged file)

It wasn't available so I have had a stab at implementing it ... could
someone take a look and do a review?
Perhaps even integrate it into the mainline?

Its working for me, and I use it with the following screenrc lines


hardstatus string '%{= kG}[ %{G}%H %{g}][%N][ %=
%{=kw}%?%-Lw%?%{r}(%{W}%n*%f%t%?(%u)%?%{r})%{w}%?%+Lw%?%?%=
%{g}][%{B}%Y-%m-%d %{W}%c %{g}]'

# Enable Logging!
deflog on
# logdir /home/kbingham/logs/
logfile /home/kbingham/logs/%Y-%m-%d_%0c.%t.log


Thanks and regards

Kieran Bingham
From b69f747788070390774e62af0021387c96ba1529 Mon Sep 17 00:00:00 2001
From: Kieran Bingham <kieranbing...@gmail.com>
Date: Thu, 13 Oct 2011 17:16:24 +0100
Subject: [PATCH] Implement Logfile name for the Hard Status Line

---
 src/screen.c |   18 ++++++++++++++++++
 1 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/src/screen.c b/src/screen.c
index 3dde3b4..a8391cb 100644
--- a/src/screen.c
+++ b/src/screen.c
@@ -2829,6 +2829,24 @@ int rec;
 	    p += strlen(p) - 1;
 	  }
 	  break;
+	case 'N':
+	  {
+	    *p = 0;
+
+	    if (D_fore && D_fore->w_log && D_fore->w_log->fp)
+	      {
+		char * logfile_name = D_fore->w_log->name;
+
+		if ((int)strlen(logfile_name) < l)
+		  {
+		    strcpy(p, logfile_name);
+		    if (*p)
+		      qmflag = 1;
+		  }
+	      }
+	    p += strlen(p) - 1;
+	  }
+	  break;
         case 'p':
           {
             sprintf(p, "%d", (plusflg && display) ? D_userpid : getpid());
-- 
1.7.1

Reply via email to