Build fixes for Haiku - is this WIN32 stuff really needed, or can we get rid of it?
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19022 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
d2ae268f24
commit
8c603fe7c6
@ -3,6 +3,9 @@
|
||||
|
||||
#ifdef WIN32
|
||||
# include <winsock.h>
|
||||
#elif defined(__HAIKU__)
|
||||
# include <sys/socket.h>
|
||||
# include <netinet/in.h>
|
||||
#else
|
||||
# include <net/socket.h>
|
||||
#endif
|
||||
@ -976,7 +979,7 @@ bool IppContent::fail() const
|
||||
|
||||
bool IppContent::good() const
|
||||
{
|
||||
return (IPP_SUCCESSFUL_OK_S <= operation_id) && (operation_id <= IPP_SUCCESSFUL_OK_E);
|
||||
return /*operation_id >= IPP_SUCCESSFUL_OK_S &&*/ operation_id <= IPP_SUCCESSFUL_OK_E;
|
||||
}
|
||||
|
||||
bool IppContent::operator !() const
|
||||
|
@ -1,11 +1,12 @@
|
||||
// Sun, 18 Jun 2000
|
||||
// Y.Takagi
|
||||
|
||||
#include <Alert.h>
|
||||
#include <DataIO.h>
|
||||
#include <Message.h>
|
||||
#include <Directory.h>
|
||||
#include <net/netdb.h>
|
||||
#include <Alert.h>
|
||||
|
||||
#include <pwd.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
|
||||
@ -56,10 +57,11 @@ IppTransport::IppTransport(BMessage *msg)
|
||||
}
|
||||
dir.WriteAttr(IPP_JOB_ID, B_INT32_TYPE, 0, &__jobid, sizeof(__jobid));
|
||||
|
||||
getusername(__user, sizeof(__user));
|
||||
if (__user[0] == '\0') {
|
||||
struct passwd *pwd = getpwuid(geteuid());
|
||||
if (pwd != NULL && pwd->pw_name != NULL && pwd->pw_name[0])
|
||||
strcpy(__user, pwd->pw_name);
|
||||
else
|
||||
strcpy(__user, "baron");
|
||||
}
|
||||
|
||||
sprintf(__file, "%s/%s@ipp.%ld", spool_path, __user, __jobid);
|
||||
|
||||
|
@ -6,7 +6,11 @@
|
||||
#include <ostream>
|
||||
#include <cstring>
|
||||
#else
|
||||
#ifdef __HAIKU__
|
||||
# include <sys/socket.h>
|
||||
#else
|
||||
# include <net/socket.h>
|
||||
#endif
|
||||
#include <ostream.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
@ -1,11 +1,13 @@
|
||||
// Sun, 18 Jun 2000
|
||||
// Y.Takagi
|
||||
|
||||
#include <Alert.h>
|
||||
#include <DataIO.h>
|
||||
#include <Message.h>
|
||||
#include <Directory.h>
|
||||
#include <net/netdb.h>
|
||||
#include <Alert.h>
|
||||
|
||||
#include <netdb.h>
|
||||
#include <pwd.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <iomanip>
|
||||
@ -33,6 +35,12 @@ LprTransport::LprTransport(BMessage *msg)
|
||||
__jobid = 0;
|
||||
__error = false;
|
||||
|
||||
struct passwd *pwd = getpwuid(geteuid());
|
||||
if (pwd != NULL && pwd->pw_name != NULL && pwd->pw_name[0])
|
||||
strcpy(__user, pwd->pw_name);
|
||||
else
|
||||
strcpy(__user, "baron");
|
||||
|
||||
DUMP_BMESSAGE(msg);
|
||||
|
||||
const char *spool_path = msg->FindString(SPOOL_PATH);
|
||||
@ -58,11 +66,6 @@ LprTransport::LprTransport(BMessage *msg)
|
||||
}
|
||||
dir.WriteAttr(LPR_JOB_ID, B_INT32_TYPE, 0, &__jobid, sizeof(__jobid));
|
||||
|
||||
getusername(__user, sizeof(__user));
|
||||
if (__user[0] == '\0') {
|
||||
strcpy(__user, "baron");
|
||||
}
|
||||
|
||||
sprintf(__file, "%s/%s@ipp.%ld", spool_path, __user, __jobid);
|
||||
|
||||
__fs.open(__file, ios::in | ios::out | ios::binary | ios::trunc);
|
||||
@ -79,14 +82,6 @@ LprTransport::~LprTransport()
|
||||
char hostname[128];
|
||||
gethostname(hostname, sizeof(hostname));
|
||||
|
||||
char username[128];
|
||||
#ifdef WIN32
|
||||
unsigned long length = sizeof(hostname);
|
||||
GetUserName(username, &length);
|
||||
#else
|
||||
getusername(username, sizeof(username));
|
||||
#endif
|
||||
|
||||
ostringstream cfname;
|
||||
cfname << "cfA" << setw(3) << setfill('0') << __jobid << hostname;
|
||||
|
||||
@ -95,7 +90,7 @@ LprTransport::~LprTransport()
|
||||
|
||||
ostringstream cf;
|
||||
cf << 'H' << hostname << '\n';
|
||||
cf << 'P' << username << '\n';
|
||||
cf << 'P' << __user << '\n';
|
||||
cf << 'l' << dfname.str() << '\n';
|
||||
cf << 'U' << dfname.str() << '\n';
|
||||
|
||||
|
@ -5,10 +5,15 @@
|
||||
# include <windows.h>
|
||||
# include <winsock.h>
|
||||
# include <sstream>
|
||||
#else /* BeOS */
|
||||
#include <cerrno>
|
||||
#else
|
||||
# ifdef __HAIKU__
|
||||
# include <sys/socket.h>
|
||||
# include <netdb.h>
|
||||
# else
|
||||
# include <net/socket.h>
|
||||
# include <net/netdb.h>
|
||||
# endif
|
||||
# include <errno.h>
|
||||
# include "_sstream"
|
||||
#endif
|
||||
|
||||
|
@ -4,15 +4,18 @@
|
||||
#ifdef WIN32
|
||||
#include <winsock.h>
|
||||
#else
|
||||
#ifdef __HAIKU__
|
||||
# include <sys/socket.h>
|
||||
#else
|
||||
# include <net/socket.h>
|
||||
#include <net/netdb.h>
|
||||
#ifdef HAVE_ARPA_INET
|
||||
// inet_addr() is not defined in netdb.h anymore under BONE & later
|
||||
#include <arpa/inet.h>
|
||||
#endif
|
||||
#include <netdb.h>
|
||||
#include <arpa/inet.h>
|
||||
#endif // WIN32
|
||||
|
||||
#include <cstdio>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "Socket.h"
|
||||
#include "SocketStream.h"
|
||||
|
||||
|
@ -2,7 +2,11 @@
|
||||
// Y.Takagi
|
||||
|
||||
#ifndef WIN32
|
||||
#ifdef __HAIKU__
|
||||
# include <sys/socket.h>
|
||||
#else
|
||||
# include <net/socket.h>
|
||||
#endif
|
||||
|
||||
#ifdef _DEBUG
|
||||
#include <iostream>
|
||||
|
Loading…
Reference in New Issue
Block a user