source: rtems/cpukit/libmisc/shell/write_file.c

Last change on this file was 5f8c41c, checked in by Joel Sherrill <joel@…>, on 04/01/22 at 18:18:49

Update email address of Fernando Ruiz Casas to <fruizcasas@…>

This was requested to be executed prior to relicensing to BSD-2.

  • Property mode set to 100644
File size: 689 bytes
Line 
1/**
2 * @file
3 *
4 * @brief Write buffer to a file
5 */
6
7/*
8 * Copyright (c) 2001 Fernando Ruiz Casas <fruizcasas@gmail.com>
9 *
10 *  The license and distribution terms for this file may be
11 *  found in the file LICENSE in this distribution or at
12 *  http://www.rtems.org/license/LICENSE.
13 */
14
15#ifdef HAVE_CONFIG_H
16#include "config.h"
17#endif
18
19#include <stdio.h>
20#include <unistd.h>
21#include <string.h>
22
23#include <rtems/shell.h>
24
25void rtems_shell_write_file(
26  const char *name,
27  const char *content
28)
29{
30  FILE * fd;
31
32  fd = fopen(name,"w");
33  if ( !fd ) {
34    fprintf( stderr, "Unable to write %s\n", name );
35  }
36
37  if (fd) {
38    fwrite(content,1,strlen(content),fd);
39    fclose(fd);
40  }
41}
42
43
Note: See TracBrowser for help on using the repository browser.