Files
rtems/cpukit/libmisc/shell/write_file.c
Ralf Corsepius 94547d1d8b 2011-12-04 Ralf Corsépius <ralf.corsepius@rtems.org>
* libmisc/shell/print-ls.c: Include "internal.h".
	* libmisc/shell/pwcache.c: Make user_from_uid static.
	* libmisc/shell/shell.c: Make rtems_shell_init_env,
	rtems_shell_env_free, rtems_shell_line_editor,
	rtems_shell_init_issue, rtems_shell_task static.
	* libmisc/shell/shell_cmdset.c: Make rtems_shell_add_topic static.
	* libmisc/shell/shell_makeargs.c: Include <rtems/shell.h>.
	* libmisc/shell/write_file.c: Include <rtems/shell.h>.
2011-12-04 11:57:51 +00:00

46 lines
697 B
C

/*
*
* Write buffer to a file
*
* Author:
*
* WORK: fernando.ruiz@ctv.es
* HOME: correo@fernando-ruiz.com
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rtems.com/license/LICENSE.
*
* $Id$
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <rtems/shell.h>
void rtems_shell_write_file(
const char *name,
const char *content
)
{
FILE * fd;
fd = fopen(name,"w");
if ( !fd ) {
fprintf( stderr, "Unable to write %s\n", name );
}
if (fd) {
fwrite(content,1,strlen(content),fd);
fclose(fd);
}
}