summaryrefslogtreecommitdiff
path: root/mail/mush/patches/patch-ak
blob: db588ab046a8928190d2e14073acd52e23c6d100 (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
$NetBSD: patch-ak,v 1.3 2021/05/20 19:21:13 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
--- pick.c.orig	2021-05-20 15:01:53.877747112 -0400
+++ pick.c	2021-05-20 15:15:36.015390640 -0400
@@ -297,11 +297,12 @@
 
 
 static int
-cmplines(m1, m2)
+cmpreallines(m1, m2)
     struct msg **m1;
     struct msg **m2;
 {
-    int z =  (int) (*m2)->m_lines - (int) (*m1)->m_lines;
+    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,17 +341,17 @@
 	}
 
     cnt = i;
-    qsort((char *) mlist, cnt, sizeof(struct msg *), cmplines);
+    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;
+	lcur = mlist[i]->m_lines - mlist[i]->m_headers;
 	mcur = mlist[i]->m_spare;
 
-	if (mlist[i + 1]->m_lines != lcur)
+	if (mlist[i + 1]->m_lines - mlist[i + 1]->m_headers != lcur)
 	    /* Next message has not the same number of lines, skip */
 	    continue;
 
@@ -374,7 +375,7 @@
 	}
 	omsize = mlist[i]->m_size - (omsg - otext);
 	for (j = i + 1; j < cnt; j++) {
-	    if (mlist[j]->m_lines != lcur)
+	    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;
@@ -746,12 +747,14 @@
 int *month, *day, *year;
 {
     long gmt;
+    time_t tgmt;
     char unused[4], zone[8];
     struct tm *t;
     extern long getzoff();
 
     (void) sscanf(date, "%ld%3c%s", &gmt, unused, zone);
     gmt += getzoff(zone);
+    tgmt = gmt < 0 ? 0 : gmt;
     t = gmtime(&gmt);
     *month = t->tm_mon;
     *day = t->tm_mday;
@@ -767,7 +770,7 @@
 register char *p;
 {
     register char *p2;
-    long	  t;
+    time_t	  t;
     int 	  i;
     struct tm 	  *today;
 
@@ -833,7 +836,7 @@
     register char *p;
     char	   buf[256];
     int		   n = 0, value;
-    long	   t;
+    time_t	   t;
     struct tm 	  *today;
 
     (void) argv_to_string(buf, argv);