2008-05-19 08:18:50 +00:00
|
|
|
/* vi: set sw=4 ts=4: */
|
|
|
|
/*
|
|
|
|
* Utility routines.
|
|
|
|
*
|
2008-09-25 12:13:34 +00:00
|
|
|
* Copyright (C) 2008 Bernhard Reutner-Fischer
|
2008-05-19 08:18:50 +00:00
|
|
|
*
|
|
|
|
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "libbb.h"
|
|
|
|
|
|
|
|
/* Open file and write string str to it, close file.
|
2009-03-09 00:12:37 +00:00
|
|
|
* Die on any open or write error. */
|
2008-06-27 02:52:20 +00:00
|
|
|
void FAST_FUNC xopen_xwrite_close(const char* file, const char* str)
|
2008-05-19 08:18:50 +00:00
|
|
|
{
|
|
|
|
int fd = xopen(file, O_WRONLY);
|
2009-03-09 00:12:37 +00:00
|
|
|
xwrite_str(fd, str);
|
2008-05-19 08:18:50 +00:00
|
|
|
close(fd);
|
|
|
|
}
|