Re: sial output redirection

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

 



Denman, Robert wrote:
Thanks Dave.  You're absolutely right.  I tested using the global fp and
the redirections work.  The only change needed is to sial.c.


OK, that's good -- queued for the next release.

Thanks,
  Dave

Generated By: Teradata Corporation  (Tue Nov 13 06:50:50 PST 2007)

 extensions/sial.c |   11
++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 11 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-13 06:50:44.000000000
-0800
@@ -638,7 +638,18 @@
 run_callback(void)
 {
 extern char *crash_global_cmd();
+
+       FILE *ofp = NULL;
+
+       if (fp != NULL) {
+               ofp = sial_getofile();
+               sial_setofile(fp);
+       }
+
        sial_cmd(crash_global_cmd(), args, argcnt);
+       if (ofp) {
+               sial_setofile(ofp);
+       }
 }

-----Original Message-----
From: Dave Anderson [mailto:anderson@xxxxxxxxxx] Sent: Tuesday, November 13, 2007 5:44 AM
To: Discussion list for crash utility usage, maintenance and development
Cc: Luc.Chouinard@xxxxxxxxxxxxxxxx; Denman, Robert
Subject: Re:  sial output redirection

Chouinard, Luc wrote:

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

  Luc

-----Original Message-----
From: crash-utility-bounces@xxxxxxxxxx on behalf of Denman, Robert
Sent: Mon 11/12/2007 6:43 PM
To: crash-utility@xxxxxxxxxx
Subject:  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 -


I don't see the need for crash_cmd_filep()?

Since sial.c has the global "fp" #extern'd, it should
just be able to call sial_setofile(fp), and then all
redirection types should be covered.

Dave



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;
+       }
+}





--
Crash-utility mailing list
Crash-utility@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/crash-utility

[Index of Archives]     [Fedora Development]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [KDE Users]     [Fedora Tools]

 

Powered by Linux