Sélectionner une révision Git
write.c 9,63 Kio
#define _POSIX_C_SOURCE 200809L
#define _DEFAULT_SOURCE
#include <lektor/mkv.h>
#include <pcre.h>
#include <stdbool.h>
#include <stdio.h>
#include <unistd.h>
#include <limits.h>
#include <dirent.h>
#include <string.h>
#include <stdlib.h>
#include <errno.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <sys/wait.h>
static const char *METADATA_TEMPLATE =
" <?xml version=\"1.0\" encoding=\"UTF-8\"?> "
" <Tags> "
" <Tag> "
" <Targets> "
" <TargetTypeValue>70</TargetTypeValue> "
" </Targets> "
" <Simple> "
" <Name>TITLE</Name> "
" <String>%s</String> "
" </Simple> "
" </Tag> "
" <Tag> "
" <Simple> "
" <Name>TITLE</Name> "
" <String>%s</String> "
" </Simple> "
" <Simple> "
" <Name>CONTENT_TYPE</Name> "
" <String>%s</String> "
" </Simple> "
" <Simple> "
" <Name>ADDRESS</Name> "
" <String>%s</String> "
" </Simple> "
" <Simple> "
" <Name>ARTIST</Name> "
" <String>%s</String> "
" </Simple> "
" <Simple> "
" <Name>GENRE</Name> "
" <String>%s</String> "
" </Simple> "
" <Simple> "
" <Name>TRACK</Name> "
" <String>%d</String> "
" </Simple> "
" </Tag> "
" </Tags> ";
static bool
mkvpropedit__(const char *const args[])
{
pid_t pid;
int wstatus, status, fd;
if ((pid = fork()) == 0) {
if ((fd = open("/dev/null", O_WRONLY | O_TRUNC)) < 0) {
fprintf(stderr, " ! call_mkvpropedit: can't to open /dev/null in O_WRONLY O_TRUNC\n");
return false;
}
if (dup2(fd, 1) < 0) {