2007-04-06 03:49:43 +05:30
|
|
|
/* vi: set sw=4 ts=4: */
|
|
|
|
/*
|
|
|
|
* Match fstypes for use in mount unmount
|
|
|
|
* We accept notmpfs,nfs but not notmpfs,nonfs
|
|
|
|
* This allows us to match fstypes that start with no like so
|
|
|
|
* mount -at ,noddy
|
|
|
|
*
|
2009-03-15 04:27:20 +05:30
|
|
|
* Returns 1 for a match, otherwise 0
|
2007-04-06 03:49:43 +05:30
|
|
|
*
|
2010-08-16 23:44:46 +05:30
|
|
|
* Licensed under GPLv2 or later, see file LICENSE in this source tree.
|
2007-04-06 03:49:43 +05:30
|
|
|
*/
|
|
|
|
#include "libbb.h"
|
|
|
|
|
2017-01-30 05:15:05 +05:30
|
|
|
int FAST_FUNC fstype_matches(const char *fstype, const char *comma_list)
|
2007-04-06 03:49:43 +05:30
|
|
|
{
|
2009-03-15 04:27:20 +05:30
|
|
|
int match = 1;
|
2007-04-06 03:49:43 +05:30
|
|
|
|
2017-01-30 05:15:05 +05:30
|
|
|
if (!comma_list)
|
2009-03-15 04:27:20 +05:30
|
|
|
return match;
|
2007-05-30 05:59:55 +05:30
|
|
|
|
2017-01-30 05:15:05 +05:30
|
|
|
if (comma_list[0] == 'n' && comma_list[1] == 'o') {
|
2009-03-15 04:27:20 +05:30
|
|
|
match--;
|
2017-01-30 05:15:05 +05:30
|
|
|
comma_list += 2;
|
2007-04-06 03:49:43 +05:30
|
|
|
}
|
|
|
|
|
2009-03-15 04:27:20 +05:30
|
|
|
while (1) {
|
2017-01-30 05:15:05 +05:30
|
|
|
char *after_mnt_type = is_prefixed_with(comma_list, fstype);
|
2015-03-12 22:18:34 +05:30
|
|
|
if (after_mnt_type
|
|
|
|
&& (*after_mnt_type == '\0' || *after_mnt_type == ',')
|
2007-04-06 03:49:43 +05:30
|
|
|
) {
|
2009-03-15 04:27:20 +05:30
|
|
|
return match;
|
2007-04-06 03:49:43 +05:30
|
|
|
}
|
2017-01-30 05:15:05 +05:30
|
|
|
comma_list = strchr(comma_list, ',');
|
|
|
|
if (!comma_list)
|
2009-03-15 04:27:20 +05:30
|
|
|
break;
|
2017-01-30 05:15:05 +05:30
|
|
|
comma_list++;
|
2007-04-06 03:49:43 +05:30
|
|
|
}
|
|
|
|
|
2009-03-15 04:27:20 +05:30
|
|
|
return !match;
|
2007-04-06 03:49:43 +05:30
|
|
|
}
|