scanner: add maildir-scan mode; improve portability

Use d_ino (struct dirent) only when available.

Implement a mode for scanning just maildirs (ie. the dirs with cur / new
in them). Use d_type (if available) to optimize that.
This commit is contained in:
Dirk-Jan C. Binnema
2023-08-12 15:59:32 +03:00
parent 8caf504381
commit f5beea2eb2
4 changed files with 197 additions and 64 deletions

View File

@ -47,20 +47,21 @@ endif
# compilers / flags
#
extra_flags = [
'-Wc11-extensions', # for clang
'-Wno-unused-parameter',
'-Wno-cast-function-type',
'-Wformat-security',
'-Wformat=2',
'-Wstack-protector',
'-Wno-switch-enum',
'-Wno-keyword-macro',
'-Wno-volatile',
'-Wno-deprecated-volatile',
'-Wno-#warnings',
# assuming these are false alarm... (in fmt, with gcc13):
'-Wno-array-bounds',
'-Wno-stringop-overflow',
# clang
'-Wc11-extensions', # for clang
'-Wno-keyword-macro',
'-Wno-deprecated-volatile',
'-Wno-#warnings',
]
if get_option('buildtype') == 'debug'
@ -104,6 +105,20 @@ add_project_arguments(['-DHAVE_CONFIG_H'], language: 'cpp')
config_h_dep=declare_dependency(
include_directories: include_directories(['.']))
#
# d_type, d_ino are not available universally, so let's check
# (we use them for optimizations in mu-scanner
#
if cxx.has_member('struct dirent', 'd_ino', prefix : '#include<dirent.h>')
config_h_data.set('HAVE_DIRENT_D_INO', 1)
endif
if cxx.has_member('struct dirent', 'd_type', prefix : '#include<dirent.h>')
config_h_data.set('HAVE_DIRENT_D_TYPE', 1)
endif
functions=[
'setsid'
]