src/libs/mpv/mpv.c
/*
 * mpv_fmt_cmd -- like printf.  Takes a format string and variable arguments, formats
 * the message and sends via mpv_cmd.
 */
- like printf.  Takes a format string and variable arguments, formats
the message and sends via mpv_cmd.
- like printf . Takes a format string and variable arguments formats the message and sends via mpv_cmd .
int mpv_fmt_cmd(char* fmt, ...) {
  va_list ap;
  char* p = NULL;
  int size = 0;
  va_start(ap, fmt);
  size = vsnprintf(p, size, fmt, ap);
  va_end(ap);
  if (size < 0)
    return -1;
  ++size;                       
  p = malloc(size);
  if (!p)
    return -1;
  va_start(ap, fmt);
  size = vsnprintf(p,size,fmt,ap);
  va_end(ap);
  if (size < 0) {
    free(p);
    return -1;
  }
  return mpv_cmd(p);
}
int mpv_fmt_cmd ( char * fmt , ... ) { va_list ap ; char * p = NULL ; int size = 0 ; va_start ( ap , fmt ) ; size = vsnprintf ( p , size , fmt , ap ) ; va_end ( ap ) ; if ( size < 0 ) return -1 ; ++ size ; p = malloc ( size ) ; if ( ! p ) return -1 ; va_start ( ap , fmt ) ; size = vsnprintf ( p , size , fmt , ap ) ; va_end ( ap ) ; if ( size < 0 ) { free ( p ) ; return -1 ; } return mpv_cmd ( p ) ; }
mpv_fmt_cmd -- like printf.
mpv_fmt_cmd -- like printf .
/* for '\0' */