=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/mandoc/mandoc_aux.c,v retrieving revision 1.1 retrieving revision 1.2 diff -c -r1.1 -r1.2 *** src/usr.bin/mandoc/mandoc_aux.c 2014/03/21 22:17:01 1.1 --- src/usr.bin/mandoc/mandoc_aux.c 2014/03/21 22:52:21 1.2 *************** *** 1,6 **** ! /* $Id: mandoc_aux.c,v 1.1 2014/03/21 22:17:01 schwarze Exp $ */ /* * Copyright (c) 2009, 2011 Kristaps Dzonsons * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above --- 1,7 ---- ! /* $Id: mandoc_aux.c,v 1.2 2014/03/21 22:52:21 schwarze Exp $ */ /* * Copyright (c) 2009, 2011 Kristaps Dzonsons + * Copyright (c) 2014 Ingo Schwarze * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above *************** *** 16,27 **** --- 17,46 ---- */ #include + #include #include #include #include #include "mandoc.h" #include "mandoc_aux.h" + + int + mandoc_asprintf(char **dest, const char *fmt, ...) + { + va_list ap; + int ret; + + va_start(ap, fmt); + ret = vasprintf(dest, fmt, ap); + va_end(ap); + + if (-1 == ret) { + perror(NULL); + exit((int)MANDOCLEVEL_SYSERR); + } + return(ret); + } void * mandoc_calloc(size_t num, size_t size)