X-Git-Url: http://dolda2000.com/gitweb/?a=blobdiff_plain;f=lib%2Fuilib.c;h=48b3eed1470846a81a182bbddd59eb06a7f19008;hb=312c174ec00d1722845a67a135f6c54325dfa3aa;hp=b235105061f018a1584e3b312839e8004b9dd22b;hpb=302a260054ea38d3cb97be6d1a3010082c09265d;p=doldaconnect.git diff --git a/lib/uilib.c b/lib/uilib.c index b235105..48b3eed 100644 --- a/lib/uilib.c +++ b/lib/uilib.c @@ -58,6 +58,7 @@ #define RESP_STR 1 #define RESP_INT 2 #define RESP_FLOAT 3 +#define RESP_LNUM 4 struct respclass { @@ -212,8 +213,10 @@ static struct qcmd *makeqcmd(wchar_t *name) 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++; @@ -474,6 +477,9 @@ int dc_queuecmd(int (*callback)(struct dc_response *), void *data, ...) { 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); @@ -497,6 +503,7 @@ int dc_queuecmd(int (*callback)(struct dc_response *), void *data, ...) } else { if(buf != NULL) free(buf); + errno = EINVAL; return(-1); } } else { @@ -1369,6 +1376,12 @@ struct dc_intresp *dc_interpret(struct dc_response *resp) 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++;