Mirror of :pserver:cvs@cvs.fefe.de:/cvs libowfat https://www.fefe.de/libowfat/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

30 lines
659 B

  1. #include <stdarg.h>
  2. #include <sys/uio.h>
  3. #include "errmsg.h"
  4. #include "str.h"
  5. /* the people who defined stdarg.h need to be taken behind the barn and shot */
  6. int errmsg_cvt(struct iovec* x,const char* message, va_list a) {
  7. int i,j;
  8. j=0;
  9. if (argv0) {
  10. x[0].iov_base=(char*)argv0;
  11. x[0].iov_len=str_len(argv0);
  12. x[1].iov_base=": ";
  13. x[1].iov_len=2;
  14. j=2;
  15. }
  16. x[j].iov_base=(char*)message; x[j].iov_len=str_len(message); ++j;
  17. for (i=0; j<22; ++i) {
  18. const char* t=va_arg(a,const char*);
  19. if (!t) break;
  20. x[j].iov_base=(char*)t;
  21. x[j].iov_len=str_len(t);
  22. ++j;
  23. }
  24. x[j].iov_base="\n";
  25. x[j].iov_len=1;
  26. return j+1;
  27. }