#include <sys/stat.h>
#include <stdio.h>
-#ifdef WIN32
+#ifdef _WIN32
# include <winsock.h>
#else
# include <sys/socket.h>
# include <netinet/in.h>
# include <arpa/inet.h>
# include <netdb.h>
-#endif /* WIN32 */
+#endif /* _WIN32 */
#ifdef __APPLE__
# include <CoreFoundation/CFNumber.h>
# include <CoreFoundation/CFPreferences.h>
* -1...
*/
-#ifdef WIN32
+#ifdef _WIN32
closesocket(fd);
#else
close(fd);
-#endif /* WIN32 */
+#endif /* _WIN32 */
return (-1);
}
ssize_t nbytes; /* Number of bytes written */
off_t tbytes; /* Total bytes written */
char buffer[32768]; /* Output buffer */
-#ifdef WIN32
+#ifdef _WIN32
DWORD tv; /* Timeout in milliseconds */
#else
struct timeval tv; /* Timeout in secs and usecs */
-#endif /* WIN32 */
+#endif /* _WIN32 */
/*
* Set the timeout...
*/
-#ifdef WIN32
+#ifdef _WIN32
tv = (DWORD)(timeout * 1000);
setsockopt(fd, SOL_SOCKET, SO_RCVTIMEO, (char *)&tv, sizeof(tv));
setsockopt(fd, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(tv));
setsockopt(fd, SOL_SOCKET, SO_SNDTIMEO, &tv, sizeof(tv));
-#endif /* WIN32 */
+#endif /* _WIN32 */
fputs("STATE: -connecting-to-device\n", stderr);
_cupsLangPrintFilter(stderr, "INFO", _("Connected to printer."));
#include <sys/types.h>
#include <sys/stat.h>
-#ifdef WIN32
+#ifdef _WIN32
# include <winsock.h>
#else
# include <unistd.h>
# include <netinet/in.h>
# include <arpa/inet.h>
# include <netdb.h>
-#endif /* WIN32 */
+#endif /* _WIN32 */
/*
*/
#include <cups/string-private.h>
-#ifdef WIN32
+#ifdef _WIN32
# include <io.h>
#else
# include <unistd.h>
# include <fcntl.h>
-#endif /* WIN32 */
+#endif /* _WIN32 */
#include "ieee1284.c"
#include "backend-private.h"
-#ifdef WIN32
+#ifdef _WIN32
# include <io.h>
#else
# include <unistd.h>
# include <fcntl.h>
# include <termios.h>
-#endif /* WIN32 */
+#endif /* _WIN32 */
/*
# include <time.h>
# include <sys/stat.h>
-# ifdef WIN32
+# ifdef _WIN32
# include <direct.h>
# include <io.h>
# else
# include <unistd.h>
-# endif /* WIN32 */
+# endif /* _WIN32 */
# include <cups/cups.h>
# include <cups/array.h>
#include "data/epson.h"
#include "data/hp.h"
#include "data/label.h"
-#ifndef WIN32
+#ifndef _WIN32
# include <sys/utsname.h>
-#endif // !WIN32
+#endif // !_WIN32
//
vars->add(new ppdcVariable("CUPS_VERSION_MINOR", MAKE_STRING(CUPS_VERSION_MINOR)));
vars->add(new ppdcVariable("CUPS_VERSION_PATCH", MAKE_STRING(CUPS_VERSION_PATCH)));
-#ifdef WIN32
+#ifdef _WIN32
vars->add(new ppdcVariable("PLATFORM_NAME", "Windows"));
vars->add(new ppdcVariable("PLATFORM_ARCH", "X86"));
vars->add(new ppdcVariable("PLATFORM_NAME", "unknown"));
vars->add(new ppdcVariable("PLATFORM_ARCH", "unknown"));
}
-#endif // WIN32
+#endif // _WIN32
if (f)
read_file(f, ffp);
#include <sys/stat.h>
#include <sys/wait.h>
-#ifdef WIN32
+#ifdef _WIN32
# include <direct.h>
#else
# include <unistd.h>
-#endif /* WIN32 */
+#endif /* _WIN32 */
#include "mime.h"
break;
case MIME_MAGIC_LOCALE :
-#if defined(WIN32) || defined(__EMX__) || defined(__APPLE__)
+#if defined(_WIN32) || defined(__EMX__) || defined(__APPLE__)
result = !strcmp(rules->value.localev, setlocale(LC_ALL, ""));
#else
result = !strcmp(rules->value.localev, setlocale(LC_MESSAGES, ""));
#include <cups/ppd-private.h>
#include <cups/raster.h>
#include <math.h>
-#ifdef WIN32
+#ifdef _WIN32
# define X_OK 0
-#endif /* WIN32 */
+#endif /* _WIN32 */
/*
#define _CUPS_NO_DEPRECATED
#include <cups/cups-private.h>
-#ifdef WIN32
+#ifdef _WIN32
# include <process.h>
# include <sys/timeb.h>
#else
# include <sys/wait.h>
-#endif /* WIN32 */
+#endif /* _WIN32 */
#include <regex.h>
#ifdef HAVE_DNSSD
# include <dns_sd.h>
# define kDNSServiceMaxDomainName AVAHI_DOMAIN_NAME_MAX
#endif /* HAVE_DNSSD */
-#ifndef WIN32
+#ifndef _WIN32
extern char **environ; /* Process environment variables */
-#endif /* !WIN32 */
+#endif /* !_WIN32 */
/*
case kDNSServiceErr_PollingMode :
return ("Service polling mode error.");
-#ifndef WIN32
+#ifndef _WIN32
case kDNSServiceErr_Timeout :
return ("Service timeout.");
-#endif /* !WIN32 */
+#endif /* !_WIN32 */
}
# elif defined(HAVE_AVAHI)
int i, /* Looping var */
myenvc, /* Number of environment variables */
status; /* Exit status of program */
-#ifndef WIN32
+#ifndef _WIN32
char program[1024]; /* Program to execute */
int pid; /* Process ID */
-#endif /* !WIN32 */
+#endif /* !_WIN32 */
/*
myargv[i] = strdup(args[i]);
}
-#ifdef WIN32
+#ifdef _WIN32
if (getenv("IPPFIND_DEBUG"))
{
printf("\nProgram:\n %s\n", args[0]);
while (wait(&status) != pid)
;
}
-#endif /* WIN32 */
+#endif /* _WIN32 */
/*
* Free memory...
if (getenv("IPPFIND_DEBUG"))
{
-#ifdef WIN32
+#ifdef _WIN32
printf("Exit Status: %d\n", status);
#else
if (WIFEXITED(status))
printf("Exit Status: %d\n", WEXITSTATUS(status));
else
printf("Terminating Signal: %d\n", WTERMSIG(status));
-#endif /* WIN32 */
+#endif /* _WIN32 */
}
return (status == 0);
static double
get_time(void)
{
-#ifdef WIN32
+#ifdef _WIN32
struct _timeb curtime; /* Current Windows time */
_ftime(&curtime);
return (0.0);
else
return (curtime.tv_sec + 0.000001 * curtime.tv_usec);
-#endif /* WIN32 */
+#endif /* _WIN32 */
}
#include <limits.h>
#include <sys/stat.h>
-#ifdef WIN32
+#ifdef _WIN32
# include <fcntl.h>
# include <io.h>
# include <process.h>
# include <sys/fcntl.h>
# include <sys/wait.h>
# include <poll.h>
-#endif /* WIN32 */
+#endif /* _WIN32 */
#ifdef HAVE_DNSSD
# include <dns_sd.h>
if (!port)
{
-#ifdef WIN32
+#ifdef _WIN32
/*
* Windows is almost always used as a single user system, so use a default
* port number of 8631.
*/
port = 8000 + ((int)getuid() % 1000);
-#endif /* WIN32 */
+#endif /* _WIN32 */
fprintf(stderr, "Listening on port %d.\n", port);
}
{
const char *tmpdir; /* Temporary directory */
-#ifdef WIN32
+#ifdef _WIN32
if ((tmpdir = getenv("TEMP")) == NULL)
tmpdir = "C:/TEMP";
#elif defined(__APPLE__) && !TARGET_OS_IOS
#else
if ((tmpdir = getenv("TMPDIR")) == NULL)
tmpdir = "/tmp";
-#endif /* WIN32 */
+#endif /* _WIN32 */
snprintf(directory, sizeof(directory), "%s/ippserver.%d", tmpdir, (int)getpid());
{
int i, j; /* Looping vars */
_ipp_printer_t *printer; /* Printer */
-#ifndef WIN32
+#ifndef _WIN32
char path[1024]; /* Full path to command */
-#endif /* !WIN32 */
+#endif /* !_WIN32 */
char uri[1024], /* Printer URI */
#ifdef HAVE_SSL
securi[1024], /* Secure printer URI */
};
-#ifndef WIN32
+#ifndef _WIN32
/*
* If a command was specified, make sure it exists and is executable...
*/
command = path;
}
}
-#endif /* !WIN32 */
+#endif /* !_WIN32 */
/*
* Allocate memory for the printer...
* Filter attributes as needed...
*/
-#ifndef WIN32 /* Avoid MS compiler bug */
+#ifndef _WIN32 /* Avoid MS compiler bug */
(void)dst;
-#endif /* !WIN32 */
+#endif /* !_WIN32 */
ipp_tag_t group = ippGetGroupTag(attr);
const char *name = ippGetName(attr);
ipp_attribute_t *attr; /* Job attribute */
char val[1280], /* IPP_NAME=value */
*valptr; /* Pointer into string */
-#ifndef WIN32
+#ifndef _WIN32
int mypipe[2]; /* Pipe for stderr */
char line[2048], /* Line from stderr */
*ptr, /* Pointer into line */
*endptr; /* End of line */
ssize_t bytes; /* Bytes read */
-#endif /* !WIN32 */
+#endif /* !_WIN32 */
fprintf(stderr, "Running command \"%s %s\".\n", job->printer->command,
job->filename);
* Now run the program...
*/
-#ifdef WIN32
+#ifdef _WIN32
status = _spawnvpe(_P_WAIT, job->printer->command, myargv, myenvp);
#else
while (wait(&status) < 0);
# endif /* HAVE_WAITPID */
}
-#endif /* WIN32 */
+#endif /* _WIN32 */
if (status)
{
-#ifndef WIN32
+#ifndef _WIN32
if (WIFEXITED(status))
-#endif /* !WIN32 */
+#endif /* !_WIN32 */
fprintf(stderr, "Command \"%s\" exited with status %d.\n",
job->printer->command, WEXITSTATUS(status));
-#ifndef WIN32
+#ifndef _WIN32
else
fprintf(stderr, "Command \"%s\" terminated with signal %d.\n",
job->printer->command, WTERMSIG(status));
-#endif /* !WIN32 */
+#endif /* !_WIN32 */
job->state = IPP_JSTATE_ABORTED;
}
else if (status < 0)
#include <cups/file-private.h>
#include <regex.h>
#include <sys/stat.h>
-#ifdef WIN32
+#ifdef _WIN32
# include <windows.h>
# ifndef R_OK
# define R_OK 0
#else
# include <signal.h>
# include <termios.h>
-#endif /* WIN32 */
+#endif /* _WIN32 */
#ifndef O_BINARY
# define O_BINARY 0
#endif /* !O_BINARY */
static void print_xml_header(_cups_testdata_t *data);
static void print_xml_string(cups_file_t *outfile, const char *element, const char *s);
static void print_xml_trailer(_cups_testdata_t *data, int success, const char *message);
-#ifndef WIN32
+#ifndef _WIN32
static void sigterm_handler(int sig);
-#endif /* WIN32 */
+#endif /* _WIN32 */
static int timeout_cb(http_t *http, void *user_data);
static int token_cb(_ipp_file_t *f, _ipp_vars_t *vars, _cups_testdata_t *data, const char *token);
static void usage(void) _CUPS_NORETURN;
/* Global data */
-#ifndef WIN32
+#ifndef _WIN32
/*
* Catch SIGINT and SIGTERM...
*/
signal(SIGINT, sigterm_handler);
signal(SIGTERM, sigterm_handler);
-#endif /* !WIN32 */
+#endif /* !_WIN32 */
/*
* Initialize the locale and variables...
snprintf(filename, sizeof(filename), "%s.gz", argv[i]);
if (access(filename, 0) && filename[0] != '/'
-#ifdef WIN32
+#ifdef _WIN32
&& (!isalpha(filename[0] & 255) || filename[1] != ':')
-#endif /* WIN32 */
+#endif /* _WIN32 */
)
{
snprintf(filename, sizeof(filename), "%s/ipptool/%s", cg->cups_datadir, argv[i]);
}
if (access(argv[i], 0) && argv[i][0] != '/'
-#ifdef WIN32
+#ifdef _WIN32
&& (!isalpha(argv[i][0] & 255) || argv[i][1] != ':')
-#endif /* WIN32 */
+#endif /* _WIN32 */
)
{
snprintf(testname, sizeof(testname), "%s/ipptool/%s", cg->cups_datadir, argv[i]);
}
if (!Cancel && status == HTTP_STATUS_ERROR && httpError(data->http) != EINVAL &&
-#ifdef WIN32
+#ifdef _WIN32
httpError(data->http) != WSAETIMEDOUT)
#else
httpError(data->http) != ETIMEDOUT)
-#endif /* WIN32 */
+#endif /* _WIN32 */
{
if (httpReconnect2(data->http, 30000, NULL))
data->prev_pass = 0;
}
if (!Cancel && status == HTTP_STATUS_ERROR && httpError(data->http) != EINVAL &&
-#ifdef WIN32
+#ifdef _WIN32
httpError(data->http) != WSAETIMEDOUT)
#else
httpError(data->http) != ETIMEDOUT)
-#endif /* WIN32 */
+#endif /* _WIN32 */
{
if (httpReconnect2(data->http, 30000, NULL))
data->prev_pass = 0;
*dstptr = '\0';
}
else if (!access(src, R_OK) || *src == '/'
-#ifdef WIN32
+#ifdef _WIN32
|| (isalpha(*src & 255) && src[1] == ':')
-#endif /* WIN32 */
+#endif /* _WIN32 */
)
{
/*
static void
pause_message(const char *message) /* I - Message */
{
-#ifdef WIN32
+#ifdef _WIN32
HANDLE tty; /* Console handle */
DWORD mode; /* Console mode */
char key; /* Key press */
close(tty);
return;
}
-#endif /* WIN32 */
+#endif /* _WIN32 */
/*
* Display the prompt...
cupsFilePrintf(cupsFileStdout(), "%s\n---- PRESS ANY KEY ----", message);
-#ifdef WIN32
+#ifdef _WIN32
/*
* Read a key...
*/
tcsetattr(tty, TCSAFLUSH, &original);
close(tty);
-#endif /* WIN32 */
+#endif /* _WIN32 */
/*
* Erase the "press any key" prompt...
}
-#ifndef WIN32
+#ifndef _WIN32
/*
* 'sigterm_handler()' - Handle SIGINT and SIGTERM.
*/
signal(SIGINT, SIG_DFL);
signal(SIGTERM, SIG_DFL);
}
-#endif /* !WIN32 */
+#endif /* !_WIN32 */
/*