1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
|
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
/*
* University Copyright- Copyright (c) 1982, 1986, 1988
* The Regents of the University of California
* All Rights Reserved
*
* University Acknowledgment- Portions of this document are derived from
* software developed by the University of California, Berkeley, and its
* contributors.
*/
/*
* mailx -- a modified version of a University of California at Berkeley
* mail program
*
* This file contains the definitions of data structures used in
* configuring the network behavior of Mail when replying.
*/
/*
* The following constants are used when you are running 4.1a bsd or
* later on a local network. The name thus found is inserted
* into the host table slot whose name was originally EMPTY.
*/
#define EMPTY "** empty **"
#define EMPTYID 'E'
/*
* The following data structure is the host table. You must have
* an entry here for your own machine, plus any special stuff you
* expect the mailer to know about. Not all hosts need be here, however:
* mailx can dope out stuff about hosts on the fly by looking
* at addresses. The machines needed here are:
* 1) The local machine
* 2) Any machines on the path to a network gateway
* 3) Any machines with nicknames that you want to have considered
* the same.
* The machine id letters can be anything you like and are not seen
* externally. Be sure not to use characters with the 0200 bit set --
* these have special meanings.
*/
struct netmach {
char *nt_machine;
char nt_mid;
short nt_type;
};
/*
* Network type codes. Basically, there is one for each different
* network, if the network can be discerned by the separator character,
* such as @ for the arpa net. The purpose of these codes is to
* coalesce cases where more than one character means the same thing,
* such as % and @ for the arpanet. Also, the host table uses a
* bit map of these codes to show what it is connected to.
* BN -- connected to Bell Net.
* AN -- connected to ARPA net, SN -- connected to Schmidt net.
*/
#define AN 1 /* Connected to ARPA net */
#define BN 2 /* Connected to BTL net */
#define SN 4 /* Connected to Schmidt net */
/*
* Data structure for table mapping network characters to network types.
*/
struct ntypetab {
char nt_char; /* Actual character separator */
int nt_bcode; /* Type bit code */
};
/*
* Codes for the "kind" of a network. IMPLICIT means that if there are
* physically several machines on the path, one does not list them in the
* address. The arpa net is like this. EXPLICIT means you list them,
* as in UUCP.
* By the way, this distinction means we lose if anyone actually uses the
* arpa net subhost convention: name@subhost@arpahost
*/
#define IMPLICIT 1
#define EXPLICIT 2
/*
* Table for mapping a network code to its type -- IMPLICIT routing or
* IMPLICIT routing.
*/
struct nkindtab {
int nk_type; /* Its bit code */
int nk_kind; /* Whether explicit or implicit */
};
/*
* The following table gives the order of preference of the various
* networks. Thus, if we have a choice of how to get somewhere, we
* take the preferred route.
*/
struct netorder {
short no_stat;
char no_char;
};
/*
* External declarations for above defined tables.
*/
extern struct netmach netmach[];
extern struct ntypetab ntypetab[];
extern struct nkindtab nkindtab[];
extern struct netorder netorder[];
extern char *metanet;
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2018 Joyent, Inc.
*/
/*
* Copyright (c) 1985, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016 by Delphix. All rights reserved.
*/
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
/*
* University Copyright- Copyright (c) 1982, 1986, 1988
* The Regents of the University of California
* All Rights Reserved
*
* University Acknowledgment- Portions of this document are derived from
* software developed by the University of California, Berkeley, and its
* contributors.
*/
#ifndef _MAILX_DEF_H
#define _MAILX_DEF_H
#ifdef __cplusplus
extern "C" {
#endif
#include <sys/types.h>
#include <signal.h>
#include <stdio.h>
#include <fcntl.h>
#include <string.h>
#include <termio.h>
#include <setjmp.h>
#include <time.h>
#include <sys/stat.h>
#include <maillock.h>
#include <ctype.h>
#include <errno.h>
#ifndef preSVr4
#include <unistd.h>
#include <stdlib.h>
#include <ulimit.h>
#include <wait.h>
#include <libcustr.h>
#endif
#ifdef VMUNIX
#include <sys/wait.h>
#endif
#include "local.h"
#include "uparm.h"
/*
* mailx -- a modified version of a University of California at Berkeley
* mail program
*/
#define SENDESC '~' /* Default escape for sending */
#define NMLSIZE 1024 /* max names in a message list */
#define PATHSIZE 1024 /* Size of pathnames throughout */
#define HSHSIZE 59 /* Hash size for aliases and vars */
#define HDRFIELDS 3 /* Number of header fields */
#define LINESIZE 5120 /* max readable line width */
#define STRINGSIZE ((unsigned)128) /* Dynamic allocation units */
#define MAXARGC 1024 /* Maximum list of raw strings */
#define NOSTR ((char *)0) /* Nill string pointer */
#define NOSTRPTR ((char **)0) /* Nill pointer to string pointer */
#define NOINTPTR ((int *)0) /* Nill pointer */
#define MAXEXP 25 /* Maximum expansion of aliases */
/* A nice function to string compare */
#define equal(a, b) (strcmp(a, b) == 0)
/* Keep a list of all opened files */
#define fopen(s, t) my_fopen(s, t)
/* Delete closed file from the list */
#define fclose(s) my_fclose(s)
struct message {
off_t m_offset; /* offset in block of message */
long m_size; /* Bytes in the message */
long m_lines; /* Lines in the message */
long m_clen; /* Content-Length of the mesg */
short m_flag; /* flags, see below */
char m_text; /* TRUE if the contents is text */
/* False otherwise */
};
typedef struct fplst {
FILE *fp;
struct fplst *next;
} NODE;
/*
* flag bits.
*/
#define MUSED (1<<0) /* entry is used, but this bit isn't */
#define MDELETED (1<<1) /* entry has been deleted */
#define MSAVED (1<<2) /* entry has been saved */
#define MTOUCH (1<<3) /* entry has been noticed */
#define MPRESERVE (1<<4) /* keep entry in sys mailbox */
#define MMARK (1<<5) /* message is marked! */
#define MODIFY (1<<6) /* message has been modified */
#define MNEW (1<<7) /* message has never been seen */
#define MREAD (1<<8) /* message has been read sometime. */
#define MSTATUS (1<<9) /* message status has changed */
#define MBOX (1<<10) /* Send this to mbox, regardless */
#define MBOXED (1<<11) /* message has been sent to mbox */
#define H_AFWDCNT 1 /* "Auto-Forward-Count:" */
#define H_AFWDFROM 2 /* "Auto-Forwarded-From:" */
#define H_CLEN 3 /* "Content-Length:" */
#define H_CTYPE 4 /* "Content-Type:" */
#define H_DATE 5 /* "Date:" */
#define H_DEFOPTS 6 /* "Default-Options:" */
#define H_EOH 7 /* "End-of-Header:" */
#define H_FROM 8 /* "From " */
#define H_FROM1 9 /* ">From " */
#define H_FROM2 10 /* "From: " */
#define H_MTSID 11 /* "MTS-Message-ID:" */
#define H_MTYPE 12 /* "Message-Type:" */
#define H_MVERS 13 /* "Message-Version:" */
#define H_MSVC 14 /* "Message-Service:" */
#define H_RECEIVED 15 /* "Received:" */
#define H_RVERS 16 /* "Report-Version:" */
#define H_STATUS 17 /* "Status:" */
#define H_SUBJ 18 /* "Subject:" */
#define H_TO 19 /* "To:" */
#define H_TCOPY 20 /* ">To:" */
#define H_TROPTS 21 /* "Transport-Options:" */
#define H_UAID 22 /* "UA-Content-ID:" */
#define H_DAFWDFROM 23 /* Hold A-F-F when sending Del. Notf. */
#define H_DTCOPY 24 /* Hold ">To:" when sending Del. Notf. */
#define H_DRECEIVED 25 /* Hold Rcvd: when sending Del. Notf. */
#define H_CONT 26 /* Continuation of previous line */
#define H_NAMEVALUE 27 /* unrecognized "name: value" hdr line */
/*
* Format of the command description table.
* The actual table is declared and initialized
* in lex.c
*/
struct cmd {
char *c_name; /* Name of command */
int (*c_func)(void *); /* Implementor of the command */
short c_argtype; /* Type of arglist (see below) */
short c_msgflag; /* Required flags of messages */
short c_msgmask; /* Relevant flags of messages */
};
/* can't initialize unions */
#define c_minargs c_msgflag /* Minimum argcount for RAWLIST */
#define c_maxargs c_msgmask /* Max argcount for RAWLIST */
/*
* Argument types.
*/
#define MSGLIST 0 /* Message list type */
#define STRLIST 1 /* A pure string */
#define RAWLIST 2 /* Shell string list */
#define NOLIST 3 /* Just plain 0 */
#define NDMLIST 4 /* Message list, no defaults */
#define P 040 /* Autoprint dot after command */
#define I 0100 /* Interactive command bit */
#define M 0200 /* Legal from send mode bit */
#define W 0400 /* Illegal when read only bit */
#define F 01000 /* Is a conditional command */
#define T 02000 /* Is a transparent command */
#define R 04000 /* Cannot be called from collect */
/*
* Oft-used mask values
*/
#define MMNORM (MDELETED|MSAVED) /* Look at both save and delete bits */
#define MMNDEL MDELETED /* Look only at deleted bit */
/*
* Structure used to return a break down of a head
* line
*/
typedef struct headline {
custr_t *hl_from; /* The name of the sender */
custr_t *hl_tty; /* Its tty string (if any) */
custr_t *hl_date; /* The entire date string */
} headline_t;
#define GTO 1 /* Grab To: line */
#define GSUBJECT 2 /* Likewise, Subject: line */
#define GCC 4 /* And the Cc: line */
#define GBCC 8 /* And also the Bcc: line */
#define GDEFOPT 16 /* And the Default-Options: lines */
#define GNL 32 /* Print blank line after */
#define GOTHER 64 /* Other header lines */
#define GMASK (GTO|GSUBJECT|GCC|GBCC|GDEFOPT|GNL|GOTHER)
/* Mask of all header lines */
#define GDEL 128 /* Entity removed from list */
#define GCLEN 256 /* Include Content-Length header */
/*
* Structure used to pass about the current
* state of the user-typed message header.
*/
struct header {
char *h_to; /* Dynamic "To:" string */
char *h_subject; /* Subject string */
char *h_cc; /* Carbon copies string */
char *h_bcc; /* Blind carbon copies */
char *h_defopt; /* Default options */
char **h_others; /* Other header lines */
int h_seq; /* Sequence for optimization */
};
/*
* Structure of namelist nodes used in processing
* the recipients of mail and aliases and all that
* kind of stuff.
*/
struct name {
struct name *n_flink; /* Forward link in list. */
struct name *n_blink; /* Backward list link */
short n_type; /* From which list it came */
char *n_name; /* This fella's name */
char *n_full; /* Full name */
};
/*
* Structure of a variable node. All variables are
* kept on a singly-linked list of these, rooted by
* "variables"
*/
struct var {
struct var *v_link; /* Forward link to next variable */
char *v_name; /* The variable's name */
char *v_value; /* And it's current value */
};
struct mgroup {
struct mgroup *ge_link; /* Next person in this group */
char *ge_name; /* This person's user name */
};
struct grouphead {
struct grouphead *g_link; /* Next grouphead in list */
char *g_name; /* Name of this group */
struct mgroup *g_list; /* Users in group. */
};
#define NIL ((struct name *)0) /* The nil pointer for namelists */
#define NONE ((struct cmd *)0) /* The nil pointer to command tab */
#define NOVAR ((struct var *)0) /* The nil pointer to variables */
#define NOGRP ((struct grouphead *)0) /* The nil grouphead pointer */
#define NOGE ((struct mgroup *)0) /* The nil group pointer */
#define NOFP ((struct fplst *)0) /* The nil file pointer */
#define TRUE 1
#define FALSE 0
#define DEADPERM 0600 /* permissions of dead.letter */
#define TEMPPERM 0600 /* permissions of temp files */
#define MBOXPERM 0600 /* permissions of ~/mbox */
#ifndef MFMODE
#define MFMODE 0600 /* create mode for `/var/mail' files */
#endif
/*
* Structure of the hash table of ignored header fields
*/
struct ignore {
struct ignore *i_link; /* Next ignored field in bucket */
char *i_field; /* This ignored field */
};
#ifdef preSVr4
struct utimbuf {
time_t actime;
time_t modtime;
};
#else
#include <utime.h>
#endif
/*
* Token values returned by the scanner used for argument lists.
* Also, sizes of scanner-related things.
*/
#define TEOL 0 /* End of the command line */
#define TNUMBER 1 /* A message number */
#define TDASH 2 /* A simple dash */
#define TSTRING 3 /* A string (possibly containing -) */
#define TDOT 4 /* A "." */
#define TUP 5 /* An "^" */
#define TDOLLAR 6 /* A "$" */
#define TSTAR 7 /* A "*" */
#define TOPEN 8 /* An '(' */
#define TCLOSE 9 /* A ')' */
#define TPLUS 10 /* A '+' */
#define REGDEP 2 /* Maximum regret depth. */
#define STRINGLEN 1024 /* Maximum length of string token */
/*
* Constants for conditional commands. These describe whether
* we should be executing stuff or not.
*/
#define CANY 0 /* Execute in send or receive mode */
#define CRCV 1 /* Execute in receive mode only */
#define CSEND 2 /* Execute in send mode only */
#define CTTY 3 /* Execute if attached to a tty only */
#define CNOTTY 4 /* Execute if not attached to a tty */
/*
* Flags for msend().
*/
#define M_IGNORE 1 /* Do "ignore/retain" processing */
#define M_SAVING 2 /* Saving to a file/folder */
/*
* VM/UNIX has a vfork system call which is faster than forking. If we
* don't have it, fork(2) will do . . .
*/
#if !defined(VMUNIX) && defined(preSVr4)
#define vfork() fork()
#endif
#ifndef SIGRETRO
#define sigchild()
#endif
/*
* 4.2bsd signal interface help...
*/
#ifdef VMUNIX
#define sigset(s, a) signal(s, a)
#define sigsys(s, a) signal(s, a)
#else
#ifndef preSVr4
/* SVr4 version of sigset() in fio.c */
#define sigsys(s, a) signal(s, a)
#define setjmp(x) sigsetjmp((x), 1)
#define longjmp siglongjmp
#define jmp_buf sigjmp_buf
#else
#define OLD_BSD_SIGS
#endif
#endif
/*
* Truncate a file to the last character written. This is
* useful just before closing an old file that was opened
* for read/write.
*/
#define trunc(stream) ftruncate(fileno(stream), (long)ftell(stream))
/*
* The pointers for the string allocation routines,
* there are NSPACE independent areas.
* The first holds STRINGSIZE bytes, the next
* twice as much, and so on.
*/
#define NSPACE 25 /* Total number of string spaces */
struct strings {
char *s_topFree; /* Beginning of this area */
char *s_nextFree; /* Next alloctable place here */
unsigned s_nleft; /* Number of bytes left here */
};
/* The following typedefs must be used in SVR4 */
#ifdef preSVr4
#ifndef sun
typedef int gid_t;
typedef int uid_t;
typedef int mode_t;
typedef int pid_t;
#endif
#endif
#define STSIZ 40
#define TMPSIZ 14
/*
* Forward declarations of routine types to keep lint and cc happy.
*/
extern int Copy(int *msgvec);
extern FILE *Fdopen(int fildes, char *mode);
extern int Followup(int *msgvec);
extern char *Getf(register char *s);
extern int More(int *msgvec);
extern int Respond(int *msgvec);
extern int Save(int *msgvec);
extern int Sendm(char *str);
extern int Sput(char str[]);
extern int Type(int *msgvec);
extern void Verhogen(void);
extern char *addone(char hf[], char news[]);
extern char *addto(char hf[], char news[]);
extern void alter(char name[]);
extern int alternates(char **namelist);
extern void announce(void);
extern int any(int ch, char *str);
extern int anyof(register char *s1, register char *s2);
extern int argcount(char **argv);
extern void assign(char name[], char value[]);
extern int blankline(const char linebuf[]);
extern struct name *cat(struct name *n1, struct name *n2);
extern FILE *collect(struct header *hp);
extern void commands(void);
extern char *copy(char *str1, char *str2);
extern int copycmd(char str[]);
extern int deassign(register char *s);
extern int delm(int *msgvec);
extern struct name *delname(register struct name *np, char name[]);
extern int deltype(int msgvec[]);
extern char *detract(register struct name *np, int ntype);
extern int docomma(char *s);
extern int dopipe(char str[]);
extern int dosh(char *str);
extern int echo(register char **argv);
extern int editor(int *msgvec);
extern int edstop(int noremove);
extern struct name *elide(struct name *names);
extern int elsecmd(void);
extern int endifcmd(void);
extern int execute(char linebuf[], int contxt);
extern char *expand(char *name);
extern struct name *extract(char line[], int arg_ntype);
extern int fferror(FILE *iob);
extern int field(char str[]);
extern int file(char **argv);
extern struct grouphead *findgroup(char name[]);
extern void findmail(char *name);
extern int first(int f, int m);
extern void flush(void);
extern int folders(char **arglist);
extern int followup(int *msgvec);
extern int from(int *msgvec);
extern off_t fsize(FILE *iob);
extern int getfold(char *name);
extern int gethfield(register FILE *f, char linebuf[], register long rem);
extern int getaline(char *line, int size, FILE *f, int *hasnulls);
extern int getmessage(char *buf, int *vector, int flags);
extern int getmsglist(char *buf, int *vector, int flags);
extern int getname(uid_t uid, char namebuf[]);
extern int getrawlist(char line[], char **argv, int argc);
extern void getrecf(char *buf, char *recfile,
int useauthor, int sz_recfile);
extern uid_t getuserid(char name[]);
extern int grabh(register struct header *hp, int gflags, int subjtop);
extern int group(char **argv);
extern void hangup(int);
extern int hash(char name[]);
extern char *hcontents(char hfield[]);
extern int headerp(register char *line);
extern int headers(int *msgvec);
extern int headline_alloc(headline_t **);
extern void headline_free(headline_t *);
extern void headline_reset(headline_t *);
extern int help(void);
extern char *helppath(char *file);
extern char *hfield(char field[], struct message *mp,
char *(*add)(char *, char *));
extern void holdsigs(void);
extern int icequal(register char *s1, register char *s2);
extern int ifcmd(char **argv);
extern int igfield(char *list[]);
extern int inc(void);
extern void inithost(void);
extern int isdir(char name[]);
extern boolean_t is_headline(const char *);
extern int ishfield(char linebuf[], char field[]);
extern int ishost(char *sys, char *rest);
extern int isign(char *field, int saving);
extern void istrcpy(char *dest, int dstsize, char *src);
extern void lcwrite(char *fn, FILE *fi, FILE *fo, int addnl);
extern void load(char *name);
extern int loadmsg(char str[]);
extern int lock(FILE *fp, char *mode, int blk);
extern void lockmail(void);
extern int mail(char **people);
extern void mail1(struct header *hp, int use_to, char *orig_to);
extern void mapf(register struct name *np, char *from);
extern int mboxit(int msgvec[]);
extern void mechk(struct name *names);
extern int member(register char *realfield,
register struct ignore **table);
extern int messize(int *msgvec);
extern void minit(void);
extern int more(int *msgvec);
extern long msend(struct message *mailp, FILE *obuf,
int flag, int (*fp)(const char *, FILE *));
extern int my_fclose(register FILE *iop);
extern FILE *my_fopen(char *file, char *mode);
extern char *nameof(register struct message *mp);
extern char *netmap(char name[], char from[]);
extern int newfileinfo(int start);
extern int next(int *msgvec);
extern int npclose(FILE *ptr);
extern FILE *npopen(char *cmd, char *mode);
extern char *nstrcpy(char *dst, int dstsize, char *src);
extern char *nstrcat(char *dst, int dstsize, char *src);
extern int null(char *e);
extern int outof(struct name *names, FILE *fo);
extern struct name *outpre(struct name *to);
extern void panic(char *str);
extern int parse_headline(const char *, headline_t *);
extern int pcmdlist(void);
extern int pdot(void);
extern int preserve(int *msgvec);
extern void printgroup(char name[]);
extern void printhead(int mesg);
extern int puthead(struct header *hp, FILE *fo, int w, long clen);
extern int pversion(char *e);
extern void quit(int noremove);
extern int readline(FILE *ibuf, char *linebuf);
extern void receipt(struct message *mp);
extern void relsesigs(void);
extern int removefile(char name[]);
extern int replyall(int *msgvec);
extern int replysender(int *msgvec);
extern int respond(int *msgvec);
extern int retfield(char *list[]);
extern int rexit(int e);
extern char *safeexpand(char name[]);
extern void *salloc(unsigned size);
extern void *srealloc(void *optr, unsigned size);
extern int samebody(register char *user, register char *addr,
int fuzzy);
extern int save(char str[]);
extern void savedead(int s);
extern char *savestr(char *str);
extern int schdir(char *str);
extern int screensize(void);
extern int scroll(char arg[]);
extern int sendm(char *str);
extern int set(char **arglist);
extern void setclen(register struct message *mp);
extern int setfile(char *name, int isedit);
extern FILE *setinput(register struct message *mp);
extern void setptr(register FILE *ibuf);
extern int shell(char *str);
#ifndef sigchild
extern void sigchild(void);
#endif
#ifndef sigset
extern void (*sigset())();
#endif
extern char *skin(char *name);
extern char *snarf(char linebuf[], int *flag, int erf);
extern int source(char name[]);
extern char *splice(char *addr, char *hdr);
extern int sput(char str[]);
extern void sreset(void);
extern void stop(int s);
extern int stouch(int msgvec[]);
extern int substr(char *string1, char *string2);
extern int swrite(char str[]);
extern struct name *tailof(struct name *name);
extern void tinit(void);
extern int tmail(void);
extern int top(int *msgvec);
extern void touch(int mesg);
extern struct name *translate(struct name *np);
extern int type(int *msgvec);
extern int undelete(int *msgvec);
extern int ungroup(char **argv);
extern int unigfield(char *list[]);
extern void unlockmail(void);
extern char **unpack(struct name *np);
extern int unread(int msgvec[]);
extern int unretfield(char *list[]);
extern int unset(char **arglist);
extern int unstack(void);
extern char *unuucp(char *name);
extern struct name *usermap(struct name *names);
extern char *value(char name[]);
extern char *vcopy(char str[]);
extern void vfree(register char *cp);
extern int visual(int *msgvec);
extern char *yankword(char *name, char *word, int sz, int comma);
/*
* These functions are defined in libmail.a
*/
#ifdef __cplusplus
extern "C" {
#endif
extern int delempty(mode_t, char *);
extern char *maildomain(void);
extern void touchlock(void);
extern char *xgetenv(char *);
extern int xsetenv(char *);
#ifdef __cplusplus
}
#endif
/*
* Standard functions from the C library.
* These are all defined in <stdlib.h> and <wait.h> in SVr4.
*/
#ifdef preSVr4
extern long atol();
extern char *getcwd();
extern char *calloc();
extern char *getenv();
extern void exit();
extern void free();
extern char *malloc();
extern time_t time();
extern long ulimit();
extern int utime();
extern int wait();
extern int fputs();
#endif
#ifdef __cplusplus
}
#endif
#endif /* _MAILX_DEF_H */
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
/*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*
* University Copyright- Copyright (c) 1982, 1986, 1988
* The Regents of the University of California
* All Rights Reserved
*
* University Acknowledgment- Portions of this document are derived from
* software developed by the University of California, Berkeley, and its
* contributors.
*/
#ifndef _HDR_GLOB_H
#define _HDR_GLOB_H
/*
* mailx -- a modified version of a University of California at Berkeley
* mail program
*
* A bunch of global variable declarations lie herein.
* def.h must be included first.
*/
extern int Fflag; /* -F option (followup) */
extern int Hflag; /* print headers and exit */
extern char *Tflag; /* -T temp file for netnews */
extern int UnUUCP; /* -U flag */
extern char **altnames; /* List of alternate names for user */
extern int askme; /* ???? */
extern int baud; /* Output baud rate */
extern char *bflag; /* Bcc given from non tty */
extern char *binmsg; /* Message: content unprintable */
extern char *cflag; /* Cc given from non tty */
extern const struct cmd cmdtab[]; /* ???? */
extern int cond; /* Current state of conditional exc. */
extern NODE *curptr; /* ???? */
extern int debug; /* Debug flag set */
extern char domain[]; /* ???? */
extern struct message *dot; /* Pointer to current message */
extern int edit; /* Indicates editing a file */
extern char *editfile; /* Name of file being edited */
extern int exitflg; /* -e for mail test */
extern NODE *fplist; /* ???? */
extern struct grouphead *groups[]; /* Pointer to active groups */
extern int hflag; /* Sequence number for network -h */
extern char homedir[]; /* Name of home directory */
extern char host[]; /* ???? */
extern struct ignore *ignore[]; /* Pointer to ignored fields */
extern int image; /* File descriptor for image of msg */
extern FILE *input; /* Current command input file */
extern int intty; /* True if standard input a tty */
extern int issysmbox; /* mailname is a system mailbox */
extern FILE *itf; /* Input temp file buffer */
extern int lexnumber; /* Number of TNUMBER from scan() */
extern char lexstring[]; /* String from TSTRING, scan() */
extern int loading; /* Loading user definitions */
extern char *lockname; /* named used for /var/mail locking */
extern char *maildir; /* directory for mail files */
extern char mailname[]; /* Name of /var/mail system mailbox */
extern off_t mailsize; /* Size of system mailbox */
extern int maxfiles; /* Maximum number of open files */
extern struct message *message; /* The actual message structure */
extern char *metanet; /* ???? */
extern int msgCount; /* Count of messages read in */
extern gid_t myegid; /* User's effective gid */
extern uid_t myeuid; /* User's effective uid */
extern char myname[]; /* My login id */
extern pid_t mypid; /* Current process id */
extern gid_t myrgid; /* User's real gid */
extern uid_t myruid; /* User's real uid */
extern int newsflg; /* -I option for netnews */
extern char noheader; /* Suprress initial header listing */
extern int noreset; /* String resets suspended */
extern char nosrc; /* Don't source /etc/mail/mailx.rc */
extern int nretained; /* Number of retained fields */
extern int numberstack[]; /* Stack of regretted numbers */
extern char origname[]; /* Original name of mail file */
extern FILE *otf; /* Output temp file buffer */
extern int outtty; /* True if standard output a tty */
extern FILE *pipef; /* Pipe file we have opened */
extern char *progname; /* program name (argv[0]) */
extern char *prompt; /* prompt string */
extern int rcvmode; /* True if receiving mail */
extern int readonly; /* Will be unable to rewrite file */
extern int regretp; /* Pointer to TOS of regret tokens */
extern int regretstack[]; /* Stack of regretted tokens */
extern struct ignore *retain[HSHSIZE]; /* Pointer to retained fields */
extern char *rflag; /* -r address for network */
extern int rmail; /* Being called as rmail */
extern int sawcom; /* Set after first command */
extern int selfsent; /* User sent self something */
extern int senderr; /* An error while checking */
extern int rpterr; /* An error msg was sent to stderr */
extern char *sflag; /* Subject given from non tty */
extern int sourcing; /* Currently reading variant file */
extern int space; /* Current maximum number of messages */
extern jmp_buf srbuf; /* ???? */
extern struct strings stringdope[]; /* pointer for the salloc routines */
extern char *stringstack[]; /* Stack of regretted strings */
extern char tempEdit[]; /* ???? */
extern char tempMail[]; /* ???? */
extern char tempMesg[]; /* ???? */
extern char tempQuit[]; /* ???? */
extern char tempResid[]; /* temp file in :saved */
extern char tempZedit[]; /* ???? */
extern int tflag; /* Read headers from text */
extern uid_t uid; /* The invoker's user id */
extern struct utimbuf *utimep; /* ???? */
extern struct var *variables[]; /* Pointer to active var list */
extern const char *const version; /* ???? */
extern int receipt_flg; /* Flag for return receipt */
/*
* Standard external variables from the C library.
*/
extern char *optarg;
extern int optind;
#endif /* _HDR_GLOB_H */
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
/*
* University Copyright- Copyright (c) 1982, 1986, 1988
* The Regents of the University of California
* All Rights Reserved
*
* University Acknowledgment- Portions of this document are derived from
* software developed by the University of California, Berkeley, and its
* contributors.
*/
/*
* mailx -- a modified version of a University of California at Berkeley
* mail program
*/
#ifdef V7
#include "v7.local.h"
#endif
#ifdef USG
#include "usg.local.h"
#endif
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
/*
* University Copyright- Copyright (c) 1982, 1986, 1988
* The Regents of the University of California
* All Rights Reserved
*
* University Acknowledgment- Portions of this document are derived from
* software developed by the University of California, Berkeley, and its
* contributors.
*/
/*
* mailx -- a modified version of a University of California at Berkeley
* mail program
*
* This file is included by normal files which want both
* globals and declarations.
*/
/*#define USG 1 */ /* System V */
#define USG_TTY 1 /* termio(4I) */
#include "def.h"
#include "glob.h"
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
/*
* University Copyright- Copyright (c) 1982, 1986, 1988
* The Regents of the University of California
* All Rights Reserved
*
* University Acknowledgment- Portions of this document are derived from
* software developed by the University of California, Berkeley, and its
* contributors.
*/
/*
* mailx -- a modified version of a University of California at Berkeley
* mail program
*/
extern char *libpath();
#ifdef preSVr4
#ifdef USG
# define LIBPATH "/usr/lib/mailx"
#else
# define LIBPATH "/usr/lib"
#endif
#else
# define LIBPATH "/usr/share/lib/mailx"
#endif
#define LOCALEPATH "/usr/lib/locale"
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 1991 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
/*
* University Copyright- Copyright (c) 1982, 1986, 1988
* The Regents of the University of California
* All Rights Reserved
*
* University Acknowledgment- Portions of this document are derived from
* software developed by the University of California, Berkeley, and its
* contributors.
*/
/*
* Declarations and constants specific to an installation.
*/
/*
* mailx -- a modified version of a University of California at Berkeley
* mail program
*/
#define LOCAL EMPTYID /* Dynamically determined local host */
#ifdef preSVr4
# define MAIL "/bin/rmail" /* Mail delivery agent */
#else
# define MAIL "/usr/bin/rmail"/* Mail delivery agent */
#endif
#define SENDMAIL "/usr/lib/sendmail"
/* Name of classy mail deliverer */
#define EDITOR "ed" /* Name of text editor */
#define VISUAL "vi" /* Name of display editor */
#define PG (value("PAGER") ? value("PAGER") : \
(value("bsdcompat") ? "more" : "pg -e"))
/* Standard output pager */
#define MORE PG
#define LS (value("LISTER") ? value("LISTER") : "ls")
/* Name of directory listing prog*/
#ifdef preSVr4
# define SHELL "/bin/sh" /* Standard shell */
#else
# define SHELL "/usr/bin/sh" /* Standard shell */
#endif
#define HELPFILE helppath("mailx.help")
/* Name of casual help file */
#define THELPFILE helppath("mailx.help.~")
/* Name of casual tilde help */
#ifdef preSVr4
# define MASTER (value("bsdcompat") ? libpath("Mail.rc") : \
libpath("mailx.rc")
#else
# define MASTER (value("bsdcompat") ? "/etc/mail/Mail.rc" : \
"/etc/mail/mailx.rc")
#endif
#define APPEND /* New mail goes to end of mailbox */
#define CANLOCK /* Locking protocol actually works */
#define UTIME /* System implements utime(2) */
|