screen-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[screen-devel] [PATCH] WinMsg: Provide an escape code to display log fil


From: Kieran Bingham
Subject: [screen-devel] [PATCH] WinMsg: Provide an escape code to display log filename
Date: Sun, 4 Oct 2015 17:04:21 +0100

This can be useful when you need easy access to the log files, or when the 
filename
is changed / updated frequently (for example recording multiple tests) and you 
want
to log the filename (containing the test data) against the results

Typical use : add [%N] to your hardstatus string in .screenrc

Signed-off-by: Kieran Bingham <address@hidden>
---
 src/winmsg.c | 11 +++++++++++
 src/winmsg.h |  1 +
 2 files changed, 12 insertions(+)

diff --git a/src/winmsg.c b/src/winmsg.c
index 4d7db12..44e5720 100644
--- a/src/winmsg.c
+++ b/src/winmsg.c
@@ -36,6 +36,7 @@
 
 #include "winmsg.h"
 #include "fileio.h"
+#include "logfile.h"
 #include "process.h"
 #include "sched.h"
 #include "mark.h"
@@ -420,6 +421,13 @@ winmsg_esc_ex(WinNum, Window *win)
        wmc_set(cond);
 }
 
+winmsg_esc_ex(WinLogName, Window *win)
+{
+       if (win && win->w_log && win->w_log->fp)
+               wmbc_printf(wmbc, "%s", win->w_log->name);
+
+}
+
 winmsg_esc_ex(WinSize, Window *win)
 {
        if (!win)
@@ -628,6 +636,9 @@ char *MakeWinMsgEv(WinMsgBuf *winmsg, char *str, Window 
*win,
                case WINESC_WIN_NUM:
                        WinMsgDoEscEx(WinNum, win);
                        break;
+               case WINESC_WIN_LOGNAME:
+                       WinMsgDoEscEx(WinLogName, win);
+                       break;
                }
        }
        if (wmc_is_active(cond) && !wmc_is_set(cond))
diff --git a/src/winmsg.h b/src/winmsg.h
index 491d2cc..030745b 100644
--- a/src/winmsg.h
+++ b/src/winmsg.h
@@ -53,6 +53,7 @@ typedef enum {
        WINESC_HSTATUS         = 'h',
        WINESC_HOST            = 'H',
        WINESC_WIN_NUM         = 'n',
+       WINESC_WIN_LOGNAME     = 'N',
        WINESC_PID             = 'p',
        WINESC_COPY_MODE       = 'P',  /* copy/_P_aste mode */
        WINESC_WIN_SIZE        = 's',
-- 
2.1.4




reply via email to

[Prev in Thread] Current Thread [Next in Thread]