1 #if !defined(lint) && !defined(DOS)
2 static char rcsid
[] = "$Id: search.c 854 2007-12-07 17:44:43Z hubert@u.washington.edu $";
6 * ========================================================================
7 * Copyright 2013-2020 Eduardo Chappa
8 * Copyright 2006 University of Washington
10 * Licensed under the Apache License, Version 2.0 (the "License");
11 * you may not use this file except in compliance with the License.
12 * You may obtain a copy of the License at
14 * http://www.apache.org/licenses/LICENSE-2.0
16 * ========================================================================
19 #include "../pith/headers.h"
20 #include "../pith/search.h"
24 build_searchset(MAILSTREAM
*stream
)
27 SEARCHSET
*ret_s
= NULL
, **set
;
33 for(i
= 1L, set
= &ret_s
, run
= 0L; i
<= stream
->nmsgs
; i
++){
34 if(!((mc
= mail_elt(stream
, i
)) && mc
->sequence
)){ /* end of run */
35 if(run
){ /* run in progress */
40 else if(run
++){ /* next in run */
43 else{ /* start of new run */
44 *set
= mail_newsearchset();
46 * Leave off (*set)->last until we get more than one msg
47 * in the run, to avoid 607:607 in SEARCH.
49 (*set
)->first
= (*set
)->last
= i
;
58 in_searchset(SEARCHSET
*srch
, long unsigned int num
)
64 for(s
= srch
; s
; s
= s
->next
)
65 for(i
= s
->first
; i
<= s
->last
; i
++){