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:
authorCorinna Vinschen <corinna@vinschen.de>2014-02-09 00:57:27 +0400
committerCorinna Vinschen <corinna@vinschen.de>2014-02-09 00:57:27 +0400
commit234074f6834dfd090bc6780ffe667b11d3b7c101 (patch)
tree62756a2be569fa69668a74d42d8094ec0cdeb2ec /winsup/cygwin/miscfuncs.h
parentabbe1f5320881ec7da114a4e0b6d17045d6b5500 (diff)
* miscfuncs.h (class NT_readline): New class to implement line-wise
reading from file using native NT functions. * miscfuncs.cc (NT_readline::init): New method. * mount.cc (mount_info::from_fstab): Utilize NT_readline to read fstab files.
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))