EMAIL/DATE65: OA-D in EMAIL invokes DATE65.SYSTEM, which calls EMAIL one exit.

This commit is contained in:
Bobbi Webber-Manners 2020-09-04 21:00:21 -04:00
parent 724a1aa988
commit 4a5df18e46
6 changed files with 33 additions and 7 deletions

View File

@ -15,6 +15,7 @@
#include <unistd.h>
#include <string.h>
#include <ctype.h>
#include "email_common.h"
#include "../inc/ip65.h"
@ -37,6 +38,7 @@ char nondst_tz_code[4];
int nondst_tz_secs;
char dst_tz_code[4];
int dst_tz_secs;
uint8_t exec_email_on_exit = 0;
/*
* Is year a leap year?
@ -222,8 +224,11 @@ void error_exit(void)
void confirm_exit(void)
{
printf("\nPress any key ");
printf("\n[Press Any Key]");
cgetc();
if (exec_email_on_exit) {
exec("EMAIL.SYSTEM", NULL); // Assuming it is in current working dir
}
}
void printsystemdate(void)
@ -259,7 +264,7 @@ void readtimezonefile(void) {
fclose(fp);
}
int main(void)
int main(int argc, char *argv[])
{
uint8_t eth_init = ETH_INIT_DEFAULT;
uint32_t server;
@ -270,6 +275,14 @@ int main(void)
unsigned char *p;
unsigned char dow, dst;
if ((argc == 2) && (strcmp(argv[1], "EMAIL") == 0))
exec_email_on_exit = 1;
if (exec_email_on_exit) {
videomode(VIDEOMODE_80COL);
printf("%c%s NTP%c\n\n", 0x0f, PROGNAME, 0x0e);
}
printsystemdate();
if (doesclrscrafterexit())
@ -372,7 +385,7 @@ int main(void)
dt.month = 12;
else {
printf("\nWhat kind of month is %s?\n", datestr+4);
exit(1);
error_exit();
}
datestr[3] = 0;

View File

@ -100,6 +100,13 @@ void load_smtp65(void) {
}
#pragma code-name (pop)
#pragma code-name (push, "LC")
void load_date65(void) {
sprintf(filename, "%s/DATE65.SYSTEM", cfg_instdir);
exec(filename, "EMAIL");
}
#pragma code-name (pop)
/*
* Put cursor at beginning of PROMPT_ROW
*/
@ -1984,6 +1991,10 @@ void keyboard_hdlr(void) {
reverse = 0;
switch_mailbox(curr_mbox);
break;
case 0x80 + 'd': // OA-D "Update date using NTP"
case 0x80 + 'D':
load_date65();
break;
case 0x80 + 'e': // OA-E "Open message in editor"
case 0x80 + 'E':
sprintf(filename, "%s/%s/EMAIL.%u", cfg_emaildir, curr_mbox, h->emailnum);

View File

@ -4,7 +4,9 @@
// Bobbi June 2020
/////////////////////////////////////////////////////////////////
#define PROGNAME "emai//er v1.01"
#include <stdint.h>
#define PROGNAME "emai//er v1.02"
// Configuration params from POP65.CFG
char cfg_server[40]; // IP of POP3 server

View File

@ -48,7 +48,7 @@ uint16_t pop_port;
* Keypress before quit
*/
void confirm_exit(void) {
printf("\nPress any key ");
printf("\n[Press Any Key]");
cgetc();
if (exec_email_on_exit) {
sprintf(filename, "%s/EMAIL.SYSTEM", cfg_instdir);

View File

@ -31,7 +31,7 @@ static char filename[255];
* Keypress before quit
*/
void confirm_exit(void) {
printf("\nPress any key ");
printf("\n[Press Any Key]");
cgetc();
exit(0);
}

View File

@ -48,7 +48,7 @@ uint16_t smtp_port;
* Keypress before quit
*/
void confirm_exit(void) {
printf("\nPress any key ");
printf("\n[Press Any Key]");
cgetc();
if (exec_email_on_exit) {
sprintf(filename, "%s/EMAIL.SYSTEM", cfg_instdir);