ソースを参照

faux.conv: boolean to string function

Serj Kalichev 3 年 前
コミット
640a980260
2 ファイル変更15 行追加0 行削除
  1. 1 0
      faux/conv.h
  2. 14 0
      faux/conv/conv.c

+ 1 - 0
faux/conv.h

@@ -25,6 +25,7 @@ bool_t faux_conv_atoc(const char *str, char *val, int base);
 bool_t faux_conv_atouc(const char *str, unsigned char *val, int base);
 
 bool_t faux_conv_str2bool(const char *str, bool_t *val);
+const char *faux_conv_bool2str(bool_t *val);
 
 C_DECL_END
 

+ 14 - 0
faux/conv/conv.c

@@ -309,3 +309,17 @@ bool_t faux_conv_str2bool(const char *str, bool_t *val)
 
 	return BOOL_FALSE;
 }
+
+
+/** @brief Converts bool_t to string
+ *
+ * @param [in] val Boolean value.
+ * @return "true" or "false" strings
+ */
+const char *faux_conv_bool2str(bool_t *val)
+{
+	if (val)
+		return "true";
+
+	return "false";
+}