#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)