X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=secnet.git;a=blobdiff_plain;f=util.c;h=3e8d56eaebbc50855ed2cde7026b5bf5be7c0767;hp=977e131fbeda106fcaa8fe7964af878ccbe2ebe9;hb=HEAD;hpb=4ab0e4ad32e169bfd9e3af465e5850ccb8520890 diff --git a/util.c b/util.c index 977e131..3e8d56e 100644 --- a/util.c +++ b/util.c @@ -183,15 +183,6 @@ char *write_mpstring(MP_INT *a) return buff; } -int32_t write_mpbin(MP_INT *a, uint8_t *buffer, int32_t buflen) -{ - char *hb = write_mpstring(a); - int32_t len; - hex_decode(buffer, buflen, &len, hb, True); - free(hb); - return len; -} - #define DEFINE_SETFDFLAG(fn,FL,FLAG) \ void fn(int fd) { \ int r=fcntl(fd, F_GET##FL); \ @@ -723,6 +714,15 @@ const char *pollbadbit(int revents) return 0; } +void pathprefix_template_init(struct pathprefix_template *out, + const char *prefix, int maxsuffix) +{ + size_t l=strlen(prefix); + NEW_ARY(out->buffer,l+maxsuffix+1); + strcpy(out->buffer,prefix); + out->write_here=out->buffer+l; +} + enum async_linebuf_result async_linebuf_read(struct pollfd *pfd, struct buffer_if *buf, const char **emsg_out)