Ejemplo n.º 1
0
#include "../internal.h"
#include <errno.h>
#include <fcntl.h>
#include <assert.h>

FILE *fopen(const char *restrict filename, const char *restrict mode) {
	int flags = translateFlags(mode);
	if (flags == -1) {
		errno = EINVAL;
		return NULL;
	}

	int fd = open(filename, flags, 0);
	if (fd == -1)return 0;

	FILE* f = fdopen(fd, mode);
	if (!f) {
		assert(0);
	}

	return f;
}
Ejemplo n.º 2
0
AutoStr* Uri_Compose2(Uri const* uri, int flags)
{
    SELF_CONST(uri);
    return AutoStr_FromTextStd(self->compose(translateFlags(flags)).toUtf8().constData());
}