/*
* Dolda Connect - Modular multiuser Direct Connect-style client
- * Copyright (C) 2004 Fredrik Tolf (fredrik@dolda2000.com)
+ * Copyright (C) 2004 Fredrik Tolf <fredrik@dolda2000.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#include <netdb.h>
#include <sys/poll.h>
#include <pwd.h>
+#include <stdint.h>
#ifdef HAVE_RESOLVER
#include <arpa/nameser.h>
#include <resolv.h>
#define RESP_STR 1
#define RESP_INT 2
#define RESP_FLOAT 3
+#define RESP_LNUM 4
struct respclass
{
int family;
int sentcreds;
} servinfo;
-char *dc_srv_local;
+char dc_srv_local_addr;
+char *dc_srv_local = &dc_srv_local_addr;
static void message(int bits, char *format, ...)
{
if((cmd->name != NULL) && !wcscmp(cmd->name, name))
break;
}
- if(cmd == NULL)
+ if(cmd == NULL) {
+ errno = ENOSYS; /* Bleh */
return(NULL);
+ }
}
new = smalloc(sizeof(*new));
new->tag = tag++;
{
if((ichandle = iconv_open("wchar_t", "utf-8")) == (iconv_t)-1)
return(-1);
- dc_srv_local = sstrdup("");
initcmds();
return(0);
}
{
freepart = 1;
part = swprintf2(L"%i", va_arg(al, int));
+ } else if(!wcscmp(tpart, L"li")) {
+ freepart = 1;
+ part = swprintf2(L"%ji", (intmax_t)va_arg(al, dc_lnum_t));
} else if(!wcscmp(tpart, L"s")) {
freepart = 1;
part = icmbstowcs(sarg = va_arg(al, char *), NULL);
return(-1);
}
} else if(!wcscmp(tpart, L"ls")) {
+ freepart = 0;
part = va_arg(al, wchar_t *);
} else if(!wcscmp(tpart, L"ll")) {
freepart = 1;
} else {
if(buf != NULL)
free(buf);
+ errno = EINVAL;
return(-1);
}
} else {
iresp->argv[iresp->argc].type = cls->wordt[i];
iresp->argc++;
break;
+ case RESP_LNUM:
+ sizebuf(&(iresp->argv), &args, iresp->argc + 1, sizeof(*(iresp->argv)), 1);
+ iresp->argv[iresp->argc].val.lnum = wcstoll(resp->rlines[resp->curline].argv[i + 1], NULL, 0);
+ iresp->argv[iresp->argc].type = cls->wordt[i];
+ iresp->argc++;
+ break;
}
}
resp->curline++;