libsmbconf: Added a sbcErrorString() function.
authorAndreas Schneider <asn@samba.org>
Thu, 7 Apr 2011 13:27:52 +0000 (15:27 +0200)
committerMichael Adam <obnox@samba.org>
Tue, 10 May 2011 17:13:19 +0000 (19:13 +0200)
Signed-off-by: Michael Adam <obnox@samba.org>
lib/smbconf/smbconf.c
lib/smbconf/smbconf.h

index 80fe9aac3722c22772b3bf8e93d22430f2d8f008..5fbf52da05098bd070018e97cbc5c7068d528011 100644 (file)
@@ -42,6 +42,41 @@ static WERROR smbconf_global_check(struct smbconf_ctx *ctx)
  *
  **********************************************************************/
 
+const char *sbcErrorString(sbcErr error)
+{
+       switch (error) {
+               case SBC_ERR_OK:
+                       return "SBC_ERR_OK";
+               case SBC_ERR_NOT_IMPLEMENTED:
+                       return "SBC_ERR_NOT_IMPLEMENTED";
+               case SBC_ERR_NOT_SUPPORTED:
+                       return "SBC_ERR_NOT_SUPPORTED";
+               case SBC_ERR_UNKNOWN_FAILURE:
+                       return "SBC_ERR_UNKNOWN_FAILURE";
+               case SBC_ERR_NOMEM:
+                       return "SBC_ERR_NOMEM";
+               case SBC_ERR_INVALID_PARAM:
+                       return "SBC_ERR_INVALID_PARAM";
+               case SBC_ERR_BADFILE:
+                       return "SBC_ERR_BADFILE";
+               case SBC_ERR_NO_SUCH_SERVICE:
+                       return "SBC_ERR_NO_SUCH_SERVICE";
+               case SBC_ERR_IO_FAILURE:
+                       return "SBC_ERR_IO_FAILURE";
+               case SBC_ERR_CAN_NOT_COMPLETE:
+                       return "SBC_ERR_CAN_NOT_COMPLETE";
+               case SBC_ERR_NO_MORE_ITEMS:
+                       return "SBC_ERR_NO_MORE_ITEMS";
+               case SBC_ERR_FILE_EXISTS:
+                       return "SBC_ERR_FILE_EXISTS";
+               case SBC_ERR_ACCESS_DENIED:
+                       return "SBC_ERR_ACCESS_DENIED";
+       }
+
+       return "unknown sbcErr value";
+}
+
+
 /**
  * Tell whether the backend requires messaging to be set up
  * for the backend to work correctly.
index dc640d075b6f49bcfa6d11fe722b0d71b4aefec9..11e971b5bad91880215aacc0746455483a0b81e1 100644 (file)
@@ -57,6 +57,15 @@ struct smbconf_service {
        char **param_values;
 };
 
+/**
+ * @brief Translate an error value into a string
+ *
+ * @param error
+ *
+ * @return a pointer to a static string
+ **/
+const char *sbcErrorString(sbcErr error);
+
 /*
  * the smbconf API functions
  */