From 7fc9c6dfbef57331c8b5eae0943f3fe95f2e63e1 Mon Sep 17 00:00:00 2001 From: pixel Date: Sun, 13 Apr 2003 12:44:14 +0000 Subject: Removing Baltisot from there --- generic/Output.cpp | 101 ----------------------------------------------------- 1 file changed, 101 deletions(-) delete mode 100644 generic/Output.cpp (limited to 'generic/Output.cpp') diff --git a/generic/Output.cpp b/generic/Output.cpp deleted file mode 100644 index b072236..0000000 --- a/generic/Output.cpp +++ /dev/null @@ -1,101 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#include "Output.h" -#include "Exceptions.h" -#ifdef HAVE_CONFIG_H -#include "config.h" -#else -#define _(x) x -#endif - -Output::Output(String no, int create, int trunc) throw (GeneralException) : - Handle(no.strlen() ? open(no.to_charp(), O_WRONLY | (O_CREAT * (create ? 1 : 0)) | (O_TRUNC * (trunc ? 1 : 0)) -#if defined __linux__ || defined __CYGWIN32__ -, 00666 -#endif -) : dup(1)), - n(no) { - if (GetHandle() < 0) { - throw IOGeneral(String(_("Error opening file ")) + no + _(" for writing: ") + strerror(errno)); - } - - size = lseek(GetHandle(), 0, SEEK_END); - lseek(GetHandle(), 0, SEEK_SET); - - struct stat s; - - fstat(GetHandle(), &s); - - date_modif = s.st_mtime; -} - -Output::Output(const Output & o) : Handle(o), n(o.n) { -} - -bool Output::CanWrite() const { - return 1; -} - -bool Output::CanRead() const { - return 0; -} - -bool Output::CanSeek() const { - struct stat s; - - fstat(GetHandle(), &s); - - return S_ISREG(s.st_mode); -} - -off_t Output::seek(off_t offset, int whence) throw (GeneralException) { - if ((itell = lseek(GetHandle(), offset, whence)) < 0) { - throw IOGeneral(String(_("Error seeking file ")) + n + _(": ") + strerror(errno)); - } -#ifdef PARANOID_SEEK - if (itell != lseek(GetHandle(), 0, SEEK_CUR)) { - throw IOGeneral(String(_("Error seeking file ")) + n + _(": the position does not match")); - } -#endif - return itell; -} - -String Output::GetName() const { - return n; -} - -Stdout_t::Stdout_t() {} - -bool Stdout_t::CanSeek() const { - return 0; -} - -String Stdout_t::GetName() const { - return "Stdout"; -} - -Stderr_t::Stderr_t() : Handle(dup(2)) {} - -bool Stderr_t::CanWrite() const { - return 1; -} - -bool Stderr_t::CanRead() const { - return 0; -} - -bool Stderr_t::CanSeek() const { - return 0; -} - -String Stderr_t::GetName() const { - return "Stderr"; -} - -Stdout_t Stdout; -Stderr_t Stderr; -- cgit v1.2.3