summaryrefslogtreecommitdiff
path: root/gnu/usr.sbin/sendmail/libsmutil
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2001-09-11 18:55:53 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2001-09-11 18:55:53 +0000
commit4643c616c81fb1198b29c3eaff4d697392c8dc4b (patch)
tree4afa26a5f1a2ef0e47061eb08b6d339bc7e8dad1 /gnu/usr.sbin/sendmail/libsmutil
parent8afe339a41c898cc4a2d42d03d115b16f2053bad (diff)
sendmail 8.12.0 with $Id tags converted to $Sendmail
Diffstat (limited to 'gnu/usr.sbin/sendmail/libsmutil')
-rw-r--r--gnu/usr.sbin/sendmail/libsmutil/cf.c71
-rw-r--r--gnu/usr.sbin/sendmail/libsmutil/err.c63
2 files changed, 134 insertions, 0 deletions
diff --git a/gnu/usr.sbin/sendmail/libsmutil/cf.c b/gnu/usr.sbin/sendmail/libsmutil/cf.c
new file mode 100644
index 00000000000..6d4f000ba65
--- /dev/null
+++ b/gnu/usr.sbin/sendmail/libsmutil/cf.c
@@ -0,0 +1,71 @@
+/*
+ * Copyright (c) 2000-2001 Sendmail, Inc. and its suppliers.
+ * All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set
+ * forth in the LICENSE file which can be found at the top level of
+ * the sendmail distribution.
+ *
+ */
+
+#include <sendmail.h>
+SM_RCSID("@(#)$Sendmail: cf.c,v 8.14 2001/05/02 00:42:46 ca Exp $")
+#include <sendmail/pathnames.h>
+
+/*
+** GETCFNAME -- return the name of the .cf file to use.
+**
+** Some systems (e.g., NeXT) determine this dynamically.
+**
+** For others: returns submit.cf or sendmail.cf depending
+** on the modes.
+**
+** Parameters:
+** opmode -- operation mode.
+** submitmode -- submit mode.
+** cftype -- may request a certain cf file.
+** conffile -- if set, return it.
+**
+** Returns:
+** name of .cf file.
+*/
+
+char *
+getcfname(opmode, submitmode, cftype, conffile)
+ int opmode;
+ int submitmode;
+ int cftype;
+ char *conffile;
+{
+
+ if (conffile != NULL)
+ return conffile;
+
+#if NETINFO
+ {
+ char *cflocation;
+
+ cflocation = ni_propval("/locations", NULL, "sendmail",
+ "sendmail.cf", '\0');
+ if (cflocation != NULL)
+ return cflocation;
+ }
+#endif /* NETINFO */
+
+ if (cftype == SM_GET_SUBMIT_CF ||
+ ((submitmode != SUBMIT_UNKNOWN ||
+ opmode == MD_DELIVER ||
+ opmode == MD_ARPAFTP ||
+ opmode == MD_SMTP) &&
+ cftype != SM_GET_SENDMAIL_CF))
+ {
+ struct stat sbuf;
+ static char cf[PATH_MAX];
+
+ (void) sm_strlcpyn(cf, sizeof cf, 2, _DIR_SENDMAILCF,
+ "submit.cf");
+ if (cftype == SM_GET_SUBMIT_CF || stat(cf, &sbuf) == 0)
+ return cf;
+ }
+ return _PATH_SENDMAILCF;
+}
diff --git a/gnu/usr.sbin/sendmail/libsmutil/err.c b/gnu/usr.sbin/sendmail/libsmutil/err.c
new file mode 100644
index 00000000000..6ae078715dc
--- /dev/null
+++ b/gnu/usr.sbin/sendmail/libsmutil/err.c
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2001 Sendmail, Inc. and its suppliers.
+ * All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set
+ * forth in the LICENSE file which can be found at the top level of
+ * the sendmail distribution.
+ *
+ */
+
+#include <sendmail.h>
+
+SM_RCSID("@(#)$Sendmail: err.c,v 8.3 2001/01/24 01:27:30 gshapiro Exp $")
+
+#include <ctype.h>
+
+/*VARARGS1*/
+void
+#ifdef __STDC__
+message(const char *msg, ...)
+#else /* __STDC__ */
+message(msg, va_alist)
+ const char *msg;
+ va_dcl
+#endif /* __STDC__ */
+{
+ const char *m;
+ SM_VA_LOCAL_DECL
+
+ m = msg;
+ if (isascii(m[0]) && isdigit(m[0]) &&
+ isascii(m[1]) && isdigit(m[1]) &&
+ isascii(m[2]) && isdigit(m[2]) && m[3] == ' ')
+ m += 4;
+ SM_VA_START(ap, msg);
+ (void) vfprintf(stderr, m, ap);
+ SM_VA_END(ap);
+ (void) fprintf(stderr, "\n");
+}
+
+/*VARARGS1*/
+void
+#ifdef __STDC__
+syserr(const char *msg, ...)
+#else /* __STDC__ */
+syserr(msg, va_alist)
+ const char *msg;
+ va_dcl
+#endif /* __STDC__ */
+{
+ const char *m;
+ SM_VA_LOCAL_DECL
+
+ m = msg;
+ if (isascii(m[0]) && isdigit(m[0]) &&
+ isascii(m[1]) && isdigit(m[1]) &&
+ isascii(m[2]) && isdigit(m[2]) && m[3] == ' ')
+ m += 4;
+ SM_VA_START(ap, msg);
+ (void) vfprintf(stderr, m, ap);
+ SM_VA_END(ap);
+ (void) fprintf(stderr, "\n");
+}