From a40faef5a7086e776ddb5fb54d14d79f543f185f Mon Sep 17 00:00:00 2001 From: Eric Allman Date: Tue, 13 Jun 1995 16:23:20 -0800 Subject: [PATCH] make a bunch of #defines into 0/1 instead of ifdef/ifndef SCCS-vsn: usr.sbin/sendmail/src/usersmtp.c 8.55 SCCS-vsn: usr.sbin/sendmail/src/recipient.c 8.93 SCCS-vsn: usr.sbin/sendmail/src/main.c 8.129 SCCS-vsn: usr.sbin/sendmail/src/conf.h 8.188 SCCS-vsn: usr.sbin/sendmail/src/sendmail.h 8.141 SCCS-vsn: usr.sbin/sendmail/src/daemon.c 8.102 SCCS-vsn: usr.sbin/sendmail/src/util.c 8.76 SCCS-vsn: usr.sbin/sendmail/src/deliver.c 8.158 SCCS-vsn: usr.sbin/sendmail/src/conf.c 8.195 SCCS-vsn: usr.sbin/sendmail/src/map.c 8.77 --- usr/src/usr.sbin/sendmail/src/conf.c | 8 +-- usr/src/usr.sbin/sendmail/src/conf.h | 71 ++++++++++++++--------- usr/src/usr.sbin/sendmail/src/daemon.c | 32 +++++----- usr/src/usr.sbin/sendmail/src/deliver.c | 12 ++-- usr/src/usr.sbin/sendmail/src/main.c | 8 +-- usr/src/usr.sbin/sendmail/src/map.c | 8 +-- usr/src/usr.sbin/sendmail/src/recipient.c | 4 +- usr/src/usr.sbin/sendmail/src/sendmail.h | 24 ++++---- usr/src/usr.sbin/sendmail/src/usersmtp.c | 6 +- usr/src/usr.sbin/sendmail/src/util.c | 8 +-- 10 files changed, 97 insertions(+), 84 deletions(-) diff --git a/usr/src/usr.sbin/sendmail/src/conf.c b/usr/src/usr.sbin/sendmail/src/conf.c index 5f4ecce60f..67f151e733 100644 --- a/usr/src/usr.sbin/sendmail/src/conf.c +++ b/usr/src/usr.sbin/sendmail/src/conf.c @@ -7,7 +7,7 @@ */ #ifndef lint -static char sccsid[] = "@(#)conf.c 8.194 (Berkeley) %G%"; +static char sccsid[] = "@(#)conf.c 8.195 (Berkeley) %G%"; #endif /* not lint */ # include "sendmail.h" @@ -332,7 +332,7 @@ setupmaps() hes_map_lookup, null_map_store); #endif -#ifdef NETINFO +#if NETINFO MAPDEF("netinfo", NULL, MCF_ALIASOK, map_parseargs, ni_map_open, null_map_close, ni_map_lookup, null_map_store); @@ -2844,7 +2844,7 @@ getcfname() if (ConfFile != NULL) return ConfFile; -#ifdef NETINFO +#if NETINFO { extern char *ni_propval(); char *cflocation; @@ -3342,7 +3342,7 @@ load_if_names() ** Caller should free the return value of ni_proval */ -#ifdef NETINFO +#if NETINFO # include diff --git a/usr/src/usr.sbin/sendmail/src/conf.h b/usr/src/usr.sbin/sendmail/src/conf.h index 540ee68f2d..32acd50df9 100644 --- a/usr/src/usr.sbin/sendmail/src/conf.h +++ b/usr/src/usr.sbin/sendmail/src/conf.h @@ -5,7 +5,7 @@ * * %sccs.include.redist.c% * - * @(#)conf.h 8.187 (Berkeley) %G% + * @(#)conf.h 8.188 (Berkeley) %G% */ /* @@ -53,34 +53,35 @@ struct rusage; /* forward declaration to get gcc to shut up in wait.h */ /********************************************************************** ** Compilation options. -** -** #define these if they are available; comment them out otherwise. -**********************************************************************/ - -# define LOG 1 /* enable logging */ -# define UGLYUUCP 1 /* output ugly UUCP From lines */ -# define NETUNIX 1 /* include unix domain support */ -# define NETINET 1 /* include internet support */ -# define MATCHGECOS 1 /* match user names from gecos field */ -# define XDEBUG 1 /* enable extended debugging */ -# if (defined(NEWDB) || defined(HESIOD)) && !defined(USERDB) -# define USERDB 1 /* look in user database */ -# endif - -/********************************************************************** -** 0/1 Compilation options. ** #define these to 1 if they are available; ** #define them to 0 otherwise. +** All can be overridden from Makefile. **********************************************************************/ +# ifndef NETINET +# define NETINET 1 /* include internet support */ +# endif + # ifndef NAMED_BIND # define NAMED_BIND 1 /* use Berkeley Internet Domain Server */ # endif +# ifndef XDEBUG +# define XDEBUG 1 /* enable extended debugging */ +# endif + +# ifndef MATCHGECOS +# define MATCHGECOS 1 /* match user names from gecos field */ +# endif + # ifndef DSN # define DSN 1 /* include delivery status notification code */ # endif +# if !defined(USERDB) && (defined(NEWDB) || defined(HESIOD)) +# define USERDB 1 /* look in user database */ +# endif + # ifndef MIME8TO7 # define MIME8TO7 1 /* 8->7 bit MIME conversions */ # endif @@ -89,14 +90,19 @@ struct rusage; /* forward declaration to get gcc to shut up in wait.h */ # define MIME7TO8 1 /* 7->8 bit MIME conversions */ # endif -/* -** Most systems have symbolic links today, so default them on. You -** can turn them off by #undef'ing this below. -*/ +/********************************************************************** +** "Hard" compilation options. +** #define these if they are available; comment them out otherwise. +** These cannot be overridden from the Makefile, and should really not +** be turned off unless absolutely necessary. +**********************************************************************/ -# define HASLSTAT 1 /* has lstat(2) call */ +# define LOG /* enable logging -- don't turn off */ -/* +/********************************************************************** +** End of site-specific configuration. +**********************************************************************/ + /* ** General "standard C" defines. ** ** These may be undone later, to cope with systems that claim to @@ -110,6 +116,12 @@ struct rusage; /* forward declaration to get gcc to shut up in wait.h */ #ifdef __STDC__ # define HASSETVBUF 1 /* we have setvbuf(3) in libc */ #endif + +/* +** Assume you have standard calls; can be #undefed below if necessary. +*/ + +# define HASLSTAT 1 /* has lstat(2) call */ /********************************************************************** ** Operating system configuration. ** @@ -117,7 +129,6 @@ struct rusage; /* forward declaration to get gcc to shut up in wait.h */ ** change these. **********************************************************************/ - /* ** HP-UX -- tested for 8.07, 9.00, and 9.01. ** @@ -617,7 +628,7 @@ extern int errno; # define SFS_TYPE SFS_4ARGS /* use 4-arg impl */ # define SFS_BAVAIL f_bfree /* alternate field name */ # define TZ_TYPE TZ_TM_NAME /* use tm->tm_name */ -# undef NETUNIX /* no unix domain socket support */ +# define NETUNIX 0 /* no unix domain socket support */ #endif @@ -636,7 +647,7 @@ extern int errno; # define HASGETUSERSHELL 0 /* does not have getusershell(3) call */ # define HASSETREUID 1 /* has setreuid(2) call */ # define NEEDFSYNC 1 /* needs the fsync(2) call stub */ -# undef NETUNIX /* no unix domain socket support */ +# define NETUNIX 0 /* no unix domain socket support */ # define FORK fork # define MAXPATHLEN 1024 # define LA_TYPE LA_SHORT @@ -673,7 +684,7 @@ typedef short pid_t; # define SFS_TYPE SFS_STATFS /* use statfs() impl */ # define SFS_BAVAIL f_bfree /* alternate field name */ # define TZ_TYPE TZ_TM_NAME /* use tm->tm_name */ -# undef NETUNIX /* no unix domain socket support */ +# define NETUNIX 0 /* no unix domain socket support */ # undef WIFEXITED # undef WEXITSTATUS # define strtoul strtol /* gcc library bogosity */ @@ -1116,7 +1127,7 @@ extern int syslog(int, char *, ...); #ifdef _UTS # include -# undef HASLSTAT /* has symlinks, but they cause problems */ +# undef HASLSTAT /* has symlinks, but they cause problems */ # define NEEDFSYNC 1 /* system fsync(2) fails on non-EFS filesys */ # define SYS5SIGNALS 1 /* System V signal semantics */ # define SYS5SETPGRP 1 /* use System V setpgrp(2) syscall */ @@ -1415,6 +1426,10 @@ extern int errno; # define HASGETUSERSHELL 1 /* libc has getusershell(3) call */ #endif +#ifndef NETUNIX +# define NETUNIX 1 /* include unix domain support */ +#endif + #ifndef HASFLOCK # define HASFLOCK 0 /* assume no flock(2) support */ #endif diff --git a/usr/src/usr.sbin/sendmail/src/daemon.c b/usr/src/usr.sbin/sendmail/src/daemon.c index 697083be20..849e87a340 100644 --- a/usr/src/usr.sbin/sendmail/src/daemon.c +++ b/usr/src/usr.sbin/sendmail/src/daemon.c @@ -12,9 +12,9 @@ #ifndef lint #ifdef DAEMON -static char sccsid[] = "@(#)daemon.c 8.101 (Berkeley) %G% (with daemon mode)"; +static char sccsid[] = "@(#)daemon.c 8.102 (Berkeley) %G% (with daemon mode)"; #else -static char sccsid[] = "@(#)daemon.c 8.101 (Berkeley) %G% (without daemon mode)"; +static char sccsid[] = "@(#)daemon.c 8.102 (Berkeley) %G% (without daemon mode)"; #endif #endif /* not lint */ @@ -94,7 +94,7 @@ getrequests() bool refusingconnections = TRUE; FILE *pidf; int socksize; -#ifdef XDEBUG +#if XDEBUG bool j_has_dot; #endif extern void reapchild(); @@ -149,7 +149,7 @@ getrequests() fclose(pidf); } -#ifdef XDEBUG +#if XDEBUG { char jbuf[MAXHOSTNAMELEN]; @@ -229,7 +229,7 @@ makeconnection(host, port, mci, usesecureport) if (p != NULL) { *p = '\0'; -#ifdef NETINET +#if NETINET hid = inet_addr(&host[1]); if (hid == -1) #endif @@ -261,7 +261,7 @@ makeconnection(host, port, mci, usesecureport) mci->mci_status = "5.1.2"; return (EX_NOHOST); } -#ifdef NETINET +#if NETINET addr.sin.sin_family = AF_INET; /*XXX*/ addr.sin.sin_addr.s_addr = hid; #endif @@ -302,7 +302,7 @@ gothostent: addr.sa.sa_family = hp->h_addrtype; switch (hp->h_addrtype) { -#ifdef NETINET +#if NETINET case AF_INET: bcopy(hp->h_addr, &addr.sin.sin_addr, @@ -341,14 +341,14 @@ gothostent: switch (addr.sa.sa_family) { -#ifdef NETINET +#if NETINET case AF_INET: addr.sin.sin_port = port; addrlen = sizeof (struct sockaddr_in); break; #endif -#ifdef NETISO +#if NETISO case AF_ISO: /* assume two byte transport selector */ bcopy((char *) &port, TSEL((struct sockaddr_iso *) &addr), 2); @@ -445,7 +445,7 @@ gothostent: errstring(sav_errno)); switch (addr.sa.sa_family) { -#ifdef NETINET +#if NETINET case AF_INET: bcopy(hp->h_addr_list[i++], &addr.sin.sin_addr, @@ -1036,7 +1036,7 @@ host_map_lookup(map, name, av, statp) ** A printable version of that sockaddr. */ -#ifdef NETLINK +#if NETLINK # include #endif @@ -1057,7 +1057,7 @@ anynet_ntoa(sap) switch (sap->sa.sa_family) { -#ifdef NETUNIX +#if NETUNIX case AF_UNIX: if (sap->sunix.sun_path[0] != '\0') sprintf(buf, "[UNIX: %.64s]", sap->sunix.sun_path); @@ -1066,12 +1066,12 @@ anynet_ntoa(sap) return buf; #endif -#ifdef NETINET +#if NETINET case AF_INET: return inet_ntoa(sap->sin.sin_addr); #endif -#ifdef NETLINK +#if NETLINK case AF_LINK: sprintf(buf, "[LINK: %s]", link_ntoa((struct sockaddr_dl *) &sap->sa)); @@ -1123,7 +1123,7 @@ hostnamebyanyaddr(sap) switch (sap->sa.sa_family) { -#ifdef NETINET +#if NETINET case AF_INET: hp = sm_gethostbyaddr((char *) &sap->sin.sin_addr, INADDRSZ, @@ -1131,7 +1131,7 @@ hostnamebyanyaddr(sap) break; #endif -#ifdef NETISO +#if NETISO case AF_ISO: hp = sm_gethostbyaddr((char *) &sap->siso.siso_addr, sizeof sap->siso.siso_addr, diff --git a/usr/src/usr.sbin/sendmail/src/deliver.c b/usr/src/usr.sbin/sendmail/src/deliver.c index ee4edbf637..b7eb70e2e4 100644 --- a/usr/src/usr.sbin/sendmail/src/deliver.c +++ b/usr/src/usr.sbin/sendmail/src/deliver.c @@ -7,7 +7,7 @@ */ #ifndef lint -static char sccsid[] = "@(#)deliver.c 8.157 (Berkeley) %G%"; +static char sccsid[] = "@(#)deliver.c 8.158 (Berkeley) %G%"; #endif /* not lint */ #include "sendmail.h" @@ -518,7 +518,7 @@ sendenvelope(e, mode) /* now run through the queue */ for (q = e->e_sendqueue; q != NULL; q = q->q_next) { -#ifdef XDEBUG +#if XDEBUG char wbuf[MAXNAME + 20]; (void) sprintf(wbuf, "sendall(%s)", q->q_paddr); @@ -563,7 +563,7 @@ sendenvelope(e, mode) e->e_ntries++; } -#ifdef XDEBUG +#if XDEBUG checkfd012("end of sendenvelope"); #endif @@ -1035,7 +1035,7 @@ deliver(e, firstto) SmtpPhase = NULL; mci = NULL; -#ifdef XDEBUG +#if XDEBUG { char wbuf[MAXLINE]; @@ -1637,7 +1637,7 @@ tryhost: ** Restore state and return. */ -#ifdef XDEBUG +#if XDEBUG { char wbuf[MAXLINE]; @@ -2229,7 +2229,6 @@ putfromline(mci, e) if (bitnset(M_NHDR, mci->mci_mailer->m_flags)) return; -# ifdef UGLYUUCP if (bitnset(M_UGLYUUCP, mci->mci_mailer->m_flags)) { char *bang; @@ -2249,7 +2248,6 @@ putfromline(mci, e) template = xbuf; } } -# endif /* UGLYUUCP */ expand(template, buf, sizeof buf, e); putxline(buf, mci, PXLF_NOTHINGSPECIAL); } diff --git a/usr/src/usr.sbin/sendmail/src/main.c b/usr/src/usr.sbin/sendmail/src/main.c index 4374f49634..d633fb3597 100644 --- a/usr/src/usr.sbin/sendmail/src/main.c +++ b/usr/src/usr.sbin/sendmail/src/main.c @@ -13,7 +13,7 @@ static char copyright[] = #endif /* not lint */ #ifndef lint -static char sccsid[] = "@(#)main.c 8.128 (Berkeley) %G%"; +static char sccsid[] = "@(#)main.c 8.129 (Berkeley) %G%"; #endif /* not lint */ #define _DEFINE @@ -698,7 +698,7 @@ main(argc, argv, envp) ** Extract special fields for local use. */ -#ifdef XDEBUG +#if XDEBUG checkfd012("before readcf"); #endif vendor_pre_defaults(CurEnv); @@ -917,7 +917,7 @@ main(argc, argv, envp) exit(ExitStat); } -#ifdef XDEBUG +#if XDEBUG checkfd012("before main() initmaps"); #endif @@ -1412,7 +1412,7 @@ disconnect(droplev, e) errno = 0; } -#ifdef XDEBUG +#if XDEBUG checkfd012("disconnect"); #endif diff --git a/usr/src/usr.sbin/sendmail/src/map.c b/usr/src/usr.sbin/sendmail/src/map.c index 7bd56c52d3..315767523f 100644 --- a/usr/src/usr.sbin/sendmail/src/map.c +++ b/usr/src/usr.sbin/sendmail/src/map.c @@ -7,7 +7,7 @@ */ #ifndef lint -static char sccsid[] = "@(#)map.c 8.76 (Berkeley) %G%"; +static char sccsid[] = "@(#)map.c 8.77 (Berkeley) %G%"; #endif /* not lint */ #include "sendmail.h" @@ -369,7 +369,7 @@ initmaps(rebuild, e) { extern void map_init(); -#ifdef XDEBUG +#if XDEBUG checkfd012("entering initmaps"); #endif CurEnv = e; @@ -382,7 +382,7 @@ initmaps(rebuild, e) { stabapply(map_init, 0); } -#ifdef XDEBUG +#if XDEBUG checkfd012("exiting initmaps"); #endif } @@ -1916,7 +1916,7 @@ hes_map_lookup(map, name, av, statp) ** NeXT NETINFO Modules */ -#ifdef NETINFO +#if NETINFO #define NETINFO_DEFAULT_DIR "/aliases" #define NETINFO_DEFAULT_PROPERTY "members" diff --git a/usr/src/usr.sbin/sendmail/src/recipient.c b/usr/src/usr.sbin/sendmail/src/recipient.c index 54bce036a5..2fa94669fe 100644 --- a/usr/src/usr.sbin/sendmail/src/recipient.c +++ b/usr/src/usr.sbin/sendmail/src/recipient.c @@ -7,7 +7,7 @@ */ #ifndef lint -static char sccsid[] = "@(#)recipient.c 8.92 (Berkeley) %G%"; +static char sccsid[] = "@(#)recipient.c 8.93 (Berkeley) %G%"; #endif /* not lint */ # include "sendmail.h" @@ -683,7 +683,7 @@ finduser(name, fuzzyp) return (pw); } -#ifdef MATCHGECOS +#if MATCHGECOS /* see if fuzzy matching allowed */ if (!MatchGecos) { diff --git a/usr/src/usr.sbin/sendmail/src/sendmail.h b/usr/src/usr.sbin/sendmail/src/sendmail.h index 0b8f20289b..c0351c4818 100644 --- a/usr/src/usr.sbin/sendmail/src/sendmail.h +++ b/usr/src/usr.sbin/sendmail/src/sendmail.h @@ -5,7 +5,7 @@ * * %sccs.include.redist.c% * - * @(#)sendmail.h 8.140 (Berkeley) %G% + * @(#)sendmail.h 8.141 (Berkeley) %G% */ /* @@ -15,7 +15,7 @@ # ifdef _DEFINE # define EXTERN # ifndef lint -static char SmailSccsId[] = "@(#)sendmail.h 8.140 %G%"; +static char SmailSccsId[] = "@(#)sendmail.h 8.141 %G%"; # endif # else /* _DEFINE */ # define EXTERN extern @@ -46,19 +46,19 @@ static char SmailSccsId[] = "@(#)sendmail.h 8.140 %G%"; # ifdef DAEMON # include # endif -# ifdef NETUNIX +# if NETUNIX # include # endif -# ifdef NETINET +# if NETINET # include # endif -# ifdef NETISO +# if NETISO # include # endif -# ifdef NETNS +# if NETNS # include # endif -# ifdef NETX25 +# if NETX25 # include # endif @@ -903,19 +903,19 @@ struct prival union bigsockaddr { struct sockaddr sa; /* general version */ -#ifdef NETUNIX +#if NETUNIX struct sockaddr_un sunix; /* UNIX family */ #endif -#ifdef NETINET +#if NETINET struct sockaddr_in sin; /* INET family */ #endif -#ifdef NETISO +#if NETISO struct sockaddr_iso siso; /* ISO family */ #endif -#ifdef NETNS +#if NETNS struct sockaddr_ns sns; /* XNS family */ #endif -#ifdef NETX25 +#if NETX25 struct sockaddr_x25 sx25; /* X.25 family */ #endif }; diff --git a/usr/src/usr.sbin/sendmail/src/usersmtp.c b/usr/src/usr.sbin/sendmail/src/usersmtp.c index 65ab1d544e..c11813883f 100644 --- a/usr/src/usr.sbin/sendmail/src/usersmtp.c +++ b/usr/src/usr.sbin/sendmail/src/usersmtp.c @@ -10,9 +10,9 @@ #ifndef lint #ifdef SMTP -static char sccsid[] = "@(#)usersmtp.c 8.54 (Berkeley) %G% (with SMTP)"; +static char sccsid[] = "@(#)usersmtp.c 8.55 (Berkeley) %G% (with SMTP)"; #else -static char sccsid[] = "@(#)usersmtp.c 8.54 (Berkeley) %G% (without SMTP)"; +static char sccsid[] = "@(#)usersmtp.c 8.55 (Berkeley) %G% (without SMTP)"; #endif #endif /* not lint */ @@ -884,7 +884,7 @@ reply(m, mci, e, timeout, pfunc) pause(); mci->mci_state = MCIS_ERROR; smtpquit(m, mci, e); -#ifdef XDEBUG +#if XDEBUG { char wbuf[MAXLINE]; char *p = wbuf; diff --git a/usr/src/usr.sbin/sendmail/src/util.c b/usr/src/usr.sbin/sendmail/src/util.c index c5840d797d..9d6858733e 100644 --- a/usr/src/usr.sbin/sendmail/src/util.c +++ b/usr/src/usr.sbin/sendmail/src/util.c @@ -7,7 +7,7 @@ */ #ifndef lint -static char sccsid[] = "@(#)util.c 8.75 (Berkeley) %G%"; +static char sccsid[] = "@(#)util.c 8.76 (Berkeley) %G%"; #endif /* not lint */ # include "sendmail.h" @@ -1039,7 +1039,7 @@ xfclose(fp, a, b) { if (tTd(53, 99)) printf("xfclose(%x) %s %s\n", fp, a, b); -#ifdef XDEBUG +#if XDEBUG if (fileno(fp) == 1) syserr("xfclose(%s %s): fd = 1", a, b); #endif @@ -1099,7 +1099,7 @@ sfgets(buf, siz, fp, timeout, during) usrerr("451 timeout waiting for input during %s", during); buf[0] = '\0'; -#ifdef XDEBUG +#if XDEBUG checkfd012(during); #endif return (NULL); @@ -1446,7 +1446,7 @@ void checkfd012(where) char *where; { -#ifdef XDEBUG +#if XDEBUG register int i; struct stat stbuf; -- 2.20.1