2 * ========================================================================
3 * Copyright 2013-2022 Eduardo Chappa
4 * Copyright 2006 University of Washington
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * ========================================================================
15 #include "../pith/headers.h"
16 #include "../pith/search.h"
20 build_searchset(MAILSTREAM
*stream
)
23 SEARCHSET
*ret_s
= NULL
, **set
;
29 for(i
= 1L, set
= &ret_s
, run
= 0L; i
<= stream
->nmsgs
; i
++){
30 if(!((mc
= mail_elt(stream
, i
)) && mc
->sequence
)){ /* end of run */
31 if(run
){ /* run in progress */
36 else if(run
++){ /* next in run */
39 else{ /* start of new run */
40 *set
= mail_newsearchset();
42 * Leave off (*set)->last until we get more than one msg
43 * in the run, to avoid 607:607 in SEARCH.
45 (*set
)->first
= (*set
)->last
= i
;
54 in_searchset(SEARCHSET
*srch
, long unsigned int num
)
60 for(s
= srch
; s
; s
= s
->next
)
61 for(i
= s
->first
; i
<= s
->last
; i
++){