Official Patch #6 for Mush 6.5
Barton E. Schaefer
schaefer at ogccse.ogc.edu
Sat Jul 1 07:21:19 AEST 1989
This is the shortest patch so far (about the size I hoped the last one
would be) and is a first for Mush in that it actually *decreases* the size
of mail.c. :-)
Mushrc:
Removed the erroneous usage of "echo -p".
README-6.5:
The usual summary.
commands.c:
"echo -p" now refuses to work if there is no current folder.
mail.c:
Treatment of headers now conforms to the man page description;
Bcc addresses are not expanded in files when $no_expand is set,
and aliases ARE expanded in the edit file when $edit_hdrs is set,
regardless of $no_expand.
Ordering of message headers in outgoing messages is now the same
regardless of whether $edit_hdrs is used. If the user rearranges
his headers in the editor, his ordering is preserved except that
X-Mailer, To, Subject, and Cc will move (in that order) to the end.
If the user deletes the From or Date headers, they will appear just
before the X-Mailer header. (This is the same as before).
The error messages when writes fail are a little better now.
main.c:
Fixed the error in initializing mailfile.
version.h:
Obvious.
Prereq: "6/26/89"
*** /tmp/,RCSt1020947 Fri Jun 30 10:34:52 1989
--- version.h Thu Jun 29 13:12:33 1989
***************
*** 1,8 ****
/* @(#)version.h (c) Copyright 1989 (Dan Heller) */
#define MUSHNAME "Mail User's Shell"
! #define RELEASE_DATE "6/26/89"
#define RELEASE 6
#define REVISION 5
! #define PATCHLEVEL 5
#define ORIGINAL_DATE "4/17/89"
--- 1,8 ----
/* @(#)version.h (c) Copyright 1989 (Dan Heller) */
#define MUSHNAME "Mail User's Shell"
! #define RELEASE_DATE "6/30/89"
#define RELEASE 6
#define REVISION 5
! #define PATCHLEVEL 6
#define ORIGINAL_DATE "4/17/89"
*** /tmp/,RCSt1020947 Fri Jun 30 10:34:01 1989
--- Mushrc Wed Jun 28 20:08:21 1989
***************
*** 110,116 ****
echo "I see you've never used the Mush program before."
echo "I'll set some special flags to help you out."
echo "After you've used Mush a few times, you can type the command:"
! echo -p "\n${prompt}expert\n"
echo "and the flags will no longer be set unless you put them"
echo "in your $HOME/$MAILRC file."
echo ""
--- 110,118 ----
echo "I see you've never used the Mush program before."
echo "I'll set some special flags to help you out."
echo "After you've used Mush a few times, you can type the command:"
! echo ""
! echo " expert"
! echo ""
echo "and the flags will no longer be set unless you put them"
echo "in your $HOME/$MAILRC file."
echo ""
*** /tmp/,RCSt1022001 Fri Jun 30 11:06:39 1989
--- README-6.5 Fri Jun 30 11:06:12 1989
***************
*** 211,213 ****
--- 211,223 ----
Installation directives have been added to the makefiles. Look over the
various initialization and help files and fix any file path names before
using "make install". See README.
+
+ ----------
+ Changes in the 6-30-89 patch:
+
+ Fixed bugs in the Mushrc init file and initialization in general.
+
+ Treatment of outgoing mail headers (the add_headers() function) has been
+ cleaned up a little and made consistent, so setting $edit_hdrs no longer
+ rearranges things and the man page description is correct. It might also
+ be a little easier now to follow what is going on in that function.
*** /tmp/,RCSt1020947 Fri Jun 30 10:34:14 1989
--- commands.c Wed Jun 28 20:07:14 1989
***************
*** 1068,1073 ****
--- 1068,1077 ----
hdr_format = save_hdr_fmt;
} else if (as_prompt) {
char *save_prompt = prompt;
+ if (!mailfile || !*mailfile) {
+ print("No current folder.\n");
+ return -1;
+ }
prompt = buf;
mail_status(1);
prompt = save_prompt;
*** /tmp/,RCSt1020947 Fri Jun 30 10:34:28 1989
--- mail.c Thu Jun 29 13:12:46 1989
***************
*** 1278,1284 ****
} else {
next_file +=
find_files(p,files+next_file,names+next_file,size-next_file,0);
! (void) strcpy(Bcc, p);
rm_cmts_in_addr(p);
skipspaces(0);
if (*p) {
--- 1278,1285 ----
} else {
next_file +=
find_files(p,files+next_file,names+next_file,size-next_file,0);
! if (expand)
! (void) strcpy(Bcc, p);
rm_cmts_in_addr(p);
skipspaces(0);
if (*p) {
***************
*** 1461,1471 ****
break;
} else {
/* Drop this file, but continue writing others */
- error("Write failed");
if (names[size]) {
close_lock(names[size], files[size]);
xfree(names[size]);
! }
if (size < --next_file) {
names[size] = names[next_file];
files[size--] = files[next_file];
--- 1462,1473 ----
break;
} else {
/* Drop this file, but continue writing others */
if (names[size]) {
+ error("Write failed: %s", names[size]);
close_lock(names[size], files[size]);
xfree(names[size]);
! } else
! error("Write failed");
if (size < --next_file) {
names[size] = names[next_file];
files[size--] = files[next_file];
***************
*** 1560,1575 ****
pF += strlen(sprintf(pF, " (%s)", p));
*pF++ = '\n', *pF++ = 0;
! if (for_editor) {
! for (i = 0; i < size; i++) {
fputs(From_buf, files[i]);
fprintf(files[i], "%sDate: %s\n",
ison(flags, FORWARD) ? "Resent-" : "", rfc_date(date_str));
! if (*in_reply_to)
! fprintf(files[i], "In-Reply-To: %s\n", in_reply_to);
}
!
! /* first print users own message headers */
if (own_hdrs && !do_set(set_options, "no_hdrs")) {
struct options *opts;
for (opts = own_hdrs; opts; opts = opts->next)
--- 1562,1591 ----
pF += strlen(sprintf(pF, " (%s)", p));
*pF++ = '\n', *pF++ = 0;
! /* First print From, Date, In-Reply-To */
! for (i = 0; i < size; i++) {
! if (for_editor)
fputs(From_buf, files[i]);
+ else if (isoff(flags, EDIT_HDRS)) {
+ #ifdef PICKY_MAILER
+ if (i > 0)
+ #endif /* PICKY_MAILER */
+ fputs(From_buf, files[i]);
+ got_from = TRUE;
+ }
+ if (for_editor || isoff(flags, EDIT_HDRS)) {
+ #ifdef PICKY_MAILER
+ if (i > 0)
+ #endif /* PICKY_MAILER */
fprintf(files[i], "%sDate: %s\n",
ison(flags, FORWARD) ? "Resent-" : "", rfc_date(date_str));
! got_date = TRUE;
}
! if (*in_reply_to)
! fprintf(files[i], "In-Reply-To: %s\n", in_reply_to);
! }
! /* next print user's own message headers */
! if (for_editor || isoff(flags, EDIT_HDRS))
if (own_hdrs && !do_set(set_options, "no_hdrs")) {
struct options *opts;
for (opts = own_hdrs; opts; opts = opts->next)
***************
*** 1580,1630 ****
}
}
! if (!do_set(set_options, "no_expand")) {
! /* for edit_hdrs, print the headers followed by a blank line */
! if (!(p = alias_to_address(To))) {
! wprint("To: alias expansion failed.\n");
return -1;
} else
! (void) strcpy(To, p);
! if (Cc[0])
! if (!(p = alias_to_address(Cc))) {
! wprint("Cc: alias expansion failed.\n");
! return -1;
! } else
! (void) strcpy(Cc, p);
! if (Bcc[0])
! if (!(p = alias_to_address(Bcc))) {
! wprint("Bcc: alias expansion failed.\n");
! return -1;
! } else
! (void) strcpy(Bcc, p);
! }
! } else
! /* if not for the editor and the user doesn't use edit_hdrs,
! * add his own_hdrs by hand here. (also take care of in-reply-to)
! */
! if (isoff(flags, EDIT_HDRS) && !do_set(set_options, "no_hdrs")) {
! if (own_hdrs) {
! struct options *opts;
! for (opts = own_hdrs; opts; opts = opts->next)
! for (i = 0; i < size; i++) {
! p = opts->value;
! skipspaces(0);
! /* user can't set his own date: headers */
! if (*p && lcase_strncmp(opts->option, "date:", 5))
! fprintf(files[i], "%s %s\n", opts->option, p);
! }
! }
! if (*in_reply_to)
! for (i = 0; i < size; i++)
! fprintf(files[i], "In-Reply-To: %s\n", in_reply_to);
! }
!
! if (!for_editor && ison(flags, EDIT_HDRS)) {
! /*
! * copy the headers of the message removing special headers.
! */
int print_hdr = FALSE;
rewind(fp);
while (fgets(buf, sizeof(buf), fp)) {
--- 1596,1626 ----
}
}
! /*
! * Now either prepare to put the rest of the headers into the file
! * or (when sending edited headers) copy them back out of the file
! */
! if (for_editor) {
! /* for edit_hdrs, print the headers followed by a blank line */
! if (!(p = alias_to_address(To))) {
! wprint("To: alias expansion failed.\n");
! return -1;
! } else
! (void) strcpy(To, p);
! if (Cc[0])
! if (!(p = alias_to_address(Cc))) {
! wprint("Cc: alias expansion failed.\n");
return -1;
} else
! (void) strcpy(Cc, p);
! if (Bcc[0])
! if (!(p = alias_to_address(Bcc))) {
! wprint("Bcc: alias expansion failed.\n");
! return -1;
! } else
! (void) strcpy(Bcc, p);
! } else if (ison(flags, EDIT_HDRS)) {
! /* copy the headers of the message removing special headers */
int print_hdr = FALSE;
rewind(fp);
while (fgets(buf, sizeof(buf), fp)) {
***************
*** 1659,1666 ****
wprint("You can't change or add date headers.\n");
else {
got_date = TRUE;
! (void) sprintf(buf, "%sDate: %s", ison(flags, FORWARD)?
! "Resent-" : "", rfc_date(date_str));
}
else if (!lcase_strncmp(p, "subject:", 8))
(print_hdr = FALSE), strdup(subj, p);
--- 1655,1662 ----
wprint("You can't change or add date headers.\n");
else {
got_date = TRUE;
! (void) sprintf(buf, "Date: %s", rfc_date(date_str));
! p = buf;
}
else if (!lcase_strncmp(p, "subject:", 8))
(print_hdr = FALSE), strdup(subj, p);
***************
*** 1689,1717 ****
}
}
if (print_hdr)
! /* print_hdr will be 2 for From: header */
for (i = print_hdr-1; i < size; i++)
fputs(buf, files[i]), fputc('\n', files[i]);
}
}
! /* now do the required (or changed) headers (Date, To, Cc) */
wrap_addrs(To, 80);
wrap_addrs(Cc, 80);
wrap_addrs(Bcc, 80);
for (i = 0; i < size; i++) {
- if (!for_editor && !got_date)
#ifdef PICKY_MAILER
! if (i > 0)
#endif /* PICKY_MAILER */
fprintf(files[i], "%sDate: %s\n",
ison(flags, FORWARD) ? "Resent-" : "", rfc_date(date_str));
- fprintf(files[i], "X-Mailer: %s (%d.%d.%d %s)\n",
- MUSHNAME, RELEASE, REVISION, PATCHLEVEL, RELEASE_DATE);
#ifdef PICKY_MAILER
! if (i > 0)
#endif /* PICKY_MAILER */
! if (!got_from)
! fputs(From_buf, files[i]);
fprintf(files[i], "%sTo: %s\n",
ison(flags, FORWARD) ? "Resent-" : "", To);
if (for_editor || isoff(flags, EDIT_HDRS)) {
--- 1685,1713 ----
}
}
if (print_hdr)
! /* print_hdr may be 2 for From: header */
for (i = print_hdr-1; i < size; i++)
fputs(buf, files[i]), fputc('\n', files[i]);
}
}
! /* Finally, do the required (or changed) headers (Date, To, Cc) */
wrap_addrs(To, 80);
wrap_addrs(Cc, 80);
wrap_addrs(Bcc, 80);
for (i = 0; i < size; i++) {
#ifdef PICKY_MAILER
! if (i > 0) {
#endif /* PICKY_MAILER */
+ if (!got_from)
+ fputs(From_buf, files[i]);
+ if (!got_date)
fprintf(files[i], "%sDate: %s\n",
ison(flags, FORWARD) ? "Resent-" : "", rfc_date(date_str));
#ifdef PICKY_MAILER
! }
#endif /* PICKY_MAILER */
! fprintf(files[i], "X-Mailer: %s (%d.%d.%d %s)\n",
! MUSHNAME, RELEASE, REVISION, PATCHLEVEL, RELEASE_DATE);
fprintf(files[i], "%sTo: %s\n",
ison(flags, FORWARD) ? "Resent-" : "", To);
if (for_editor || isoff(flags, EDIT_HDRS)) {
*** /tmp/,RCSt1020947 Fri Jun 30 10:34:32 1989
--- main.c Thu Jun 29 13:12:46 1989
***************
*** 71,76 ****
--- 71,77 ----
strdup(cmd_help, p);
init(); /* must be done before checking mail since "login" is set here */
+ mailfile = "";
#ifdef HOMEMAIL
{
char *home = do_set(set_options, "home");
***************
*** 111,118 ****
(void) cmd_line(sprintf(buf, "source %s", DEFAULT_RC), msg_list);
(void) source(0, DUBL_NULL);
}
! if (Flags.folder && *Flags.folder)
! mailfile = Flags.folder;
set_cwd(); /* call _after_ sourcing files */
--- 112,118 ----
(void) cmd_line(sprintf(buf, "source %s", DEFAULT_RC), msg_list);
(void) source(0, DUBL_NULL);
}
! mailfile = Flags.folder;
set_cwd(); /* call _after_ sourcing files */
--
Bart Schaefer "And if you believe that, you'll believe anything."
-- DangerMouse
CSNET / Internet schaefer at cse.ogc.edu
UUCP ...{sequent,tektronix,verdix}!ogccse!schaefer
More information about the Comp.sources.bugs
mailing list