File vacation-1.2.7.1.multiple-vacationmsg_files.diff of Package vacation
--- vacation.c.orig 2012-01-29 21:18:46.516568917 -0500
+++ vacation.c 2012-01-29 21:22:55.799452451 -0500
@@ -102,6 +102,7 @@
/* Extern definitions for getopt(3) */
extern int optind, opterr;
extern char *optarg;
+char *vmsg = VMSG;
/*
* VACATION -- return a message to the sender when on vacation.
@@ -136,7 +137,7 @@
#endif
if (argc == 1 || (argc == 2 && (strcmp(argv[1], "-F") == 0)))
nflag = 1;
- while ((ch = getopt (argc, argv, "a:h:Iit:jrlF")) != EOF)
+ while ((ch = getopt (argc, argv, "a:f:h:Iit:jrlF")) != EOF)
switch ((char) ch)
{
case 'a': /* alias */
@@ -149,6 +150,13 @@
cur->next = names;
names = cur;
break;
+ case 'f':
+ if(optarg) {
+ vmsg = optarg; /* another vacation.msg file */
+ } else {
+ syslog(LOG_NOTICE, "vacation: -f option used but not file given");
+ }
+ break;
case 'h': /* hostname */
vdomain = optarg;
break;
@@ -741,10 +749,10 @@
printd (logline);
#endif
- mfp = fopen (VMSG, "r");
+ mfp = fopen (vmsg, "r");
if (mfp == NULL)
{
- syslog (LOG_NOTICE, "vacation: no ~%s/%s file.\n", myname, VMSG);
+ syslog (LOG_NOTICE, "vacation: no ~%s/%s file.\n", myname, vmsg);
closelog();
exit (1);
}
@@ -822,7 +830,7 @@
{
puts ("usage: vacation [ -I | -i | -l ] [ -F ]");
puts
- ("or: vacation [ -j ] [ -a alias ] [ -h hostname ] [ -tN ] [ -r ] login");
+ ("or: vacation [ -j ] [ -a alias ] [ -f file ] [ -h hostname ] [ -tN ] [ -r ] login");
exit (1);
}
@@ -882,11 +890,11 @@
printd (logline);
#endif
- if (((message = fopen (VMSG, "r")) == NULL))
+ if (((message = fopen (vmsg, "r")) == NULL))
{
- if (((message = fopen (VMSG, "w")) == NULL))
+ if (((message = fopen (vmsg, "w")) == NULL))
{
- fprintf (stderr, "vacation: cannot open %s\n", VMSG);
+ fprintf (stderr, "vacation: cannot open %s\n", vmsg);
exit (1);
}
fprintf (message, "Subject: away from my mail\n\n");
@@ -908,7 +916,7 @@
fclose (oldmessage);
}
fclose (message);
- snprintf (ebuf, PATH_MAX, "%s %s", editor, VMSG); /* Flawfinder: ignore */
+ snprintf (ebuf, PATH_MAX, "%s %s", editor, vmsg); /* Flawfinder: ignore */
#ifdef DEBUG
snprintf (logline, MAXLINE, "calling editor with \"%s\"\n", ebuf); /* Flawfinder: ignore */
printd (logline);
--- vacation.man.orig 2012-01-29 21:23:21.844126847 -0500
+++ vacation-en.man 2012-01-29 21:25:49.001287129 -0500
@@ -40,6 +40,9 @@
.BI \-a " alias"
]
[
+.BI \-f " file"
+]
+[
.BI \-t N
]
[
@@ -241,6 +244,10 @@
.RB ` From: '
entry.
.TP
+.BI \-f\ <file>
+use a different message file than the default, .vacation.msg.
+The path to this file is relative to the home directory of the user.
+.TP
.BI \-?
issue short usage line.
.SH USAGE