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 2006 University of Washington
9 * Licensed under the Apache License, Version 2.0 (the "License");
10 * you may not use this file except in compliance with the License.
11 * You may obtain a copy of the License at
13 * http://www.apache.org/licenses/LICENSE-2.0
15 * ========================================================================
18 #include "../pith/headers.h"
19 #include "../pith/search.h"
23 build_searchset(MAILSTREAM
*stream
)
26 SEARCHSET
*ret_s
= NULL
, **set
;
32 for(i
= 1L, set
= &ret_s
, run
= 0L; i
<= stream
->nmsgs
; i
++){
33 if(!((mc
= mail_elt(stream
, i
)) && mc
->sequence
)){ /* end of run */
34 if(run
){ /* run in progress */
39 else if(run
++){ /* next in run */
42 else{ /* start of new run */
43 *set
= mail_newsearchset();
45 * Leave off (*set)->last until we get more than one msg
46 * in the run, to avoid 607:607 in SEARCH.
48 (*set
)->first
= (*set
)->last
= i
;
57 in_searchset(SEARCHSET
*srch
, long unsigned int num
)
63 for(s
= srch
; s
; s
= s
->next
)
64 for(i
= s
->first
; i
<= s
->last
; i
++){