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.cc')
-rw-r--r--winsup/cygwin/miscfuncs.cc76
1 files changed, 0 insertions, 76 deletions
diff --git a/winsup/cygwin/miscfuncs.cc b/winsup/cygwin/miscfuncs.cc
index 7397bea47..0a3651cb1 100644
--- a/winsup/cygwin/miscfuncs.cc
+++ b/winsup/cygwin/miscfuncs.cc
@@ -384,82 +384,6 @@ WritePipeOverlapped (HANDLE h, LPCVOID buf, DWORD len, LPDWORD ret_len,
return ret;
}
-bool
-NT_readline::init (POBJECT_ATTRIBUTES attr, PCHAR in_buf, ULONG in_buflen)
-{
- NTSTATUS status;
- IO_STATUS_BLOCK io;
-
- status = NtOpenFile (&fh, SYNCHRONIZE | FILE_READ_DATA, attr, &io,
- FILE_SHARE_VALID_FLAGS,
- FILE_SYNCHRONOUS_IO_NONALERT
- | FILE_OPEN_FOR_BACKUP_INTENT);
- if (!NT_SUCCESS (status))
- {
- paranoid_printf ("NtOpenFile(%S) failed, status %y",
- attr->ObjectName, status);
- return false;
- }
- buf = in_buf;
- buflen = in_buflen;
- got = end = buf;
- len = 0;
- line = 1;
- return true;
-}
-
-PCHAR
-NT_readline::gets ()
-{
- IO_STATUS_BLOCK io;
-
- while (true)
- {
- /* len == 0 indicates we have to read from the file. */
- if (!len)
- {
- if (!NT_SUCCESS (NtReadFile (fh, NULL, NULL, NULL, &io, got,
- (buflen - 2) - (got - buf), NULL, NULL)))
- return NULL;
- len = io.Information;
- /* Set end marker. */
- got[len] = got[len + 1] = '\0';
- /* Set len to the absolute len of bytes in buf. */
- len += got - buf;
- /* Reset got to start reading at the start of the buffer again. */
- got = end = buf;
- }
- else
- {
- got = end + 1;
- ++line;
- }
- /* Still some valid full line? */
- if (got < buf + len)
- {
- if ((end = strchr (got, '\n')))
- {
- end[end[-1] == '\r' ? -1 : 0] = '\0';
- return got;
- }
- /* Last line missing a \n at EOF? */
- if (len < buflen - 2)
- {
- len = 0;
- return got;
- }
- }
- /* We have to read once more. Move remaining bytes to the start of
- the buffer and reposition got so that it points to the end of
- the remaining bytes. */
- len = buf + len - got;
- memmove (buf, got, len);
- got = buf + len;
- buf[len] = buf[len + 1] = '\0';
- len = 0;
- }
-}
-
/* backslashify: Convert all forward slashes in src path to back slashes
in dst path. Add a trailing slash to dst when trailing_slash_p arg
is set to 1. */