xref: /optee_os/lib/libutils/isoc/fwrite.c (revision 9756bcc46d64a1631546811382b397068af73c44)
1 // SPDX-License-Identifier: BSD-2-Clause
2 /*
3  * Copyright (c) 2020, Huawei Technologies Co., Ltd
4  */
5 
6 #include <stdio.h>
7 #include <stdlib.h>
8 #include <unistd.h>
9 
10 size_t fwrite(const void *ptr, size_t size, size_t nmemb, FILE *stream)
11 {
12 	int fd = 0;
13 
14 	if (stream == stdout)
15 		fd = 1;
16 	else if (stream == stderr)
17 		fd = 2;
18 	else
19 		abort();
20 
21 	return write(fd, ptr, size * nmemb);
22 }
23