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

Function cupsGetDest

cups/dest.c:1052–1093  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1050 */
1051
1052cups_dest_t * /* O - Destination pointer or @code NULL@ */
1053cupsGetDest(const char *name, /* I - Destination name or @code NULL@ for the default destination */
1054 const char *instance, /* I - Instance name or @code NULL@ */
1055 int num_dests, /* I - Number of destinations */
1056 cups_dest_t *dests) /* I - Destinations */
1057{
1058 int diff, /* Result of comparison */
1059 match; /* Matching index */
1060
1061
1062 if (num_dests <= 0 || !dests)
1063 return (NULL);
1064
1065 if (!name)
1066 {
1067 /*
1068 * NULL name for default printer.
1069 */
1070
1071 while (num_dests > 0)
1072 {
1073 if (dests->is_default)
1074 return (dests);
1075
1076 num_dests --;
1077 dests ++;
1078 }
1079 }
1080 else
1081 {
1082 /*
1083 * Lookup name and optionally the instance...
1084 */
1085
1086 match = cups_find_dest(name, instance, num_dests, dests, -1, &diff);
1087
1088 if (!diff)
1089 return (dests + match);
1090 }
1091
1092 return (NULL);
1093}
1094
1095
1096/*

Callers 12

mainFunction · 0.85
mainFunction · 0.85
mainFunction · 0.85
mainFunction · 0.85
check_destFunction · 0.85
mainFunction · 0.85
cupsAddDestFunction · 0.85
cupsCopyDestFunction · 0.85
cupsRemoveDestFunction · 0.85
cupsSetDests2Function · 0.85
cups_enum_destsFunction · 0.85
cups_get_destsFunction · 0.85

Calls 1

cups_find_destFunction · 0.85

Tested by 1

mainFunction · 0.68