IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 386


Ignore:
Timestamp:
Apr 2, 2004, 4:35:18 AM (22 years ago)
Author:
rhl
Message:

1/ Added psVErrorStackPrint()
2/ Made psErrorStackPrint() handle errorCodes that are actually from errno

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/archive/pslib/src/Utils/error.c

    r332 r386  
    146146                       ...)             // arguments for format
    147147{
     148    va_list ap;
     149    /*
     150     * Print header?
     151     */
     152    if (fmt != NULL) {
     153        va_start(ap, fmt);
     154    }
     155
     156    psVErrorStackPrint(fd, fmt, ap);
     157
     158    if (fmt != NULL) {
     159        va_end(ap);
     160    }
     161}
     162
     163void psVErrorStackPrint(FILE *fd,       // write to this file descriptor
     164                        const char *fmt,// format for any header information; may be NULL
     165                        va_list ap)     // arguments for format
     166{
    148167    static int first = 1;
    149168   
     
    171190     */
    172191    if (fmt != NULL) {
    173         va_list ap;
    174         va_start(ap, fmt);
    175         vprintf(fmt, ap);
    176         va_end(ap);
     192        vfprintf(fd, fmt, ap);
     193        if (strchr(fmt, '\n') == NULL) {
     194            fprintf(fd, "\n");
     195        }
    177196    }
    178197    /*
     
    187206   
    188207    for (int i = 0; i < nerror; i++) {
     208        int code = stack[i]->error.code;
    189209        fprintf(fd, "%*s%-*s %-30s %s\n",
    190210                i, "", 30 - i, stack[i]->error.name,
    191                 errorStringList[stack[i]->error.code], stack[i]->error.msg);
    192     }
    193 }
     211                (code < PS_ERR_BASE ? strerror(code) : errorStringList[code]), stack[i]->error.msg);
     212    }
     213}
Note: See TracChangeset for help on using the changeset viewer.