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

Function cupsGetPPD3

cups/ppd-util.c:123–459  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

121 */
122
123http_status_t /* O - HTTP status */
124cupsGetPPD3(http_t *http, /* I - HTTP connection or @code CUPS_HTTP_DEFAULT@ */
125 const char *name, /* I - Destination name */
126 time_t *modtime, /* IO - Modification time */
127 char *buffer, /* I - Filename buffer */
128 size_t bufsize) /* I - Size of filename buffer */
129{
130 int http_port; /* Port number */
131 char http_hostname[HTTP_MAX_HOST];
132 /* Hostname associated with connection */
133 http_t *http2; /* Alternate HTTP connection */
134 int fd; /* PPD file */
135 char localhost[HTTP_MAX_URI],/* Local hostname */
136 hostname[HTTP_MAX_URI], /* Hostname */
137 resource[HTTP_MAX_URI]; /* Resource name */
138 int port; /* Port number */
139 http_status_t status; /* HTTP status from server */
140 char tempfile[1024] = ""; /* Temporary filename */
141 _cups_globals_t *cg = _cupsGlobals(); /* Pointer to library globals */
142
143
144 /*
145 * Range check input...
146 */
147
148 DEBUG_printf(("cupsGetPPD3(http=%p, name=\"%s\", modtime=%p(%d), buffer=%p, "
149 "bufsize=%d)", http, name, modtime,
150 modtime ? (int)*modtime : 0, buffer, (int)bufsize));
151
152 if (!name)
153 {
154 DEBUG_puts("2cupsGetPPD3: No printer name, returning NULL.");
155 _cupsSetError(IPP_STATUS_ERROR_INTERNAL, _("No printer name"), 1);
156 return (HTTP_STATUS_NOT_ACCEPTABLE);
157 }
158
159 if (!modtime)
160 {
161 DEBUG_puts("2cupsGetPPD3: No modtime, returning NULL.");
162 _cupsSetError(IPP_STATUS_ERROR_INTERNAL, _("No modification time"), 1);
163 return (HTTP_STATUS_NOT_ACCEPTABLE);
164 }
165
166 if (!buffer || bufsize <= 1)
167 {
168 DEBUG_puts("2cupsGetPPD3: No filename buffer, returning NULL.");
169 _cupsSetError(IPP_STATUS_ERROR_INTERNAL, _("Bad filename buffer"), 1);
170 return (HTTP_STATUS_NOT_ACCEPTABLE);
171 }
172
173#ifndef _WIN32
174 /*
175 * See if the PPD file is available locally...
176 */
177
178 if (http)
179 httpGetHostname(http, hostname, sizeof(hostname));
180 else

Callers 3

mainFunction · 0.85
cupsGetPPDFunction · 0.85
cupsGetPPD2Function · 0.85

Calls 15

_cupsGlobalsFunction · 0.85
_cupsSetErrorFunction · 0.85
httpGetHostnameFunction · 0.85
cupsServerFunction · 0.85
_cups_strcasecmpFunction · 0.85
_cupsConnectFunction · 0.85
cups_get_printer_uriFunction · 0.85
ippPortFunction · 0.85
httpAddrPortFunction · 0.85
httpConnect2Function · 0.85
cupsEncryptionFunction · 0.85
cupsTempFdFunction · 0.85

Tested by 1

mainFunction · 0.68