Deleted Added
sdiff udiff text old ( 27757 ) new ( 30407 )
full compact
1/*
2 * Copyright (c) 1983, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

--- 102 unchanged lines hidden (view full) ---

111static char pxlength[10] = "-y"; /* page length in pixels */
112static char pxwidth[10] = "-x"; /* page width in pixels */
113static char tempfile[] = "errsXXXXXX"; /* file name for filter errors */
114static char width[10] = "-w"; /* page width in static characters */
115#define TFILENAME "fltXXXXXX"
116static char tfile[] = TFILENAME; /* file name for filter output */
117
118static void abortpr __P((int));
119static void banner __P((char *, char *));
120static int dofork __P((int));
121static int dropit __P((int));
122static void init __P((void));
123static void openpr __P((void));
124static void opennet __P((char *));
125static void opentty __P((void));
126static void openrem __P((void));

--- 1218 unchanged lines hidden (view full) ---

1345 DU = DEFUID;
1346 if (cgetstr(bp,"ff", &FF) == -1)
1347 FF = DEFFF;
1348 if (cgetnum(bp, "pw", &PW) < 0)
1349 PW = DEFWIDTH;
1350 sprintf(&width[2], "%ld", PW);
1351 if (cgetnum(bp, "pl", &PL) < 0)
1352 PL = DEFLENGTH;
1353 sprintf(&length[2], "%ld", PL);
1354 if (cgetnum(bp,"px", &PX) < 0)
1355 PX = 0;
1356 sprintf(&pxwidth[2], "%ld", PX);
1357 if (cgetnum(bp, "py", &PY) < 0)
1358 PY = 0;
1359 sprintf(&pxlength[2], "%ld", PY);
1360 cgetstr(bp, "rm", &RM);

--- 89 unchanged lines hidden (view full) ---

1450 */
1451static void
1452opennet(cp)
1453 char *cp;
1454{
1455 register int i;
1456 int resp, port;
1457 char save_ch;
1458
1459 save_ch = *cp;
1460 *cp = '\0';
1461 port = atoi(LP);
1462 if (port <= 0) {
1463 syslog(LOG_ERR, "%s: bad port number: %s", printer, LP);
1464 exit(1);
1465 }
1466 *cp++ = save_ch;
1467
1468 for (i = 1; ; i = i < 256 ? i << 1 : i) {
1469 resp = -1;
1470 pfd = getport(cp, port);
1471 if (pfd < 0 && errno == ECONNREFUSED)
1472 resp = 1;
1473 else if (pfd >= 0) {
1474 /*
1475 * need to delay a bit for rs232 lines
1476 * to stabilize in case printer is
1477 * connected via a terminal server
1478 */

--- 43 unchanged lines hidden (view full) ---

1522/*
1523 * Printer is on a remote host
1524 */
1525static void
1526openrem()
1527{
1528 register int i, n;
1529 int resp;
1530
1531 for (i = 1; ; i = i < 256 ? i << 1 : i) {
1532 resp = -1;
1533 pfd = getport(RM, 0);
1534 if (pfd >= 0) {
1535 (void) snprintf(line, sizeof(line), "\2%s\n", RP);
1536 n = strlen(line);
1537 if (write(pfd, line, n) == n &&
1538 (resp = response()) == '\0')
1539 break;
1540 (void) close(pfd);
1541 }

--- 108 unchanged lines hidden (view full) ---

1650 }
1651 ftruncate(fd, 0);
1652 (void)vsnprintf(buf, sizeof(buf) - 1, msg, ap);
1653 va_end(ap);
1654 strcat(buf, "\n");
1655 (void) write(fd, buf, strlen(buf));
1656 (void) close(fd);
1657}