#endif /* if 0 */
/* ¥×¥í¥¥·¥µ¡¼¥Ð¤Î¥¢¥É¥ì¥¹¤ò¤ò¥Õ¥¡¥¤¥ë¤«¤éÆɤó¤ÇÀßÄꤹ¤ë */
-static void set_proxy(void)
+void set_proxy(char *default_url, int default_port)
{
char buf[1024];
size_t len;
if (!fp)
{
- /* ¥Õ¥¡¥¤¥ë¤¬Â¸ºß¤·¤Ê¤¤¾ì¹ç¤Ïdefine.hÆâ¤Î¥Ç¥Õ¥©¥ë¥È¤òÀßÄê */
- proxy = (char *)HTTP_PROXY;
- proxy_port = HTTP_PROXY_PORT;
+ /* ¥Õ¥¡¥¤¥ë¤¬Â¸ºß¤·¤Ê¤¤¾ì¹ç¤Ï¥Ç¥Õ¥©¥ë¥È¤òÀßÄê */
+ proxy = default_url;
+ proxy_port = default_port;
return;
}
else
{
strcpy(proxy, s);
- proxy_port = HTTP_PROXY_PORT;
+ proxy_port = default_port;
}
/* ¥×¥í¥¥·¤Î¥¢¥É¥ì¥¹¤òproxy¤Ë¥³¥Ô¡¼ */
int soc_write(int sd, char *buf, size_t sz)
{
#ifndef MACINTOSH
-#ifndef WINDOWS
- write(sd, buf, sz);
-#else
int nleft, nwritten;
-
+
nleft = sz;
while (nleft > 0) {
nleft -= nwritten;
buf += nwritten;
}
-#endif
#else /* !MACINTOSH */
OTResult bytesSent;
#endif
#if !defined(WINDOWS) && !defined(MACINTOSH)
-static jmp_buf env;
+static sigjmp_buf env;
static void (*sig_int_saved)(int);
static void (*sig_alm_saved)(int);
#endif
#endif
+/* ¥µ¡¼¥Ð¤Ë¥³¥Í¥¯¥È¤¹¤ë´Ø¿ô¡£ */
+int connect_server(int timeout, const char *host, int port)
#ifndef MACINTOSH
-/* ¥µ¡¼¥Ð¤Ë¥³¥Í¥¯¥È¤¹¤ë´Ø¿ô¡£ Win, unix */
-static int connect_server(int timeout, const char *host, int port)
{
int sd;
struct sockaddr_in to;
#ifndef WINDOWS
if ((sd = socket(PF_INET, SOCK_STREAM, 0)) < 0)
- {
-#ifdef JP
- errstr = "¥¨¥é¡¼: ¥½¥±¥Ã¥È¤òÀ¸À®¤Ç¤¤Þ¤»¤ó";
-#else
- errstr = "Error : cannot create socket.";
-#endif
- restore_signal();
- return -1;
- }
#else
if ((sd = socket(PF_INET, SOCK_STREAM, 0)) == INVALID_SOCKET)
+#endif
{
#ifdef JP
errstr = "¥¨¥é¡¼: ¥½¥±¥Ã¥È¤òÀ¸À®¤Ç¤¤Þ¤»¤ó";
restore_signal();
return -1;
}
-#endif
if (connect(sd, (struct sockaddr *)&to, sizeof(to)) < 0)
{
#else /* !MACINTOSH */
-/* ¥µ¡¼¥Ð¤Ë¥³¥Í¥¯¥È¤¹¤ë´Ø¿ô¡£ Mac */
-static int connect_server(int timeout, const char *host, int port)
+ /* ¥µ¡¼¥Ð¤Ë¥³¥Í¥¯¥È¤¹¤ë´Ø¿ô¡£ Mac */
{
OSStatus err;
InetHostInfo response;
}
#endif
-int connect_scoreserver(void)
-{
- /* ¥×¥í¥¥·¤òÀßÄꤹ¤ë */
- set_proxy();
-
- return connect_server(HTTP_TIMEOUT, SCORE_SERVER, SCORE_PORT);
-}
int disconnect_server(int sd)
{