File vacation-1.2.6.1.multiple-vacationmsg_files.dif of Package vacation
--- vacation.c
+++ vacation.c Wed Jul 28 11:19:32 2004
@@ -101,6 +101,9 @@
* vacation" loops.
*/
+ char *vmsg=VMSG;
+
+
int main(int argc, char **argv)
{
extern int optind, opterr;
@@ -124,7 +127,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 */
if (!(cur = (ALIAS *)malloc((u_int)sizeof(ALIAS)))) {
@@ -163,6 +166,13 @@
case 'F': /* Force creation of ~/vacation.db on NFS HOME */
fflag = 1;
break;
+ case 'f':
+ if(optarg) {
+ vmsg=optarg; /* another vacation.msg file */
+ } else {
+ syslog(LOG_NOTICE, "vacation: -f option used but no file given");
+ }
+ break;
case '?':
default:
usage();
@@ -653,9 +663,9 @@
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);
}
@@ -720,7 +730,7 @@
void usage(void)
{
puts ("usage: vacation [ -I | -i | -l ] [ -F ]");
- puts ("or: vacation [ -j ] [ -a alias ] [ -h hostname ] [ -tN ] [ -r ] login");
+ puts ("or: vacation [ -j ] [ -a alias ] [ -f file ] [ -h hostname ] [ -tN ] [ -r ] login");
exit(1);
}
@@ -767,12 +777,12 @@
printd (logline);
#endif
- if (((message = fopen (VMSG, "r")) == NULL)) {
- if (((message = fopen (VMSG, "w")) == NULL)) {
- fprintf (stderr, "vacation: cannot open %s\n", VMSG);
+ if (((message = fopen (vmsg, "r")) == NULL)) {
+ if (((message = fopen (vmsg, "w")) == NULL)) {
+ fprintf (stderr, "vacation: cannot open %s\n", vmsg);
exit (1);
}
- message = fopen (VMSG, "w");
+ message = fopen (vmsg, "w");
fprintf (message, "Subject: away from my mail\n\n");
fprintf (message, "I will not be reading my mail for a while.\n");
fprintf (message, "Your mail concerning \"$SUBJECT\"\n");
@@ -788,7 +798,7 @@
fclose (oldmessage);
}
fclose (message);
- sprintf (ebuf, "%s %s", editor, VMSG);
+ sprintf (ebuf, "%s %s", editor, vmsg);
#ifdef DEBUG
sprintf (logline, "calling editor with \"%s\"\n", ebuf);
printd (logline);
--- vacation.man
+++ vacation.man Wed Jul 28 11:20:00 2004
@@ -38,6 +38,9 @@
.BI \-a " alias"
]
[
+.BI \-f " file"
+]
+[
.BI \-t N
]
[
@@ -226,6 +229,10 @@
Otherwise, use the
.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.