MCPcopy Create free account
hub / github.com/OpenPrinting/cups / cups_queue_name

Function cups_queue_name

cups/dest.c:4447–4478  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4445 */
4446
4447static void
4448cups_queue_name(
4449 char *name, /* I - Name buffer */
4450 const char *serviceName, /* I - Service name */
4451 size_t namesize) /* I - Size of name buffer */
4452{
4453 const char *ptr; /* Pointer into serviceName */
4454 char *nameptr; /* Pointer into name */
4455
4456
4457 for (nameptr = name, ptr = serviceName; *ptr && nameptr < (name + namesize - 1); ptr ++)
4458 {
4459 /*
4460 * Sanitize the printer name...
4461 */
4462
4463 if (_cups_isalnum(*ptr))
4464 *nameptr++ = *ptr;
4465 else if (nameptr == name || nameptr[-1] != '_')
4466 *nameptr++ = '_';
4467 }
4468
4469 /*
4470 * Remove an underscore if it is the last character and isn't the only
4471 * character in the name...
4472 */
4473
4474 if (nameptr > (name + 1) && nameptr[-1] == '_')
4475 nameptr --;
4476
4477 *nameptr = '\0';
4478}

Callers 3

cupsGetDestWithURIFunction · 0.85
cups_dnssd_get_deviceFunction · 0.85
dest.cFile · 0.85

Calls 1

_cups_isalnumFunction · 0.85

Tested by

no test coverage detected