projects
/
mmh
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Updated sendfiles(1) man page to reflect upcoming code update.
[mmh]
/
sbr
/
fmt_compile.c
diff --git
a/sbr/fmt_compile.c
b/sbr/fmt_compile.c
index
f643421
..
ee495f1
100644
(file)
--- a/
sbr/fmt_compile.c
+++ b/
sbr/fmt_compile.c
@@
-44,6
+44,7
@@
#include <h/tws.h>
#include <h/fmt_scan.h>
#include <h/fmt_compile.h>
#include <h/tws.h>
#include <h/fmt_scan.h>
#include <h/fmt_compile.h>
+#include <h/mts.h>
#ifdef HAVE_SYS_TIME_H
# include <sys/time.h>
#ifdef HAVE_SYS_TIME_H
# include <sys/time.h>
@@
-75,6
+76,9
@@
extern struct mailname fmt_mnull;
#define TF_NOW 6 /* special - get current unix time */
#define TF_EXPR_SV 7 /* like expr but save current str reg */
#define TF_NOP 8 /* like expr but no result */
#define TF_NOW 6 /* special - get current unix time */
#define TF_EXPR_SV 7 /* like expr but save current str reg */
#define TF_NOP 8 /* like expr but no result */
+#define TF_MYNAME 9 /* special - get current name of user */
+#define TF_MYHOST 10 /* special - get "local" hostname */
+#define TF_LMBOX 11 /* special - get full local mailbox */
/* ftable->flags */
/* NB that TFL_PUTS is also used to decide whether the test
/* ftable->flags */
/* NB that TFL_PUTS is also used to decide whether the test
@@
-153,6
+157,9
@@
static struct ftable functable[] = {
{ "dat", TF_NUM, FT_LV_DAT, 0, TFL_PUTN },
{ "strlen", TF_NONE, FT_LV_STRLEN, 0, TFL_PUTN },
{ "me", TF_MYBOX, FT_LS_LIT, 0, TFL_PUTS },
{ "dat", TF_NUM, FT_LV_DAT, 0, TFL_PUTN },
{ "strlen", TF_NONE, FT_LV_STRLEN, 0, TFL_PUTN },
{ "me", TF_MYBOX, FT_LS_LIT, 0, TFL_PUTS },
+ { "myname", TF_MYNAME, FT_LS_LIT, 0, TFL_PUTS },
+ { "myhost", TF_MYHOST, FT_LS_LIT, 0, TFL_PUTS },
+ { "localmbox", TF_LMBOX, FT_LS_LIT, 0, TFL_PUTS },
{ "plus", TF_NUM, FT_LV_PLUS_L, 0, TFL_PUTN },
{ "minus", TF_NUM, FT_LV_MINUS_L, 0, TFL_PUTN },
{ "divide", TF_NUM, FT_LV_DIVIDE_L, 0, TFL_PUTN },
{ "plus", TF_NUM, FT_LV_PLUS_L, 0, TFL_PUTN },
{ "minus", TF_NUM, FT_LV_MINUS_L, 0, TFL_PUTN },
{ "divide", TF_NUM, FT_LV_DIVIDE_L, 0, TFL_PUTN },
@@
-239,17
+246,12
@@
static struct ftable functable[] = {
#define PUTLIT(str) do { NEW(FT_LIT,0,0); fp->f_text = (str); } while (0)
#define PUTC(c) do { NEW(FT_CHAR,0,0); fp->f_char = (c); } while (0)
#define PUTLIT(str) do { NEW(FT_LIT,0,0); fp->f_text = (str); } while (0)
#define PUTC(c) do { NEW(FT_CHAR,0,0); fp->f_char = (c); } while (0)
-static char *format_string;
+char *format_string;
static unsigned char *usr_fstring; /* for CERROR */
#define CERROR(str) compile_error (str, cp)
/*
static unsigned char *usr_fstring; /* for CERROR */
#define CERROR(str) compile_error (str, cp)
/*
- * external prototypes
- */
-extern char *getusername(void);
-
-/*
* static prototypes
*/
static struct ftable *lookup(char *);
* static prototypes
*/
static struct ftable *lookup(char *);
@@
-316,7
+318,7
@@
int
fmt_compile(char *fstring, struct format **fmt)
{
register char *cp;
fmt_compile(char *fstring, struct format **fmt)
{
register char *cp;
- int i;
+ size_t i;
if (format_string)
free (format_string);
if (format_string)
free (format_string);
@@
-593,6
+595,18
@@
do_func(char *sp)
LS(t->f_type, getusername());
break;
LS(t->f_type, getusername());
break;
+ case TF_MYNAME:
+ LS(t->f_type, getfullname());
+ break;
+
+ case TF_MYHOST:
+ LS(t->f_type, LocalName(0));
+ break;
+
+ case TF_LMBOX:
+ LS(t->f_type, getlocalmbox());
+ break;
+
case TF_NOW:
LV(t->f_type, time((time_t *) 0));
break;
case TF_NOW:
LV(t->f_type, time((time_t *) 0));
break;