diff options
Diffstat (limited to 'generic')
| -rw-r--r-- | generic/Handle.cpp | 2 | ||||
| -rw-r--r-- | generic/Input.cpp | 5 | ||||
| -rw-r--r-- | generic/Output.cpp | 12 | 
3 files changed, 16 insertions, 3 deletions
| diff --git a/generic/Handle.cpp b/generic/Handle.cpp index 29b4816..6d02381 100644 --- a/generic/Handle.cpp +++ b/generic/Handle.cpp @@ -10,7 +10,7 @@  #define _(x) x  #endif -Handle::Handle(const Handle & nh) : h(nh.h >= 0 ? dup(nh.h) : nh.h), closed(nh.closed), nonblock(nh.closed), zfile(0), z(0), itell(0) { +Handle::Handle(const Handle & nh) : itell(0), h(nh.h >= 0 ? dup(nh.h) : nh.h), closed(nh.closed), nonblock(nh.closed), zfile(0), z(0) {  //    cerr << "Duplication of handle " << nh.h << " to " << h << endl;      if ((h >= 0) && (nh.z)) {  	SetZ(nh.z); diff --git a/generic/Input.cpp b/generic/Input.cpp index 1cb6e2e..a51ee65 100644 --- a/generic/Input.cpp +++ b/generic/Input.cpp @@ -63,13 +63,14 @@ time_t Input::GetModif() {  off_t Input::seek(off_t offset, int whence) throw (GeneralException) {      if ((itell = lseek(GetHandle(), offset, whence)) < 0) { -	throw IOGereral(String(_("Error seeking file ")) + no + _(": ") + strerror(errno)); +	throw IOGeneral(String(_("Error seeking file ")) + n + _(": ") + strerror(errno));      }  #ifdef PARANOID_SEEK      if (itell != lseek(GetHandle(), 0, SEEK_CUR)) { -	throw IOGereral(String(_("Error seeking file ")) + no + _(": the position does not match")); +	throw IOGeneral(String(_("Error seeking file ")) + n + _(": the position does not match"));      }  #endif +    return itell;  }  Stdin_t::Stdin_t() { } diff --git a/generic/Output.cpp b/generic/Output.cpp index aace79c..72d00cf 100644 --- a/generic/Output.cpp +++ b/generic/Output.cpp @@ -49,6 +49,18 @@ bool Output::CanSeek() {      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() {      return n;  } | 
