summaryrefslogtreecommitdiff
path: root/mail/mush/patches/patch-ak
blob: 2da7df4601562551e227a181dda4309f85048a68 (plain)
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
$NetBSD: patch-ak,v 1.1 1998/10/25 17:10:57 christos Exp $
*** old/folders.c	Sun Oct 25 11:59:14 1998
--- folders.c	Sun Oct 25 11:58:30 1998
***************
*** 148,153 ****
--- 148,154 ----
  	msg[msg_cnt].m_size = 0;
  	msg[msg_cnt].m_offset = 0;
  	msg[msg_cnt].m_lines = 0;
+ 	msg[msg_cnt].m_headers = 0;
      }
      msg_cnt = 0, msg[0].m_offset = 0L;
      turnoff(glob_flags, CONT_PRNT);
*** old/hdrs.c	Sun Oct 25 11:59:10 1998
--- hdrs.c	Sun Oct 25 11:58:30 1998
***************
*** 548,554 ****
--- 548,557 ----
  		when '%': p2 = "%";
  		when 't': p2 = to;
  		when 's': p2 = subject;
+ 		when 'h': p2 = sprintf(lines, "%d", msg[cnt].m_headers);
  		when 'l': p2 = sprintf(lines, "%d", msg[cnt].m_lines);
+ 		when 'b': p2 = sprintf(lines, "%d", msg[cnt].m_lines - 
+ 				       msg[cnt].m_headers);
  		when 'c': p2 = sprintf(lines, "%ld", msg[cnt].m_size);
  		when 'i': (p2 = read_header_field(cnt, "message-id")) || (p2 = "");
  		/* date formatting chars */
*** old/msgs.c	Sun Oct 25 11:59:14 1998
--- msgs.c	Sun Oct 25 11:58:29 1998
***************
*** 797,803 ****
  int append;
  {
      char	buf[BUFSIZ];
!     int		lines = 0, msg_found = 0, had_error = 1;
      int		get_status = 1, cnt;
      long	bytes;
      struct msg  old;
--- 797,803 ----
  int append;
  {
      char	buf[BUFSIZ];
!     int		headers = 0, lines = 0, msg_found = 0, had_error = 1;
      int		get_status = 1, cnt;
      long	bytes;
      struct msg  old;
***************
*** 943,948 ****
--- 943,949 ----
  		if (cnt && lines) {
  		    msg[cnt-1].m_size = bytes - msg[cnt-1].m_offset;
  		    msg[cnt-1].m_lines = lines;
+ 		    msg[cnt-1].m_headers = headers;
  		}
  		if (isoff(glob_flags, READ_ONLY) && fputs(buf, tmpf) == -1) {
  		    error(tempfile);
***************
*** 953,960 ****
--- 954,963 ----
  		msg[cnt].m_flags = 0L;
  #ifdef MSG_SEPARATOR
  		lines = 0;
+ 		headers = 0;
  #else /* MSG_SEPARATOR */
  		lines = 1; /* count the From_ line */
+ 		headers = 1;
  		if (warn)
  		    turnon(glob_flags, WARNING);
  		strdup(msg[cnt].m_date_recv, date);
***************
*** 1021,1026 ****
--- 1024,1030 ----
  			break;
  		    }
  		    lines++;
+ 		    headers++;
  		}
  		if (!msg[cnt].m_date_sent || !*msg[cnt].m_date_sent)
  		    if (!msg[cnt].m_date_recv || !*msg[cnt].m_date_recv) {
***************
*** 1042,1047 ****
--- 1046,1052 ----
  	} else if (!msg_found && buf[0] != '\n') {
  	    /* Allow leading blank lines, but anything else is wrong */
  	    lines++;
+ 	    headers++;
  	    had_error++;
  	    break;
  	}
***************
*** 1092,1097 ****
--- 1097,1103 ----
  	else
  	    msg[cnt].m_size = ftell(fp) - msg[cnt].m_offset;
  	msg[cnt].m_lines = lines;
+ 	msg[cnt].m_headers = headers;
  	/* remember where we were to seek to for when we append new mail */ 
  	if (append)
  	    cnt++;
*** old/mush.1	Sun Oct 25 11:59:15 1998
--- mush.1	Sun Oct 25 12:04:10 1998
***************
*** 4206,4214 ****
  .nf
  .ta 0.5i
  %a	address of the author
  %c	number of characters (bytes) in the message
  %f	entire \*QFrom:\*U field (author)
! %l	number of lines in the message
  %i	the message-id (may not be present)
  %n	name of the author
  %s	subject of the message
--- 4206,4216 ----
  .nf
  .ta 0.5i
  %a	address of the author
+ %b	number of lines in the body of the message
  %c	number of characters (bytes) in the message
  %f	entire \*QFrom:\*U field (author)
! %h	number of header lines in the message
! %l	number of total lines in the message
  %i	the message-id (may not be present)
  %n	name of the author
  %s	subject of the message
*** old/mush.h	Sun Oct 25 11:59:14 1998
--- mush.h	Sun Oct 25 11:58:29 1998
***************
*** 578,583 ****
--- 578,584 ----
      long   m_offset;	/* offset in tempfile of msg */
      long   m_size;	/* number of bytes in msg */
      int    m_lines;	/* number of lines in msg */
+     int    m_headers;	/* number of header lines in msg */
      char   *m_date_recv;/* Date user received msg (see dates.c for fmt) */
      char   *m_date_sent;/* Date author sent msg (see dates.c for fmt) */
      char   *m_to;	/* Cached To: field */
*** old/pick.c	Sun Oct 25 11:59:14 1998
--- pick.c	Sun Oct 25 11:58:28 1998
***************
*** 297,307 ****
  
  
  static int
! cmplines(m1, m2)
      struct msg **m1;
      struct msg **m2;
  {
!     int z =  (int) (*m2)->m_lines - (int) (*m1)->m_lines;
      if (z > 0)
  	return 1;
      else if (z < 0)
--- 297,308 ----
  
  
  static int
! cmpreallines(m1, m2)
      struct msg **m1;
      struct msg **m2;
  {
!     int z =  (int) (((*m2)->m_lines - (*m2)->m_headers) -
! 		    ((*m1)->m_lines - (*m1)->m_headers));
      if (z > 0)
  	return 1;
      else if (z < 0)
***************
*** 340,356 ****
  	}
  
      cnt = i;
!     qsort((char *) mlist, cnt, sizeof(struct msg *), cmplines);
  
      clear_msg_list(ret_list);
  
      lcur = -1;
  
      for (i = 0; i < cnt - 1; i++) {
! 	lcur = mlist[i]->m_lines;
  	mcur = mlist[i]->m_spare;
  
! 	if (mlist[i + 1]->m_lines != lcur)
  	    /* Next message has not the same number of lines, skip */
  	    continue;
  
--- 341,357 ----
  	}
  
      cnt = i;
!     qsort((char *) mlist, cnt, sizeof(struct msg *), cmpreallines);
  
      clear_msg_list(ret_list);
  
      lcur = -1;
  
      for (i = 0; i < cnt - 1; i++) {
! 	lcur = mlist[i]->m_lines - mlist[i]->m_headers;
  	mcur = mlist[i]->m_spare;
  
! 	if (mlist[i + 1]->m_lines - mlist[i + 1]->m_headers != lcur)
  	    /* Next message has not the same number of lines, skip */
  	    continue;
  
***************
*** 374,380 ****
  	}
  	omsize = mlist[i]->m_size - (omsg - otext);
  	for (j = i + 1; j < cnt; j++) {
! 	    if (mlist[j]->m_lines != lcur)
  		/* Next message has not the same number of lines, skip */
  		break;
  	    mid = mlist[j]->m_spare;
--- 375,381 ----
  	}
  	omsize = mlist[i]->m_size - (omsg - otext);
  	for (j = i + 1; j < cnt; j++) {
! 	    if (mlist[j]->m_lines - mlist[j]->m_headers != lcur)
  		/* Next message has not the same number of lines, skip */
  		break;
  	    mid = mlist[j]->m_spare;