]> jfr.im git - solanum.git/blobdiff - librb/src/win32.c
Create configurations for user-facing messages within registration (#238)
[solanum.git] / librb / src / win32.c
index 287016bd1af053c59d8bd9bdd4b95590364cdc5a..6120b9069dca2ec83ac5eedc5a2a45cd6d0373f4 100644 (file)
  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301
  *  USA
  *
- *  $Id: win32.c 26092 2008-09-19 15:13:52Z androsyn $
  */
 
-#include <libratbox_config.h>
-#include <ratbox_lib.h>
+#include <librb_config.h>
+#include <rb_lib.h>
 #include <commio-int.h>
 
 #ifdef _WIN32
@@ -94,7 +93,7 @@ rb_spawn_process(const char *path, const char **argv)
 }
 
 pid_t
-rb_waitpid(int pid, int *status, int flags)
+rb_waitpid(pid_t pid, int *status, int flags)
 {
        DWORD timeout = (flags & WNOHANG) ? 0 : INFINITE;
        HANDLE hProcess;
@@ -152,7 +151,7 @@ rb_setenv(const char *name, const char *value, int overwrite)
 }
 
 int
-rb_kill(int pid, int sig)
+rb_kill(pid_t pid, int sig)
 {
        HANDLE hProcess;
        int ret = -1;
@@ -373,7 +372,7 @@ rb_init_netio_win32(void)
 {
        /* this muchly sucks, but i'm too lazy to do overlapped i/o, maybe someday... -androsyn */
        WNDCLASS wc;
-       static const char *classname = "ircd-ratbox-class";
+       static const char *classname = "solanum-class";
 
        wc.style = 0;
        wc.lpfnWndProc = (WNDPROC) rb_process_events;
@@ -411,22 +410,14 @@ rb_setup_fd_win32(rb_fde_t *F)
                return 0;
 
        SetHandleInformation((HANDLE) F->fd, HANDLE_FLAG_INHERIT, 0);
-       switch (F->type)
-       {
-       case RB_FD_SOCKET:
-               {
-                       u_long nonb = 1;
-                       if(ioctlsocket((SOCKET) F->fd, FIONBIO, &nonb) == -1)
-                       {
-                               rb_get_errno();
-                               return 0;
-                       }
-                       return 1;
+       if (F->type & RB_FD_SOCKET) {
+               unsigned long nonb = 1;
+               if (ioctlsocket((SOCKET) F->fd, FIONBIO, &nonb) == -1) {
+                       rb_get_errno();
+                       return 0;
                }
-       default:
-               return 1;
-
        }
+       return 1;
 }
 
 void
@@ -614,6 +605,15 @@ rb_strerror(int error)
        rb_strlcpy(buf, _rb_strerror(error), sizeof(buf));
        return buf;
 }
+
+const char *
+rb_path_to_self(void)
+{
+       static char path_buf[MAX_PATH];
+       GetModuleFileName(NULL, path_buf, MAX_PATH);
+       return path_buf;
+}
+
 #else /* win32 not supported */
 int
 rb_init_netio_win32(void)
@@ -623,21 +623,21 @@ rb_init_netio_win32(void)
 }
 
 void
-rb_setselect_win32(rb_fde_t *F, unsigned int type, PF * handler, void *client_data)
+rb_setselect_win32(rb_fde_t *F __attribute__((unused)), unsigned int type __attribute__((unused)), PF * handler __attribute__((unused)), void *client_data __attribute__((unused)))
 {
        errno = ENOSYS;
        return;
 }
 
 int
-rb_select_win32(long delay)
+rb_select_win32(long delay __attribute__((unused)))
 {
        errno = ENOSYS;
        return -1;
 }
 
 int
-rb_setup_fd_win32(rb_fde_t *F)
+rb_setup_fd_win32(rb_fde_t *F __attribute__((unused)))
 {
        errno = ENOSYS;
        return -1;