A failing post will now return non-zero error
This commit is contained in:
parent
9accf392ed
commit
2fc80ab754
@ -14,6 +14,8 @@ v0.61.0 06-Jun-2004.
|
||||
Added checks in the mbmsg post command if the To parameter has
|
||||
the correct syntax for netmail and all other areas.
|
||||
Fixed parameter count if post is used with the -q option.
|
||||
Will now return a non-zero error if the post() function
|
||||
failed.
|
||||
|
||||
mbout:
|
||||
Prepared for ICM flag (FSP-1033).
|
||||
|
@ -168,7 +168,8 @@ int main(int argc, char **argv)
|
||||
}
|
||||
|
||||
if (do_post) {
|
||||
Post(too, tarea, subj, mfile, flavor);
|
||||
if (Post(too, tarea, subj, mfile, flavor))
|
||||
die(MBERR_GENERAL);
|
||||
}
|
||||
|
||||
die(MBERR_OK);
|
||||
|
@ -41,7 +41,7 @@ extern int do_quiet; /* Suppress screen output */
|
||||
|
||||
|
||||
|
||||
void Post(char *To, long Area, char *Subj, char *File, char *Flavor)
|
||||
int Post(char *To, long Area, char *Subj, char *File, char *Flavor)
|
||||
{
|
||||
int i, rc = FALSE;
|
||||
char *aka, *temp, *sAreas;
|
||||
@ -63,7 +63,7 @@ void Post(char *To, long Area, char *Subj, char *File, char *Flavor)
|
||||
WriteError("$Can't open %s", File);
|
||||
if (!do_quiet)
|
||||
printf("Can't open \"%s\"\n", File);
|
||||
return;
|
||||
return -1;
|
||||
}
|
||||
|
||||
sAreas = calloc(PATH_MAX, sizeof(char));
|
||||
@ -72,7 +72,7 @@ void Post(char *To, long Area, char *Subj, char *File, char *Flavor)
|
||||
WriteError("$Can't open %s", sAreas);
|
||||
free(sAreas);
|
||||
fclose(tp);
|
||||
return;
|
||||
return -1;
|
||||
}
|
||||
|
||||
fread(&msgshdr, sizeof(msgshdr), 1, fp);
|
||||
@ -90,14 +90,14 @@ void Post(char *To, long Area, char *Subj, char *File, char *Flavor)
|
||||
if (rc == FALSE) {
|
||||
fclose(fp);
|
||||
fclose(tp);
|
||||
return;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!msgs.Active) {
|
||||
WriteError("Area %s not active", msgs.Name);
|
||||
fclose(fp);
|
||||
fclose(tp);
|
||||
return;
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -112,7 +112,7 @@ void Post(char *To, long Area, char *Subj, char *File, char *Flavor)
|
||||
printf("No address in \"%s\" and area is netmail\n", To);
|
||||
fclose(fp);
|
||||
fclose(tp);
|
||||
return;
|
||||
return -1;
|
||||
}
|
||||
} else {
|
||||
if ((strchr(To, '@')) || (strstr(To, (char *)".n")) || (strstr(To, (char *)".z"))) {
|
||||
@ -121,7 +121,7 @@ void Post(char *To, long Area, char *Subj, char *File, char *Flavor)
|
||||
printf("Address present in \"%s\" and area is not netmail\n", To);
|
||||
fclose(fp);
|
||||
fclose(tp);
|
||||
return;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
@ -129,7 +129,7 @@ void Post(char *To, long Area, char *Subj, char *File, char *Flavor)
|
||||
WriteError("Can't open %s", msgs.Base);
|
||||
fclose(fp);
|
||||
fclose(tp);
|
||||
return;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!Msg_Lock(30L)) {
|
||||
@ -137,7 +137,7 @@ void Post(char *To, long Area, char *Subj, char *File, char *Flavor)
|
||||
Msg_Close();
|
||||
fclose(fp);
|
||||
fclose(tp);
|
||||
return;
|
||||
return -1;
|
||||
}
|
||||
|
||||
tt = time(NULL);
|
||||
@ -268,7 +268,7 @@ void Post(char *To, long Area, char *Subj, char *File, char *Flavor)
|
||||
free(temp);
|
||||
Msg_Close();
|
||||
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,9 +1,9 @@
|
||||
#ifndef _POST_H
|
||||
#define _POST_H
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
void Post(char *, long, char *, char *, char *); /* Post a Message */
|
||||
int Post(char *, long, char *, char *, char *); /* Post a Message */
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
Reference in New Issue
Block a user