1.1 --- a/sourcemm/CSmmAPI.cpp Mon Aug 14 05:49:53 2006 +0000
1.2 +++ b/sourcemm/CSmmAPI.cpp Mon Aug 14 05:50:26 2006 +0000
1.3 @@ -357,6 +357,40 @@
1.4 return pf;
1.5 }
1.6
1.7 +void *CSmmAPI::VInterfaceMatch(CreateInterfaceFn fn, const char *iface, bool chop)
1.8 +{
1.9 + char buffer[256]; /* assume no interface will go beyond this */
1.10 + int len = static_cast<int>(strlen(iface));
1.11 +
1.12 + if (len > sizeof(buffer) - 4)
1.13 + {
1.14 + return NULL;
1.15 + }
1.16 +
1.17 + strcpy(buffer, iface);
1.18 +
1.19 + if (chop)
1.20 + {
1.21 + char *ptr = &buffer[len-1];
1.22 + int digits = 0;
1.23 + while (isdigit(*ptr) && digits <=3)
1.24 + {
1.25 + *ptr = '\0';
1.26 + digits++;
1.27 + ptr--;
1.28 + }
1.29 + if (digits != 3)
1.30 + {
1.31 + /* for now, assume this is an error */
1.32 + strcpy(buffer, iface);
1.33 + }
1.34 + }
1.35 +
1.36 + strcat(buffer, "001");
1.37 +
1.38 + return InterfaceSearch(fn, buffer, IFACE_MAXNUM, NULL);
1.39 +}
1.40 +
1.41 const char *CSmmAPI::GetBaseDir()
1.42 {
1.43 return g_ModPath.c_str();