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

Function cupsFilePutChar

cups/file.c:1459–1502  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1457 */
1458
1459int /* O - 0 on success, -1 on error */
1460cupsFilePutChar(cups_file_t *fp, /* I - CUPS file */
1461 int c) /* I - Character to write */
1462{
1463 /*
1464 * Range check input...
1465 */
1466
1467 if (!fp || (fp->mode != 'w' && fp->mode != 's'))
1468 return (-1);
1469
1470 if (fp->mode == 's')
1471 {
1472 /*
1473 * Send character immediately over socket...
1474 */
1475
1476 char ch; /* Output character */
1477
1478
1479 ch = (char)c;
1480
1481 if (send(fp->fd, &ch, 1, 0) < 1)
1482 return (-1);
1483 }
1484 else
1485 {
1486 /*
1487 * Buffer it up...
1488 */
1489
1490 if (fp->ptr >= fp->end)
1491 if (cupsFileFlush(fp))
1492 return (-1);
1493
1494 *(fp->ptr) ++ = (char)c;
1495 }
1496
1497 fp->pos ++;
1498
1499 DEBUG_printf(("4cupsFilePutChar: pos=" CUPS_LLFMT, CUPS_LLCAST fp->pos));
1500
1501 return (0);
1502}
1503
1504
1505/*

Callers 15

print_csvFunction · 0.85
print_ippserver_stringFunction · 0.85
print_json_stringFunction · 0.85
print_lineFunction · 0.85
print_xml_stringFunction · 0.85
copy_bannerFunction · 0.85
save_auth_infoFunction · 0.85
quotefMethod · 0.85
save_messagesMethod · 0.85
write_ppd_fileMethod · 0.85
do_config_serverFunction · 0.85

Calls 1

cupsFileFlushFunction · 0.85

Tested by 1

read_write_testsFunction · 0.68