summaryrefslogtreecommitdiff
path: root/tools.h
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2000-09-17 08:23:46 +0200
committerKlaus Schmidinger <vdr@tvdr.de>2000-09-17 08:23:46 +0200
commit4716cfb5a1ebae09a8a277b8943d3a885dcf1365 (patch)
tree59394b5784b6ba8cfb83bb5b526f655401bc6253 /tools.h
parent7fbf9e6c49430ca2de4683dc7319aa32d247a0f6 (diff)
downloadvdr-4716cfb5a1ebae09a8a277b8943d3a885dcf1365.tar.gz
vdr-4716cfb5a1ebae09a8a277b8943d3a885dcf1365.tar.bz2
Implemented centralized 'wait for input'
Diffstat (limited to 'tools.h')
-rw-r--r--tools.h25
1 files changed, 21 insertions, 4 deletions
diff --git a/tools.h b/tools.h
index b9f3b6c0..5c749a7c 100644
--- a/tools.h
+++ b/tools.h
@@ -4,16 +4,17 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: tools.h 1.14 2000/09/15 14:23:29 kls Exp $
+ * $Id: tools.h 1.15 2000/09/17 07:58:19 kls Exp $
*/
#ifndef __TOOLS_H
#define __TOOLS_H
#include <errno.h>
+#include <fcntl.h>
#include <stdio.h>
#include <syslog.h>
-#include <sys/wait.h>
+#include <sys/stat.h>
#include <sys/types.h>
extern int SysLogLevel;
@@ -30,12 +31,10 @@ extern int SysLogLevel;
#define DELETENULL(p) (delete (p), p = NULL)
-bool DataAvailable(int filedes, bool wait = false);
void writechar(int filedes, char c);
void writeint(int filedes, int n);
char readchar(int filedes);
bool readint(int filedes, int &n);
-int readstring(int filedes, char *buffer, int size, bool wait = false);
void purge(int filedes);
char *readline(FILE *f);
char *strn0cpy(char *dest, const char *src, size_t n);
@@ -52,6 +51,24 @@ bool RemoveFileOrDir(const char *FileName, bool FollowSymlinks = false);
bool CheckProcess(pid_t pid);
void KillProcess(pid_t pid, int Timeout = MAXPROCESSTIMEOUT);
+class cFile {
+private:
+ static bool files[];
+ static int maxFiles;
+ int f;
+public:
+ cFile(void);
+ ~cFile();
+ operator int () { return f; }
+ bool Open(const char *FileName, int Flags, mode_t Mode = S_IRUSR | S_IWUSR | S_IRGRP);
+ bool Open(int FileDes);
+ void Close(void);
+ bool IsOpen(void) { return f >= 0; }
+ int ReadString(char *Buffer, int Size);
+ bool Ready(bool Wait = true);
+ static bool AnyFileReady(int FileDes = -1, int TimeoutMs = 1000);
+ };
+
class cListObject {
private:
cListObject *prev, *next;