]> code.citadel.org Git - citadel.git/blob - citadel/utils/ctdl3264_prep.sh
Fixed imap_append() from clearing all flags on messages and avoid purge_user() from...
[citadel.git] / citadel / utils / ctdl3264_prep.sh
1 #!/bin/bash
2 # Copyright (c) 2023 by the citadel.org team
3 # This program is open source software.  Use, duplication, or disclosure
4 # is subject to the terms of the GNU General Public License, version 3.
5
6 # Source our data structures from the real live working code
7 SERVER_H=server/server.h
8
9 tail_opt=
10 tail +1 ${SERVER_H} > /dev/null 2>&1
11 if [ $? != 0 ] ; then
12         tail_opt=-n
13 fi
14
15 # Generate the "32-bit" versions of these structures.
16 # Note that this is specifically for converting "32-bit to 64-bit" -- NOT "any-to-any"
17 convert_struct() {
18         start_line=$(cat ${SERVER_H} | egrep -n "^struct $1 {" | cut -d: -f1)
19         tail ${tail_opt} +${start_line} ${SERVER_H} | sed '/};/q' \
20         | sed s/"^struct $1 {"/"struct ${1}_32 {"/g \
21         | sed s/"long "/"int32_t "/g \
22         | sed s/"time_t "/"int32_t "/g \
23         | sed s/"size_t "/"int32_t "/g \
24         | sed s/"struct ExpirePolicy "/"struct ExpirePolicy_32 "/g
25         echo ''
26
27 }
28
29 # Here we go.  Let's make this thing happen.
30 (
31
32         echo '// This file was automatically generated by ctdl3264_prep.sh'
33         echo '// Attempting to modify it would be an exercise in futility.'
34         echo ''
35
36         convert_struct "ctdluser"
37         convert_struct "ExpirePolicy"
38         convert_struct "ctdlroom"
39         convert_struct "floor"
40         convert_struct "visit"
41         convert_struct "visit_index"
42         convert_struct "MetaData"
43         convert_struct "CtdlCompressHeader"
44         convert_struct "UseTable"
45
46 ) >utils/ctdl3264_structs.h