From 43db71f8b5ecb9e6f243cf940d479547ebf8c855 Mon Sep 17 00:00:00 2001 From: Sadrul Habib Chowdhury Date: Thu, 1 Apr 2010 15:59:34 -0400 Subject: [PATCH] Use NEED_FORE flag for 'hardcopy'. Screen wouldn't do anything with 'hardcopy' if there was no foreground window, except overwriting the specified file (when hardcopy_append is off, of course). But the NEED_FORE flag wasn't set. I am not sure why this was the case. So I have added the NEED_FORE flag so that 'hardcopy' command fails if there is no foreground window. --- src/comm.c | 2 +- src/process.c | 5 +---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/src/comm.c b/src/comm.c index aa512de..5f4af8a 100644 --- a/src/comm.c +++ b/src/comm.c @@ -195,7 +195,7 @@ struct comm comms[RC_LAST + 1] = { "focusminsize", ARGS_02 }, { "gr", NEED_FORE|ARGS_01 }, { "group", NEED_FORE|ARGS_01 }, - { "hardcopy", ARGS_012 }, + { "hardcopy", NEED_FORE|ARGS_012 }, { "hardcopy_append", ARGS_1 }, { "hardcopydir", ARGS_01 }, { "hardstatus", ARGS_012 }, diff --git a/src/process.c b/src/process.c index 783fdd7..da9188d 100644 --- a/src/process.c +++ b/src/process.c @@ -1291,10 +1291,7 @@ int key; OutputMsg(0, "%s: hardcopy: too many arguments", rc_name); break; } - if (fore == 0 && *args == 0) - OutputMsg(0, "%s: hardcopy: window required", rc_name); - else - WriteFile(user, file, mode); + WriteFile(user, file, mode); } break; case RC_DEFLOG: -- 2.11.4.GIT