Changeset 4944 for trunk/psLib/src/sys/psTrace.c
- Timestamp:
- Sep 2, 2005, 11:32:06 AM (21 years ago)
- File:
-
- 1 edited
-
trunk/psLib/src/sys/psTrace.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/sys/psTrace.c
r4578 r4944 9 9 * @author GLG, MHPCC 10 10 * 11 * @version $Revision: 1.5 5$ $Name: not supported by cvs2svn $12 * @date $Date: 2005-0 7-18 20:54:22$11 * @version $Revision: 1.56 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2005-09-02 21:32:06 $ 13 13 * 14 14 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 55 55 static p_psComponent* cRoot = NULL; // The root of the trace component 56 56 static FILE *traceFP = NULL; // File destination for messages. 57 //static int traceFD = 0; 57 58 58 59 static void componentFree(p_psComponent* comp); … … 525 526 526 527 // XXX EAM : I've added code to close the old traceFP (safely) 527 void psTraceSetDestination(FILE * fp) 528 { 529 530 bool special; 531 532 // XXX EAM perhaps return an error? 533 if (fp == NULL) { 528 void psTraceSetDestination(int fd) 529 { 530 531 532 /* 533 bool special; 534 535 // XXX EAM perhaps return an error? 536 if (fp == NULL) { 537 return; 538 } 539 540 // cannot close traceFP if one of the special FILE ptrs 541 special = (traceFP == NULL); 542 special |= (traceFP == stdin); 543 special |= (traceFP == stdout); 544 special |= (traceFP == stderr); 545 546 if (!special) { 547 fclose (traceFP); 548 } 549 traceFP = fp; 550 */ 551 if (fd == -1) { 534 552 return; 535 553 } 536 537 // cannot close traceFP if one of the special FILE ptrs 538 special = (traceFP == NULL); 539 special |= (traceFP == stdin); 540 special |= (traceFP == stdout); 541 special |= (traceFP == stderr); 542 543 if (!special) { 544 fclose (traceFP); 545 } 546 traceFP = fp; 547 } 548 549 FILE *psTraceGetDestination() 550 { 551 if (traceFP == NULL) { 554 if (fd == 1) { 552 555 traceFP = stdout; 553 } 554 return traceFP; 556 } else if (fd == 2) { 557 traceFP = stderr; 558 } else if (fd == 0) { 559 traceFP = stdin; 560 } else if (fd > 2) { 561 traceFP = fdopen(fd, "w"); 562 } 563 } 564 565 int psTraceGetDestination() 566 { 567 int fd; 568 fd = fileno(traceFP); 569 return fd; 555 570 } 556 571
Note:
See TracChangeset
for help on using the changeset viewer.
