Changeset 2e85b3c in mainline for uspace/lib/c/generic/str_error.c


Ignore:
Timestamp:
2011-02-16T18:22:43Z (13 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
f4c87aa9
Parents:
600733e (diff), ec59693 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Development branch

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/generic/str_error.c

    r600733e r2e85b3c  
    3333 */
    3434
     35#include <errno.h>
    3536#include <str_error.h>
    3637#include <stdio.h>
     
    6364static fibril_local char noerr[NOERR_LEN];
    6465
    65 const char *str_error(const int errno)
     66const char *str_error(const int e)
    6667{
    67         if ((errno <= 0) && (errno >= MIN_ERRNO))
    68                 return err_desc[-errno];
     68        if ((e <= 0) && (e >= MIN_ERRNO))
     69                return err_desc[-e];
    6970       
    70         snprintf(noerr, NOERR_LEN, "Unkown error code %d", errno);
     71        /* Ad hoc descriptions of error codes interesting for USB. */
     72        switch (e) {
     73                case EBADCHECKSUM:
     74                        return "Bad checksum";
     75                case EAGAIN:
     76                        return "Resource temporarily unavailable";
     77                default:
     78                        break;
     79        }
     80
     81        snprintf(noerr, NOERR_LEN, "Unkown error code %d", e);
    7182        return noerr;
    7283}
Note: See TracChangeset for help on using the changeset viewer.