Re: [openib-general] [PATCH] opensm: handle stdout and stderr in osm_log

2006-04-27 Thread Hal Rosenstock
On Thu, 2006-04-27 at 11:03, Sasha Khapyorsky wrote:
> Hello Hal,
> 
> "-" is added as suggested by Greg (handled as stdout).
> 
> Sasha.
> 
> 
> Handle in osm_log "-", "stdout" or "stderr" words as log file names to
> indicate logging to stdout or stderr respectively.

Thanks. Applied to both trunk and 1.0 branch.

-- Hal

> Signed-off-by: Sasha Khapyorsky <[EMAIL PROTECTED]>


___
openib-general mailing list
openib-general@openib.org
http://openib.org/mailman/listinfo/openib-general

To unsubscribe, please visit http://openib.org/mailman/listinfo/openib-general


Re: [openib-general] [PATCH] opensm: handle stdout and stderr in osm_log

2006-04-27 Thread Sasha Khapyorsky
Hello Hal,

"-" is added as suggested by Greg (handled as stdout).

Sasha.


Handle in osm_log "-", "stdout" or "stderr" words as log file names to
indicate logging to stdout or stderr respectively.

Signed-off-by: Sasha Khapyorsky <[EMAIL PROTECTED]>
---

 osm/include/opensm/osm_log.h |7 ++-
 osm/opensm/main.c|6 +-
 2 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/osm/include/opensm/osm_log.h b/osm/include/opensm/osm_log.h
index 8cf8cf1..c4744b5 100644
--- a/osm/include/opensm/osm_log.h
+++ b/osm/include/opensm/osm_log.h
@@ -224,10 +224,15 @@ osm_log_init(
   p_log->level = log_flags;
   p_log->flush = flush;
 
-  if (log_file == NULL)
+  if (log_file == NULL || !strcmp(log_file, "-") ||
+  !strcmp(log_file, "stdout"))
   {
 p_log->out_port = stdout;
   }
+  else if (!strcmp(log_file, "stderr"))
+  {
+p_log->out_port = stderr;
+  }
   else
   {
 if (accum_log_file)
diff --git a/osm/opensm/main.c b/osm/opensm/main.c
index 6f2a857..d95c314 100644
--- a/osm/opensm/main.c
+++ b/osm/opensm/main.c
@@ -722,11 +722,7 @@ #endif
   break;
 
 case 'f':
-  if (!strcmp(optarg, "stdout"))
-/* output should be to standard output */
-opt.log_file = NULL;
-  else
-opt.log_file = optarg;
+  opt.log_file = optarg;
   break;
 
 case 'e':
___
openib-general mailing list
openib-general@openib.org
http://openib.org/mailman/listinfo/openib-general

To unsubscribe, please visit http://openib.org/mailman/listinfo/openib-general


Re: [openib-general] [PATCH] opensm: handle stdout and stderr in osm_log

2006-04-27 Thread Sasha Khapyorsky
On 00:20 Thu 27 Apr , Greg Lindahl wrote:
> On Thu, Apr 27, 2006 at 01:15:57AM +0300, Sasha Khapyorsky wrote:
> 
> > There is small patch for osm_log, this provide possibility to drop log
> > output to stdout or stderr.
> 
> Isn't the Unix convention to use "--" to mean stdout?

I guess taht "-" means stdout? Yes, I think this is nice to have, will
addi too.

> Or you can use
> /dev/fd/{0,1}...

Those are not different from regular files, nothing special is needed.

Sasha.
___
openib-general mailing list
openib-general@openib.org
http://openib.org/mailman/listinfo/openib-general

To unsubscribe, please visit http://openib.org/mailman/listinfo/openib-general


Re: [openib-general] [PATCH] opensm: handle stdout and stderr in osm_log

2006-04-27 Thread Greg Lindahl
On Thu, Apr 27, 2006 at 01:15:57AM +0300, Sasha Khapyorsky wrote:

> There is small patch for osm_log, this provide possibility to drop log
> output to stdout or stderr.

Isn't the Unix convention to use "--" to mean stdout? Or you can use
/dev/fd/{0,1}...

-- greg

___
openib-general mailing list
openib-general@openib.org
http://openib.org/mailman/listinfo/openib-general

To unsubscribe, please visit http://openib.org/mailman/listinfo/openib-general


[openib-general] [PATCH] opensm: handle stdout and stderr in osm_log

2006-04-26 Thread Sasha Khapyorsky
Hello Hal,

There is small patch for osm_log, this provide possibility to drop log
output to stdout or stderr.

Sasha.


Handle in osm_log "stdout" or "stderr" words as log file names to
indicate logging to stdout or stderr respectively.

Signed-off-by: Sasha Khapyorsky <[EMAIL PROTECTED]>
---

 osm/include/opensm/osm_log.h |6 +-
 osm/opensm/main.c|6 +-
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/osm/include/opensm/osm_log.h b/osm/include/opensm/osm_log.h
index 8cf8cf1..4a7c08c 100644
--- a/osm/include/opensm/osm_log.h
+++ b/osm/include/opensm/osm_log.h
@@ -224,10 +224,14 @@ osm_log_init(
   p_log->level = log_flags;
   p_log->flush = flush;
 
-  if (log_file == NULL)
+  if (log_file == NULL || !strcmp(log_file, "stdout"))
   {
 p_log->out_port = stdout;
   }
+  else if (!strcmp(log_file, "stderr"))
+  {
+p_log->out_port = stderr;
+  }
   else
   {
 if (accum_log_file)
diff --git a/osm/opensm/main.c b/osm/opensm/main.c
index 6f2a857..d95c314 100644
--- a/osm/opensm/main.c
+++ b/osm/opensm/main.c
@@ -722,11 +722,7 @@ #endif
   break;
 
 case 'f':
-  if (!strcmp(optarg, "stdout"))
-/* output should be to standard output */
-opt.log_file = NULL;
-  else
-opt.log_file = optarg;
+  opt.log_file = optarg;
   break;
 
 case 'e':
___
openib-general mailing list
openib-general@openib.org
http://openib.org/mailman/listinfo/openib-general

To unsubscribe, please visit http://openib.org/mailman/listinfo/openib-general