~ubuntu-branches/ubuntu/lucid/edbrowse/lucid

« back to all changes in this revision

Viewing changes to main.c

  • Committer: Bazaar Package Importer
  • Author(s): Kapil Hari Paranjape
  • Date: 2007-12-05 10:39:04 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20071205103904-zr3kzzu0ym6stg16
Tags: 3.3.1-1
* New upstream version (3.3.1).
  - Messages have been internationalised.
  - Supports LANG environment variable.
  - Includes man page.
* Incorporate upstream man page:
  - debian/rules: Add rule to install upstream man page.
  - debian/edbrowse.1: Not required. Removed.

Show diffs side-by-side

added added

removed removed

Lines of Context:
12
12
/* Define the globals that are declared in eb.h. */
13
13
/* See eb.h for descriptive comments. */
14
14
 
15
 
const char *version = "3.2.1";
 
15
const char *version = "3.3.1";
16
16
char *userAgents[10], *currentAgent, *currentReferrer;
17
17
const char eol[] = "\r\n";
18
18
char EMPTYSTRING[] = "";
20
20
int webTimeout = 20, mailTimeout = 0;
21
21
bool ismc, browseLocal, zapMail, unformatMail, passMail, errorExit;
22
22
bool isInteractive, intFlag, inInput;
23
 
const char opint[] = "operation interrupted";
24
23
int fileSize, maxFileSize = 50000000;
25
24
int localAccount, maxAccount;
26
25
struct MACCOUNT accounts[MAXACCOUNT];
91
90
        return;
92
91
    }
93
92
    if(write(fh, cfgcopy, cfglen) < cfglen)
94
 
        errorPrint
95
 
           ("@could not rewrite your config file; your configuration data may be lost!");
 
93
        i_printfExit(MSG_ERBC_NoWrite);
96
94
    close(fh);
97
95
}                               /* updateConfig */
98
96
 
103
101
    char *new;
104
102
    long exp = nowday;
105
103
    if(!s || !*s) {
106
 
        puts("no subject");
 
104
        i_puts(MSG_NoSubject);
107
105
        return false;
108
106
    }
109
107
    if(!cfgcopy) {
110
 
        puts("no config file present");
 
108
        i_puts(MSG_NoConfig);
111
109
        return false;
112
110
    }
113
111
    if(!subjstart) {
114
 
        puts(".ebrc config file does not contain a subjfilter{...} block");
 
112
        i_puts(MSG_NoSubjFilter);
115
113
        return false;
116
114
    }
117
115
    if(key == 'j')
139
137
    return true;
140
138
}                               /* junkSubject */
141
139
 
142
 
/* This routine succeeds, or aborts via errorPrint */
 
140
/* This routine succeeds, or aborts via i_printfExit */
143
141
static void
144
142
readConfigFile(void)
145
143
{
187
185
    for(s = t = v = buf; s < buf + buflen; ++s) {
188
186
        c = *s;
189
187
        if(c == '\0')
190
 
            errorPrint("1.ebrc: null characters at line %d", ln);
 
188
            i_printfExit(MSG_ERBC_Nulls, ln);
191
189
        if(c == '\r' && s[1] == '\n')
192
190
            continue;
193
191
        if(cmt) {
288
286
               (last[8] == '+' || last[8] == ':')) {
289
287
                q = last + 9;
290
288
                if(*q == 0 || *q == '{' || *q == '(')
291
 
                    errorPrint("1.ebrc: missing function name at line %d", ln);
 
289
                    i_printfExit(MSG_ERBC_NoFnName, ln);
292
290
                if(isdigitByte(*q))
293
 
                    errorPrint
294
 
                       ("1.ebrc: function name at line %d begins with a digit",
295
 
                       ln);
 
291
                    i_printfExit(MSG_ERBC_FnDigit, ln);
296
292
                while(isalnumByte(*q))
297
293
                    ++q;
298
294
                if(q - last - 9 > 10)
299
 
                    errorPrint
300
 
                       ("1.ebrc: function name at line %d is too long, limit ten characters",
301
 
                       ln);
 
295
                    i_printfExit(MSG_ERBC_FnTooLong, ln);
302
296
                if(*q != '{' || q[1])
303
 
                    errorPrint
304
 
                       ("1.ebrc: improper function definition syntax at line %d",
305
 
                       ln);
 
297
                    i_printfExit(MSG_ERBC_SyntaxErr, ln);
306
298
                last[7] = 'f';
307
299
                last[6] = '\x81';
308
300
                strcpy(v, last + 6);
345
337
        if(mailblock > 1 && !strchr("\x81\x82\x83", *s)) {
346
338
            v = strchr(s, '>');
347
339
            if(!v)
348
 
                errorPrint("1.ebrc: line %d, \"condition > file\" expected",
349
 
                   ln);
 
340
                i_printfExit(MSG_ERBC_NoCondFile, ln);
350
341
            while(v > s && (v[-1] == ' ' || v[-1] == '\t'))
351
342
                --v;
352
343
            if(v == s)
353
 
                errorPrint(".ebrc: line %d, filter rule has no match string",
354
 
                   ln);
 
344
                i_printfExit(MSG_ERBC_NoMatchStr, ln);
355
345
            c = *v, *v++ = 0;
356
346
            if(c != '>') {
357
347
                while(*v != '>')
361
351
            while(*v == ' ' || *v == '\t')
362
352
                ++v;
363
353
            if(!*v)
364
 
                errorPrint("1.ebrc: line %d, match on %s is set nowhere", ln,
365
 
                   s);
 
354
                i_printfExit(MSG_ERBC_MatchNowh, ln, s);
366
355
            if(n_filters == MAXFILTER - 1)
367
 
                errorPrint("1.ebrc: line %d, too many mail filters", ln);
 
356
                i_printfExit(MSG_ERBC_Filters, ln);
368
357
            filters[n_filters].redirect = v;
369
358
            if(mailblock >= 2) {
370
359
                long exp = strtol(s, &v, 10);
404
393
        n = stringInList(keywords, s);
405
394
        if(n < 0) {
406
395
            if(!nest)
407
 
                errorPrint("1.ebrc: unrecognized keyword %s at line %d", s, ln);
 
396
                i_printfExit(MSG_ERBC_BadKeyword, s, ln);
408
397
            *v = c;             /* put it back */
409
398
            goto nokeyword;
410
399
        }
411
400
 
412
401
        if(n < 8 && mailblock != 1)
413
 
            errorPrint
414
 
               ("1.ebrc: line %d, attribute %s canot be set outside of a mail descriptor",
415
 
               ln, s);
 
402
            i_printfExit(MSG_ERBC_MailAttrOut, ln, s);
416
403
 
417
404
        if(n >= 8 && n < 13 && mimeblock != 1)
418
 
            errorPrint
419
 
               ("1.ebrc: line %d, attribute %s canot be set outside of a mime descriptor",
420
 
               ln, s);
 
405
            i_printfExit(MSG_ERBC_MimeAttrOut, ln, s);
421
406
 
422
407
        if(n >= 13 && n < 17 && tabblock != 1)
423
 
            errorPrint
424
 
               ("1.ebrc: line %d, attribute %s canot be set outside of a table descriptor",
425
 
               ln, s);
 
408
            i_printfExit(MSG_ERBC_TableAttrOut, ln, s);
426
409
 
427
410
        if(n >= 8 && mailblock)
428
 
            errorPrint
429
 
               ("1.ebrc: line %d, attribute %s canot be set inside a mail descriptor or filter block",
430
 
               ln, s);
 
411
            i_printfExit(MSG_ERBC_MailAttrIn, ln, s);
431
412
 
432
413
        if((n < 8 || n >= 13) && mimeblock)
433
 
            errorPrint
434
 
               ("1.ebrc: line %d, attribute %s canot be set inside a mime descriptor",
435
 
               ln, s);
 
414
            i_printfExit(MSG_ERBC_MimeAttrIn, ln, s);
436
415
 
437
416
        if((n < 13 || n >= 17) && tabblock)
438
 
            errorPrint
439
 
               ("1.ebrc: line %d, attribute %s canot be set inside a table descriptor",
440
 
               ln, s);
 
417
            i_printfExit(MSG_ERBC_TableAttrIn, ln, s);
441
418
 
442
419
/* act upon the keywords */
443
420
        ++v;
449
426
        while(*v == ' ' || *v == '\t')
450
427
            ++v;
451
428
        if(!*v)
452
 
            errorPrint("1.ebrc: line %d, attribute %s is set to nothing", ln,
453
 
               s);
 
429
            i_printfExit(MSG_ERBC_NoAttr, ln, s);
454
430
 
455
431
        switch (n) {
456
432
        case 0:
518
494
        case 15:
519
495
            while(*v) {
520
496
                if(td->ncols == MAXTCOLS)
521
 
                    errorPrint("1.ebrc: line %d, too many columns, limit %d",
522
 
                       ln, MAXTCOLS);
 
497
                    i_printfExit(MSG_ERBC_ManyCols, ln, MAXTCOLS);
523
498
                td->cols[td->ncols++] = v;
524
499
                q = strchr(v, ',');
525
500
                if(!q)
531
506
 
532
507
        case 16:
533
508
            if(!isdigitByte(*v))
534
 
                errorPrint
535
 
                   ("1.ebrc: line %d, keycol should be number or number,number",
536
 
                   ln);
 
509
                i_printfExit(MSG_ERBC_KeyNotNb, ln);
537
510
            td->key1 = strtol(v, &v, 10);
538
511
            if(*v == ',' && isdigitByte(v[1]))
539
512
                td->key2 = strtol(v + 1, &v, 10);
540
513
            if(td->key1 > td->ncols || td->key2 > td->ncols)
541
 
                errorPrint
542
 
                   ("1.ebrc: line %d, keycol is out of range; only %d columns specified",
543
 
                   ln, td->ncols);
 
514
                i_printfExit(MSG_ERBC_KeyOutRange, ln, td->ncols);
544
515
            continue;
545
516
 
546
517
        case 17:
547
518
            addressFile = v;
548
519
            ftype = fileTypeByName(v, false);
549
520
            if(ftype && ftype != 'f')
550
 
                errorPrint("1.ebrc: address book %s is not a regular file", v);
 
521
                i_printfExit(MSG_ERBC_AbNotFile, v);
551
522
            continue;
552
523
 
553
524
        case 18:
554
525
            ipbFile = v;
555
526
            ftype = fileTypeByName(v, false);
556
527
            if(ftype && ftype != 'f')
557
 
                errorPrint("1.ebrc: ip blacklist %s is not a regular file", v);
 
528
                i_printfExit(MSG_ERBC_IPNotFile, v);
558
529
            continue;
559
530
 
560
531
        case 19:
561
532
            mailDir = v;
562
533
            if(fileTypeByName(v, false) != 'd')
563
 
                errorPrint("1.ebrc: %s is not a directory", v);
 
534
                i_printfExit(MSG_ERBC_NotDir, v);
564
535
            continue;
565
536
 
566
537
        case 20:
568
539
                if(!userAgents[j])
569
540
                    break;
570
541
            if(j == 10)
571
 
                errorPrint("1.ebrc: line %d, too many user agents, limit 9",
572
 
                   ln);
 
542
                i_printfExit(MSG_ERBC_ManyAgents, ln);
573
543
            userAgents[j] = v;
574
544
            continue;
575
545
 
577
547
            cookieFile = v;
578
548
            ftype = fileTypeByName(v, false);
579
549
            if(ftype && ftype != 'f')
580
 
                errorPrint("1.ebrc: cookie jar %s is not a regular file", v);
 
550
                i_printfExit(MSG_ERBC_JarNotFile, v);
581
551
            j = open(v, O_WRONLY | O_APPEND | O_CREAT, 0600);
582
552
            if(j < 0)
583
 
                errorPrint("1.ebrc: cannot %s cookie jar %s",
584
 
                   ftype ? "create" : "write to", v);
 
553
                i_printfExit(MSG_ERBC_JarNoWrite, v);
585
554
            close(j);
586
555
            continue;
587
556
 
588
557
        case 22:
589
558
            if(javaDisCount == MAXNOJS)
590
 
                errorPrint("1.ebrc: too many no js directives, limit %d",
591
 
                   MAXNOJS);
 
559
                i_printfExit(MSG_ERBC_NoJS, MAXNOJS);
592
560
            if(*v == '.')
593
561
                ++v;
594
562
            q = strchr(v, '.');
595
563
            if(!q || q[1] == 0)
596
 
                errorPrint("1.ebrc: line %d, domain %s does not contain a dot",
597
 
                   ln, v);
 
564
                i_printfExit(MSG_ERBC_DomainDot, ln, v);
598
565
            javaDis[javaDisCount++] = v;
599
566
            continue;
600
567
 
602
569
            spamCan = v;
603
570
            ftype = fileTypeByName(v, false);
604
571
            if(ftype && ftype != 'f')
605
 
                errorPrint("1.ebrc: mail trash can %s is not a regular file",
606
 
                   v);
 
572
                i_printfExit(MSG_ERBC_TrashNotFile, v);
607
573
            continue;
608
574
 
609
575
        case 24:
618
584
            sslCerts = v;
619
585
            ftype = fileTypeByName(v, false);
620
586
            if(ftype && ftype != 'f')
621
 
                errorPrint
622
 
                   ("1.ebrc: SSL certificate file %s is not a regular file", v);
 
587
                i_printfExit(MSG_ERBC_SSLNoFile, v);
623
588
            j = open(v, O_RDONLY);
624
589
            if(j < 0)
625
 
                errorPrint
626
 
                   ("1.ebrc: SSL certificate file %s does not exist or is not readable.",
627
 
                   v);
 
590
                i_printfExit(MSG_ERBC_SSLNoRead, v);
628
591
            close(j);
629
592
            continue;
630
593
 
653
616
            continue;
654
617
 
655
618
        default:
656
 
            errorPrint("1.ebrc: line %d, keyword %s is not yet implemented", ln,
657
 
               s);
 
619
            i_printfExit(MSG_ERBC_KeywordNYI, ln, s);
658
620
        }                       /* switch */
659
621
 
660
622
      nokeyword:
663
625
            if(localAccount == maxAccount + 1)
664
626
                continue;
665
627
            if(localAccount)
666
 
                errorPrint("1.ebrc: sets multiple mail accounts as default");
 
628
                i_printfExit(MSG_ERBC_SevDefaults);
667
629
            localAccount = maxAccount + 1;
668
630
            continue;
669
631
        }
673
635
                ++maxAccount;
674
636
                mailblock = 0;
675
637
                if(!act->inurl)
676
 
                    errorPrint("1.ebrc: missing inserver at line %d", ln);
 
638
                    i_printfExit(MSG_ERBC_NoInserver, ln);
677
639
                if(!act->outurl)
678
 
                    errorPrint("1.ebrc: missing outserver at line %d", ln);
 
640
                    i_printfExit(MSG_ERBC_NoOutserver, ln);
679
641
                if(!act->login)
680
 
                    errorPrint("1.ebrc: missing login at line %d", ln);
 
642
                    i_printfExit(MSG_ERBC_NoLogin, ln);
681
643
                if(!act->password)
682
 
                    errorPrint("1.ebrc: missing password at line %d", ln);
 
644
                    i_printfExit(MSG_ERBC_NPasswd, ln);
683
645
                if(!act->from)
684
 
                    errorPrint("1.ebrc: missing from at line %d", ln);
 
646
                    i_printfExit(MSG_ERBC_NoFrom, ln);
685
647
                if(!act->reply)
686
 
                    errorPrint("1.ebrc: missing reply at line %d", ln);
 
648
                    i_printfExit(MSG_ERBC_NoReply, ln);
687
649
                if(!act->inport)
688
650
                    act->inport = 110;
689
651
                if(!act->outport)
700
662
                ++maxMime;
701
663
                mimeblock = 0;
702
664
                if(!mt->type)
703
 
                    errorPrint("1.ebrc: missing type at line %d", ln);
 
665
                    i_printfExit(MSG_ERBC_NoType, ln);
704
666
                if(!mt->desc)
705
 
                    errorPrint("1.ebrc: missing description at line %d", ln);
 
667
                    i_printfExit(MSG_ERBC_NDesc, ln);
706
668
                if(!mt->suffix && !mt->prot)
707
 
                    errorPrint
708
 
                       ("1.ebrc: missing suffix or protocol list at line %d",
709
 
                       ln);
 
669
                    i_printfExit(MSG_ERBC_NoSuffix, ln);
710
670
                if(!mt->program)
711
 
                    errorPrint("1.ebrc: missing program at line %d", ln);
 
671
                    i_printfExit(MSG_ERBC_NoProgram, ln);
712
672
                continue;
713
673
            }
714
674
 
716
676
                ++maxTables;
717
677
                tabblock = 0;
718
678
                if(!td->name)
719
 
                    errorPrint("1.ebrc: missing table name at line %d", ln);
 
679
                    i_printfExit(MSG_ERBC_NoTblName, ln);
720
680
                if(!td->shortname)
721
 
                    errorPrint("1.ebrc: missing short name at line %d", ln);
 
681
                    i_printfExit(MSG_ERBC_NoShortName, ln);
722
682
                if(!td->ncols)
723
 
                    errorPrint("1.ebrc: missing columns at line %d", ln);
 
683
                    i_printfExit(MSG_ERBC_NColumns, ln);
724
684
                continue;
725
685
            }
726
686
 
727
687
            if(--nest < 0)
728
 
                errorPrint("1.ebrc: unexpected } at line %d", ln);
 
688
                i_printfExit(MSG_ERBC_UnexpBrace, ln);
729
689
            if(nest)
730
690
                goto putback;
731
691
/* This ends the function */
738
698
/* Does else make sense here? */
739
699
            c = toupper(stack[nest]);
740
700
            if(c != 'I')
741
 
                errorPrint
742
 
                   ("1.ebrc: else at line %d is not part of an if statement",
743
 
                   ln);
 
701
                i_printfExit(MSG_ERBC_UnexElse, ln);
744
702
            goto putback;
745
703
        }
746
704
 
747
705
        if(*s != '\x81') {
748
706
            if(!nest)
749
 
                errorPrint("1.ebrc: garbled text at line %d", ln);
 
707
                i_printfExit(MSG_ERBC_GarblText, ln);
750
708
            goto putback;
751
709
        }
752
710
 
760
718
                curblock = "a filter block";
761
719
            if(mimeblock)
762
720
                curblock = "a mime descriptor";
763
 
            errorPrint
764
 
               ("1.ebrc: line %d, cannot start a function, mail/mime descriptor, or filter block inside %s",
765
 
               ln, curblock);
 
721
            i_printfExit(MSG_ERBC_FnNotStart, ln, curblock);
766
722
        }
767
723
 
768
724
        if(!strchr("fmertsb", c) && !nest)
769
 
            errorPrint
770
 
               ("1.ebrc: statement at line %d must appear inside a function",
771
 
               ln);
 
725
            i_printfExit(MSG_ERBC_StatNotInFn, ln);
772
726
 
773
727
        if(c == 'm') {
774
728
            mailblock = 1;
775
729
            if(maxAccount == MAXACCOUNT)
776
 
                errorPrint
777
 
                   ("1too many email accounts in your config file, limit %d",
778
 
                   MAXACCOUNT);
 
730
                i_printfExit(MSG_ERBC_ManyAcc, MAXACCOUNT);
779
731
            act = accounts + maxAccount;
780
732
            continue;
781
733
        }
783
735
        if(c == 'e') {
784
736
            mimeblock = 1;
785
737
            if(maxMime == MAXMIME)
786
 
                errorPrint
787
 
                   ("1too many mime types in your config file, limit %d",
788
 
                   MAXMIME);
 
738
                i_printfExit(MSG_ERBC_ManyTypes, MAXMIME);
789
739
            mt = mimetypes + maxMime;
790
740
            continue;
791
741
        }
793
743
        if(c == 'b') {
794
744
            tabblock = 1;
795
745
            if(maxTables == MAXDBT)
796
 
                errorPrint
797
 
                   ("1too many sql tables in your config file, limit %d",
798
 
                   MAXDBT);
 
746
                i_printfExit(MSG_ERBC_ManyTables, MAXDBT);
799
747
            td = dbtables + maxTables;
800
748
            continue;
801
749
        }
818
766
        if(c == 'f') {
819
767
            stack[++nest] = c;
820
768
            if(sn == MAXEBSCRIPT)
821
 
                errorPrint("1too many functions in your config file, limit %d",
822
 
                   sn);
 
769
                i_printfExit(MSG_ERBC_ManyFn, sn);
823
770
            ebScriptName[sn] = s + 2;
824
771
            t[-1] = 0;
825
772
            ebScript[sn] = t;
827
774
        }
828
775
 
829
776
        if(++nest >= sizeof (stack))
830
 
            errorPrint
831
 
               ("1.ebrc: line %d, control structures are nested too deeply",
832
 
               ln);
 
777
            i_printfExit(MSG_ERBC_TooDeeply, ln);
833
778
        stack[nest] = c;
834
779
 
835
780
      putback:
837
782
    }                           /* loop over lines */
838
783
 
839
784
    if(nest)
840
 
        errorPrint("1.ebrc: function %s is not closed at eof",
841
 
           ebScriptName[sn]);
 
785
        i_printfExit(MSG_ERBC_FnNotClosed, ebScriptName[sn]);
842
786
 
843
787
    if(mailblock | mimeblock)
844
 
        errorPrint("1.ebrc: mail or mime block is not closed at EOF");
 
788
        i_printfExit(MSG_ERBC_MNotClosed);
845
789
 
846
790
    if(cfgmodify)
847
791
        updateConfig();
982
926
{
983
927
    intFlag = true;
984
928
    if(inInput)
985
 
        printf("interrupt, type qt to quit completely\n");
 
929
        i_puts(MSG_EnterInterrupt);
986
930
/* If we were reading from a file, or socket, this signal should
987
931
 * cause the read to fail.  Check for intFlag, so we know it was
988
932
 * interrupted, and not an io failure.
1017
961
    int cx, account;
1018
962
    bool rc, doConfig = true;
1019
963
 
 
964
    selectLanguage();
 
965
 
1020
966
    ttySaveSettings();
1021
967
 
1022
968
/* Let's everybody use my malloc and free routines */
1030
976
        home = 0;
1031
977
/* I require this, though I'm not sure what this means for non-Unix OS's */
1032
978
    if(!home)
1033
 
        errorPrint("1home directory not defined by $HOME.");
 
979
        i_printfExit(MSG_NotHome);
1034
980
    if(fileTypeByName(home, false) != 'd')
1035
 
        errorPrint("1%s is not a directory", home);
 
981
        i_printfExit(MSG_NotDir, home);
1036
982
 
1037
983
/* See sample.ebrc in this directory for a sample config file. */
1038
984
    configFile = allocMem(strlen(home) + 7);
1100
1046
            ++s, passMail = true;
1101
1047
        if(*s == 'm' && isdigitByte(s[1])) {
1102
1048
            if(!maxAccount)
1103
 
                errorPrint
1104
 
                   ("1no mail accounts specified, please check your .ebrc config file");
 
1049
                i_printfExit(MSG_NoMailAcc);
1105
1050
            account = strtol(s + 1, &s, 10);
1106
1051
            if(account == 0 || account > maxAccount)
1107
 
                errorPrint("1invalid account number, please use 1 through %d",
1108
 
                   maxAccount);
 
1052
                i_printfExit(MSG_BadAccNb, maxAccount);
1109
1053
            if(!*s) {
1110
1054
                ismc = true;    /* running as a mail client */
1111
1055
                allowJS = false;        /* no javascript in mail client */
1115
1059
                break;
1116
1060
            }
1117
1061
        }
1118
 
        errorPrint("1edbrowse  -v    (show version)\n\
1119
 
edbrowse -h (this message)\n\
1120
 
edbrowse -c (edit config file)\n\
1121
 
edbrowse  [-e] [-d?] -[u|p]m?    (read your mail) \n\
1122
 
edbrowse  [-e] [-d?] -m? address1 address2 ... file [+attachments]\n\
1123
 
edbrowse  [-e] [-d?] file1 file2 ...");
 
1062
        i_printfExit(MSG_Usage);
1124
1063
    }                           /* options */
1125
1064
 
1126
1065
    if(tcp_init() < 0)
1142
1081
        if(!argc)
1143
1082
            fetchMail(account);
1144
1083
        if(argc == 1)
1145
 
            errorPrint
1146
 
               ("1please specify at least one recipient and the file to send");
 
1084
            i_printfExit(MSG_MinOneRec);
1147
1085
/* I don't know that argv[argc] is 0, or that I can set it to 0,
1148
1086
 * so I back everything up by 1. */
1149
1087
        reclist = argv - 1;
1157
1095
        }
1158
1096
        atlist = argv + argc - nat - 1;
1159
1097
        if(atlist <= argv)
1160
 
            errorPrint
1161
 
               ("1please specify at least one recipient and the file to send, before your attachments");
 
1098
            i_printfExit(MSG_MinOneRecBefAtt);
1162
1099
        body = *atlist;
1163
1100
        if(nat)
1164
1101
            memcpy(atlist, atlist + 1, sizeof (char *) * nat);
1185
1122
        char *file = *argv;
1186
1123
        ++cx;
1187
1124
        if(cx == MAXSESSION)
1188
 
            errorPrint("1too many files open simultaneously, limit %d",
1189
 
               MAXSESSION);
 
1125
            i_printfExit(MSG_ManyOpen, MAXSESSION);
1190
1126
        cxSwitch(cx, false);
1191
1127
        if(cx == 1)
1192
1128
            runEbFunction("init");
1224
1160
        ++cx;
1225
1161
        cxSwitch(cx, false);
1226
1162
        runEbFunction("init");
1227
 
        printf("edbrowse ready\n");
 
1163
        i_puts(MSG_Ready);
1228
1164
    }
1229
1165
    if(cx > 1)
1230
1166
        cxSwitch(1, false);
1235
1171
        pst p = inputLine();
1236
1172
        copyPstring(saveline, p);
1237
1173
        if(perl2c((char *)p))
1238
 
            printf
1239
 
               ("entered command line contains nulls; you can use \\0 in a search/replace string to indicate null\n");
 
1174
            i_puts(MSG_EnterNull);
1240
1175
        else
1241
1176
            edbrowseCommand((char *)p, false);
1242
1177
        copyPstring(linePending, saveline);
1295
1230
/* Separate function name and arguments */
1296
1231
    spaceCrunch(linecopy, true, false);
1297
1232
    if(linecopy[0] == 0) {
1298
 
        setError("no function specified");
 
1233
        setError(MSG_NoFunction);
1299
1234
        goto fail;
1300
1235
    }
1301
1236
    memset(args, 0, sizeof (args));
1306
1241
        *t = 0;
1307
1242
    for(s = linecopy; *s; ++s)
1308
1243
        if(!isalnumByte(*s)) {
1309
 
            setError("function name should only contain letters and numbers");
 
1244
            setError(MSG_BadFunctionName);
1310
1245
            goto fail;
1311
1246
        }
1312
1247
    for(j = 0; ebScript[j]; ++j)
1313
1248
        if(stringEqual(linecopy, ebScriptName[j] + 1))
1314
1249
            break;
1315
1250
    if(!ebScript[j]) {
1316
 
        setError("no such function %s", linecopy);
 
1251
        setError(MSG_NoSuchFunction, linecopy);
1317
1252
        goto fail;
1318
1253
    }
1319
1254
 
1327
1262
    j = 0;
1328
1263
    for(s = t; s; s = t) {
1329
1264
        if(++j >= 10) {
1330
 
            setError("too many arguments");
 
1265
            setError(MSG_ManyArgs);
1331
1266
            goto fail;
1332
1267
        }
1333
1268
        args[j] = ++s;
1342
1277
 
1343
1278
    while(code = *ip) {
1344
1279
        if(intFlag) {
1345
 
            setError(opint);
 
1280
            setError(MSG_Interrupted);
1346
1281
            goto fail;
1347
1282
        }
1348
1283
        endl = strchr(ip, '\n');
1423
1358
            if(*s == '~' && isdigitByte(s[1])) {
1424
1359
                j = *++s - '0';
1425
1360
                if(j) {
 
1361
                    if(!args[j]) {
 
1362
                        setError(MSG_NoArgument, j);
 
1363
                        nzFree(new);
 
1364
                        goto fail;
 
1365
                    }
1426
1366
                    strcpy(t, args[j]);
1427
1367
                    t += argl[j];
1428
1368
                    continue;
1474
1414
/* pipe the buffer into the program */
1475
1415
        f = popen(cmd, "w");
1476
1416
        if(!f) {
1477
 
            setError("could not spawn subcommand %s, errno %d", cmd, errno);
 
1417
            setError(MSG_NoSpawn, cmd, errno);
1478
1418
            return false;
1479
1419
        }
1480
1420
        if(!unfoldBuffer(context, false, &buf, &buflen)) {
1493
1433
        } else {
1494
1434
            f = fopen(edbrowseTempFile, "w");
1495
1435
            if(!f) {
1496
 
                setError("could not create temp file %s, errno %d",
1497
 
                   edbrowseTempFile, errno);
 
1436
                setError(MSG_TempNoCreate2, edbrowseTempFile, errno);
1498
1437
                *u = 0;
1499
1438
                return false;
1500
1439
            }
1529
1468
{
1530
1469
    struct DBTABLE *td;
1531
1470
    if(maxTables == MAXDBT) {
1532
 
        setError("too many sql tables in cache, limit %d", MAXDBT);
 
1471
        setError(MSG_ManyTables, MAXDBT);
1533
1472
        return 0;
1534
1473
    }
1535
1474
    td = dbtables + maxTables++;