Lines Matching +full:ep +full:- +full:side
2 * Copyright (c) 1998-2001, 2003, 2006, 2007 Proofpoint, Inc. and its suppliers.
4 * Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved.
16 SM_RCSID("@(#)$Id: macro.c,v 8.108 2013-11-22 20:51:55 ca Exp $")
19 #if MAXMACROID != (BITMAPBITS - 1)
37 /* table for next id in non-printable ASCII range: disallow some value */
49 /* 9 ht */ -1,
50 /* 10 nl */ -1,
51 /* 11 vt */ -1,
52 /* 12 np */ -1,
53 /* 13 cr */ -1,
72 /* 32 sp */ -1,
87 ** INITMACROS -- initialize the macro system
98 ** Side Effects:
105 { '*', MATCHZANY }, { '+', MATCHANY }, { '-', MATCHONE },
126 stab(name, ST_MACRO, ST_ENTER)->s_macro = mid; \
137 for (m = MetaMacros; m->metaname != '\0'; m++)
139 buf[0] = m->metaval;
141 macdefine(&e->e_macro, A_TEMP, m->metaname, buf);
148 macdefine(&e->e_macro, A_TEMP, c, buf);
152 macdefine(&e->e_macro, A_PERM, 'n', "MAILER-DAEMON");
160 ** EXPAND/DOEXPAND -- macro expand a string using $x escapes.
164 ** s -- the string to expand. [i]
165 ** buf -- the place to put the expansion. [i]
166 ** bufsize -- the size of the buffer.
167 ** explevel -- the depth of expansion (doexpand only)
168 ** e -- envelope in which to work.
213 ** Check for non-ordinary (special?) character.
252 iflev--;
256 skiplev--;
265 s--;
283 if (skipping || xp >= &xbuf[sizeof(xbuf) - 1])
293 xp < &xbuf[sizeof(xbuf) - 1])
332 i = xp - xbuf;
334 i = bufsize - 1;
358 ** MACTABCLEAR -- clear entire macro table
361 ** mac -- Macro table.
366 ** Side Effects:
376 if (mac->mac_rpool == NULL)
379 SM_FREE(mac->mac_table[i]);
385 ** MACDEFINE -- bind a macro name to a value
393 ** mac -- Macro table.
394 ** vclass -- storage class of 'value', ignored if value==NULL.
402 ** -- value == NULL,
403 ** -- value points to a string literal,
404 ** -- value was allocated from mac->mac_rpool
406 ** from e->e_rpool,
407 ** -- in the case of an envelope macro,
409 ** such as e->e_sender.
410 ** id -- Macro id. This is a single character macro name
412 ** value -- Macro value: either NULL, or a string.
442 mac->mac_table[id] == NULL ? "" : "re", macname(id));
451 if (mac->mac_rpool == NULL)
455 if (mac->mac_table[id] != NULL &&
456 bitnset(id, mac->mac_allocated))
457 freeit = mac->mac_table[id];
463 clrbitn(id, mac->mac_allocated);
472 setbitn(id, mac->mac_allocated);
474 mac->mac_table[id] = newvalue;
483 newvalue = sm_rpool_strdup_x(mac->mac_rpool, value);
484 mac->mac_table[id] = newvalue;
500 ** MACSET -- set a named macro to a value (low level)
506 ** mac -- Macro table.
507 ** i -- Macro name, specified as an integer offset.
508 ** value -- Macro value: either NULL, or a string.
529 mac->mac_table[i] = value;
533 ** MACVALUE -- return uninterpreted value of a macro.
539 ** n -- the name of the macro.
540 ** e -- envelope in which to start looking for the macro.
545 ** Side Effects:
555 if (e != NULL && e->e_mci != NULL)
557 char *p = e->e_mci->mci_macro.mac_table[n];
564 char *p = e->e_macro.mac_table[n];
568 if (e == e->e_parent)
570 e = e->e_parent;
585 ** MACNAME -- return the name of a macro given its internal id
588 ** n -- the id of the macro
593 ** Side Effects:
597 ** Not thread-safe.
627 ** MACID_PARSE -- return id of macro identified by its name
630 ** p -- pointer to name string -- either a single
632 ** ep -- filled in with the pointer to the byte
636 ** 0 -- An error was detected.
637 ** 1..MAXMACROID -- The internal id code for this macro.
639 ** Side Effects:
645 macid_parse(p, ep) in macid_parse() argument
647 char **ep;
663 if (ep != NULL)
664 *ep = p;
672 if (ep != NULL)
673 *ep = p + 1;
686 while (*++p != '\0' && *p != '}' && bp < &mbuf[sizeof(mbuf) - 1])
694 mid = -1;
702 mbuf, (int) (sizeof(mbuf) - 1));
715 if (s->s_macro != 0)
716 mid = s->s_macro;
723 s->s_macro = -1;
727 MacroName[NextMacroId] = s->s_name;
728 s->s_macro = mid = NextMacroId;
734 if (ep != NULL)
735 *ep = p;
749 ** WORDINCLASS -- tell if a word is in a specific class
752 ** str -- the name of the word to look up.
753 ** cl -- the class name.
778 return s != NULL && bitnset(bitidx(cl), s->s_class);
781 map = &s->s_dynclass;
784 if (bitset(MF_OPENBOGUS, map->map_mflags))
791 if (!SM_IS_EMPTY(map->map_tag))
793 sm_strlcpy(key, map->map_tag, sizeof(key));
798 p = (map->map_class->map_lookup)(map, key, NULL, &status);
804 sm_syslog(LOG_WARNING, CurEnv->e_id,
806 map->map_mname, key, status);