diff options
Diffstat (limited to 'prtmib.c')
| -rw-r--r-- | prtmib.c | 32 |
1 files changed, 31 insertions, 1 deletions
@@ -890,8 +890,15 @@ putdescr(const struct Bind *b, int max) static void putmodel(const struct Bind *b, int max) { + static const struct { + const char *from; + const char *to; + } vend[] = { + { "KONICA MINOLTA", "KM" }, + { "Xerox", "XRX" }, + }; char buf[128]; - int i, n, out; + int i, n, out, k, fl, tl, ok; char *p, *v; if (!b || b->nstr <= 0) { @@ -927,6 +934,29 @@ putmodel(const struct Bind *b, int max) if (*p == '\0') *v = '\0'; } + /* "KONICA MINOLTA bizhub C250i" -> "KM bizhub C250i" + * "Xerox WorkCentre 7835" -> "XRX WorkCentre 7835" */ + n = (int)strlen(buf); + for (k = 0; k < (int)LEN(vend); k++) { + fl = (int)strlen(vend[k].from); + if (n < fl) + continue; + ok = 1; + for (i = 0; i < fl; i++) + if (tolower((unsigned char)buf[i]) != + tolower((unsigned char)vend[k].from[i])) { + ok = 0; + break; + } + if (!ok) + continue; + if (buf[fl] != '\0' && buf[fl] != ' ') + continue; + tl = (int)strlen(vend[k].to); + memmove(buf + tl, buf + fl, (size_t)(n - fl + 1)); + memcpy(buf, vend[k].to, (size_t)tl); + break; + } n = (int)strlen(buf); if (n > max) n = max; |
