ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/i-scream/projects/libstatgrab/src/libstatgrab/error.c
(Generate patch)

Comparing projects/libstatgrab/src/libstatgrab/error.c (file contents):
Revision 1.7 by tdb, Wed Apr 7 21:08:40 2004 UTC vs.
Revision 1.10 by ats, Thu Apr 8 11:01:44 2004 UTC

# Line 30 | Line 30
30   #include "statgrab.h"
31  
32   static sg_error error = SG_ERROR_NONE;
33 + #define ERROR_ARG_MAX 256
34 + static char error_arg[ERROR_ARG_MAX];
35  
36   void sg_set_error(sg_error code, const char *arg) {
37          error = code;
38 <        /* FIXME do something with arg */
38 >        if (arg != NULL) {
39 >                sg_strlcpy(error_arg, arg, sizeof error_arg);
40 >        }
41 >        else {
42 >                /* FIXME is this the best idea? */
43 >                error_arg[0] = '\0';
44 >        }
45   }
46  
47   sg_error sg_get_error() {
48          return error;
49   }
50  
51 + const char *sg_get_error_arg() {
52 +        return error_arg;
53 + }
54 +
55   const char *sg_str_error(sg_error code) {
56          switch (code) {
57          case SG_ERROR_NONE:
# Line 102 | Line 114 | const char *sg_str_error(sg_error code) {
114                  return "unsupported function";
115          case SG_ERROR_XSW_VER_MISMATCH:
116                  return "XSW version mismatch";
105        default:
106                return "unknown error";
117          }
118 +        return "unknown error";
119   }
120  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines