[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: LYNX-DEV Lynx won't launch
From: |
Wayne Buttles |
Subject: |
Re: LYNX-DEV Lynx won't launch |
Date: |
Mon, 30 Mar 1998 16:09:11 -0500 (EST) |
Try putting this in before firing off lynx (I think this is proper
syntax):
setenv("LINES=24"); setenv("COLS=80");
On Mon, 30 Mar 1998, Kristin McNally wrote:
> OS: Windows NT 4.0
> LYNX: version 2.8
>
> I am trying to launch Lynx v2.8 from a parent process that redirects
> Lynx's standard i/o to the parent's console window. When the Lynx
> process is created, it receives the redirected handles and sends this
> error message to the parent's console:
>
> initscr( ): LINES=0 COLS=0: too small.
>
> The Lynx process will launch fine from the parent process as long as it
> launches with its own console... but if it has its own console, I cannot
> redirect the std i/o.
>
> Any suggestions or information will be greatly appreciated.
>
> Kristin McNally
> MOON Communications
> address@hidden (preferred)
> address@hidden
>
> FYI: The parent process main( ) function that is creating the Lynx
> process:
>
> /////////////// START CODE /////////////////////////////////
> #include <windows.h>
> #include <process.h>
> #include <fcntl.h>
> #include <io.h>
> #include <stdio.h>
> #include <direct.h>
>
> const char * const LYNX_EXE = "c:\\lynx_w32\\lynx.exe";
>
> void main(int argc, char * argv[])
> {
> char szBuffer[_MAX_FNAME];
> BOOL fStatus;
> DWORD dwBytesRead;
> HANDLE hReadPipe;
> HANDLE hWritePipe;
>
> STARTUPINFO si;
> PROCESS_INFORMATION pi;
> SECURITY_ATTRIBUTES sa;
> SECURITY_DESCRIPTOR sd;
> LPSECURITY_ATTRIBUTES lpsa = NULL;
> CONSOLE_SCREEN_BUFFER_INFO coninfo;
>
> // if on windows NT...
> InitializeSecurityDescriptor (&sd, SECURITY_DESCRIPTOR_REVISION);
> SetSecurityDescriptorDacl(&sd, TRUE, NULL, FALSE);
>
> // initialize Security Descriptor
> sa.nLength = sizeof(SECURITY_ATTRIBUTES);
> sa.bInheritHandle = TRUE;
> sa.lpSecurityDescriptor = &sd;
> lpsa = &sa;
>
> CreatePipe(&hReadPipe, &hWritePipe, lpsa, 1);
>
> wsprintf(szBuffer, "%s", LYNX_EXE );
> ZeroMemory( &si, sizeof(STARTUPINFO));
> si.cb = sizeof(STARTUPINFO);
> si.dwFlags = STARTF_USESTDHANDLES;
> si.hStdOutput = hWritePipe;
>
> si.hStdError = hWritePipe;
>
> // Change directory so Lynx can find everything it needs
> _chdir("c:\\lynx_w32");
>
> fStatus = CreateProcess(
> NULL,
> szBuffer,
> NULL,
> NULL,
> TRUE,
> DETACHED_PROCESS,
> NULL,
> NULL,
> &si,
> &pi);
>
> if (fStatus == FALSE)
> {
> printf("Can't create process: %d\n", GetLastError());
> return;
> }
> Sleep(200);
>
> fprintf(stdout, "Starting Loop\n");
>
> while(TRUE)
> {
> fStatus = ReadFile( hReadPipe, szBuffer, 1, &dwBytesRead, NULL);
> if (fStatus != TRUE)
> {
> break;
> }
> szBuffer[dwBytesRead] = '\0';;
> fprintf(stdout, "%s", szBuffer);
> }
>
> CloseHandle(hWritePipe);
> CloseHandle(hReadPipe);
> CloseHandle(pi.hProcess);
> system("pause");
> }
>