Hottest Free Downloads - DownloadPipe.com Over 197,000 downloads! Bookmark Now!
DownloadPipe.com - New Downloads Every Minute
 SEARCH:
FAQFAQ    SearchSearch      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

empire-client patch: re-using command filters

 
   Games (Home) -> Hints about Empire RSS
Next:  Looking for LOTR 19 LED PC Board  
Author Message
Martin Neitzel

External


Since: Oct 16, 2009
Posts: 2



(Msg. 1) Posted: Fri Oct 16, 2009 10:25 pm
Post subject: empire-client patch: re-using command filters
Archived from groups: rec>games>empire (more info?)

As promised, here is the small patch for the standard empire command
line client to make it easier to run everything through your pager
(or other things) again and again.

The patch is quite trivial. My changes to the pipe documentation
under "Syntax" are actually longer than the change to the code.

This is a strict client-side feature and the improvement will work
against unpatched servers just as nicely. However, when you run
"info Syntax" with them, you'll get their standard, un-improved
documentation. Simply reading the info patch below once will get
you educated well enough, I think.

Martin

Index: src/client/servcmd.c
===================================================================
RCS file: /cvsroot/empserver/empserver/src/client/servcmd.c,v
retrieving revision 1.50
diff -u -r1.50 servcmd.c
--- src/client/servcmd.c 13 Dec 2007 21:36:25 -0000 1.50
+++ src/client/servcmd.c 16 Oct 2009 23:25:43 -0000
@@ -45,6 +45,7 @@
#include "misc.h"
#include "proto.h"
#include "secure.h"
+#include "linebuf.h"

#ifdef _WIN32
#define open(filename, flags, ...) \
@@ -230,6 +231,8 @@
static void
dopipe(char *p)
{
+ static char last_pipe_cmd[LBUF_LEN_MAX] = "more";
+
if (!redir_authorized(p, "pipe to shell command", !redir_fp))
return;
if (*p++ != '|') {
@@ -238,10 +241,10 @@
}

for (; *p && isspace(*p); p++) ;
- if (*p == 0) {
- fprintf(stderr, "Redirection lacks a command\n");
- return;
- }
+ if (*p)
+ strncpy (last_pipe_cmd, p, sizeof(last_pipe_cmd)-1);
+ else
+ p = last_pipe_cmd;

redir_is_pipe = 1;
if ((redir_fp = popen(p, "w")) == NULL) {
Index: info/Syntax.t
===================================================================
RCS file: /cvsroot/empserver/empserver/info/Syntax.t,v
retrieving revision 1.1
diff -u -r1.1 Syntax.t
--- info/Syntax.t 22 Dec 2005 10:09:17 -0000 1.1
+++ info/Syntax.t 16 Oct 2009 23:25:43 -0000
@@ -136,11 +136,41 @@
replacing the file it if it already exists.
.s1
.ne 2
-.EX VERB ARG ... | PROGRAM [ARGS...]
+.EX VERB ARG ... | [ PROGRAM [ARGS...] ]
which send the output of the command to the program \*QPROGRAM\*U
with optional arguments \*QARGS\*U.
This is most useful when \*QPROGRAM\*U is some type of
pager like \*(iFmore\*(pF(1) or \*(iFless\*(pF(1).
+In fact, Empire starts out with the \*(iFmore\*(pF(1)
+pager as your default pipe program.
+Caveat: you should be careful to specify all required
+arguments for your empire verb right away on the command
+line. For example, while
+.EX news | more
+will work fine, reading your telegrams with
+.EX read | more
+will appear to mysteriously hang without any output.
+What happens is this:
+telegrams and the final prompt "Into the shredder, boss?"
+all vanish into the pipe buffer.
+You have to answer the
+"interactive" argument prompt blindly with a "yes" or "no" before
+you can see the whole shebang.
+Better specify such arguments right away:
+.EX read y | more
+.s1
+If you do not specify any program (and just end your
+command with a | character), the same program as the
+last time will be used.
+This makes it much easier to use your pager again and again.
+Another example: the sequence
+.NF
+show s b | grep ^frg
+show s c |
+show s s |
+.FI
+will tell you everything about frigates and not bother you
+with other ship types.
.s1
The Empire shell also recognizes a few control characters:
.s1
Back to top
Login to vote
Display posts from previous:   
Related Topics:
Empire Client with audio feedback? - Hello, I realize this topic might seem a bit of an unusual one, but for some time lately I've been trying to get my feet wet in Empire blitzes. A major obstacle for me to accomplish this has been the fact that in the basic Emp_Client, maps and other dat...

Installing Empire 4.3.9 Server [0/1] "empire-4.3.9.sfv" yE.. - Hello all just wondering if I can get some help installing a empire server. I get an error when issue the make comand see below: [empire@ip-208-109-206-106 empire-4.3.9]$ make cd . && autoconf /bin/sh: autoconf: command not found make: *** [con...

Suggested Linux client? - What linux client would you suggest for a fairly clueless player? The furthest I've ever gotten in empire was navigating a frigate around. I think I might've gotten guns/shells loaded on it. Do both ptkei and pei work with the new server? Any other....

GUI Mac Client? - I've searched around and it appears this question hasn't been asked since 2003, sorry if I missed anything. I'd like to play Empire, and I'm running Mac OSX. I'd like to find a good GUI client. Has anyone managed to get PTkEI working on a modern Mac? I...

Since we are NOT playing Empire, what ARE we playing? (non.. - OK Guys and Gals, You can't fool me. I know you are playing something!!! We all do. We play games because they are fun for us. ut not eveyone plays teh same types of games. Whether is board games (chess, risk, chutes and ladders), console games..
       Games (Home) -> Hints about Empire All times are: Pacific Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Categories:
 Windows Forums
  Game Forums
 Linux Forums
 Mac Forums
 PDA Forums
 Mobile Forums
  Top  |  Store  |  RSS Feeds RSS  |  Data Feeds  |  Advertise  |  Submit  |  Bookmark  |  Newsletter  |  Contact