portability: add support for Illumos

This still won't work on older Solaris systems, but modern Illumos
at least should build and run now.
This commit is contained in:
Justin Maggard
2014-05-14 17:53:25 -07:00
parent 361bc34f93
commit 34cb08928c
10 changed files with 58 additions and 30 deletions

View File

@ -604,10 +604,14 @@ filter_hidden(scan_filter *d)
static int
filter_type(scan_filter *d)
{
#if HAVE_STRUCT_DIRENT_D_TYPE
return ( (d->d_type == DT_DIR) ||
(d->d_type == DT_LNK) ||
(d->d_type == DT_UNKNOWN)
);
#else
return 1;
#endif
}
static int
@ -615,7 +619,7 @@ filter_a(scan_filter *d)
{
return ( filter_hidden(d) &&
(filter_type(d) ||
((d->d_type == DT_REG) &&
(is_reg(d) &&
(is_audio(d->d_name) ||
is_playlist(d->d_name))))
);
@ -626,7 +630,7 @@ filter_av(scan_filter *d)
{
return ( filter_hidden(d) &&
(filter_type(d) ||
((d->d_type == DT_REG) &&
(is_reg(d) &&
(is_audio(d->d_name) ||
is_video(d->d_name) ||
is_playlist(d->d_name))))
@ -638,7 +642,7 @@ filter_ap(scan_filter *d)
{
return ( filter_hidden(d) &&
(filter_type(d) ||
((d->d_type == DT_REG) &&
(is_reg(d) &&
(is_audio(d->d_name) ||
is_image(d->d_name) ||
is_playlist(d->d_name))))
@ -650,7 +654,7 @@ filter_v(scan_filter *d)
{
return ( filter_hidden(d) &&
(filter_type(d) ||
(d->d_type == DT_REG &&
(is_reg(d) &&
is_video(d->d_name)))
);
}
@ -660,7 +664,7 @@ filter_vp(scan_filter *d)
{
return ( filter_hidden(d) &&
(filter_type(d) ||
((d->d_type == DT_REG) &&
(is_reg(d) &&
(is_video(d->d_name) ||
is_image(d->d_name))))
);
@ -671,7 +675,7 @@ filter_p(scan_filter *d)
{
return ( filter_hidden(d) &&
(filter_type(d) ||
(d->d_type == DT_REG &&
(is_reg(d) &&
is_image(d->d_name)))
);
}
@ -681,7 +685,7 @@ filter_avp(scan_filter *d)
{
return ( filter_hidden(d) &&
(filter_type(d) ||
((d->d_type == DT_REG) &&
(is_reg(d) &&
(is_audio(d->d_name) ||
is_image(d->d_name) ||
is_video(d->d_name) ||
@ -754,11 +758,11 @@ ScanDirectory(const char *dir, const char *parent, media_types dir_types)
type = TYPE_UNKNOWN;
snprintf(full_path, PATH_MAX, "%s/%s", dir, namelist[i]->d_name);
name = escape_tag(namelist[i]->d_name, 1);
if( namelist[i]->d_type == DT_DIR )
if( is_dir(namelist[i]) == 1 )
{
type = TYPE_DIR;
}
else if( namelist[i]->d_type == DT_REG )
else if( is_reg(namelist[i]) == 1 )
{
type = TYPE_FILE;
}