Comparar commits

..

1 Commits

Autor SHA1 Mensagem Data
msweet c917c72ba6 Import cups.org releases
git-svn-id: svn+ssh://src.apple.com/svn/cups/cups.org/tags/release-1.0b6a@4306 a1ca3aef-8c08-0410-bb20-df032aa958be
2013-05-10 18:56:23 +00:00
53 arquivos alterados com 458 adições e 778 exclusões
+7 -7
Ver Arquivo
@@ -1,4 +1,4 @@
README - CUPS v1.0b9 - 09/03/1999
README - CUPS v1.0b6 - 07/30/1999
---------------------------------
BETA SOFTWARE BETA SOFTWARE BETA SOFTWARE BETA SOFTWARE BETA SOFTWARE
@@ -57,7 +57,7 @@ the binary distributions from Easy Software Products:
- Digital UNIX (aka OSF1 aka Compaq Tru64 UNIX) 4.0 or higher
- HP-UX 10.20 or higher
- IRIX 5.3 or higher
- Linux 2.0 with glibc2 or higher (tested with RedHat 5.2)
- Linux 2.0.36 with glibc2 or higher (tested with RedHat 5.2)
- Solaris 2.5 or higher (SPARC or Intel)
@@ -124,11 +124,6 @@ Similarly, for the sample LaserJet driver you can use "LaserJet" and
For other printers and interfaces see the CUPS System Administator's
Manual included with this software.
If you're interested in a complete, commercial printing solution for
UNIX, check out our ESP Print Pro software at:
http://www.easysw.com/printpro
PRINTING FILES
@@ -193,3 +188,8 @@ licensing information, please contact:
Voice: +1.301.373.9603
Email: cups-info@cups.org
WWW: http://www.cups.org
If you're interested in a complete, commercial printing solution for
UNIX, check out our ESP Print Pro software at:
http://www.easysw.com/printpro
+7 -13
Ver Arquivo
@@ -294,12 +294,12 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
*/
if (httpPost(http, resource))
{
fputs("INFO: Unable to POST print request; retrying...\n", stderr);
sleep(10);
httpReconnect(http);
continue;
}
if (httpPost(http, resource))
{
fputs("INFO: Unable to POST print request; retrying...\n", stderr);
sleep(10);
continue;
}
fputs("INFO: POST successful, sending IPP request...\n", stderr);
@@ -336,13 +336,7 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
}
}
/*
* If we are chunking the output from stdin, make sure we end up with
* a 0-length chunk at the end...
*/
if (fp == stdin)
httpWrite(http, buffer, 0);
httpWrite(http, buffer, 0);
fputs("INFO: Print file sent; checking status...\n", stderr);
+1 -1
Ver Arquivo
@@ -107,7 +107,7 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
int bytes; /* Number of bytes read */
if ((fp = fopen(cupsTempFile(filename, sizeof(filename)), "w")) == NULL)
if ((fp = fopen(tmpnam(filename), "w")) == NULL)
{
perror("ERROR: unable to create temporary file");
return (1);
+1 -3
Ver Arquivo
@@ -209,7 +209,7 @@ main(int argc, /* I - Number of command-line arguments */
return (1);
}
temp = fopen(cupsTempFile(tempfile, sizeof(tempfile)), "w");
temp = fopen(tmpnam(tempfile), "w");
if (temp == NULL)
{
@@ -234,8 +234,6 @@ main(int argc, /* I - Number of command-line arguments */
else
job_id = cupsPrintFile(dest, tempfile, "(stdin)", num_options, options);
unlink(tempfile);
if (job_id < 1)
{
fputs("lpr: unable to print standard input.\n", stderr);
-9
Ver Arquivo
@@ -107,23 +107,14 @@ main(int argc, /* I - Number of command-line arguments */
puts("<AREA SHAPE=\"RECT\" COORDS=\"95,10,175,30\" HREF=\"/classes\" ALT=\"Current Printer Classes Status\">");
puts("<AREA SHAPE=\"RECT\" COORDS=\"185,10,235,30\" HREF=\"/jobs\" ALT=\"Current Jobs Status\">");
puts("<AREA SHAPE=\"RECT\" COORDS=\"245,10,395,30\" HREF=\"/documentation.html\" ALT=\"Read CUPS Documentation On-Line\">");
#ifdef ESPPRINTPRO
puts("<AREA SHAPE=\"RECT\" COORDS=\"405,10,490,30\" HREF=\"http://www.easysw.com/printpro/software.html\" ALT=\"Download the Current ESP Print Pro Software\">");
puts("<AREA SHAPE=\"RECT\" COORDS=\"505,10,585,30\" HREF=\"http://www.easysw.com/printpro/support.html\" ALT=\"Get Tech Support for Current ESP Print Pro\">");
#else
puts("<AREA SHAPE=\"RECT\" COORDS=\"405,10,490,30\" HREF=\"http://www.cups.org\" ALT=\"Download the Current CUPS Software\">");
#endif /* ESPPRINTPRO */
puts("</MAP>");
puts("</HEAD>");
puts("<BODY>");
puts("<P ALIGN=CENTER>");
puts("<A HREF=\"http://www.easysw.com\" ALT=\"Easy Software Products Home Page\">");
puts("<IMG SRC=\"/images/logo.gif\" WIDTH=\"71\" HEIGHT=\"40\" BORDER=0 ALT=\"Easy Software Products Home Page\"></A>");
#ifdef ESPPRINTPRO
puts("<IMG SRC=\"/images/navbar.gif\" WIDTH=\"600\" HEIGHT=\"40\" USEMAP=\"#navbar\" BORDER=0>");
#else
puts("<IMG SRC=\"/images/navbar.gif\" WIDTH=\"540\" HEIGHT=\"40\" USEMAP=\"#navbar\" BORDER=0>");
#endif /* ESPPRINTPRO */
printf("<H1>%s on %s</H1>\n", name == NULL ? "Classes" : name,
getenv("SERVER_NAME"));
+2 -9
Ver Arquivo
@@ -62,6 +62,8 @@ main(int argc, /* I - Number of command-line arguments */
http_t *http; /* Connection to the server */
setbuf(stdout, NULL);
/*
* Get the request language...
*/
@@ -107,23 +109,14 @@ main(int argc, /* I - Number of command-line arguments */
puts("<AREA SHAPE=\"RECT\" COORDS=\"95,10,175,30\" HREF=\"/classes\" ALT=\"Current Printer Classes Status\">");
puts("<AREA SHAPE=\"RECT\" COORDS=\"185,10,235,30\" HREF=\"/jobs\" ALT=\"Current Jobs Status\">");
puts("<AREA SHAPE=\"RECT\" COORDS=\"245,10,395,30\" HREF=\"/documentation.html\" ALT=\"Read CUPS Documentation On-Line\">");
#ifdef ESPPRINTPRO
puts("<AREA SHAPE=\"RECT\" COORDS=\"405,10,490,30\" HREF=\"http://www.easysw.com/printpro/software.html\" ALT=\"Download the Current ESP Print Pro Software\">");
puts("<AREA SHAPE=\"RECT\" COORDS=\"505,10,585,30\" HREF=\"http://www.easysw.com/printpro/support.html\" ALT=\"Get Tech Support for Current ESP Print Pro\">");
#else
puts("<AREA SHAPE=\"RECT\" COORDS=\"405,10,490,30\" HREF=\"http://www.cups.org\" ALT=\"Download the Current CUPS Software\">");
#endif /* ESPPRINTPRO */
puts("</MAP>");
puts("</HEAD>");
puts("<BODY>");
puts("<P ALIGN=CENTER>");
puts("<A HREF=\"http://www.easysw.com\" ALT=\"Easy Software Products Home Page\">");
puts("<IMG SRC=\"/images/logo.gif\" WIDTH=\"71\" HEIGHT=\"40\" BORDER=0 ALT=\"Easy Software Products Home Page\"></A>");
#ifdef ESPPRINTPRO
puts("<IMG SRC=\"/images/navbar.gif\" WIDTH=\"600\" HEIGHT=\"40\" USEMAP=\"#navbar\" BORDER=0>");
#else
puts("<IMG SRC=\"/images/navbar.gif\" WIDTH=\"540\" HEIGHT=\"40\" USEMAP=\"#navbar\" BORDER=0>");
#endif /* ESPPRINTPRO */
fflush(stdout);
-9
Ver Arquivo
@@ -107,23 +107,14 @@ main(int argc, /* I - Number of command-line arguments */
puts("<AREA SHAPE=\"RECT\" COORDS=\"95,10,175,30\" HREF=\"/classes\" ALT=\"Current Printer Classes Status\">");
puts("<AREA SHAPE=\"RECT\" COORDS=\"185,10,235,30\" HREF=\"/jobs\" ALT=\"Current Jobs Status\">");
puts("<AREA SHAPE=\"RECT\" COORDS=\"245,10,395,30\" HREF=\"/documentation.html\" ALT=\"Read CUPS Documentation On-Line\">");
#ifdef ESPPRINTPRO
puts("<AREA SHAPE=\"RECT\" COORDS=\"405,10,490,30\" HREF=\"http://www.easysw.com/printpro/software.html\" ALT=\"Download the Current ESP Print Pro Software\">");
puts("<AREA SHAPE=\"RECT\" COORDS=\"505,10,585,30\" HREF=\"http://www.easysw.com/printpro/support.html\" ALT=\"Get Tech Support for Current ESP Print Pro\">");
#else
puts("<AREA SHAPE=\"RECT\" COORDS=\"405,10,490,30\" HREF=\"http://www.cups.org\" ALT=\"Download the Current CUPS Software\">");
#endif /* ESPPRINTPRO */
puts("</MAP>");
puts("</HEAD>");
puts("<BODY>");
puts("<P ALIGN=CENTER>");
puts("<A HREF=\"http://www.easysw.com\" ALT=\"Easy Software Products Home Page\">");
puts("<IMG SRC=\"/images/logo.gif\" WIDTH=\"71\" HEIGHT=\"40\" BORDER=0 ALT=\"Easy Software Products Home Page\"></A>");
#ifdef ESPPRINTPRO
puts("<IMG SRC=\"/images/navbar.gif\" WIDTH=\"600\" HEIGHT=\"40\" USEMAP=\"#navbar\" BORDER=0>");
#else
puts("<IMG SRC=\"/images/navbar.gif\" WIDTH=\"540\" HEIGHT=\"40\" USEMAP=\"#navbar\" BORDER=0>");
#endif /* ESPPRINTPRO */
printf("<H1>%s on %s</H1>\n", printer == NULL ? "Printers" : printer,
getenv("SERVER_NAME"));
+8 -30
Ver Arquivo
@@ -1,5 +1,5 @@
#
# "$Id: cupsd.conf 628 1999-08-23 15:24:48Z mike $"
# "$Id: cupsd.conf 510 1999-07-09 14:20:15Z mike $"
#
# Sample configuration file for the Common UNIX Printing System (CUPS)
# scheduler.
@@ -70,25 +70,20 @@ Port 631
# program is run...
#
#User lp
#Group sys
User lp
Group sys
#
# SystemGroup: the group name for "System" (printer administration)
# access. The default varies depending on the operating system, but
# will be "sys", "system", or "root" (checked for in that order.)
# access.
#
#SystemGroup sys
SystemGroup sys
#
# ServerName: the hostname of your server, as advertised to the world.
# By default CUPS will use the hostname of the system.
#
# This is also the name used by clients when connecting to the local
# server, so you can use this to configure a client machine without
# a local server running.
#
#ServerName myhost.domain.com
@@ -310,23 +305,6 @@ LogLevel info
# Deny: denies access from the specified hostname, domain, IP address, or
# network.
#
# Both "Allow" and "Deny" accept the following notations for addresses:
#
# All
# None
# *.domain.com
# .domain.com
# host.domain.com
# nnn.*
# nnn.nnn.*
# nnn.nnn.nnn.*
# nnn.nnn.nnn.nnn
# nnn.nnn.nnn.nnn/mm
# nnn.nnn.nnn.nnn/mmm.mmm.mmm.mmm
#
# The host and domain address require that you enable hostname lookups
# with "HostNameLookups On" above.
#
<Location />
</Location>
@@ -351,8 +329,8 @@ LogLevel info
#
# You definitely will want to limit access to the administration tools.
# The default configuration requires a local connection from a user who
# is a member of the system group to do any admin tasks. You can change
# the group name using the SystemGroup directive.
# is a member of group "sys" to do any admin tasks. You can change the
# group name using the SystemGroup directive.
#
AuthType Basic
@@ -365,5 +343,5 @@ Allow From 127.0.0.1
</Location>
#
# End of "$Id: cupsd.conf 628 1999-08-23 15:24:48Z mike $".
# End of "$Id: cupsd.conf 510 1999-07-09 14:20:15Z mike $".
#
+1 -1
Ver Arquivo
@@ -28,7 +28,7 @@
* Version of software...
*/
#define CUPS_SVERSION "CUPS v1.0b9"
#define CUPS_SVERSION "CUPS v1.0"
/*
* Where are files stored?
+11 -13
Ver Arquivo
@@ -46,7 +46,12 @@ AC_ARG_ENABLE(debug, [ --enable-debug turn on debugging [default=no]],
OPTIM="-g "
fi])
AC_ARG_ENABLE(shared, [ --disable-shared turn off shared libraries [default=no]])
if test "$disable_shared" != "yes"; then
if eval "test x$disable_shared = xyes"; then
PICFLAG=0
LIBCUPS="libcups.a"
LIBCUPSIMAGE="libcupsimage.a"
DSO=":"
else
case "$uname" in
SunOS* | UNIX_S*)
LIBCUPS="libcups.so.1"
@@ -58,7 +63,7 @@ if test "$disable_shared" != "yes"; then
LIBCUPSIMAGE="libcupsimage.sl.1"
DSO="ld -b -z +h \$@ -o"
;;
OSF1* | Linux* | FreeBSD*)
OSF1* | Linux*)
LIBCUPS="libcups.so.1"
LIBCUPSIMAGE="libcupsimage.so.1"
DSO="\$(CC) -Wl,-soname,\$@ -shared \$(OPTIM) -o"
@@ -76,11 +81,6 @@ if test "$disable_shared" != "yes"; then
DSO="\$(CC) -Wl,-soname,\$@ -shared \$(OPTIM) -o"
;;
esac
else
PICFLAG=0
LIBCUPS="libcups.a"
LIBCUPSIMAGE="libcupsimage.a"
DSO=":"
fi
dnl Checks for programs...
@@ -91,14 +91,13 @@ AC_PROG_RANLIB
AC_PATH_PROG(AR,ar)
AC_PATH_PROG(CHMOD,chmod)
AC_PATH_PROG(CP,cp)
AC_PATH_PROG(MV,mv)
AC_PATH_PROG(NROFF,nroff)
if test "$NROFF" = ""; then
AC_PATH_PROG(GROFF,groff)
if test "$GROFF" = ""; then
AC_PATH_PROG(NROFF,groff)
if test "$NROFF" = ""; then
NROFF="echo"
else
NROFF="$GROFF -T ascii"
NROFF="$NROFF -T ascii"
fi
fi
AC_PATH_PROG(HTMLDOC,htmldoc)
@@ -213,7 +212,6 @@ else
if test -z "$OPTIM"; then
OPTIM="+O2"
fi
OPTIM="-Ae $OPTIM"
;;
SunOS*)
# Solaris
@@ -273,7 +271,7 @@ if test "$prefix" = "NONE"; then
fi
dnl Fix "libdir" variable for IRIX 6.x...
if test "$uname" = "IRIX" -a $uversion -ge 65; then
if test "$uname" = "IRIX" -a $uversion -ge 62; then
libdir="/usr/lib32"
fi
+1 -1
Ver Arquivo
@@ -117,7 +117,7 @@ extern int cupsGetPrinters(char ***printers);
extern int cupsPrintFile(const char *printer, const char *filename,
const char *title, int num_options,
cups_option_t *options);
extern char *cupsTempFile(char *filename, int len);
extern int cupsAddOption(const char *name, const char *value,
int num_options, cups_option_t **options);
extern void cupsFreeOptions(int num_options, cups_option_t *options);
+20 -110
Ver Arquivo
@@ -25,8 +25,6 @@
*
* httpInitialize() - Initialize the HTTP interface library and set the
* default HTTP proxy (if any).
* httpCheck() - Check to see if there is a pending response from
* the server.
* httpClose() - Close an HTTP connection...
* httpConnect() - Connect to a HTTP server.
* httpReconnect() - Reconnect to a HTTP server...
@@ -192,41 +190,6 @@ httpInitialize(void)
}
/*
* 'httpCheck()' - Check to see if there is a pending response from the server.
*/
int /* O - 0 = no data, 1 = data available */
httpCheck(http_t *http) /* I - HTTP connection */
{
fd_set input; /* Input set for select() */
struct timeval timeout; /* Timeout */
/*
* First see if there is data in the buffer...
*/
if (http == NULL)
return (0);
if (http->used)
return (1);
/*
* Then try doing a select() to poll the socket...
*/
FD_ZERO(&input);
FD_SET(http->fd, &input);
timeout.tv_sec = 0;
timeout.tv_usec = 0;
return (select(http->fd + 1, &input, NULL, NULL, &timeout) > 0);
}
/*
* 'httpClose()' - Close an HTTP connection...
*/
@@ -329,10 +292,7 @@ httpReconnect(http_t *http) /* I - HTTP data */
*/
if ((http->fd = socket(AF_INET, SOCK_STREAM, 0)) < 0)
{
http->error = errno;
return (-1);
}
#ifdef FD_CLOEXEC
fcntl(http->fd, F_SETFD, FD_CLOEXEC); /* Close this socket when starting *
@@ -354,8 +314,6 @@ httpReconnect(http_t *http) /* I - HTTP data */
if (connect(http->fd, (struct sockaddr *)&(http->hostaddr),
sizeof(http->hostaddr)) < 0)
{
http->error = errno;
#ifdef WIN32
closesocket(http->fd);
#else
@@ -364,8 +322,6 @@ httpReconnect(http_t *http) /* I - HTTP data */
return (-1);
}
else
http->error = 0;
return (0);
}
@@ -692,11 +648,6 @@ httpRead(http_t *http, /* I - HTTP data */
* data, go idle...
*/
if (http->data_encoding == HTTP_ENCODE_CHUNKED &&
(http->state == HTTP_GET_SEND || http->state == HTTP_POST_RECV ||
http->state == HTTP_POST_SEND || http->state == HTTP_PUT_RECV))
httpGets(len, sizeof(len), http);
if (http->state == HTTP_POST_RECV)
http->state ++;
else
@@ -731,23 +682,13 @@ httpRead(http_t *http, /* I - HTTP data */
if (bytes > 0)
http->data_remaining -= bytes;
else if (bytes < 0)
http->error = errno;
if (http->data_remaining == 0)
if (http->data_remaining == 0 && http->data_encoding != HTTP_ENCODE_CHUNKED)
{
if (http->data_encoding == HTTP_ENCODE_CHUNKED &&
(http->state == HTTP_GET_SEND || http->state == HTTP_POST_RECV ||
http->state == HTTP_POST_SEND || http->state == HTTP_PUT_RECV))
httpGets(len, sizeof(len), http);
if (http->data_encoding != HTTP_ENCODE_CHUNKED)
{
if (http->state == HTTP_POST_RECV)
http->state ++;
else
http->state = HTTP_WAITING;
}
if (http->state == HTTP_POST_RECV)
http->state ++;
else
http->state = HTTP_WAITING;
}
return (bytes);
@@ -776,8 +717,11 @@ httpWrite(http_t *http, /* I - HTTP data */
if (http->data_encoding == HTTP_ENCODE_CHUNKED &&
(http->state == HTTP_GET_SEND || http->state == HTTP_POST_RECV ||
http->state == HTTP_POST_SEND || http->state == HTTP_PUT_RECV))
if (httpPrintf(http, "%x\r\n", length) < 0)
{
sprintf(len, "%x\r\n", length);
if (send(http->fd, len, strlen(len), 0) < 3)
return (-1);
}
if (length == 0)
{
@@ -802,7 +746,6 @@ httpWrite(http_t *http, /* I - HTTP data */
if (bytes < 0)
{
DEBUG_puts("httpWrite: error writing data...\n");
return (-1);
}
@@ -813,12 +756,6 @@ httpWrite(http_t *http, /* I - HTTP data */
http->data_remaining -= bytes;
}
if (http->data_encoding == HTTP_ENCODE_CHUNKED &&
(http->state == HTTP_GET_SEND || http->state == HTTP_POST_RECV ||
http->state == HTTP_POST_SEND || http->state == HTTP_PUT_RECV))
if (httpPrintf(http, "\r\n") < 0)
return (-1);
if (http->data_remaining == 0 && http->data_encoding == HTTP_ENCODE_LENGTH)
{
/*
@@ -861,8 +798,6 @@ httpGets(char *line, /* I - Line to read into */
* Pre-scan the buffer and see if there is a newline in there...
*/
errno = 0;
do
{
bufptr = http->buffer;
@@ -880,36 +815,23 @@ httpGets(char *line, /* I - Line to read into */
* No newline; see if there is more data to be read...
*/
if ((bytes = recv(http->fd, bufend, HTTP_MAX_BUFFER - http->used, 0)) < 0)
if ((bytes = recv(http->fd, bufend, HTTP_MAX_BUFFER - http->used, 0)) < 1)
{
/*
* Nope, can't get a line this time...
*/
if (errno != http->error)
{
http->error = errno;
continue;
}
DEBUG_printf(("httpGets(): recv() error %d!\n", errno));
return (NULL);
}
else if (bytes == 0)
else
{
if (http->blocking)
http->error = EPIPE;
/*
* Yup, update the amount used and the end pointer...
*/
return (NULL);
http->used += bytes;
bufend += bytes;
}
/*
* Yup, update the amount used and the end pointer...
*/
http->used += bytes;
bufend += bytes;
}
}
while (bufptr >= bufend);
@@ -937,7 +859,6 @@ httpGets(char *line, /* I - Line to read into */
if (http->used > 0)
memcpy(http->buffer, bufptr, http->used);
DEBUG_printf(("httpGets(): Returning \"%s\"\n", line));
return (line);
}
else if (*bufptr == 0x0d)
@@ -946,8 +867,6 @@ httpGets(char *line, /* I - Line to read into */
*lineptr++ = *bufptr++;
}
DEBUG_puts("httpGets(): No new line available!");
return (NULL);
}
@@ -961,11 +880,8 @@ httpPrintf(http_t *http, /* I - HTTP data */
const char *format, /* I - printf-style format string */
...) /* I - Additional args as needed */
{
int bytes, /* Number of bytes to write */
nbytes, /* Number of bytes written */
tbytes; /* Number of bytes all together */
char buf[HTTP_MAX_BUFFER], /* Buffer for formatted string */
*bufptr; /* Pointer into buffer */
int bytes; /* Number of bytes to write */
char buf[HTTP_MAX_BUFFER]; /* Buffer for formatted string */
va_list ap; /* Variable argument pointer */
@@ -975,11 +891,7 @@ httpPrintf(http_t *http, /* I - HTTP data */
DEBUG_printf(("httpPrintf: %s", buf));
for (tbytes = 0, bufptr = buf; tbytes < bytes; tbytes += nbytes, bufptr += nbytes)
if ((nbytes = send(http->fd, bufptr, bytes - tbytes, 0)) < 0)
return (-1);
return (bytes);
return (send(http->fd, buf, bytes, 0));
}
@@ -1185,7 +1097,7 @@ httpUpdate(http_t *http) /* I - HTTP data */
* See if there was an error...
*/
if (http->error)
if (errno)
return (HTTP_ERROR);
/*
@@ -1430,8 +1342,6 @@ http_send(http_t *http, /* I - HTTP data */
if (request == HTTP_POST || request == HTTP_PUT)
http->state ++;
http->status = HTTP_CONTINUE;
if (httpPrintf(http, "%s %s HTTP/1.1\r\n", codes[request], buf) < 1)
{
/*
-3
Ver Arquivo
@@ -221,7 +221,6 @@ typedef struct
{
int fd; /* File descriptor for this socket */
int blocking; /* To block or not to block */
int error; /* Last error on read */
time_t activity; /* Time since last read/write */
http_state_t state; /* State of client */
http_status_t status; /* Status of last request */
@@ -246,13 +245,11 @@ typedef struct
*/
# define httpBlocking(http,b) (http)->blocking = (b)
extern int httpCheck(http_t *http);
# define httpClearFields(http) memset((http)->fields, 0, sizeof((http)->fields)),\
httpSetField((http), HTTP_FIELD_HOST, (http)->hostname)
extern void httpClose(http_t *http);
extern http_t *httpConnect(const char *host, int port);
extern int httpDelete(http_t *http, const char *uri);
# define httpError(http) ((http)->error)
extern void httpFlush(http_t *http);
extern int httpGet(http_t *http, const char *uri);
extern char *httpGets(char *line, int length, http_t *http);
+17 -17
Ver Arquivo
@@ -65,7 +65,7 @@
*/
static ipp_attribute_t *add_attr(ipp_t *ipp, int num_values);
static int ipp_read(http_t *http, unsigned char *buffer, int length);
static int ipp_read(http_t *http, char *buffer, int length);
/*
@@ -725,7 +725,7 @@ ippRead(http_t *http, /* I - HTTP data */
ipp_t *ipp) /* I - IPP data */
{
int n; /* Length of data */
unsigned char buffer[8192]; /* Data buffer */
char buffer[8192]; /* Data buffer */
ipp_attribute_t *attr; /* Current attribute */
ipp_tag_t tag; /* Current tag */
@@ -867,7 +867,7 @@ ippRead(http_t *http, /* I - HTTP data */
attr->group_tag = ipp->curtag;
attr->value_tag = tag;
attr->name = strdup((char *)buffer);
attr->name = strdup(buffer);
attr->num_values = 0;
}
@@ -913,7 +913,7 @@ ippRead(http_t *http, /* I - HTTP data */
buffer[n] = '\0';
DEBUG_printf(("ippRead: value = \'%s\'\n", buffer));
attr->values[attr->num_values].string.text = strdup((char *)buffer);
attr->values[attr->num_values].string.text = strdup(buffer);
break;
case IPP_TAG_DATE :
if (ipp_read(http, buffer, 11) < 11)
@@ -952,7 +952,7 @@ ippRead(http_t *http, /* I - HTTP data */
buffer[n] = '\0';
attr->values[attr->num_values].string.charset = strdup((char *)buffer);
attr->values[attr->num_values].string.charset = strdup(buffer);
if (ipp_read(http, buffer, 2) < 2)
return (IPP_ERROR);
@@ -964,7 +964,7 @@ ippRead(http_t *http, /* I - HTTP data */
buffer[n] = '\0';
attr->values[attr->num_values].string.text = strdup((char *)buffer);
attr->values[attr->num_values].string.text = strdup(buffer);
break;
}
@@ -1044,7 +1044,7 @@ ippWrite(http_t *http, /* I - HTTP data */
{
int i; /* Looping var */
int n; /* Length of data */
unsigned char buffer[8192], /* Data buffer */
char buffer[8192], /* Data buffer */
*bufptr; /* Pointer into buffer */
ipp_attribute_t *attr; /* Current attribute */
@@ -1073,7 +1073,7 @@ ippWrite(http_t *http, /* I - HTTP data */
*bufptr++ = ipp->request.any.request_id >> 8;
*bufptr++ = ipp->request.any.request_id;
if (httpWrite(http, (char *)buffer, bufptr - buffer) < 0)
if (httpWrite(http, buffer, bufptr - buffer) < 0)
{
DEBUG_puts("ippWrite: Could not write IPP header...");
return (IPP_ERROR);
@@ -1329,7 +1329,7 @@ ippWrite(http_t *http, /* I - HTTP data */
* Write the data out...
*/
if (httpWrite(http, (char *)buffer, bufptr - buffer) < 0)
if (httpWrite(http, buffer, bufptr - buffer) < 0)
{
DEBUG_puts("ippWrite: Could not write IPP attribute...");
return (IPP_ERROR);
@@ -1352,7 +1352,7 @@ ippWrite(http_t *http, /* I - HTTP data */
*/
buffer[0] = IPP_TAG_END;
if (httpWrite(http, (char *)buffer, 1) < 0)
if (httpWrite(http, buffer, 1) < 0)
{
DEBUG_puts("ippWrite: Could not write IPP end-tag...");
return (IPP_ERROR);
@@ -1429,13 +1429,13 @@ add_attr(ipp_t *ipp, /* I - IPP request */
* 'ipp_read()' - Semi-blocking read on a HTTP connection...
*/
static int /* O - Number of bytes read */
ipp_read(http_t *http, /* I - Client connection */
unsigned char *buffer, /* O - Buffer for data */
int length) /* I - Total length */
static int /* O - Number of bytes read */
ipp_read(http_t *http, /* I - Client connection */
char *buffer,/* O - Buffer for data */
int length) /* I - Total length */
{
int tbytes, /* Total bytes read */
bytes; /* Bytes read this pass */
int tbytes, /* Total bytes read */
bytes; /* Bytes read this pass */
/*
@@ -1443,7 +1443,7 @@ ipp_read(http_t *http, /* I - Client connection */
*/
for (tbytes = 0; tbytes < length; tbytes += bytes, buffer += bytes)
if ((bytes = httpRead(http, (char *)buffer, length - tbytes)) <= 0)
if ((bytes = httpRead(http, buffer, length - tbytes)) <= 0)
break;
/*
+1 -2
Ver Arquivo
@@ -149,8 +149,7 @@ cupsLangGet(const char *language) /* I - Language or locale */
* operating systems.
*/
if (language == NULL || language[0] == '\0' ||
strcmp(language, "POSIX") == 0)
if (language == NULL || language[0] == '\0')
strcpy(langname, "C");
else
strcpy(langname, language);
+1 -6
Ver Arquivo
@@ -177,12 +177,7 @@ typedef struct cups_lang_str /**** Language Cache Structure ****/
* Prototypes...
*/
# ifdef WIN32
# define cupsLangDefault() cupsLangGet(setlocale(LC_ALL, ""))
# else /* This fix works around bugs in the Linux and HP-UX setlocale() */
# define cupsLangDefault() cupsLangGet(getenv("LANG"))
# endif /* WIN32 */
# define cupsLangDefault() cupsLangGet(setlocale(LC_ALL, ""))
extern char *cupsLangEncoding(cups_lang_t *lang);
extern void cupsLangFlush(void);
extern void cupsLangFree(cups_lang_t *lang);
+34 -6
Ver Arquivo
@@ -33,6 +33,7 @@
* ppdMarkDefaults() - Mark all default options in the PPD file.
* ppdMarkOption() - Mark an option in a PPD file.
* ppd_defaults() - Set the defaults for this group and all sub-groups.
* ppd_default() - Set the default choice for an option.
*/
/*
@@ -47,7 +48,8 @@
* Local functions...
*/
static void ppd_defaults(ppd_file_t *ppd, ppd_group_t *g);
static void ppd_defaults(ppd_group_t *g);
static void ppd_default(ppd_option_t *o);
/*
@@ -294,7 +296,12 @@ ppdMarkDefaults(ppd_file_t *ppd)/* I - PPD file record */
return;
for (i = ppd->num_groups, g = ppd->groups; i > 0; i --, g ++)
ppd_defaults(ppd, g);
ppd_defaults(g);
o = ppdFindOption(ppd, "PageSize");
for (i = 0; i < ppd->num_sizes; i ++)
ppd->sizes[i].marked = strcmp(ppd->sizes[i].name, o->defchoice) == 0;
}
@@ -387,8 +394,7 @@ ppdMarkOption(ppd_file_t *ppd, /* I - PPD file record */
*/
static void
ppd_defaults(ppd_file_t *ppd, /* I - PPD file */
ppd_group_t *g) /* I - Group to default */
ppd_defaults(ppd_group_t *g) /* I - Group to default */
{
int i; /* Looping var */
ppd_option_t *o; /* Current option */
@@ -400,10 +406,32 @@ ppd_defaults(ppd_file_t *ppd, /* I - PPD file */
for (i = g->num_options, o = g->options; i > 0; i --, o ++)
if (strcmp(o->keyword, "PageRegion") != 0)
ppdMarkOption(ppd, o->keyword, o->defchoice);
ppd_default(o);
for (i = g->num_subgroups, sg = g->subgroups; i > 0; i --, sg ++)
ppd_defaults(ppd, sg);
ppd_defaults(sg);
}
/*
* 'ppd_default()' - Set the default choice for an option.
*/
static void
ppd_default(ppd_option_t *o) /* I - Option to default */
{
int i; /* Looping var */
ppd_choice_t *c; /* Current choice */
if (o == NULL)
return;
for (i = o->num_choices, c = o->choices; i > 0; i --, c ++)
if (strcmp(c->choice, o->defchoice) == 0)
c->marked = 1;
else
c->marked = 0;
}
-2
Ver Arquivo
@@ -456,8 +456,6 @@ ppdOpen(FILE *fp) /* I - File to read from */
return (NULL);
}
DEBUG_printf(("ppdOpen: keyword = %s, string = %08x\n", keyword, string));
safe_free(string);
/*
+12 -59
Ver Arquivo
@@ -217,10 +217,8 @@ cupsDoFileRequest(http_t *http, /* I - HTTP connection to server */
DEBUG_puts("cupsDoFileRequest: post...");
if (httpPost(http, resource))
{
httpReconnect(http);
continue;
}
if (httpPost(http, resource))
break;
/*
* Send the IPP data and wait for the response...
@@ -502,6 +500,7 @@ cupsGetPPD(const char *name) /* I - Printer name */
resource[HTTP_MAX_URI]; /* Resource name */
static char filename[HTTP_MAX_URI]; /* Local filename */
char *tempdir; /* Temporary file directory */
struct stat fileinfo; /* File information */
/*
@@ -517,29 +516,33 @@ cupsGetPPD(const char *name) /* I - Printer name */
#if defined(WIN32) || defined(__EMX__)
tempdir = "C:/WINDOWS/TEMP";
sprintf(filename, "%s/%s.ppd", tempdir, printer);
#else
if ((tempdir = getenv("TMPDIR")) == NULL)
tempdir = "/tmp";
sprintf(filename, "%s/%d.%s.ppd", tempdir, getuid(), printer);
#endif /* WIN32 || __EMX__ */
sprintf(filename, "%s/%s.ppd", tempdir, printer);
if (stat(filename, &fileinfo))
memset(&fileinfo, 0, sizeof(fileinfo));
/*
* And send a request to the HTTP server...
* And send a request to the HTTP server using "if-modified-since"...
*/
sprintf(resource, "/printers/%s.ppd", printer);
httpClearFields(cups_server);
httpSetField(cups_server, HTTP_FIELD_HOST, hostname);
httpSetField(cups_server, HTTP_FIELD_IF_MODIFIED_SINCE,
httpGetDateString(fileinfo.st_mtime));
httpGet(cups_server, resource);
switch (httpUpdate(cups_server))
{
case HTTP_OK : /* New file - get it! */
break;
case HTTP_NOT_MODIFIED : /* File hasn't been modified; use the current copy */
return (filename);
default :
return (NULL);
}
@@ -885,56 +888,6 @@ cupsPrintFile(const char *name, /* I - Printer or class name */
}
/*
* 'cupsTempFile()' - Generate a temporary filename.
*/
char * /* O - Filename */
cupsTempFile(char *filename, /* I - Pointer to buffer */
int len) /* I - Size of buffer */
{
char *tmpdir; /* TMPDIR environment var */
static char buf[1024] = ""; /* Buffer if you pass in NULL and 0 */
/*
* See if a filename was specified...
*/
if (filename == NULL)
{
filename = buf;
len = sizeof(buf);
}
/*
* See if TMPDIR is defined...
*/
if ((tmpdir = getenv("TMPDIR")) == NULL)
tmpdir = "/var/tmp";
if ((strlen(tmpdir) + 8) > len)
{
/*
* The specified directory exceeds the size of the buffer; default it...
*/
strcpy(buf, "/var/tmp/XXXXXX");
return (mktemp(buf));
}
else
{
/*
* Make the temporary name using the specified directory...
*/
sprintf(filename, "%s/XXXXXX", tmpdir);
return (mktemp(filename));
}
}
/*
* 'cups_connect()' - Connect to the specified host...
*/
+35 -35
Ver Arquivo
@@ -84,9 +84,9 @@ static void zshear(float [3][3], float, float);
*/
void
ImageWhiteToWhite(const ib_t *in, /* I - Input pixels */
ib_t *out, /* I - Output pixels */
int count) /* I - Number of pixels */
ImageWhiteToWhite(ib_t *in, /* I - Input pixels */
ib_t *out, /* I - Output pixels */
int count) /* I - Number of pixels */
{
if (ImageHaveProfile)
while (count > 0)
@@ -104,9 +104,9 @@ ImageWhiteToWhite(const ib_t *in, /* I - Input pixels */
*/
void
ImageWhiteToRGB(const ib_t *in, /* I - Input pixels */
ib_t *out, /* I - Output pixels */
int count) /* I - Number of pixels */
ImageWhiteToRGB(ib_t *in, /* I - Input pixels */
ib_t *out, /* I - Output pixels */
int count) /* I - Number of pixels */
{
if (ImageHaveProfile)
while (count > 0)
@@ -133,9 +133,9 @@ ImageWhiteToRGB(const ib_t *in, /* I - Input pixels */
*/
void
ImageWhiteToBlack(const ib_t *in, /* I - Input pixels */
ib_t *out, /* I - Output pixels */
int count) /* I - Number of pixels */
ImageWhiteToBlack(ib_t *in, /* I - Input pixels */
ib_t *out, /* I - Output pixels */
int count) /* I - Number of pixels */
{
if (ImageHaveProfile)
while (count > 0)
@@ -157,9 +157,9 @@ ImageWhiteToBlack(const ib_t *in, /* I - Input pixels */
*/
void
ImageWhiteToCMY(const ib_t *in, /* I - Input pixels */
ib_t *out, /* I - Output pixels */
int count) /* I - Number of pixels */
ImageWhiteToCMY(ib_t *in, /* I - Input pixels */
ib_t *out, /* I - Output pixels */
int count) /* I - Number of pixels */
{
if (ImageHaveProfile)
while (count > 0)
@@ -186,9 +186,9 @@ ImageWhiteToCMY(const ib_t *in, /* I - Input pixels */
*/
void
ImageWhiteToCMYK(const ib_t *in, /* I - Input pixels */
ib_t *out, /* I - Output pixels */
int count) /* I - Number of pixels */
ImageWhiteToCMYK(ib_t *in, /* I - Input pixels */
ib_t *out, /* I - Output pixels */
int count) /* I - Number of pixels */
{
if (ImageHaveProfile)
while (count > 0)
@@ -216,9 +216,9 @@ ImageWhiteToCMYK(const ib_t *in, /* I - Input pixels */
*/
void
ImageRGBToBlack(const ib_t *in, /* I - Input pixels */
ib_t *out, /* I - Output pixels */
int count) /* I - Number of pixels */
ImageRGBToBlack(ib_t *in, /* I - Input pixels */
ib_t *out, /* I - Output pixels */
int count) /* I - Number of pixels */
{
if (ImageHaveProfile)
while (count > 0)
@@ -242,9 +242,9 @@ ImageRGBToBlack(const ib_t *in, /* I - Input pixels */
*/
void
ImageRGBToCMY(const ib_t *in, /* I - Input pixels */
ib_t *out, /* I - Output pixels */
int count) /* I - Number of pixels */
ImageRGBToCMY(ib_t *in, /* I - Input pixels */
ib_t *out, /* I - Output pixels */
int count) /* I - Number of pixels */
{
int c, m, y, k; /* CMYK values */
int cc, cm, cy; /* Calibrated CMY values */
@@ -316,9 +316,9 @@ ImageRGBToCMY(const ib_t *in, /* I - Input pixels */
*/
void
ImageRGBToCMYK(const ib_t *in, /* I - Input pixels */
ib_t *out, /* I - Output pixels */
int count)/* I - Number of pixels */
ImageRGBToCMYK(ib_t *in, /* I - Input pixels */
ib_t *out, /* I - Output pixels */
int count) /* I - Number of pixels */
{
int c, m, y, k, /* CMYK values */
diff, /* Color differences */
@@ -385,7 +385,7 @@ ImageRGBToCMYK(const ib_t *in, /* I - Input pixels */
else if (cy > 255)
*out++ = ImageDensity[255];
else
*out++ = ImageDensity[cy];
*out++ = cy;
*out++ = ImageDensity[k];
@@ -433,9 +433,9 @@ ImageRGBToCMYK(const ib_t *in, /* I - Input pixels */
*/
void
ImageRGBToWhite(const ib_t *in, /* I - Input pixels */
ib_t *out, /* I - Output pixels */
int count) /* I - Number of pixels */
ImageRGBToWhite(ib_t *in, /* I - Input pixels */
ib_t *out, /* I - Output pixels */
int count) /* I - Number of pixels */
{
if (ImageHaveProfile)
while (count > 0)
@@ -459,9 +459,9 @@ ImageRGBToWhite(const ib_t *in, /* I - Input pixels */
*/
void
ImageRGBToRGB(const ib_t *in, /* I - Input pixels */
ib_t *out, /* I - Output pixels */
int count) /* I - Number of pixels */
ImageRGBToRGB(ib_t *in, /* I - Input pixels */
ib_t *out, /* I - Output pixels */
int count) /* I - Number of pixels */
{
int c, m, y, k; /* CMYK values */
int cr, cg, cb; /* Calibrated RGB values */
@@ -521,9 +521,9 @@ ImageRGBToRGB(const ib_t *in, /* I - Input pixels */
*/
void
ImageLut(ib_t *pixels, /* IO - Input/output pixels */
int count, /* I - Number of pixels/bytes to adjust */
const ib_t *lut) /* I - Lookup table */
ImageLut(ib_t *pixels, /* I - Input/output pixels */
int count, /* I - Number of pixels/bytes to adjust */
ib_t *lut) /* I - Lookup table */
{
while (count > 0)
{
@@ -539,7 +539,7 @@ ImageLut(ib_t *pixels, /* IO - Input/output pixels */
*/
void
ImageRGBAdjust(ib_t *pixels, /* IO - Input/output pixels */
ImageRGBAdjust(ib_t *pixels, /* I - Input/output pixels */
int count, /* I - Number of pixels to adjust */
int saturation, /* I - Color saturation (%) */
int hue) /* I - Color hue (degrees) */
+14 -14
Ver Arquivo
@@ -72,14 +72,14 @@ static int gif_read_image(FILE *fp, image_t *img, gif_cmap_t cmap,
* 'ImageReadGIF()' - Read a GIF image file.
*/
int /* O - Read status */
ImageReadGIF(image_t *img, /* IO - Image */
FILE *fp, /* I - Image file */
int primary, /* I - Primary choice for colorspace */
int secondary, /* I - Secondary choice for colorspace */
int saturation, /* I - Color saturation (%) */
int hue, /* I - Color hue (degrees) */
const ib_t *lut) /* I - Lookup table for gamma/brightness */
int /* O - Read status */
ImageReadGIF(image_t *img, /* IO - Image */
FILE *fp, /* I - Image file */
int primary, /* I - Primary choice for colorspace */
int secondary, /* I - Secondary choice for colorspace */
int saturation,/* I - Color saturation (%) */
int hue, /* I - Color hue (degrees) */
ib_t *lut) /* I - Lookup table for gamma/brightness */
{
unsigned char buf[1024]; /* Input buffer */
gif_cmap_t cmap; /* Colormap */
@@ -236,13 +236,13 @@ ImageReadGIF(image_t *img, /* IO - Image */
* 'gif_read_cmap()' - Read the colormap from a GIF file...
*/
static int /* O - -1 on error, 0 on success */
gif_read_cmap(FILE *fp, /* I - File to read from */
int ncolors, /* I - Number of colors in file */
gif_cmap_t cmap, /* O - Colormap information */
int *gray) /* IO - Is the image grayscale? */
static int
gif_read_cmap(FILE *fp,
int ncolors,
gif_cmap_t cmap,
int *gray)
{
int i; /* Looping var */
int i;
/*
+7 -7
Ver Arquivo
@@ -41,13 +41,13 @@
*/
int /* O - Read status */
ImageReadJPEG(image_t *img, /* IO - Image */
FILE *fp, /* I - Image file */
int primary, /* I - Primary choice for colorspace */
int secondary, /* I - Secondary choice for colorspace */
int saturation, /* I - Color saturation (%) */
int hue, /* I - Color hue (degrees) */
const ib_t *lut) /* I - Lookup table for gamma/brightness */
ImageReadJPEG(image_t *img, /* IO - Image */
FILE *fp, /* I - Image file */
int primary, /* I - Primary choice for colorspace */
int secondary, /* I - Secondary choice for colorspace */
int saturation, /* I - Color saturation (%) */
int hue, /* I - Color hue (degrees) */
ib_t *lut) /* I - Lookup table for gamma/brightness */
{
struct jpeg_decompress_struct cinfo; /* Decompressor info */
struct jpeg_error_mgr jerr; /* Error handler info */
+7 -7
Ver Arquivo
@@ -44,13 +44,13 @@
*/
int /* O - Read status */
ImageReadPhotoCD(image_t *img, /* IO - Image */
FILE *fp, /* I - Image file */
int primary, /* I - Primary choice for colorspace */
int secondary, /* I - Secondary choice for colorspace */
int saturation, /* I - Color saturation (%) */
int hue, /* I - Color hue (degrees) */
const ib_t *lut) /* I - Lookup table for gamma/brightness */
ImageReadPhotoCD(image_t *img, /* IO - Image */
FILE *fp, /* I - Image file */
int primary, /* I - Primary choice for colorspace */
int secondary, /* I - Secondary choice for colorspace */
int saturation, /* I - Color saturation (%) */
int hue, /* I - Color hue (degrees) */
ib_t *lut) /* I - Lookup table for gamma/brightness */
{
int x, y; /* Looping vars */
int xdir, /* X direction */
+8 -8
Ver Arquivo
@@ -40,14 +40,14 @@
* 'ImageReadPNG()' - Read a PNG image file.
*/
int /* O - Read status */
ImageReadPNG(image_t *img, /* IO - Image */
FILE *fp, /* I - Image file */
int primary, /* I - Primary choice for colorspace */
int secondary, /* I - Secondary choice for colorspace */
int saturation, /* I - Color saturation (%) */
int hue, /* I - Color hue (degrees) */
const ib_t *lut) /* I - Lookup table for gamma/brightness */
int /* O - Read status */
ImageReadPNG(image_t *img, /* IO - Image */
FILE *fp, /* I - Image file */
int primary, /* I - Primary choice for colorspace */
int secondary, /* I - Secondary choice for colorspace */
int saturation,/* I - Color saturation (%) */
int hue, /* I - Color hue (degrees) */
ib_t *lut) /* I - Lookup table for gamma/brightness */
{
int y; /* Looping var */
png_structp pp; /* PNG read pointer */
+8 -8
Ver Arquivo
@@ -38,14 +38,14 @@
* 'ImageReadPNM()' - Read a PNM image file.
*/
int /* O - Read status */
ImageReadPNM(image_t *img, /* IO - Image */
FILE *fp, /* I - Image file */
int primary, /* I - Primary choice for colorspace */
int secondary, /* I - Secondary choice for colorspace */
int saturation, /* I - Color saturation (%) */
int hue, /* I - Color hue (degrees) */
const ib_t *lut) /* I - Lookup table for gamma/brightness */
int /* O - Read status */
ImageReadPNM(image_t *img, /* IO - Image */
FILE *fp, /* I - Image file */
int primary, /* I - Primary choice for colorspace */
int secondary, /* I - Secondary choice for colorspace */
int saturation,/* I - Color saturation (%) */
int hue, /* I - Color hue (degrees) */
ib_t *lut) /* I - Lookup table for gamma/brightness */
{
int x, y; /* Looping vars */
int bpp; /* Bytes per pixel */
+8 -8
Ver Arquivo
@@ -38,14 +38,14 @@
* 'ImageReadSGI()' - Read a SGI image file.
*/
int /* O - Read status */
ImageReadSGI(image_t *img, /* IO - Image */
FILE *fp, /* I - Image file */
int primary, /* I - Primary choice for colorspace */
int secondary, /* I - Secondary choice for colorspace */
int saturation, /* I - Color saturation (%) */
int hue, /* I - Color hue (degrees) */
const ib_t *lut) /* I - Lookup table for gamma/brightness */
int /* O - Read status */
ImageReadSGI(image_t *img, /* IO - Image */
FILE *fp, /* I - Image file */
int primary, /* I - Primary choice for colorspace */
int secondary, /* I - Secondary choice for colorspace */
int saturation,/* I - Color saturation (%) */
int hue, /* I - Color hue (degrees) */
ib_t *lut) /* I - Lookup table for gamma/brightness */
{
int i, y; /* Looping vars */
int bpp; /* Bytes per pixel */
+7 -7
Ver Arquivo
@@ -75,13 +75,13 @@ static unsigned read_unsigned(FILE *fp);
*/
int /* O - Read status */
ImageReadSunRaster(image_t *img, /* IO - Image */
FILE *fp, /* I - Image file */
int primary, /* I - Primary choice for colorspace */
int secondary,/* I - Secondary choice for colorspace */
int saturation,/* I - Color saturation (%) */
int hue, /* I - Color hue (degrees) */
const ib_t *lut) /* I - Lookup table for gamma/brightness */
ImageReadSunRaster(image_t *img, /* IO - Image */
FILE *fp, /* I - Image file */
int primary, /* I - Primary choice for colorspace */
int secondary, /* I - Secondary choice for colorspace */
int saturation, /* I - Color saturation (%) */
int hue, /* I - Color hue (degrees) */
ib_t *lut) /* I - Lookup table for gamma/brightness */
{
int i, x, y,
bpp, /* Bytes per pixel */
+10 -8
Ver Arquivo
@@ -42,13 +42,13 @@
*/
int /* O - Read status */
ImageReadTIFF(image_t *img, /* IO - Image */
FILE *fp, /* I - Image file */
int primary, /* I - Primary choice for colorspace */
int secondary, /* I - Secondary choice for colorspace */
int saturation, /* I - Color saturation (%) */
int hue, /* I - Color hue (degrees) */
const ib_t *lut) /* I - Lookup table for gamma/brightness */
ImageReadTIFF(image_t *img, /* IO - Image */
FILE *fp, /* I - Image file */
int primary, /* I - Primary choice for colorspace */
int secondary, /* I - Secondary choice for colorspace */
int saturation, /* I - Color saturation (%) */
int hue, /* I - Color hue (degrees) */
ib_t *lut) /* I - Lookup table for gamma/brightness */
{
TIFF *tif; /* TIFF file */
uint32 width, height; /* Size of image */
@@ -89,7 +89,9 @@ ImageReadTIFF(image_t *img, /* IO - Image */
* Open the TIFF file and get the required parameters...
*/
lseek(fileno(fp), 0, SEEK_SET); /* Work around "feature" in some stdio's */
#ifdef __hpux
lseek(fileno(fp), 0, SEEK_SET); /* Work around "feature" in HP-UX stdio */
#endif /* __hpux */
if ((tif = TIFFFdOpen(fileno(fp), "", "r")) == NULL)
{
+116 -132
Ver Arquivo
@@ -67,12 +67,12 @@ static void flush_tile(image_t *img);
*/
image_t * /* O - New image */
ImageOpen(char *filename, /* I - Filename of image */
int primary, /* I - Primary colorspace needed */
int secondary, /* I - Secondary colorspace if primary no good */
int saturation,/* I - Color saturation level */
int hue, /* I - Color hue adjustment */
const ib_t *lut) /* I - RGB gamma/brightness LUT */
ImageOpen(char *filename, /* I - Filename of image */
int primary, /* I - Primary colorspace needed */
int secondary, /* I - Secondary colorspace if primary no good */
int saturation, /* I - Color saturation level */
int hue, /* I - Color hue adjustment */
ib_t *lut) /* I - RGB gamma/brightness LUT */
{
FILE *fp; /* File pointer */
unsigned char header[16], /* First 16 bytes of file */
@@ -178,46 +178,33 @@ ImageClose(image_t *img) /* I - Image to close */
*next; /* Next cached tile */
/*
* Free the image cache...
*/
for (current = img->first; current != NULL; current = next)
{
next = current->next;
free(current);
}
/*
* Wipe the tile cache file (if any)...
*/
if (img->cachefile != NULL)
{
fprintf(stderr, "DEBUG: Closing and removing swap file \"%s\"...\n",
img->cachename);
fclose(img->cachefile);
unlink(img->cachename);
}
/*
* Free the image cache...
*/
fputs("DEBUG: Freeing memory...\n", stderr);
for (current = img->first; current != NULL; current = next)
{
fprintf(stderr, "DEBUG: Freeing cache (%08lx, next = %08lx)...\n",
current, next);
next = current->next;
free(current);
}
/*
* Free the rest of memory...
*/
if (img->tiles != NULL)
{
fprintf(stderr, "DEBUG: Freeing tiles (%08lx)...\n", img->tiles[0]);
free(img->tiles[0]);
fprintf(stderr, "DEBUG: Freeing tile pointers (%08lx)...\n", img->tiles);
free(img->tiles);
}
@@ -229,7 +216,7 @@ ImageClose(image_t *img) /* I - Image to close */
* 'ImageSetMaxTiles()' - Set the maximum number of tiles to cache.
*
* If the "max_tiles" argument is 0 then the maximum number of tiles is
* computed from the image size or the RIP_CACHE environment variable.
* computed from the image size.
*/
void
@@ -286,7 +273,9 @@ ImageSetMaxTiles(image_t *img, /* I - Image to set */
img->max_ics = max_tiles;
fprintf(stderr, "DEBUG: max_ics=%d...\n", img->max_ics);
#ifdef DEBUG
fprintf(stderr, "ImageSetMaxTiles: max_ics=%d...\n", img->max_ics);
#endif /* DEBUG */
}
@@ -299,19 +288,18 @@ ImageSetProfile(float d, /* I - Ink/marker density */
float g, /* I - Ink/marker gamma */
float matrix[3][3]) /* I - Color transform matrix */
{
int i, j, k; /* Looping vars */
float m; /* Current matrix value */
int *im; /* Pointer into ImageMatrix */
int i, j, k; /* Looping vars */
ImageHaveProfile = 1;
for (i = 0, im = ImageMatrix[0][0]; i < 3; i ++)
for (i = 0; i < 3; i ++)
for (j = 0; j < 3; j ++)
for (k = 0, m = matrix[i][j]; k < 256; k ++)
*im++ = (int)(k * m + 0.5);
for (k = 0; k < 256; k ++)
ImageMatrix[i][j][k] = (int)(k * matrix[i][j] + 0.5);
for (k = 0, im = ImageDensity; k < 256; k ++)
*im++ = 255.0 * d * pow((float)k / 255.0, g) + 0.5;
for (k = 0; k < 256; k ++)
ImageDensity[k] = 255.0 * d * pow((float)k / 255.0, g) + 0.5;
}
@@ -319,17 +307,17 @@ ImageSetProfile(float d, /* I - Ink/marker density */
* 'ImageGetCol()' - Get a column of pixels from an image.
*/
int /* O - -1 on error, 0 on success */
ImageGetCol(image_t *img, /* I - Image */
int x, /* I - Column */
int y, /* I - Start row */
int height, /* I - Column height */
ib_t *pixels) /* O - Pixel data */
int
ImageGetCol(image_t *img,
int x,
int y,
int height,
ib_t *pixels)
{
int bpp, /* Bytes per pixel */
twidth, /* Tile width */
count; /* Number of pixels to get */
const ib_t *ib; /* Pointer into tile */
int bpp,
twidth,
count;
ib_t *ib;
if (img == NULL || x < 0 || x >= img->xsize || y >= img->ysize)
@@ -386,16 +374,16 @@ ImageGetCol(image_t *img, /* I - Image */
* 'ImageGetRow()' - Get a row of pixels from an image.
*/
int /* O - -1 on error, 0 on success */
ImageGetRow(image_t *img, /* I - Image */
int x, /* I - Start column */
int y, /* I - Row */
int width, /* I - Width of row */
ib_t *pixels) /* O - Pixel data */
int
ImageGetRow(image_t *img,
int x,
int y,
int width,
ib_t *pixels)
{
int bpp, /* Bytes per pixel */
count; /* Number of pixels to get */
const ib_t *ib; /* Pointer to pixels */
int bpp,
count;
ib_t *ib;
if (img == NULL || y < 0 || y >= img->ysize || x >= img->xsize)
@@ -439,19 +427,19 @@ ImageGetRow(image_t *img, /* I - Image */
* 'ImagePutCol()' - Put a column of pixels to an image.
*/
int /* O - -1 on error, 0 on success */
ImagePutCol(image_t *img, /* I - Image */
int x, /* I - Column */
int y, /* I - Start row */
int height, /* I - Column height */
const ib_t *pixels) /* I - Pixels to put */
int
ImagePutCol(image_t *img,
int x,
int y,
int height,
ib_t *pixels)
{
int bpp, /* Bytes per pixel */
twidth, /* Width of tile */
count; /* Number of pixels to put */
int tilex, /* Column within tile */
tiley; /* Row within tile */
ib_t *ib; /* Pointer to pixels in tile */
int bpp,
twidth,
count;
int tilex,
tiley;
ib_t *ib;
if (img == NULL || x < 0 || x >= img->xsize || y >= img->ysize)
@@ -513,18 +501,18 @@ ImagePutCol(image_t *img, /* I - Image */
* 'ImagePutRow()' - Put a row of pixels to an image.
*/
int /* O - -1 on error, 0 on success */
ImagePutRow(image_t *img, /* I - Image */
int x, /* I - Start column */
int y, /* I - Row */
int width, /* I - Row width */
const ib_t *pixels) /* I - Pixel data */
int
ImagePutRow(image_t *img,
int x,
int y,
int width,
ib_t *pixels)
{
int bpp, /* Bytes per pixel */
count; /* Number of pixels to put */
int tilex, /* Column within tile */
tiley; /* Row within tile */
ib_t *ib; /* Pointer to pixels in tile */
int bpp,
count;
int tilex,
tiley;
ib_t *ib;
if (img == NULL || y < 0 || y >= img->ysize || x >= img->xsize)
@@ -573,33 +561,28 @@ ImagePutRow(image_t *img, /* I - Image */
* 'get_tile()' - Get a cached tile.
*/
static ib_t * /* O - Pointer to tile or NULL */
get_tile(image_t *img, /* I - Image */
int x, /* I - Column in image */
int y) /* I - Row in image */
static ib_t *
get_tile(image_t *img,
int x,
int y)
{
int bpp, /* Bytes per pixel */
tilex, /* Column within tile */
tiley, /* Row within tile */
xtiles, /* Number of tiles horizontally */
ytiles; /* Number of tiles vertically */
ic_t *ic; /* Cache pointer */
itile_t *tile; /* Tile pointer */
int bpp,
tilex,
tiley,
xtiles,
ytiles;
ic_t *ic;
itile_t *tile;
if (x >= img->xsize || y >= img->ysize)
{
fprintf(stderr, "ERROR: Internal image RIP error - %d,%d is outside of %dx%d\n",
x, y, img->xsize, img->ysize);
return (NULL);
}
if (img->tiles == NULL)
{
xtiles = (img->xsize + TILE_SIZE - 1) / TILE_SIZE;
ytiles = (img->ysize + TILE_SIZE - 1) / TILE_SIZE;
fprintf(stderr, "DEBUG: Creating tile array (%dx%d)\n", xtiles, ytiles);
#ifdef DEBUG
fprintf(stderr, "get_tile: Creating tile array (%dx%d)\n", xtiles, ytiles);
#endif /* DEBUG */
img->tiles = calloc(sizeof(itile_t *), ytiles);
tile = calloc(sizeof(itile_t), xtiles * ytiles);
@@ -624,18 +607,20 @@ get_tile(image_t *img, /* I - Image */
{
if (img->num_ics < img->max_ics)
{
#ifdef DEBUG
fputs("get_tile: Allocating new cache tile...\n", stderr);
#endif /* DEBUG */
ic = calloc(sizeof(ic_t) + bpp * TILE_SIZE * TILE_SIZE, 1);
ic->pixels = ((ib_t *)ic) + sizeof(ic_t);
img->num_ics ++;
fprintf(stderr, "DEBUG: Allocated cache tile %d (%08lx)...\n",
img->num_ics, ic);
}
else
{
fprintf(stderr, "DEBUG: Flushing old cache tile (%08lx)...\n",
img->first);
#ifdef DEBUG
fputs("get_tile: Flushing old cache tile...\n", stderr);
#endif /* DEBUG */
flush_tile(img);
ic = img->first;
@@ -646,8 +631,10 @@ get_tile(image_t *img, /* I - Image */
if (tile->pos >= 0)
{
fprintf(stderr, "DEBUG: Loading cache tile from file position %d...\n",
#ifdef DEBUG
fprintf(stderr, "get_tile: loading cache tile from file position %d...\n",
tile->pos);
#endif /* DEBUG */
if (ftell(img->cachefile) != tile->pos)
if (fseek(img->cachefile, tile->pos, SEEK_SET))
@@ -657,7 +644,9 @@ get_tile(image_t *img, /* I - Image */
}
else
{
fputs("DEBUG: Clearing cache tile...\n", stderr);
#ifdef DEBUG
fputs("get_tile: Clearing cache tile...\n", stderr);
#endif /* DEBUG */
memset(ic->pixels, 0, bpp * TILE_SIZE * TILE_SIZE);
}
@@ -688,13 +677,17 @@ get_tile(image_t *img, /* I - Image */
*/
static void
flush_tile(image_t *img) /* I - Image */
flush_tile(image_t *img)
{
int bpp; /* Bytes per pixel */
itile_t *tile; /* Pointer to tile */
int bpp;
itile_t *tile;
#ifdef DEBUG
fprintf(stderr, "flush_tile(%08x)...\n", img);
#endif /* DEBUG */
bpp = ImageGetDepth(img);
tile = img->first->tile;
@@ -706,15 +699,16 @@ flush_tile(image_t *img) /* I - Image */
if (img->cachefile == NULL)
{
cupsTempFile(img->cachename, sizeof(img->cachename));
tmpnam(img->cachename);
fprintf(stderr, "DEBUG: Creating swap file \"%s\"...\n", img->cachename);
#ifdef DEBUG
fprintf(stderr, "flush_tile: Creating cache file %s...\n", img->cachename);
#endif /* DEBUG */
if ((img->cachefile = fopen(img->cachename, "wb+")) == NULL)
{
perror("ERROR: Unable to create image swap file");
tile->ic = NULL;
tile->dirty = 0;
fprintf(stderr, "flush_tile: Unable to create swap file - %s\n",
strerror(errno));
return;
}
}
@@ -723,32 +717,22 @@ flush_tile(image_t *img) /* I - Image */
{
if (ftell(img->cachefile) != tile->pos)
if (fseek(img->cachefile, tile->pos, SEEK_SET))
{
perror("ERROR: Unable to seek in swap file");
tile->ic = NULL;
tile->dirty = 0;
return;
}
perror("flush_tile:");
}
else
{
if (fseek(img->cachefile, 0, SEEK_END))
{
perror("ERROR: Unable to append to swap file");
tile->ic = NULL;
tile->dirty = 0;
return;
}
perror("flush_tile:");
tile->pos = ftell(img->cachefile);
}
#ifdef DEBUG
fprintf(stderr, "flush_tile: Wrote tile cache at position %d...\n",
tile->pos);
#endif /* DEBUG */
if (fwrite(tile->ic->pixels, bpp, TILE_SIZE * TILE_SIZE, img->cachefile) < 1)
perror("ERROR: Unable to write tile to swap file");
else
fprintf(stderr, "DEBUG: Wrote tile at position %d...\n", tile->pos);
fwrite(tile->ic->pixels, bpp, TILE_SIZE * TILE_SIZE, img->cachefile);
tile->ic = NULL;
tile->dirty = 0;
}
+22 -24
Ver Arquivo
@@ -153,7 +153,7 @@ typedef struct
*/
extern image_t *ImageOpen(char *filename, int primary, int secondary,
int saturation, int hue, const ib_t *lut);
int saturation, int hue, ib_t *lut);
extern void ImageClose(image_t *img);
extern void ImageSetMaxTiles(image_t *img, int max_tiles);
extern void ImageSetProfile(float d, float g, float matrix[3][3]);
@@ -161,51 +161,49 @@ extern void ImageSetProfile(float d, float g, float matrix[3][3]);
#define ImageGetDepth(img) ((img)->colorspace < 0 ? -(img)->colorspace : (img)->colorspace)
extern int ImageGetCol(image_t *img, int x, int y, int height, ib_t *pixels);
extern int ImageGetRow(image_t *img, int x, int y, int width, ib_t *pixels);
extern int ImagePutCol(image_t *img, int x, int y, int height, const ib_t *pixels);
extern int ImagePutRow(image_t *img, int x, int y, int width, const ib_t *pixels);
extern int ImagePutCol(image_t *img, int x, int y, int height, ib_t *pixels);
extern int ImagePutRow(image_t *img, int x, int y, int width, ib_t *pixels);
/*
* File formats...
*/
extern int ImageReadGIF(image_t *img, FILE *fp, int primary, int secondary,
int saturation, int hue, const ib_t *lut);
int saturation, int hue, ib_t *lut);
extern int ImageReadJPEG(image_t *img, FILE *fp, int primary, int secondary,
int saturation, int hue, const ib_t *lut);
int saturation, int hue, ib_t *lut);
extern int ImageReadPNG(image_t *img, FILE *fp, int primary, int secondary,
int saturation, int hue, const ib_t *lut);
int saturation, int hue, ib_t *lut);
extern int ImageReadPNM(image_t *img, FILE *fp, int primary, int secondary,
int saturation, int hue, const ib_t *lut);
int saturation, int hue, ib_t *lut);
extern int ImageReadPhotoCD(image_t *img, FILE *fp, int primary,
int secondary, int saturation, int hue,
const ib_t *lut);
int secondary, int saturation, int hue, ib_t *lut);
extern int ImageReadSGI(image_t *img, FILE *fp, int primary, int secondary,
int saturation, int hue, const ib_t *lut);
int saturation, int hue, ib_t *lut);
extern int ImageReadSunRaster(image_t *img, FILE *fp, int primary,
int secondary, int saturation, int hue,
const ib_t *lut);
int secondary, int saturation, int hue, ib_t *lut);
extern int ImageReadTIFF(image_t *img, FILE *fp, int primary, int secondary,
int saturation, int hue, const ib_t *lut);
int saturation, int hue, ib_t *lut);
/*
* Colorspace conversions...
*/
extern void ImageWhiteToWhite(const ib_t *in, ib_t *out, int count);
extern void ImageWhiteToRGB(const ib_t *in, ib_t *out, int count);
extern void ImageWhiteToBlack(const ib_t *in, ib_t *out, int count);
extern void ImageWhiteToCMY(const ib_t *in, ib_t *out, int count);
extern void ImageWhiteToCMYK(const ib_t *in, ib_t *out, int count);
extern void ImageWhiteToWhite(ib_t *in, ib_t *out, int count);
extern void ImageWhiteToRGB(ib_t *in, ib_t *out, int count);
extern void ImageWhiteToBlack(ib_t *in, ib_t *out, int count);
extern void ImageWhiteToCMY(ib_t *in, ib_t *out, int count);
extern void ImageWhiteToCMYK(ib_t *in, ib_t *out, int count);
extern void ImageRGBToWhite(const ib_t *in, ib_t *out, int count);
extern void ImageRGBToRGB(const ib_t *in, ib_t *out, int count);
extern void ImageRGBToBlack(const ib_t *in, ib_t *out, int count);
extern void ImageRGBToCMY(const ib_t *in, ib_t *out, int count);
extern void ImageRGBToCMYK(const ib_t *in, ib_t *out, int count);
extern void ImageRGBToWhite(ib_t *in, ib_t *out, int count);
extern void ImageRGBToRGB(ib_t *in, ib_t *out, int count);
extern void ImageRGBToBlack(ib_t *in, ib_t *out, int count);
extern void ImageRGBToCMY(ib_t *in, ib_t *out, int count);
extern void ImageRGBToCMYK(ib_t *in, ib_t *out, int count);
extern void ImageRGBAdjust(ib_t *pixels, int count, int saturation, int hue);
extern void ImageLut(ib_t *pixels, int count, const ib_t *lut);
extern void ImageLut(ib_t *pixels, int count, ib_t *lut);
/*
* Image scaling operations...
+1 -6
Ver Arquivo
@@ -91,7 +91,6 @@ main(int argc, /* I - Number of command-line arguments */
float zoom; /* Zoom facter */
int ppi; /* Pixels-per-inch */
int hue, sat; /* Hue and saturation adjustment */
int realcopies; /* Real copies being printed */
if (argc != 7)
@@ -259,11 +258,8 @@ main(int argc, /* I - Number of command-line arguments */
if (Copies > 1 && !slowcollate)
{
printf("/#copies %d def\n", Copies);
realcopies = Copies;
Copies = 1;
Copies = 1;
}
else
realcopies = 1;
/*
* Output the pages...
@@ -277,7 +273,6 @@ main(int argc, /* I - Number of command-line arguments */
for (xpage = 0; xpage < xpages; xpage ++)
for (ypage = 0; ypage < ypages; ypage ++, page ++)
{
fprintf(stderr, "PAGE: %d %d\n", page, realcopies);
fprintf(stderr, "INFO: Printing page %d...\n", page);
ppdEmit(ppd, stdout, PPD_ORDER_PAGE);
+5 -17
Ver Arquivo
@@ -296,7 +296,7 @@ main(int argc, /* I - Number of command-line arguments */
resolution = "";
/*
* Choose the appropriate colorspace...
* Choose the appropriate colorspace and color profile...
*/
switch (header.cupsColorSpace)
@@ -388,32 +388,22 @@ main(int argc, /* I - Number of command-line arguments */
if (ppd != NULL)
{
fprintf(stderr, "DEBUG: Searching for profile \"%s/%s\"...\n",
resolution, media_type);
for (i = 0, profile = ppd->profiles; i < ppd->num_profiles; i ++, profile ++)
{
fprintf(stderr, "DEBUG: \"%s/%s\" = ", profile->resolution,
profile->media_type);
if ((strcmp(profile->resolution, resolution) == 0 ||
profile->resolution[0] == '-') &&
(strcmp(profile->media_type, media_type) == 0 ||
profile->media_type[0] == '-'))
{
fputs("MATCH!\n", stderr);
break;
}
else
fputs("no.\n", stderr);
}
/*
* If we found a color profile, use it!
*/
if (i < ppd->num_profiles)
{
fputs("Setting color profile!\n", stderr);
ImageSetProfile(profile->density, profile->gamma, profile->matrix);
}
}
/*
@@ -564,8 +554,6 @@ main(int argc, /* I - Number of command-line arguments */
Copies = 1;
}
else
header.NumCopies = 1;
/*
* Create the dithering lookup tables...
@@ -609,7 +597,7 @@ main(int argc, /* I - Number of command-line arguments */
fprintf(stderr, "DEBUG: cupsColorSpace = %d\n", header.cupsColorSpace);
fprintf(stderr, "DEBUG: img->colorspace = %d\n", img->colorspace);
row = malloc(2 * header.cupsBytesPerLine);
row = malloc(header.cupsBytesPerLine);
ras = cupsRasterOpen(1, CUPS_RASTER_WRITE);
blank = img->colorspace < 0 ? 0 : ~0;
+1 -1
Ver Arquivo
@@ -205,7 +205,7 @@ main(int argc, /* I - Number of command-line arguments */
if (sloworder || slowcollate)
{
temp = fopen(cupsTempFile(tempfile, sizeof(tempfile)), "wb+");
temp = fopen(tmpnam(tempfile), "wb+");
if (temp == NULL)
slowcollate = sloworder = 0;
+11 -14
Ver Arquivo
@@ -193,17 +193,6 @@ TextMain(char *name, /* I - Name of filter */
options = NULL;
num_options = cupsParseOptions(argv[5], 0, &options);
if ((val = cupsGetOption("prettyprint", num_options, options)) != NULL)
{
PrettyPrint = 1;
PageLeft = 72.0f;
PageRight = PageWidth - 36.0f;
PageBottom = PageBottom > 36.0f ? PageBottom : 36.0f;
PageTop = PageLength - 36.0f;
CharsPerInch = 12;
LinesPerInch = 8;
}
if ((ppd = SetCommonOptions(num_options, options, 1)) != NULL)
ppdClose(ppd);
@@ -212,15 +201,23 @@ TextMain(char *name, /* I - Name of filter */
if ((val = cupsGetOption("columns", num_options, options)) != NULL)
PageColumns = atoi(val);
if ((val = cupsGetOption("prettyprint", num_options, options)) != NULL)
{
PrettyPrint = 1;
PageLeft = 72.0f;
PageRight = PageWidth - 36.0f;
PageBottom = PageBottom > 36.0f ? PageBottom : 36.0f;
PageTop = PageLength - 36.0f - 216.0f / LinesPerInch;
CharsPerInch = 12;
LinesPerInch = 8;
}
if ((val = cupsGetOption("cpi", num_options, options)) != NULL)
CharsPerInch = atoi(val);
if ((val = cupsGetOption("lpi", num_options, options)) != NULL)
LinesPerInch = atoi(val);
if ((val = cupsGetOption("prettyprint", num_options, options)) != NULL)
PageTop -= 216.0f / LinesPerInch;
Copies = atoi(argv[4]);
WriteProlog(argv[3], argv[2], ppd);
+8 -10
Ver Arquivo
@@ -343,36 +343,34 @@ WriteProlog(char *title, /* I - Title of job */
{
puts("\tdup 2 mod 0 eq {");
printf("\t\tT stringwidth pop neg %.1f add %.1f } {\n",
PageRight - PageLeft - 36.0f / LinesPerInch,
(0.5f + 0.157f) * 72.0f / LinesPerInch);
PageRight - PageLeft - 36.0f / LinesPerInch, 54.0f / LinesPerInch);
printf("\t\t%.1f %.1f } ifelse\n", 36.0f / LinesPerInch,
(0.5f + 0.157f) * 72.0f / LinesPerInch);
54.0f / LinesPerInch);
}
else
printf("\t%.1f %.1f\n", 36.0f / LinesPerInch,
(0.5f + 0.157f) * 72.0f / LinesPerInch);
54.0f / LinesPerInch);
puts("\tmoveto T show");
printf("\t(%s)\n", curdate);
printf("\tdup stringwidth pop neg 2 div %.1f add %.1f\n",
(PageRight - PageLeft) * 0.5,
(0.5f + 0.157f) * 72.0f / LinesPerInch);
(PageRight - PageLeft) * 0.5, 54.0f / LinesPerInch);
puts("\tmoveto show");
if (Duplex)
{
puts("\tdup P cvs exch 2 mod 0 eq {");
printf("\t\t%.1f %.1f } {\n", 36.0f / LinesPerInch,
(0.5f + 0.157f) * 72.0f / LinesPerInch);
54.0f / LinesPerInch);
printf("\t\tdup stringwidth pop neg %.1f add %.1f } ifelse\n",
PageRight - PageLeft - 36.0f / LinesPerInch,
(0.5f + 0.157f) * 72.0f / LinesPerInch);
54.0f / LinesPerInch);
}
else
printf("\tP cvs dup stringwidth pop neg %.1f add %.1f\n",
PageRight - PageLeft - 36.0f / LinesPerInch,
(0.5f + 0.157f) * 72.0f / LinesPerInch);
54.0f / LinesPerInch);
puts("\tmoveto show");
puts("\tgrestore");
@@ -456,7 +454,7 @@ write_string(int col, /* I - Start column */
}
x += (float)col * 72.0f / (float)CharsPerInch;
y -= (float)(row + 0.843) * 72.0f / (float)LinesPerInch;
y -= (float)(row + 0.5) * 72.0f / (float)LinesPerInch;
attr = s->attr;
BIN
Ver Arquivo
Arquivo binário não exibido.
BIN
Ver Arquivo
Arquivo binário não exibido.
+1 -1
Ver Arquivo
@@ -264,7 +264,7 @@ WRITEDICTS
currentdict /cntdict .undef
currentdict /w2dict .undef
/printobject { (%stderr) (w) file 3 1 roll writeobject } odef
/printobject { (%stdout) (w) file 3 1 roll writeobject } odef
/writeobject { exch 1 array astore .writeobjects } odef
% Implement binary error message output.
+4 -6
Ver Arquivo
@@ -206,7 +206,7 @@ userdict /=string 256 string put
revision 100 idiv ( )
product
counttomark
{ (%stderr) (w) file exch false .writecvp
{ (%stdout) (w) file exch false .writecvp
} repeat pop
} bind def
@@ -454,7 +454,7 @@ systemdict /internaldict .knownget not { 0 } if type /operatortype ne
/write=
{ 1 index exch write=only (\n) writestring
} bind def
/=only { (%stderr) (w) file exch write=only } bind def
/=only { (%stdout) (w) file exch write=only } bind def
/= { =only (\n) print } bind def
/=print /=only load def
% Temporarily define == as = for the sake of runlibfile0.
@@ -834,7 +834,7 @@ end
/write==only exch def
/write== {1 index exch write==only (\n) writestring} bind def
/==only { (%stderr) (w) file exch write==only } bind def
/==only { (%stdout) (w) file exch write==only } bind def
/== {==only (\n) print} bind def
% Define [write]===[only], an extension that prints dictionaries
@@ -866,7 +866,7 @@ end
/write===only exch def
/write=== {1 index exch write===only (\n) writestring} bind def
/===only { (%stderr) (w) file exch write===only } bind def
/===only { (%stdout) (w) file exch write===only } bind def
/=== { ===only (\n) print } bind def
(END PROCS) VMDEBUG
@@ -1183,8 +1183,6 @@ NOCACHE { 0 setcachelimit } if
>> sethalftone
} bind def
.setdefaultscreen
% Set a null transfer function...
{} bind settransfer
initgraphics
% The interpreter relies on there being at least 2 entries
% on the graphics stack. Establish the second one now.
-1
Ver Arquivo
@@ -56,7 +56,6 @@ drawopdict begin
/j { j } def
/w { w } def
/M { M } def
/gs { pop } def
end
% ---------------- Color setting ---------------- %
-1
Ver Arquivo
@@ -119,7 +119,6 @@ main(int argc, /* I - Number of command-line arguments */
if ((content_type = getenv("CONTENT_TYPE")) != NULL &&
strcmp(content_type, "application/pdf") == 0)
{
fputs("INFO: Converting PDF file to PostScript...\n", stderr);
define_string("PSFile", "%stdout");
initial_enter_name("NODISPLAY", &vtrue);
}
+2 -2
Ver Arquivo
@@ -485,7 +485,7 @@ zbytesavailable(register os_ptr op)
int
zflush(register os_ptr op)
{ stream *s;
int code = zget_stderr(&s);
int code = zget_stdout(&s);
if ( code < 0 )
return code;
sflush(s);
@@ -526,7 +526,7 @@ zprint(register os_ptr op)
ref rstdout;
int code;
check_read_type(*op, t_string);
code = zget_stderr(&s);
code = zget_stdout(&s);
if ( code < 0 )
return code;
status = write_string(op, s);
+17 -39
Ver Arquivo
@@ -296,42 +296,27 @@ IsAuthorized(client_t *con) /* I - Connection */
address = ntohl(con->http.hostaddr.sin_addr.s_addr);
hostlen = strlen(con->http.hostname);
if (address == 0x7f000001 || strcasecmp(con->http.hostname, "localhost") == 0)
switch (auth)
{
/*
* Access from localhost (127.0.0.1) is always allowed...
*/
case AUTH_ALLOW : /* Order Deny,Allow */
if (check_auth(address, con->http.hostname, hostlen,
best->num_deny, best->deny))
auth = AUTH_DENY;
auth = AUTH_ALLOW;
}
else
{
/*
* Do authorization checks on the domain/address...
*/
if (check_auth(address, con->http.hostname, hostlen,
best->num_allow, best->allow))
auth = AUTH_ALLOW;
break;
switch (auth)
{
case AUTH_ALLOW : /* Order Deny,Allow */
if (check_auth(address, con->http.hostname, hostlen,
best->num_deny, best->deny))
auth = AUTH_DENY;
case AUTH_DENY : /* Order Allow,Deny */
if (check_auth(address, con->http.hostname, hostlen,
best->num_allow, best->allow))
auth = AUTH_ALLOW;
if (check_auth(address, con->http.hostname, hostlen,
best->num_allow, best->allow))
auth = AUTH_ALLOW;
break;
case AUTH_DENY : /* Order Allow,Deny */
if (check_auth(address, con->http.hostname, hostlen,
best->num_allow, best->allow))
auth = AUTH_ALLOW;
if (check_auth(address, con->http.hostname, hostlen,
best->num_deny, best->deny))
auth = AUTH_DENY;
break;
}
if (check_auth(address, con->http.hostname, hostlen,
best->num_deny, best->deny))
auth = AUTH_DENY;
break;
}
if (auth == AUTH_DENY)
@@ -444,13 +429,6 @@ IsAuthorized(client_t *con) /* I - Connection */
if (strcmp(con->username, grp->gr_mem[i]) == 0)
return (HTTP_OK);
/*
* Check to see if the default group ID matches for the user...
*/
if (grp->gr_gid == pw->pw_gid)
return (HTTP_OK);
/*
* The user isn't part of the specified group, so deny access...
*/
+10 -9
Ver Arquivo
@@ -433,9 +433,11 @@ ReadClient(client_t *con) /* I - Client to read from */
}
else if ((status = IsAuthorized(con)) != HTTP_OK)
{
SendError(con, status);
CloseClient(con);
return (0);
if (!SendError(con, status))
{
CloseClient(con);
return (0);
}
}
else switch (con->http.state)
{
@@ -721,7 +723,7 @@ ReadClient(client_t *con) /* I - Client to read from */
LogRequest(con, HTTP_OK);
}
if (httpPrintf(HTTP(con), "\r\n") < 0)
if (send(con->http.fd, "\r\n", 2, 0) < 0)
{
CloseClient(con);
return (0);
@@ -922,7 +924,7 @@ int /* O - 1 if successful, 0 otherwise */
SendError(client_t *con, /* I - Connection */
http_status_t code) /* I - Error code */
{
char message[1024]; /* Message for user */
char message[1024]; /* Text version of error code */
/*
@@ -969,8 +971,7 @@ SendError(client_t *con, /* I - Connection */
sprintf(message, "<HTML><HEAD><TITLE>%d %s</TITLE></HEAD>"
"<BODY><H1>%s</H1>%s</BODY></HTML>\n",
code, httpStatus(code), httpStatus(code),
con->language ? con->language->messages[code] :
httpStatus(code));
con->language ? con->language->messages[code] : httpStatus(code));
if (httpPrintf(HTTP(con), "Content-Type: text/html\r\n") < 0)
return (0);
@@ -978,7 +979,7 @@ SendError(client_t *con, /* I - Connection */
return (0);
if (httpPrintf(HTTP(con), "\r\n") < 0)
return (0);
if (httpPrintf(HTTP(con), "%s", message) < 0)
if (send(con->http.fd, message, strlen(message), 0) < 0)
return (0);
}
else if (httpPrintf(HTTP(con), "\r\n") < 0)
@@ -1455,8 +1456,8 @@ pipe_command(client_t *con, /* I - Client connection */
* Child comes here... Close stdin if necessary and dup the pipe to stdout.
*/
setgid(Group);
setuid(User);
setgid(Group);
if (infile)
{
+2 -26
Ver Arquivo
@@ -138,7 +138,6 @@ ReadConfiguration(void)
int status; /* Return status */
char directory[1024];/* Configuration directory */
struct rlimit limit; /* Runtime limit */
char *language; /* Language string */
/*
@@ -188,16 +187,10 @@ ReadConfiguration(void)
sprintf(ServerAdmin, "root@%s", ServerName);
strcpy(ServerRoot, CUPS_SERVERROOT);
strcpy(DocumentRoot, CUPS_DATADIR "/doc");
strcpy(SystemGroup, DEFAULT_GROUP);
strcpy(AccessLog, "logs/access_log");
strcpy(ErrorLog, "logs/error_log");
if ((language = DEFAULT_LANGUAGE) == NULL)
language = "en";
else if (strcmp(language, "C") == 0 || strcmp(language, "POSIX") == 0)
language = "en";
strcpy(DefaultLanguage, language);
strcpy(DefaultLanguage, DEFAULT_LANGUAGE);
strcpy(DefaultCharset, DEFAULT_CHARSET);
strcpy(RIPCache, "8m");
if (getenv("TMPDIR") == NULL)
@@ -205,23 +198,6 @@ ReadConfiguration(void)
else
strcpy(TempDir, getenv("TMPDIR"));
/*
* Find the default system group: "sys", "system", or "root"...
*/
if (getgrnam("sys") != NULL)
strcpy(SystemGroup, "sys");
else
{
endgrent();
if (getgrnam("system") != NULL)
strcpy(SystemGroup, "system");
else
strcpy(SystemGroup, "root");
}
endgrent();
User = DEFAULT_UID;
Group = DEFAULT_GID;
LogLevel = LOG_ERROR;
+1 -1
Ver Arquivo
@@ -49,7 +49,7 @@ VAR char ConfigurationFile[256] VALUE(CUPS_SERVERROOT "/conf/cupsd.conf"),
/* Root directory for scheduler */
DocumentRoot[1024] VALUE(CUPS_DATADIR "/doc"),
/* Root directory for documents */
SystemGroup[32],
SystemGroup[32] VALUE(DEFAULT_GROUP),
/* System group name */
AccessLog[1024] VALUE("logs/access_log"),
/* Access log filename */
+4 -26
Ver Arquivo
@@ -81,35 +81,13 @@
#define DEFAULT_TIMEOUT 300 /* Timeout during requests/updates */
#define DEFAULT_KEEPALIVE 60 /* Timeout between requests */
#define DEFAULT_INTERVAL 30 /* Interval between browse updates */
#ifdef WIN32 /* Fix for broken Linux setlocale() */
# define DEFAULT_LANGUAGE setlocale(LC_ALL,"")
#define DEFAULT_LANGUAGE setlocale(LC_ALL,NULL)
/* Default language encoding */
#else
# define DEFAULT_LANGUAGE getenv("LANG")
/* Default language encoding */
#endif /* !WIN32 */
#define DEFAULT_CHARSET "iso-8859-1"
/* Default charset */
#ifdef __sgi
# define DEFAULT_UID 9 /* Default user ID */
# define DEFAULT_GID 0 /* Default group ID */
#elif defined(__hpux)
# define DEFAULT_UID 9 /* Default user ID */
# define DEFAULT_GID 0 /* Default group ID */
#elif defined(__sun)
# define DEFAULT_UID 71 /* Default user ID */
# define DEFAULT_GID 0 /* Default group ID */
#elif defined(__linux)
# define DEFAULT_UID 4 /* Default user ID */
# define DEFAULT_GID 0 /* Default group ID */
#elif defined(__osf__)
# define DEFAULT_UID 8 /* Default user ID */
# define DEFAULT_GID 0 /* Default group ID */
#else
# define DEFAULT_UID 9 /* Default user ID */
# define DEFAULT_GID 0 /* Default group ID */
#endif /* __sgi */
#define DEFAULT_GROUP "sys" /* Default system group */
#define DEFAULT_UID 9 /* Default user ID */
#define DEFAULT_GID 0 /* Default group ID */
/*
+14 -38
Ver Arquivo
@@ -427,8 +427,7 @@ add_class(client_t *con, /* I - Client connection */
* Class doesn't exist; see if we have a printer of the same name...
*/
if ((pclass = FindPrinter(resource + 9)) != NULL &&
!(pclass->type & CUPS_PRINTER_REMOTE))
if (FindPrinter(resource + 9) != NULL)
{
/*
* Yes, return an error...
@@ -437,25 +436,14 @@ add_class(client_t *con, /* I - Client connection */
send_ipp_error(con, IPP_NOT_POSSIBLE);
return;
}
/*
* If we found a printer but didn't error out, then rename the printer to
* printer@host...
*/
if (pclass != NULL)
else
{
strcat(pclass->name, "@");
strcat(pclass->name, pclass->hostname);
SetPrinterAttrs(pclass);
SortPrinters();
/*
* No, add the pclass...
*/
pclass = AddClass(resource + 9);
}
/*
* No, add the pclass...
*/
pclass = AddClass(resource + 9);
}
else if (pclass->type & CUPS_PRINTER_REMOTE)
{
@@ -638,8 +626,7 @@ add_printer(client_t *con, /* I - Client connection */
* Printer doesn't exist; see if we have a class of the same name...
*/
if ((printer = FindClass(resource + 10)) != NULL &&
!(printer->type & CUPS_PRINTER_REMOTE))
if (FindClass(resource + 10) != NULL)
{
/*
* Yes, return an error...
@@ -648,25 +635,14 @@ add_printer(client_t *con, /* I - Client connection */
send_ipp_error(con, IPP_NOT_POSSIBLE);
return;
}
/*
* If we found a class but didn't error out, then rename the class to
* class@host...
*/
if (printer != NULL)
else
{
strcat(printer->name, "@");
strcat(printer->name, printer->hostname);
SetPrinterAttrs(printer);
SortPrinters();
/*
* No, add the printer...
*/
printer = AddPrinter(resource + 10);
}
/*
* No, add the printer...
*/
printer = AddPrinter(resource + 10);
}
else if (printer->type & CUPS_PRINTER_REMOTE)
{
+5 -7
Ver Arquivo
@@ -640,8 +640,7 @@ StartJob(int id, /* I - Job ID */
{
current->procs[i] = pid;
LogMessage(LOG_DEBUG, "Started %s (PID %d) for job %d.", command, pid,
current->id);
DEBUG_printf(("StartJob: started %s - pid = %d.\n", command, pid));
}
}
@@ -689,8 +688,7 @@ StartJob(int id, /* I - Job ID */
{
current->procs[i] = pid;
LogMessage(LOG_DEBUG, "Started %s (PID %d) for job %d.", command, pid,
current->id);
DEBUG_printf(("StartJob: started %s - pid = %d.\n", command, pid));
}
}
else
@@ -801,7 +799,7 @@ UpdateJob(job_t *job) /* I - Job to check */
loglevel = LOG_WARN;
message = buffer + 8;
}
else if (strncmp(buffer, "INFO:", 5) == 0)
if (strncmp(buffer, "INFO:", 5) == 0)
{
loglevel = LOG_INFO;
message = buffer + 5;
@@ -851,7 +849,7 @@ UpdateJob(job_t *job) /* I - Job to check */
LogMessage(loglevel, "%s", message);
if ((loglevel >= LOG_INFO && !job->state) ||
loglevel < LOG_INFO)
loglevel == LOG_ERROR)
strncpy(job->printer->state_message, message,
sizeof(job->printer->state_message) - 1);
}
@@ -938,8 +936,8 @@ start_process(char *command, /* I - Full path to command */
* Change user to something "safe"...
*/
setgid(Group);
setuid(User);
setgid(Group);
/*
* Execute the command; if for some reason this doesn't work,
-3
Ver Arquivo
@@ -355,9 +355,6 @@ sigchld_handler(int sig) /* I - Signal number */
{
DEBUG_printf(("sigcld_handler: pid = %d, status = %d\n", pid, status));
if (status)
LogMessage(LOG_ERROR, "PID %d crashed with status %d!", pid, status);
for (job = Jobs; job != NULL; job = job->next)
if (job->state == IPP_JOB_PROCESSING)
{
+4 -7
Ver Arquivo
@@ -47,13 +47,10 @@ clean:
install:
-$(MKDIR) $(BINDIR)
-$(MKDIR) $(LIBDIR)
$(CP) accept lpadmin $(SBINDIR)
-$(LN) accept $(SBINDIR)/reject
-$(LN) $(SBINDIR)/lpadmin $(LIBDIR)
-$(LN) $(SBINDIR)/accept $(LIBDIR)
-$(LN) $(SBINDIR)/accept $(LIBDIR)/reject
-$(LN) $(SBINDIR)/accept $(BINDIR)/disable
-$(LN) $(SBINDIR)/accept $(BINDIR)/enable
$(CP) accept lpadmin $(LIBDIR)
-$(LN) accept $(LIBDIR)/reject
-$(LN) $(LIBDIR)/accept $(BINDIR)/disable
-$(LN) $(LIBDIR)/accept $(BINDIR)/enable
$(CP) cancel lp lpstat $(BINDIR)
#
+1 -3
Ver Arquivo
@@ -201,7 +201,7 @@ main(int argc, /* I - Number of command-line arguments */
return (1);
}
temp = fopen(cupsTempFile(tempfile, sizeof(tempfile)), "w");
temp = fopen(tmpnam(tempfile), "w");
if (temp == NULL)
{
@@ -226,8 +226,6 @@ main(int argc, /* I - Number of command-line arguments */
else
job_id = cupsPrintFile(dest, tempfile, "(stdin)", num_options, options);
unlink(tempfile);
if (job_id < 1)
{
fputs("lp: unable to print stdin.\n", stderr);
+1 -1
Ver Arquivo
@@ -945,7 +945,7 @@ set_printer_file(http_t *http, /* I - Server connection */
* Yes, the file is compressed; uncompress to a temp file...
*/
if ((fp = fopen(cupsTempFile(tempfile, sizeof(tempfile)), "wb")) == NULL)
if ((fp = fopen(tmpnam(tempfile), "wb")) == NULL)
{
perror("lpadmin: Unable to create temporary file");
return;