Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'winsup/cygwin/miscfuncs.h')
-rw-r--r--winsup/cygwin/miscfuncs.h20
1 files changed, 19 insertions, 1 deletions
diff --git a/winsup/cygwin/miscfuncs.h b/winsup/cygwin/miscfuncs.h
index bc36a1987..66dfc900a 100644
--- a/winsup/cygwin/miscfuncs.h
+++ b/winsup/cygwin/miscfuncs.h
@@ -1,7 +1,7 @@
/* miscfuncs.h: main Cygwin header file.
Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
- 2007, 2008, 2009, 2010, 2011, 2012, 2013 Red Hat, Inc.
+ 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Red Hat, Inc.
This file is part of Cygwin.
@@ -23,6 +23,24 @@ BOOL WINAPI ReadPipeOverlapped (HANDLE h, PVOID buf, DWORD len,
BOOL WINAPI WritePipeOverlapped (HANDLE h, LPCVOID buf, DWORD len,
LPDWORD ret_len, DWORD timeout);
+/* class for per-line reading using native functions. The caller provides
+ the file as an POBJECT_ATTRIBUTES, and the buffer space. */
+class NT_readline
+{
+ HANDLE fh;
+ PCHAR buf;
+ PCHAR got;
+ PCHAR end;
+ ULONG buflen;
+ ULONG len;
+ ULONG line;
+public:
+ NT_readline () : fh (NULL) {}
+ bool init (POBJECT_ATTRIBUTES attr, char *buf, ULONG buflen);
+ PCHAR gets ();
+ ~NT_readline () { if (fh) NtClose (fh); }
+};
+
extern "C" void yield ();
#define import_address(x) __import_address ((void *)(x))