/*
- * "$Id: ipptest.c 5876 2006-08-24 15:05:04Z mike $"
+ * "$Id: ipptest.c 6503 2007-05-01 23:06:44Z mike $"
*
* IPP test command for the Common UNIX Printing System (CUPS).
*
- * Copyright 1997-2006 by Easy Software Products.
+ * Copyright 1997-2007 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
* property of Easy Software Products and are protected by Federal
{
if (!strcmp(argv[i], "-v"))
Verbosity ++;
+ else if (!strcmp(argv[i], "-d"))
+ {
+ i ++;
+
+ if (i >= argc)
+ usage(NULL);
+ else
+ putenv(argv[i]);
+ }
else if (!strcmp(argv[i], "-i"))
{
i++;
strlcpy(tokenptr, cupsUser(), sizeof(token) - (tokenptr - token));
tempptr += 5;
}
+ else if (!strncasecmp(tempptr + 1, "ENV[", 4))
+ {
+ char *end; /* End of $ENV[name] */
+
+
+ if ((end = strchr(tempptr + 5, ']')) != NULL)
+ {
+ *end++ = '\0';
+ strlcpy(tokenptr,
+ getenv(tempptr + 5) ? getenv(tempptr + 5) : tempptr + 5,
+ sizeof(token) - (tokenptr - token));
+ tempptr = end;
+ }
+ else
+ {
+ *tokenptr++ = *tempptr++;
+ *tokenptr = '\0';
+ }
+ }
else
{
- *tokenptr++ = *tempptr ++;
+ *tokenptr++ = *tempptr++;
*tokenptr = '\0';
}
if (filename[0])
response = cupsDoFileRequest(http, request, resource, filename);
else
- response = cupsDoRequest(http, request, resource);
+ response = cupsDoIORequest(http, request, resource, -1,
+ Verbosity ? 1 : -1);
if (response == NULL)
{
puts(" BAD STATUS");
printf(" status-code = %04x (%s)\n",
- cupsLastError(), cupsLastErrorString());
+ cupsLastError(), ippErrorString(cupsLastError()));
for (i = 0; i < num_expects; i ++)
if (ippFindAttribute(response, expects[i], IPP_TAG_ZERO) == NULL)
/*
- * End of "$Id: ipptest.c 5876 2006-08-24 15:05:04Z mike $".
+ * End of "$Id: ipptest.c 6503 2007-05-01 23:06:44Z mike $".
*/