1.1 --- a/sourcemm/CSmmAPI.cpp Mon Aug 14 20:14:02 2006 +0000
1.2 +++ b/sourcemm/CSmmAPI.cpp Tue Aug 15 20:10:12 2006 +0000
1.3 @@ -357,10 +357,11 @@
1.4 return pf;
1.5 }
1.6
1.7 -void *CSmmAPI::VInterfaceMatch(CreateInterfaceFn fn, const char *iface, bool chop)
1.8 +void *CSmmAPI::VInterfaceMatch(CreateInterfaceFn fn, const char *iface, int min)
1.9 {
1.10 char buffer[256]; /* assume no interface will go beyond this */
1.11 int len = static_cast<int>(strlen(iface));
1.12 + int ret; /* just in case something doesn't handle NULL properly */
1.13
1.14 if (len > static_cast<int>(sizeof(buffer) - 4))
1.15 {
1.16 @@ -369,7 +370,7 @@
1.17
1.18 strcpy(buffer, iface);
1.19
1.20 - if (chop)
1.21 + if (min != -1)
1.22 {
1.23 char *ptr = &buffer[len-1];
1.24 int digits = 0;
1.25 @@ -383,12 +384,15 @@
1.26 {
1.27 /* for now, assume this is an error */
1.28 strcpy(buffer, iface);
1.29 + } else {
1.30 + char num[4];
1.31 + min = (min == 0) ? 1 : min;
1.32 + snprintf(num, sizeof(num), "%03d", min);
1.33 + strcat(buffer, num);
1.34 }
1.35 }
1.36
1.37 - strcat(buffer, "001");
1.38 -
1.39 - return InterfaceSearch(fn, buffer, IFACE_MAXNUM, NULL);
1.40 + return InterfaceSearch(fn, buffer, IFACE_MAXNUM, &ret);
1.41 }
1.42
1.43 const char *CSmmAPI::GetBaseDir()