⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 readcf.c

📁 操作系统SunOS 4.1.3版本的源码
💻 C
📖 第 1 页 / 共 2 页
字号:
			break;		}		p = DelimChar;	}	if (m->m_eol == NULL)	{		if (strcmp(m->m_mailer, "[IPC]") == 0 ||		    strcmp(m->m_mailer, "[TCP]") == 0)			m->m_eol = "\r\n";		else			m->m_eol = "\n";	}	/* now store the mailer away */	if (NextMailer >= MAXMAILERS)	{		syserr("too many mailers defined (%d max)", MAXMAILERS);		return;	}	if (m->m_argv == NULL)	{		syserr("mailer %s does not have an argument vector", 			m->m_name);		return;	}		Mailer[NextMailer++] = m;	s = stab(m->m_name, ST_MAILER, ST_ENTER);	s->s_mailer = m;}/***  MUNCHSTRING -- translate a string into internal form.****	Parameters:**		p -- the string to munch.****	Returns:**		the munched string.****	Side Effects:**		Sets "DelimChar" to point to the string that caused us**		to stop.*/char *munchstring(p)	register char *p;{	register char *q;	bool backslash = FALSE;	bool quotemode = FALSE;	static char buf[MAXLINE];	extern char *DelimChar;	for (q = buf; *p != '\0'; p++)	{		if (backslash)		{			/* everything is roughly literal */			backslash = FALSE;			switch (*p)			{			  case 'r':		/* carriage return */				*q++ = '\r';				continue;			  case 'n':		/* newline */				*q++ = '\n';				continue;			  case 'f':		/* form feed */				*q++ = '\f';				continue;			  case 'b':		/* backspace */				*q++ = '\b';				continue;			}			*q++ = *p;		}		else		{			if (*p == '\\')				backslash = TRUE;			else if (*p == '"')				quotemode = !quotemode;			else if (quotemode || *p != ',')				*q++ = *p;			else				break;		}	}	DelimChar = p;	*q++ = '\0';	return (buf);}/***  MAKEARGV -- break up a string into words****	Parameters:**		p -- the string to break up.****	Returns:**		a char **argv (dynamically allocated)****	Side Effects:**		munges p.*/char **makeargv(p)	register char *p;{	char *q;	int i;	char **avp;	char *argv[MAXPV + 1];	/* take apart the words */	i = 0;	while (*p != '\0' && i < MAXPV)	{		q = p;		while (*p != '\0' && !isspace(*p))			p++;		while (isspace(*p))			*p++ = '\0';		argv[i++] = newstr(q);	}	argv[i++] = NULL;	/* now make a copy of the argv */	avp = (char **) xalloc(sizeof *avp * i);	bcopy((char *) argv, (char *) avp, sizeof *avp * i);	return (avp);}/***  PRINTRULES -- print rewrite rules (for debugging)****	Parameters:**		none.****	Returns:**		none.****	Side Effects:**		prints rewrite rules.*/# ifdef DEBUGprintrules(){	register struct rewrite *rwp;	register int ruleset;	for (ruleset = 0; ruleset < 10; ruleset++)	{		if (RewriteRules[ruleset] == NULL)			continue;		printf("\n----Rule Set %d:", ruleset);		for (rwp = RewriteRules[ruleset]; rwp != NULL; rwp = rwp->r_next)		{			printf("\nLHS:");			printav(rwp->r_lhs);			printf("RHS:");			printav(rwp->r_rhs);		}	}}# endif DEBUG/***  SETOPTION -- set global processing option****	Parameters:**		opt -- option name.**		val -- option value (as a text string).**		safe -- set if this came from a configuration file.**			Some options (if set from the command line) will**			reset the user id to avoid security problems.**		sticky -- if set, don't let other setoptions override**			this value.****	Returns:**		none.****	Side Effects:**		Sets options as implied by the arguments.*/static BITMAP	StickyOpt;		/* set if option is stuck */extern char	*NetName;		/* name of home (local) network */# ifdef SMTP# ifdef WIZextern char	*WizWord;		/* the stored wizard password */# endif WIZ# endif SMTPsetoption(opt, val, safe, sticky)	char opt;	char *val;	bool safe;	bool sticky;{	extern bool atobool();	extern time_t convtime();	extern int QueueLA;	extern int RefuseLA;	extern char *AliasMap;	extern bool trusteduser();	extern char *username();# ifdef DEBUG	if (tTd(37, 1))		printf("setoption %c=%s", opt, val);# endif DEBUG	/*	**  See if this option is preset for us.	*/	if (bitnset(opt, StickyOpt))	{# ifdef DEBUG		if (tTd(37, 1))			printf(" (ignored)\n");# endif DEBUG		return;	}	/*	**  Check to see if this option can be specified by this user.	*/	if (!safe && getruid() == 0)		safe = TRUE;	if (!safe && index("bdeiLmMorRsvY", opt) == NULL)	{# ifdef DEBUG		if (tTd(37, 1))			printf(" (unsafe)");# endif DEBUG		if (getruid() != geteuid())		{			printf("(Resetting uid)\n");			(void) setgid(getgid());			(void) setuid(getuid());		}	}#ifdef DEBUG	else if (tTd(37, 1))		printf("\n");#endif DEBUG	switch (opt)	{	  case 'A':		/* set default alias file */		if (val[0] == '\0')			AliasFile = "aliases";		else			AliasFile = newstr(val);		break;	  case 'a':		/* look N minutes for "@:@" in alias file */		if (val[0] == '\0')			SafeAlias = 5;		else			SafeAlias = atoi(val);		break;	  case 'b':		/* number of recipients of "big" messages */		RecipThreshold = atoi(val);		break;	  case 'B':		/* substitution for blank character */		SpaceSub = val[0];		if (SpaceSub == '\0')			SpaceSub = ' ';		break;	  case 'c':		/* don't connect to "expensive" mailers */		NoConnect = atobool(val);		break;	  case 'C':		/* checkpoint after N connections */		CheckPointLimit = atoi(val);		break;	  case 'd':		/* delivery mode */		switch (*val)		{		  case '\0':			SendMode = SM_DELIVER;			break;		  case SM_QUEUE:	/* queue only */#ifndef QUEUE			syserr("need QUEUE to set -odqueue");#endif QUEUE			/* fall through..... */		  case SM_DELIVER:	/* do everything */		  case SM_FORK:		/* fork after verification */			SendMode = *val;			break;		  default:			syserr("Unknown delivery mode %c", *val);			exit(EX_USAGE);		}		break;	  case 'D':		/* rebuild alias database as needed */		AutoRebuild = atobool(val);		break;	  case 'e':		/* set error processing mode */		switch (*val)		{		  case EM_QUIET:	/* be silent about it */		  case EM_MAIL:		/* mail back */		  case EM_BERKNET:	/* do berknet error processing */		  case EM_WRITE:	/* write back (or mail) */			HoldErrs = TRUE;			/* fall through... */		  case EM_PRINT:	/* print errors normally (default) */			ErrorMode = *val;			break;		}		break;	  case 'F':		/* file mode */		FileMode = atooct(val) & 0777;		break;	  case 'f':		/* save Unix-style From lines on front */		SaveFrom = atobool(val);		break;	  case 'g':		/* default gid */		DefGid = atoi(val);		break;	  case 'H':		/* help file */		if (val[0] == '\0')			HelpFile = "sendmail.hf";		else			HelpFile = newstr(val);		break;	  case 'h':		/* Maximum Hop count */		Maxhop = atoi(val);		break;	  case 'i':		/* ignore dot lines in message */		IgnrDot = atobool(val);		break;	  case 'L':		/* log level */		LogLevel = atoi(val);		break;	  case 'M':		/* define macro */		define(val[0], newstr(&val[1]), CurEnv);		sticky = FALSE;		break;	  case 'm':		/* send to me too */		MeToo = atobool(val);		break;	  case 'n':		/* validate RHS in newaliases */		CheckAliases = atobool(val);		break;# ifdef DAEMON	  case 'N':		/* home (local?) network name */		NetName = newstr(val);		break;# endif DAEMON	  case 'o':		/* assume old style headers */		if (atobool(val))			CurEnv->e_flags |= EF_OLDSTYLE;		else			CurEnv->e_flags &= ~EF_OLDSTYLE;		break;	  case 'P':		/* postmaster copy address for returned mail */		PostMasterCopy = newstr(val);		break;	  case 'q':		/* slope of queue only function */		QueueFactor = atoi(val);		break;	  case 'Q':		/* queue directory */		if (val[0] == '\0')			QueueDir = "mqueue";		else			QueueDir = newstr(val);		break;	  case 'r':		/* read timeout */		ReadTimeout = convtime(val);		break;	  case 'R':		/* remote mail delivery */	  	RemoteServer = newstr(val);	  	break;	  case 'S':		/* status file */		if (val[0] == '\0')			StatFile = "sendmail.st";		else			StatFile = newstr(val);		break;	  case 's':		/* be super safe, even if expensive */		SuperSafe = atobool(val);		break;	  case 'T':		/* queue timeout */		TimeOut = convtime(val);		break;	  case 't':		/* time zone name */# ifdef V6		StdTimezone = newstr(val);		DstTimezone = index(StdTimeZone, ',');		if (DstTimezone == NULL)			syserr("bad time zone spec");		else			*DstTimezone++ = '\0';# endif V6		break;	  case 'u':		/* set default uid */		DefUid = atoi(val);		break;	  case 'v':		/* run in verbose mode */		Verbose = atobool(val);		break;# ifdef SMTP# ifdef WIZ	  case 'W':		/* set the wizards password */		WizWord = newstr(val);		break;# endif WIZ# endif SMTP	  case 'x':		/* load avg at which to auto-queue msgs */		QueueLA = atoi(val);		break;	  case 'X':		/* load avg at which to auto-reject connections */		RefuseLA = atoi(val);		break;	  case 'y':		/* work recipient factor */		WkRecipFact = atoi(val);		break;	  case 'Y':		/* set NIS alias map */	  	AliasMap = newstr(val);		break;	  case 'z':		/* work message class factor */		WkClassFact = atoi(val);		break;	  case 'Z':		/* work time factor */		WkTimeFact = atoi(val);		break;	  default:		break;	}	if (sticky)		setbitn(opt, StickyOpt);	return;}/***  SETCLASS -- set a word into a class****	Parameters:**		class -- the class to put the word in.**		word -- the word to enter****	Returns:**		none.****	Side Effects:**		puts the word into the symbol table.*/setclass(class, word)	int class;	char *word;{	register STAB *s;	s = stab(word, ST_CLASS, ST_ENTER);	setbitn(class, s->s_class);}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -