aboutsummaryrefslogtreecommitdiffstats
path: root/transfug_oe.c
diff options
context:
space:
mode:
Diffstat (limited to 'transfug_oe.c')
-rw-r--r--transfug_oe.c38
1 files changed, 18 insertions, 20 deletions
diff --git a/transfug_oe.c b/transfug_oe.c
index 143558b..a8eb928 100644
--- a/transfug_oe.c
+++ b/transfug_oe.c
@@ -346,9 +346,6 @@ oe_data* oe_readbox(char* filename,void (*oput)(char*)) {
/* SIGNATURE */
fread(&signature,16,1,data->oe);
-#ifdef DEBUG
- printf("signature: %.8x\n",signature[0]);
-#endif
if ((signature[0]!=0xFE12ADCF) || /* OE 5 & OE 5 BETA SIGNATURE */
(signature[1]!=0x6F74FDC5) ||
(signature[2]!=0x11D1E366) ||
@@ -407,6 +404,14 @@ oe_data* oe_readmbox(char* filename,void (*oput)(char*)) {
FILE *mbox = NULL;
char *filename = NULL, *fn;
+void msgandquit(int h) {
+ if (h==0)
+ printf("transfug_oe\nSyntax: transfug_oe [oe_mbox]*\n"
+ "based on OE2MBX 1.21 (c) 2000 Stephan B. Nedregaard - stephan@micropop.com\n");
+ else if (h==1)
+ printf("OE2MBX cannot run on this platform. Please consult the Web site at http://www.micropop.com/code/\n");
+ exit(h);
+}
void fatal(char *s) {
printf("Fatal error: %s\n\n",s);
@@ -414,33 +419,26 @@ void fatal(char *s) {
}
void writeit(char *s) {
- if (mbox==NULL) {
- mbox=fopen(fn,"w");
- if(mbox==NULL) {
- fprintf (stderr, "TransfugDrake ERROR: cannot create file %s\n",fn);
- exit (1);
- }
- fprintf(mbox,"%s",s);
- }
+ if (mbox==NULL) {
+ mbox=fopen(fn,"w");
+ if(mbox==NULL) fatal("Cannot create output file");
+ }
+ fprintf(mbox,"%s",s);
}
int main(int argc, char*argv[]) {
int i;
- oe_data *j;
-
- /* Handle errors, help and syntax */
- if (argc<3) {
- printf("transfug_oe\nSyntax: transfug_oe oe_dbx output_mbox \n");
- return (0);
- }
+ oe_data *j;
- /* Process mailbox */
+ /* Handle errors, help and syntax */
+ if (argc<3) msgandquit(0);
+ /* Process mailboxes */
printf("Converting %s...\n",argv[1]);
fn = argv[2];
+ if (*fn==SLASH) fn++;
printf(" => %s\n",fn);
j = (oe_data*) oe_readbox(argv[1],writeit);
- printf("yy\n");
if (j!=NULL) {
if (!j->success) printf(" No messages converted"); else
printf(" %d messages converted",j->success);