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

Function lpd_write

backend/lpd.c:1256–1282  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1254 */
1255
1256static ssize_t /* O - Number of bytes written or -1 on error */
1257lpd_write(int lpd_fd, /* I - LPD socket */
1258 char *buffer, /* I - Buffer to write */
1259 size_t length) /* I - Number of bytes to write */
1260{
1261 ssize_t bytes, /* Number of bytes written */
1262 total; /* Total number of bytes written */
1263
1264
1265 if (abort_job)
1266 return (-1);
1267
1268 total = 0;
1269 while ((bytes = send(lpd_fd, buffer, length - (size_t)total, 0)) >= 0)
1270 {
1271 total += bytes;
1272 buffer += bytes;
1273
1274 if ((size_t)total == length)
1275 break;
1276 }
1277
1278 if (bytes < 0)
1279 return (-1);
1280 else
1281 return (total);
1282}
1283
1284
1285/*

Callers 2

lpd_commandFunction · 0.85
lpd_queueFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected