summaryrefslogtreecommitdiff
path: root/generic
diff options
context:
space:
mode:
authorPixel <Pixel>2002-08-15 22:15:20 +0000
committerPixel <Pixel>2002-08-15 22:15:20 +0000
commit020a28c534544c0f1710f8af1e4b295fddcad66a (patch)
tree9f9d25920c9ad6e023f5cb6d87f00cd78db86d60 /generic
parentd962e8d2d650c7b297dcd041b55060bc29996a93 (diff)
Working...
Diffstat (limited to 'generic')
-rw-r--r--generic/Handle.cpp2
-rw-r--r--generic/Input.cpp5
-rw-r--r--generic/Output.cpp12
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;
}