[T106][ZXW-22]7520V3SCV2.01.01.02P42U09_VEC_V0.8_AP_VEC origin source commit
Change-Id: Ic6e05d89ecd62fc34f82b23dcf306c93764aec4b
diff --git a/ap/app/zte_ping/error.c b/ap/app/zte_ping/error.c
new file mode 100755
index 0000000..b39a376
--- /dev/null
+++ b/ap/app/zte_ping/error.c
@@ -0,0 +1,49 @@
+
+#include "headers.h"
+#include "util.h"
+
+/* -------------------------------------------------------------------
+ * warn
+ *
+ * Prints message and return
+ * ------------------------------------------------------------------- */
+
+void warn(const char *inMessage, const char *inFile, int inLine)
+{
+ fflush(0);
+
+//#ifdef NDEBUG
+// fprintf( stderr, "%s failed\n", inMessage );
+//#else
+
+ /* while debugging output file/line number also */
+ fprintf(stderr, "%s failed (%s:%d)\n", inMessage, inFile, inLine);
+//#endif
+} /* end warn */
+
+/* -------------------------------------------------------------------
+ * warn_errno
+ *
+ * Prints message and errno message, and return.
+ * ------------------------------------------------------------------- */
+
+void warn_errno(const char *inMessage, const char *inFile, int inLine)
+{
+ int my_err;
+ const char* my_str;
+
+ /* get platform's errno and error message */
+ my_err = errno;
+ my_str = strerror(my_err);
+
+ fflush(0);
+
+//#ifdef NDEBUG
+// fprintf( stderr, "%s failed: %s\n", inMessage, my_str );
+//#else
+
+ /* while debugging output file/line number and errno value also */
+ fprintf(stderr, "%s failed (%s:%d): %s (%d)\n",
+ inMessage, inFile, inLine, my_str, my_err);
+//#endif
+} /* end warn_errno */