CHANGES IN CUPS V1.1.20rc1
+ - Added support for live testing with Valgrind (STR
+ #193)
- The CGI programs now collect the list of needed
attributes for the class, job, and printer template
files (STR #192)
/*
- * "$Id: lpc.c,v 1.11.2.6 2003/01/07 18:26:17 mike Exp $"
+ * "$Id: lpc.c,v 1.11.2.7 2003/07/20 12:51:39 mike Exp $"
*
* "lpc" command for the Common UNIX Printing System (CUPS).
*
*/
while (isspace(line[0]))
- strcpy(line, line + 1);
+ cups_strcpy(line, line + 1);
for (params = line; *params != '\0'; params ++)
if (isspace(*params))
/*
- * End of "$Id: lpc.c,v 1.11.2.6 2003/01/07 18:26:17 mike Exp $".
+ * End of "$Id: lpc.c,v 1.11.2.7 2003/07/20 12:51:39 mike Exp $".
*/
/*
- * "$Id: cups.h,v 1.32.2.10 2003/06/11 23:17:27 mike Exp $"
+ * "$Id: cups.h,v 1.32.2.11 2003/07/20 12:51:40 mike Exp $"
*
* API definitions for the Common UNIX Printing System (CUPS).
*
extern void cupsSetUser(const char *user);
extern const char *cupsUser(void);
+
# ifdef __cplusplus
}
# endif /* __cplusplus */
#endif /* !_CUPS_CUPS_H_ */
/*
- * End of "$Id: cups.h,v 1.32.2.10 2003/06/11 23:17:27 mike Exp $".
+ * End of "$Id: cups.h,v 1.32.2.11 2003/07/20 12:51:40 mike Exp $".
*/
/*
- * "$Id: language.c,v 1.20.2.23 2003/07/20 01:39:58 mike Exp $"
+ * "$Id: language.c,v 1.20.2.24 2003/07/20 12:51:40 mike Exp $"
*
* I18N/language support for the Common UNIX Printing System (CUPS).
*
#endif /* WIN32 */
#include "string.h"
#include "language.h"
+#include "debug.h"
/*
_cupsRestoreLocale(int category, /* I - Category */
char *oldlocale) /* I - Old locale or NULL */
{
+ DEBUG_printf(("_cupsRestoreLocale(category=%d, oldlocale=\"%s\")\n",
+ category, oldlocale));
+
if (oldlocale)
{
/*
char *oldlocale; /* Old locale */
+ DEBUG_printf(("_cupsSaveLocale(category=%d, locale=\"%s\")\n",
+ category, locale));
+
if ((oldlocale = setlocale(category, locale)) != NULL)
return (strdup(oldlocale));
else
/*
- * End of "$Id: language.c,v 1.20.2.23 2003/07/20 01:39:58 mike Exp $".
+ * End of "$Id: language.c,v 1.20.2.24 2003/07/20 12:51:40 mike Exp $".
*/
/*
- * "$Id: options.c,v 1.21.2.9 2003/03/21 18:07:34 mike Exp $"
+ * "$Id: options.c,v 1.21.2.10 2003/07/20 12:51:41 mike Exp $"
*
* Option routines for the Common UNIX Printing System (CUPS).
*
while (*ptr != '\'' && *ptr != '\0')
{
if (*ptr == '\\')
- strcpy(ptr, ptr + 1);
+ cups_strcpy(ptr, ptr + 1);
ptr ++;
}
while (*ptr != '\"' && *ptr != '\0')
{
if (*ptr == '\\')
- strcpy(ptr, ptr + 1);
+ cups_strcpy(ptr, ptr + 1);
ptr ++;
}
}
}
else if (*ptr == '\\')
- strcpy(ptr, ptr + 1);
+ cups_strcpy(ptr, ptr + 1);
if (*ptr != '\0')
*ptr++ = '\0';
while (!isspace(*ptr) && *ptr != '\0')
{
if (*ptr == '\\')
- strcpy(ptr, ptr + 1);
+ cups_strcpy(ptr, ptr + 1);
ptr ++;
}
/*
- * End of "$Id: options.c,v 1.21.2.9 2003/03/21 18:07:34 mike Exp $".
+ * End of "$Id: options.c,v 1.21.2.10 2003/07/20 12:51:41 mike Exp $".
*/
/*
- * "$Id: ppd.c,v 1.51.2.55 2003/07/20 01:33:11 mike Exp $"
+ * "$Id: ppd.c,v 1.51.2.56 2003/07/20 12:51:41 mike Exp $"
*
* PPD file routines for the Common UNIX Printing System (CUPS).
*
#ifndef __APPLE__
static void ppd_fix(char *string);
#else
-# define ppd_fix(s)
+# define ppd_fix(s)
#endif /* !__APPLE__ */
static void ppd_free_group(ppd_group_t *group);
static void ppd_free_option(ppd_option_t *option);
*/
if (ppd->num_sizes > 0)
+ {
ppd_free(ppd->sizes);
+ }
/*
* Free any constraints...
*/
if (ppd->num_consts > 0)
+ {
ppd_free(ppd->consts);
+ }
/*
* Free any filters...
if (ppd->num_filters > 0)
{
for (i = ppd->num_filters, filter = ppd->filters; i > 0; i --, filter ++)
+ {
ppd_free(*filter);
+ }
ppd_free(ppd->filters);
}
if (ppd->num_fonts > 0)
{
for (i = ppd->num_fonts, font = ppd->fonts; i > 0; i --, font ++)
+ {
ppd_free(*font);
+ }
ppd_free(ppd->fonts);
}
*/
if (ppd->num_profiles > 0)
+ {
ppd_free(ppd->profiles);
+ }
/*
* Free any attributes...
choice->code = string;
option = NULL;
+ string = NULL; /* Don't add as an attribute below */
}
else if (strcmp(keyword, "LandscapeOrientation") == 0)
{
*/
if (name[0] == '*')
- strcpy(name, name + 1); /* Eliminate leading asterisk */
+ cups_strcpy(name, name + 1); /* Eliminate leading asterisk */
for (i = strlen(name) - 1; i > 0 && isspace(name[i]); i --)
name[i] = '\0'; /* Eliminate trailing spaces */
*/
if (name[0] == '*')
- strcpy(name, name + 1);
+ cups_strcpy(name, name + 1);
option = ppd_get_option(group, name);
}
if (keyword[0] == '*')
- strcpy(keyword, keyword + 1);
+ cups_strcpy(keyword, keyword + 1);
if (strcmp(name, "ExitServer") == 0)
section = PPD_ORDER_EXIT;
*/
if (constraint->option1[0] == '*')
- strcpy(constraint->option1, constraint->option1 + 1);
+ cups_strcpy(constraint->option1, constraint->option1 + 1);
if (constraint->choice1[0] == '*')
- strcpy(constraint->option2, constraint->choice1 + 1);
+ cups_strcpy(constraint->option2, constraint->choice1 + 1);
else
- strcpy(constraint->option2, constraint->choice1);
+ cups_strcpy(constraint->option2, constraint->choice1);
constraint->choice1[0] = '\0';
constraint->choice2[0] = '\0';
case 3 : /* Two options, one choice... */
/*
- * The following strcpy's are safe, as optionN and
+ * The following cups_strcpy's are safe, as optionN and
* choiceN are all the same size (size defined by PPD spec...)
*/
if (constraint->option1[0] == '*')
- strcpy(constraint->option1, constraint->option1 + 1);
+ cups_strcpy(constraint->option1, constraint->option1 + 1);
if (constraint->choice1[0] == '*')
{
- strcpy(constraint->choice2, constraint->option2);
- strcpy(constraint->option2, constraint->choice1 + 1);
+ cups_strcpy(constraint->choice2, constraint->option2);
+ cups_strcpy(constraint->option2, constraint->choice1 + 1);
constraint->choice1[0] = '\0';
}
else
{
if (constraint->option2[0] == '*')
- strcpy(constraint->option2, constraint->option2 + 1);
+ cups_strcpy(constraint->option2, constraint->option2 + 1);
constraint->choice2[0] = '\0';
}
case 4 : /* Two options, two choices... */
if (constraint->option1[0] == '*')
- strcpy(constraint->option1, constraint->option1 + 1);
+ cups_strcpy(constraint->option1, constraint->option1 + 1);
if (constraint->option2[0] == '*')
- strcpy(constraint->option2, constraint->option2 + 1);
+ cups_strcpy(constraint->option2, constraint->option2 + 1);
break;
}
ppd_decode(string); /* Decode quoted string */
choice->code = string;
- string = NULL; /* Don't add as an attribute below */
+ string = NULL; /* Don't add as an attribute below */
}
#if 0
else if (strcmp(keyword, "cupsUIType") == 0 &&
(mask & (PPD_KEYWORD | PPD_STRING)) == (PPD_KEYWORD | PPD_STRING))
ppd_add_attr(ppd, keyword, name, text, string);
else
+ {
ppd_free(string);
+ }
}
/*
if ((option = ppdFindOption(ppd, "InputSlot")) != NULL)
{
for (i = 0; i < option->num_choices; i ++)
- if (option->choices[i].code == NULL || !option->choices[i].code[0])
+ if (option->choices[i].code == NULL || !option->choices[i].code[0] ||
+ !strncasecmp(option->choices[i].choice, "Auto", 4))
break;
if (i >= option->num_choices)
for (i = option->num_choices, choice = option->choices;
i > 0;
i --, choice ++)
+ {
ppd_free(choice->code);
+ }
ppd_free(option->choices);
}
/*
- * End of "$Id: ppd.c,v 1.51.2.55 2003/07/20 01:33:11 mike Exp $".
+ * End of "$Id: ppd.c,v 1.51.2.56 2003/07/20 12:51:41 mike Exp $".
*/
/*
- * "$Id: string.c,v 1.5.2.7 2003/01/07 18:26:30 mike Exp $"
+ * "$Id: string.c,v 1.5.2.8 2003/07/20 12:51:42 mike Exp $"
*
* String functions for the Common UNIX Printing System (CUPS).
*
*
* Contents:
*
+ * cups_strcpy() - Copy a string allowing for overlapping strings.
* cups_strdup() - Duplicate a string.
* cups_strcasecmp() - Do a case-insensitive comparison.
* cups_strncasecmp() - Do a case-insensitive comparison on up to N chars.
#include "string.h"
+/*
+ * 'cups_strcpy()' - Copy a string allowing for overlapping strings.
+ */
+
+void
+cups_strcpy(char *dst, /* I - Destination string */
+ const char *src) /* I - Source string */
+{
+ while (*src)
+ *dst++ = *src++;
+
+ *dst = '\0';
+}
+
+
/*
* 'cups_strdup()' - Duplicate a string.
*/
/*
- * End of "$Id: string.c,v 1.5.2.7 2003/01/07 18:26:30 mike Exp $".
+ * End of "$Id: string.c,v 1.5.2.8 2003/07/20 12:51:42 mike Exp $".
*/
/*
- * "$Id: string.h,v 1.7.2.10 2003/01/07 18:26:30 mike Exp $"
+ * "$Id: string.h,v 1.7.2.11 2003/07/20 12:51:43 mike Exp $"
*
* String definitions for the Common UNIX Printing System (CUPS).
*
* Prototypes...
*/
+extern void cups_strcpy(char *dst, const char *src);
+
# ifndef HAVE_STRDUP
extern char *cups_strdup(const char *);
# define strdup cups_strdup
#endif /* !_CUPS_STRING_H_ */
/*
- * End of "$Id: string.h,v 1.7.2.10 2003/01/07 18:26:30 mike Exp $".
+ * End of "$Id: string.h,v 1.7.2.11 2003/07/20 12:51:43 mike Exp $".
*/
/*
- * "$Id: client.c,v 1.91.2.64 2003/07/20 03:13:08 mike Exp $"
+ * "$Id: client.c,v 1.91.2.65 2003/07/20 12:51:43 mike Exp $"
*
* Client routines for the Common UNIX Printing System (CUPS) scheduler.
*
NumClients --;
if (con < (Clients + NumClients))
- memcpy(con, con + 1, (Clients + NumClients - con) * sizeof(client_t));
+ memmove(con, con + 1, (Clients + NumClients - con) * sizeof(client_t));
}
}
if (con->options[0] == '/')
- strcpy(con->options, con->options + 1);
+ cups_strcpy(con->options, con->options + 1);
if (!SendCommand(con, con->command, con->options))
{
}
if (con->options[0] == '/')
- strcpy(con->options, con->options + 1);
+ cups_strcpy(con->options, con->options + 1);
LogMessage(L_DEBUG2, "ReadClient() %d command=\"%s\", options = \"%s\"",
con->http.fd, con->command, con->options);
script_name[1024], /* SCRIPT_NAME environment variable */
server_name[1024], /* SERVER_NAME environment variable */
server_port[1024], /* SERVER_PORT environment variable */
- tmpdir[1024]; /* TMPDIR environment variable */
+ tmpdir[1024], /* TMPDIR environment variable */
+ vg_args[1024]; /* VG_ARGS environment variable */
#if defined(HAVE_SIGACTION) && !defined(HAVE_SIGSET)
struct sigaction action; /* POSIX signal handler */
#endif /* HAVE_SIGACTION && !HAVE_SIGSET */
else
*commptr |= tolower(commptr[2]) - 'a' + 10;
- strcpy(commptr + 1, commptr + 3);
+ cups_strcpy(commptr + 1, commptr + 3);
}
else if (*commptr == '?')
break;
else
envp[envc ++] = "SERVER_PROTOCOL=HTTP/0.9";
envp[envc ++] = "REDIRECT_STATUS=1";
+ envp[envc ++] = "CUPS_SERVER=localhost";
envp[envc ++] = ipp_port;
envp[envc ++] = server_name;
envp[envc ++] = server_port;
envp[envc ++] = cups_datadir;
envp[envc ++] = cups_serverroot;
+ if (getenv("VG_ARGS") != NULL)
+ {
+ snprintf(vg_args, sizeof(vg_args), "VG_ARGS=%s", getenv("VG_ARGS"));
+ envp[envc ++] = vg_args;
+ }
+
if (getenv("LD_LIBRARY_PATH") != NULL)
{
snprintf(ld_library_path, sizeof(ld_library_path), "LD_LIBRARY_PATH=%s",
/*
- * End of "$Id: client.c,v 1.91.2.64 2003/07/20 03:13:08 mike Exp $".
+ * End of "$Id: client.c,v 1.91.2.65 2003/07/20 12:51:43 mike Exp $".
*/
/*
- * "$Id: conf.c,v 1.77.2.41 2003/07/20 03:13:09 mike Exp $"
+ * "$Id: conf.c,v 1.77.2.42 2003/07/20 12:51:45 mike Exp $"
*
* Configuration routines for the Common UNIX Printing System (CUPS).
*
Listeners = temp;
temp += NumListeners;
+ memset(temp, 0, sizeof(listener_t));
+
if (get_address(value, INADDR_ANY, IPP_PORT, AF_INET, &(temp->address)))
{
httpAddrString(&(temp->address), line, sizeof(line));
/*
- * End of "$Id: conf.c,v 1.77.2.41 2003/07/20 03:13:09 mike Exp $".
+ * End of "$Id: conf.c,v 1.77.2.42 2003/07/20 12:51:45 mike Exp $".
*/
/*
- * "$Id: dirsvc.c,v 1.73.2.34 2003/07/19 22:13:53 mike Exp $"
+ * "$Id: dirsvc.c,v 1.73.2.35 2003/07/20 12:51:46 mike Exp $"
*
* Directory services routines for the Common UNIX Printing System (CUPS).
*
* Copy over the buffer data we've used up...
*/
- strcpy(buffer, lineptr);
+ cups_strcpy(buffer, lineptr);
bufused -= lineptr - buffer;
if (bufused < 0)
for (ptr1 = valbuf; *ptr1; ptr1 ++)
if (*ptr1 == '\\' && ptr1[1])
- strcpy(ptr1, ptr1 + 1);
+ cups_strcpy(ptr1, ptr1 + 1);
return (0);
}
/*
- * End of "$Id: dirsvc.c,v 1.73.2.34 2003/07/19 22:13:53 mike Exp $".
+ * End of "$Id: dirsvc.c,v 1.73.2.35 2003/07/20 12:51:46 mike Exp $".
*/
/*
- * "$Id: ipp.c,v 1.127.2.70 2003/05/13 14:50:54 mike Exp $"
+ * "$Id: ipp.c,v 1.127.2.71 2003/07/20 12:51:47 mike Exp $"
*
* IPP routines for the Common UNIX Printing System (CUPS) scheduler.
*
*/
if ((src = cupsFileOpen(from, "rb")) == NULL)
+ {
+ if (num_defaults > 0)
+ free(defaults);
+
return (-1);
+ }
if ((dst = cupsFileOpen(to, "wb")) == NULL)
{
+ if (num_defaults > 0)
+ free(defaults);
+
cupsFileClose(src);
return (-1);
}
if (cups_protocol[0])
cupsFilePrintf(dst, "%s\n", cups_protocol);
+ if (num_defaults > 0)
+ free(defaults);
+
/*
* Close both files and return...
*/
/*
- * End of "$Id: ipp.c,v 1.127.2.70 2003/05/13 14:50:54 mike Exp $".
+ * End of "$Id: ipp.c,v 1.127.2.71 2003/07/20 12:51:47 mike Exp $".
*/
/*
- * "$Id: job.c,v 1.124.2.75 2003/07/20 02:34:27 mike Exp $"
+ * "$Id: job.c,v 1.124.2.76 2003/07/20 12:51:51 mike Exp $"
*
* Job management routines for the Common UNIX Printing System (CUPS).
*
processPath[1050], /* CFProcessPath environment variable */
#endif /* __APPLE__ */
path[1024], /* PATH environment variable */
+ ipp_port[1024], /* IPP_PORT environment variable */
language[255], /* LANG environment variable */
charset[255], /* CHARSET environment variable */
classification[1024], /* CLASSIFICATION environment variable */
shlib_path[1024], /* SHLIB_PATH environment variable */
nlspath[1024], /* NLSPATH environment variable */
datadir[1024], /* CUPS_DATADIR environment variable */
- fontpath[1050]; /* CUPS_FONTPATH environment variable */
+ fontpath[1050], /* CUPS_FONTPATH environment variable */
+ vg_args[1024]; /* VG_ARGS environment variable */
static char *options = NULL; /* Full list of options */
static int optlength = 0; /* Length of option buffer */
snprintf(tmpdir, sizeof(tmpdir), "TMPDIR=%s", TempDir);
snprintf(datadir, sizeof(datadir), "CUPS_DATADIR=%s", DataDir);
snprintf(fontpath, sizeof(fontpath), "CUPS_FONTPATH=%s", FontPath);
+ sprintf(ipp_port, "IPP_PORT=%d", LocalPort);
envc = 0;
envp[envc ++] = "USER=root";
envp[envc ++] = charset;
envp[envc ++] = language;
- envp[envc ++] = TZ;
+ if (TZ && TZ[0])
+ envp[envc ++] = TZ;
envp[envc ++] = ppd;
envp[envc ++] = root;
envp[envc ++] = cache;
envp[envc ++] = printer_name;
envp[envc ++] = datadir;
envp[envc ++] = fontpath;
+ envp[envc ++] = "CUPS_SERVER=localhost";
+ envp[envc ++] = ipp_port;
+
+ if (getenv("VG_ARGS") != NULL)
+ {
+ snprintf(vg_args, sizeof(vg_args), "VG_ARGS=%s", getenv("VG_ARGS"));
+ envp[envc ++] = vg_args;
+ }
if (getenv("LD_LIBRARY_PATH") != NULL)
{
* Copy over the buffer data we've used up...
*/
- strcpy(job->buffer, lineptr);
+ cups_strcpy(job->buffer, lineptr);
job->bufused -= lineptr - job->buffer;
if (job->bufused < 0)
/*
- * End of "$Id: job.c,v 1.124.2.75 2003/07/20 02:34:27 mike Exp $".
+ * End of "$Id: job.c,v 1.124.2.76 2003/07/20 12:51:51 mike Exp $".
*/
/*
- * "$Id: ppds.c,v 1.14.2.10 2003/03/30 20:01:48 mike Exp $"
+ * "$Id: ppds.c,v 1.14.2.11 2003/07/20 12:51:53 mike Exp $"
*
* PPD scanning routines for the Common UNIX Printing System (CUPS).
*
strcpy(make_model, model_name);
while (isspace(make_model[0]))
- strcpy(make_model, make_model + 1);
+ cups_strcpy(make_model, make_model + 1);
if (!make_model[0])
continue; /* Nope... */
*/
while (isspace(manufacturer[0]))
- strcpy(manufacturer, manufacturer + 1);
+ cups_strcpy(manufacturer, manufacturer + 1);
if (!manufacturer[0] || strcmp(manufacturer, "ESP") == 0)
{
*/
country[0] = '_';
- strcpy(country + 1, ptr);
+ cups_strcpy(country + 1, ptr);
}
else
{
/*
- * End of "$Id: ppds.c,v 1.14.2.10 2003/03/30 20:01:48 mike Exp $".
+ * End of "$Id: ppds.c,v 1.14.2.11 2003/07/20 12:51:53 mike Exp $".
*/
/*
- * "$Id: printers.c,v 1.93.2.49 2003/04/26 17:19:47 mike Exp $"
+ * "$Id: printers.c,v 1.93.2.50 2003/07/20 12:51:54 mike Exp $"
*
* Printer routines for the Common UNIX Printing System (CUPS).
*
MimeDatabase->num_filters --;
if (i > 1)
- memcpy(filter, filter + 1, sizeof(mime_filter_t) * (i - 1));
+ memmove(filter, filter + 1, sizeof(mime_filter_t) * (i - 1));
filter --;
}
/*
- * End of "$Id: printers.c,v 1.93.2.49 2003/04/26 17:19:47 mike Exp $".
+ * End of "$Id: printers.c,v 1.93.2.50 2003/07/20 12:51:54 mike Exp $".
*/
#!/bin/sh
#
-# "$Id: run-stp-tests.sh,v 1.4.2.14 2003/04/23 18:39:23 mike Exp $"
+# "$Id: run-stp-tests.sh,v 1.4.2.15 2003/07/20 12:51:55 mike Exp $"
#
# Perform the complete set of IPP compliance tests specified in the
# CUPS Software Test Plan.
cwd=`pwd`
root=`dirname $cwd`
+#
+# See if we want to use valgrind...
+#
+
+echo ""
+echo "This test script can use the Valgrind software from:"
+echo ""
+echo " http://developer.kde.org/~sewardj/"
+echo ""
+echo "Please enter Y to use Valgrind or N to not use Valgrind:"
+
+read usevalgrind
+
+case "$usevalgrind" in
+ Y* | y*)
+ valgrind="valgrind --logfile=/tmp/$user/log/valgrind --error-limit=no --leak-check=yes --trace-children=yes"
+ echo "Using Valgrind; log files can be found in /tmp/$user/log..."
+ ;;
+
+ *)
+ valgrind=""
+ ;;
+esac
+
#
# Start by creating temporary directories for the tests...
#
echo "Starting scheduler..."
-../scheduler/cupsd -c /tmp/$user/cupsd.conf -f >/tmp/$user/log/debug_log &
+$valgrind ../scheduler/cupsd -c /tmp/$user/cupsd.conf -f >/tmp/$user/log/debug_log &
cupsd=$!
#if test -x /usr/bin/strace; then
echo ""
#
-# End of "$Id: run-stp-tests.sh,v 1.4.2.14 2003/04/23 18:39:23 mike Exp $"
+# End of "$Id: run-stp-tests.sh,v 1.4.2.15 2003/07/20 12:51:55 mike Exp $"
#