From e7e07f42b336bb7b5c488eb3bcc6397c0a2a03f4 Mon Sep 17 00:00:00 2001
From: wangzhengquan <wangzhengquan85@126.com>
Date: 星期一, 24 八月 2020 16:36:09 +0800
Subject: [PATCH] fix conflict

---
 common/usg_common.c |   78 +++++++++++++++++++++++++++++++++++++++
 1 files changed, 78 insertions(+), 0 deletions(-)

diff --git a/common/usg_common.c b/common/usg_common.c
new file mode 100644
index 0000000..0868a20
--- /dev/null
+++ b/common/usg_common.c
@@ -0,0 +1,78 @@
+#include "usg_common.h"
+#include <errno.h>		/* for definition of errno */
+#include <stdarg.h>		/* ISO C variable aruments */
+
+#define MAXLINE 4096      /* max line length */
+/**************************
+ * Error-handling functions
+ **************************/
+static void	err_doit(int, const char *, va_list);
+//static void err_doit(int errno, const char *fmt, va_list ap);
+
+/*void unix_error(const char *fmt, ...) [> Unix-style error <]*/
+/*{*/
+	/*va_list		ap;*/
+
+	/*va_start(ap, fmt);*/
+	/*err_doit(errno, fmt, ap);*/
+	/*va_end(ap);*/
+/*}*/
+
+void posix_error(int code, const char *fmt, ...) /* Posix-style error */
+{
+	va_list		ap;
+
+	va_start(ap, fmt);
+	err_doit(code, fmt, ap);
+	va_end(ap);
+}
+
+/*
+ * Fatal error unrelated to a system call.
+ * Error code passed as explict parameter.
+ * Print a message and terminate.
+ */
+void err_exit(int error, const char *fmt, ...)
+{
+	va_list		ap;
+
+	va_start(ap, fmt);
+	err_doit(error, fmt, ap);
+	va_end(ap);
+	//abort();		/* dump core and terminate */
+	exit(1);
+}
+
+
+
+/*
+ * Nonfatal error unrelated to a system call.
+ * Print a message and return.
+ */
+void err_msg(int error, const char *fmt, ...)
+{
+	va_list		ap;
+
+	va_start(ap, fmt);
+	err_doit(error, fmt, ap);
+	va_end(ap);
+}
+
+
+/*
+ * Print a message and return to caller.
+ * Caller specifies "errnoflag".
+ */
+static void err_doit(int error, const char *fmt, va_list ap)
+{
+	char	buf[MAXLINE];
+
+	vsnprintf(buf, MAXLINE-1, fmt, ap);
+	if (error != 0) {
+		snprintf(buf+strlen(buf), MAXLINE-strlen(buf)-1, ": %s", strerror(error));
+	}
+	strcat(buf, "\n");
+	fflush(stdout);		/* in case stdout and stderr are the same */
+	fputs(buf, stderr);
+	fflush(NULL);		/* flushes all stdio output streams */
+}

--
Gitblit v1.8.0