brintos

brintos / llvm-project-archived public Read only

0
0
Text · 916 B · 780a40d Raw
29 lines · cpp
1//===-- GPU Implementation of fputs ---------------------------------------===//2//3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.4// See https://llvm.org/LICENSE.txt for license information.5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception6//7//===----------------------------------------------------------------------===//8 9#include "src/stdio/fputs.h"10 11#include "hdr/stdio_macros.h" // for EOF.12#include "hdr/types/FILE.h"13#include "src/__support/CPP/string_view.h"14#include "src/__support/common.h"15#include "src/stdio/gpu/file.h"16 17namespace LIBC_NAMESPACE_DECL {18 19LLVM_LIBC_FUNCTION(int, fputs,20                   (const char *__restrict str, ::FILE *__restrict stream)) {21  cpp::string_view str_view(str);22  auto written = file::write(stream, str, str_view.size());23  if (written != str_view.size())24    return EOF;25  return 0;26}27 28} // namespace LIBC_NAMESPACE_DECL29