IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 4944 for trunk/psLib/test/sys


Ignore:
Timestamp:
Sep 2, 2005, 11:32:06 AM (21 years ago)
Author:
drobbin
Message:

made requested changes including using file descriptors in psTrace

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/test/sys/tst_psTrace.c

    r4547 r4944  
    88#include "pslib_strict.h"
    99#include "psTest.h"
     10#include <fcntl.h>
     11#include <unistd.h>
    1012
    1113
     
    4951    psS32 lev = 0;
    5052
    51     psTraceSetDestination(stderr);
     53    //    psTraceSetDestination(stderr);
     54    psTraceSetDestination(2);
    5255
    5356    for (i=0;i<10;i++) {
     
    9699static psS32 testTrace01(void)
    97100{
    98     psTraceSetDestination(stderr);
     101    //    psTraceSetDestination(stderr);
     102    psTraceSetDestination(2);
    99103    (void)psTraceSetLevel(".A.B.C.D.E", 5);
    100104
     
    111115{
    112116    psTraceReset();
    113     psTraceSetDestination(stderr);
     117    //    psTraceSetDestination(stderr);
     118    psTraceSetDestination(2);
    114119    psTraceSetLevel(".A.B", 2);
    115120    psTraceSetLevel(".A.B.C.D.E", 5);
     
    142147    psS32 lev = 0;
    143148
    144     psTraceSetDestination(stderr);
     149    //    psTraceSetDestination(stderr);
     150    psTraceSetDestination(2);
    145151
    146152    for (i=0;i<10;i++) {
     
    183189{
    184190    FILE *fp;
     191    int FD;
    185192    psS32 nb = 0;
    186 
    187     fp = fopen("tst_psTrace02_OUT", "w");
     193    FD = creat("tst_psTrace02_OUT", 0666);
     194    //    printf("\nFD = %d\n", FD);
     195    //    fp = fopen("tst_psTrace02_OUT", "w");
     196    fp = fdopen(FD, "w");
    188197    for (nb = 0 ; nb<4;nb++) {
    189198        if (nb == 0)
    190             psTraceSetDestination(stdout);
     199            //            psTraceSetDestination(stdout);
     200            psTraceSetDestination(1);
    191201        if (nb == 1)
    192             psTraceSetDestination(stderr);
     202            //            psTraceSetDestination(stderr);
     203            psTraceSetDestination(2);
    193204        if (nb == 2)
    194             psTraceSetDestination(NULL);
     205            psTraceSetDestination(-1); //NULL
    195206        if (nb == 3)
    196             psTraceSetDestination(fp);
     207            psTraceSetDestination(FD);
    197208
    198209        (void)psTraceSetLevel(".", 4);
     
    221232
    222233    fclose(fp);
     234    close(FD);
    223235
    224236    return(0);
     
    227239static psS32 testTrace05(void)
    228240{
    229     psTraceSetDestination(stderr);
     241    //    psTraceSetDestination(stderr);
     242    psTraceSetDestination(2);
    230243
    231244    (void)psTraceSetLevel(".", 9);
     
    277290static psS32 testTrace06(void)
    278291{
    279     psTraceSetDestination(stderr);
     292    //    psTraceSetDestination(stderr);
     293    psTraceSetDestination(2);
    280294
    281295    (void)psTraceSetLevel(".", 9);
Note: See TracChangeset for help on using the changeset viewer.