/*********************************************************************/
/* */
/* This Program Written by Paul Edwards, 3:711/934{at}fidonet. */
/* Released to the Public Domain */
/* */
/*********************************************************************/
/*********************************************************************/
/* */
/* gensmsg - generate a squish message */
/* */
/*********************************************************************/
#include
#include
#include
#include
#include
#include "makesmsg.h"
#include "strinl.h"
#include "faddr.h"
#include "error.h"
#include "exists.h"
#include "striupr.h"
#define SQPREFIX "e:\\max\\msg\\"
#define EDITOR "e"
#define MYADDR "3:711/934.9"
#define GENSMSG_SUCCESS "GEN001 Message sent successfully\n"
#define GENSMSG_INVALID_AREA "GEN002 Invalid area %s\n"
int main(void)
{
char from[72] = "Paul Edwards";
char to[72];
char subject[72];
char areaName[72];
char fnm[FILENAME_MAX];
char fnm2[FILENAME_MAX];
char fnm3[FILENAME_MAX];
char toaddr[50] = "0:0/0";
int ret = EXIT_FAILURE;
int fin;
#if 0
char answer[50];
#endif
errorDefaults();
errorInit();
if (ALLOK)
{
printf("what is the area\n");
gets(areaName);
striupr(areaName);
strcpy(fnm2, areaName);
sprintf(fnm, SQPREFIX "%s", fnm2);
sprintf(fnm3, "%s.SQD", fnm);
if (!exists(fnm3))
{
errorSet(GENSMSG_INVALID_AREA, fnm2);
}
if (ALLOK)
{
fin = 0;
while (!fin)
{
if (strcmp(areaName, "NETMAIL") == 0)
{
printf("What is the destination address?\n");
gets(toaddr);
}
printf("Who is the message to?\n");
gets(to);
printf("What is the subject?\n");
gets(subject);
system(EDITOR " gensmsg.txt");
printf("\n");
makesmsg(from, to, subject,
fnm, areaName,
"gensmsg.txt", MYADDR, toaddr);
fin = 1;
#if 0
if (ALLOK)
{
printf("Want another message in %s?\n", areaName);
gets(answer);
if (toupper(*answer) == 'Y')
{
fin = 0;
}
}
#endif
}
}
if (ALLOK)
{
errorSet(GENSMSG_SUCCESS);
ret = EXIT_SUCCESS;
}
}
errorTerm();
return (ret);
}
@EOT:
--- Mksmsg
* Origin: none (3:711/934.9)
|