[Crash-utility] sial output redirection

Denman, Robert Robert.Denman at Teradata.Com
Tue Nov 13 05:31:23 UTC 2007


Luc,

I have to post an updated patch because I overlooked one case in my
original test - the output redirection was left enabled after the sial
command completed.  It caused subsequent sial commands to be redirected
(undesirable).

 

This update saves and restores the original fp at the end of a
redirection.  Sorry...

 

- Robert -

 

Generated By: Teradata Corporation  (Mon Nov 12 21:19:08 PST 2007)

 

 extensions.c      |   12
+++++++++++++++++++++++++++++++++++++++++++++++++

 extensions/sial.c |   13
++++++++++++++++++++++++++++++++++++++++++++++++++++++

 2 files changed, 25 insertions(+), 0 deletions(-)

 

Index: crash-4.0-4.8/extensions/sial.c

===================================================================

--- crash-4.0-4.8-orig/extensions/sial.c        2007-11-12
21:15:36.000000000 -0800

+++ crash-4.0-4.8/extensions/sial.c     2007-11-12 21:19:03.000000000
-0800

@@ -638,7 +638,20 @@

 run_callback(void)

 {

 extern char *crash_global_cmd();

+extern FILE *crash_cmd_filep();

+

+       FILE *fp,

+            *ofp = NULL;

+

+       if ((fp = crash_cmd_filep()) != NULL) {

+               ofp = sial_getofile();

+               sial_setofile(fp);

+       }

+

        sial_cmd(crash_global_cmd(), args, argcnt);

+       if (ofp) {

+               sial_setofile(ofp);

+       }

 }

 

 

Index: crash-4.0-4.8/extensions.c

===================================================================

--- crash-4.0-4.8-orig/extensions.c     2007-11-12 21:15:36.000000000
-0800

+++ crash-4.0-4.8/extensions.c  2007-11-12 21:15:57.000000000 -0800

@@ -374,3 +374,15 @@

 { 

        return pc->cmd_table; 

 }

+

+FILE *

+crash_cmd_filep(void)

+{

+       if (pc->redirect & REDIRECT_TO_FILE) {

+               return pc->ofile;

+       } else if (pc->redirect & REDIRECT_TO_PIPE) {

+               return pc->pipe;

+       } else {

+               return NULL;

+       }

+}

 

________________________________

From: crash-utility-bounces at redhat.com
[mailto:crash-utility-bounces at redhat.com] On Behalf Of Chouinard, Luc
Sent: Monday, November 12, 2007 5:20 PM
To: Discussion list for crash utility usage, maintenance and
development; crash-utility at redhat.com
Subject: RE: [Crash-utility] sial output redirection

 

Very useful thing to have. Looks good. Dave can you queue it?

   Luc

-----Original Message-----
From: crash-utility-bounces at redhat.com on behalf of Denman, Robert
Sent: Mon 11/12/2007 6:43 PM
To: crash-utility at redhat.com
Subject: [Crash-utility] sial output redirection

Luc,
The following patch will allow the output of SIAL commands to be
redirected to a file or pipe.  I did not handle all cases supported by
crash (e.g. multi-pipes), only simple output redirection.  Would you
please consider this change or something like it in the next release?
Thanks.

- Robert -

Generated By: Teradata Corporation  (Mon Nov 12 15:29:56 PST 2007)

 extensions.c      |   12
++++++++++++++++++++++++++++++++++++++++++++++++++++++
 extensions/sial.c |    7 +++++++++++++++++++++++++++++++
 2 files changed, 19 insertions(+), 0 deletions(-)

Index: crash-4.0-4.8/extensions/sial.c
===================================================================
--- crash-4.0-4.8-orig/extensions/sial.c        2007-10-30
08:51:54.000000000 -0
700
+++ crash-4.0-4.8/extensions/sial.c     2007-11-12 15:28:55.000000000
-0800
@@ -638,6 +638,13 @@
 run_callback(void)
 {
 extern char *crash_global_cmd();
+extern FILE *crash_cmd_filep();
+
+       FILE *fp;
+
+       if ((fp = crash_cmd_filep()) != NULL) {
+               sial_setofile(fp);
+       }
        sial_cmd(crash_global_cmd(), args, argcnt);
 }

Index: crash-4.0-4.8/extensions.c
===================================================================
--- crash-4.0-4.8-orig/extensions.c     2007-10-30 08:51:54.000000000
-0700
+++ crash-4.0-4.8/extensions.c  2007-11-12 15:27:21.000000000 -0800
@@ -374,3 +374,15 @@
 {
        return pc->cmd_table;
 }
+
+FILE *
+crash_cmd_filep(void)
+{
+       if (pc->redirect & REDIRECT_TO_FILE) {
+               return pc->ofile;
+       } else if (pc->redirect & REDIRECT_TO_PIPE) {
+               return pc->pipe;
+       } else {
+               return NULL;
+       }
+}




Confidentiality Notice This e-mail (including any attachments) is
intended only for the recipients named above. It may contain
confidential or privileged information and should not be read, copied or
otherwise used by any other person. If you are not a named recipient,
please notify the sender of that fact and delete the e-mail from your
system. 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/crash-utility/attachments/20071113/f5601dd7/attachment.htm>


More information about the Crash-utility mailing list