mirror of
https://github.com/PowerShell/Win32-OpenSSH.git
synced 2025-07-24 06:25:35 +02:00
Fix screensize/handle isses.
This commit is contained in:
parent
b7d80edae3
commit
e12e674b82
Binary file not shown.
@ -1728,6 +1728,6 @@ typedef long ssize_t;
|
|||||||
#define HAVE_MBLEN 1
|
#define HAVE_MBLEN 1
|
||||||
|
|
||||||
#define SSHDIR "."
|
#define SSHDIR "."
|
||||||
#define _PATH_SFTP_SERVER "./sftp-server.exe"
|
#define _PATH_SFTP_SERVER "sftp-server.exe"
|
||||||
#define _PATH_SSH_PROGRAM "./ssh.exe"
|
#define _PATH_SSH_PROGRAM "ssh.exe"
|
||||||
#define _PATH_LS "dir"
|
#define _PATH_LS "dir"
|
||||||
|
@ -78,6 +78,10 @@ static volatile sig_atomic_t win_resized; /* for window resizing */
|
|||||||
/* units for format_size */
|
/* units for format_size */
|
||||||
static const char unit[] = " KMGT";
|
static const char unit[] = " KMGT";
|
||||||
|
|
||||||
|
#ifdef WINDOWS
|
||||||
|
extern int ScreenX;
|
||||||
|
#endif
|
||||||
|
|
||||||
static int
|
static int
|
||||||
can_output(void)
|
can_output(void)
|
||||||
{
|
{
|
||||||
|
21
scp.c
21
scp.c
@ -850,6 +850,7 @@ do_cmd(char *host, char *remuser, char *cmd, int *fdin, int *fdout)
|
|||||||
|
|
||||||
*fdin = _open_osfhandle((intptr_t)hstdout[0],0);
|
*fdin = _open_osfhandle((intptr_t)hstdout[0],0);
|
||||||
_setmode (*fdin, O_BINARY); // set this file handle for binary I/O
|
_setmode (*fdin, O_BINARY); // set this file handle for binary I/O
|
||||||
|
w32_allocate_fd_for_handle(hstdout[0], FALSE);
|
||||||
|
|
||||||
rc = CreateOverlappedPipe( &hstdin[0], &hstdin[1], &sa, 0 ) ;
|
rc = CreateOverlappedPipe( &hstdin[0], &hstdin[1], &sa, 0 ) ;
|
||||||
/* write to this fd to get data into ssh.exe*/
|
/* write to this fd to get data into ssh.exe*/
|
||||||
@ -865,6 +866,7 @@ do_cmd(char *host, char *remuser, char *cmd, int *fdin, int *fdout)
|
|||||||
|
|
||||||
*fdout = _open_osfhandle((intptr_t)hstdin[1],0);
|
*fdout = _open_osfhandle((intptr_t)hstdin[1],0);
|
||||||
_setmode (*fdout, O_BINARY); // set this file handle for binary I/O
|
_setmode (*fdout, O_BINARY); // set this file handle for binary I/O
|
||||||
|
w32_allocate_fd_for_handle(hstdin[1], FALSE);
|
||||||
|
|
||||||
hSaveStdout = GetStdHandle(STD_OUTPUT_HANDLE);
|
hSaveStdout = GetStdHandle(STD_OUTPUT_HANDLE);
|
||||||
//hSaveStderr = GetStdHandle(STD_ERROR_HANDLE);
|
//hSaveStderr = GetStdHandle(STD_ERROR_HANDLE);
|
||||||
@ -1067,6 +1069,10 @@ main(int argc, char **argv)
|
|||||||
extern char *optarg;
|
extern char *optarg;
|
||||||
extern int optind;
|
extern int optind;
|
||||||
|
|
||||||
|
#ifdef WINDOWS
|
||||||
|
ConInit(STD_OUTPUT_HANDLE, TRUE);
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Ensure that fds 0, 1 and 2 are open or directed to /dev/null */
|
/* Ensure that fds 0, 1 and 2 are open or directed to /dev/null */
|
||||||
sanitise_stdfd();
|
sanitise_stdfd();
|
||||||
|
|
||||||
@ -1450,7 +1456,7 @@ source(int argc, char **argv)
|
|||||||
off_t i, statbytes;
|
off_t i, statbytes;
|
||||||
size_t amt, nr;
|
size_t amt, nr;
|
||||||
int fd = -1, haderr, indx;
|
int fd = -1, haderr, indx;
|
||||||
char *last, *name, buf[2048], encname[PATH_MAX];
|
char *last, *lastf, *lastr, *name, buf[2048], encname[PATH_MAX];
|
||||||
int len;
|
int len;
|
||||||
|
|
||||||
for (indx = 0; indx < argc; ++indx) {
|
for (indx = 0; indx < argc; ++indx) {
|
||||||
@ -1487,10 +1493,15 @@ syserr: run_err("%s: %s", name, strerror(errno));
|
|||||||
run_err("%s: not a regular file", name);
|
run_err("%s: not a regular file", name);
|
||||||
goto next;
|
goto next;
|
||||||
}
|
}
|
||||||
if ((last = strrchr(name, '/')) == NULL)
|
if ((lastf = strrchr(name, '/')) == NULL && (lastr = strrchr(name, '\\')) == NULL)
|
||||||
last = name;
|
last = name;
|
||||||
else
|
else {
|
||||||
++last;
|
if (lastf)
|
||||||
|
last = lastf;
|
||||||
|
if (lastr)
|
||||||
|
last = lastr;
|
||||||
|
++last;
|
||||||
|
}
|
||||||
curfile = last;
|
curfile = last;
|
||||||
if (pflag) {
|
if (pflag) {
|
||||||
if (do_times(remout, verbose_mode, &stb) < 0)
|
if (do_times(remout, verbose_mode, &stb) < 0)
|
||||||
@ -2149,7 +2160,7 @@ int start_process_io(char *exename, char **argv, char **envv,
|
|||||||
ctr++;
|
ctr++;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = CreateProcess(
|
ret = CreateProcess(
|
||||||
exename, // given in form like "d:\\util\\cmd.exe"
|
exename, // given in form like "d:\\util\\cmd.exe"
|
||||||
cmdbuf, /* in "arg0 arg1 arg2" form command line */
|
cmdbuf, /* in "arg0 arg1 arg2" form command line */
|
||||||
NULL, /* process security */
|
NULL, /* process security */
|
||||||
|
7
sftp.c
7
sftp.c
@ -76,7 +76,6 @@ typedef void EditLine;
|
|||||||
|
|
||||||
#ifdef WIN32_VS
|
#ifdef WIN32_VS
|
||||||
#include "win32_dirent.h"
|
#include "win32_dirent.h"
|
||||||
extern int ScreenX;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* File to read commands from */
|
/* File to read commands from */
|
||||||
@ -817,8 +816,7 @@ do_ls_dir(struct sftp_conn *conn, char *path, char *strip_path, int lflag)
|
|||||||
m += strlen(tmp);
|
m += strlen(tmp);
|
||||||
free(tmp);
|
free(tmp);
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
ConSetScreenX();
|
width = ConScreenSizeX();
|
||||||
width = ScreenX ;
|
|
||||||
#else
|
#else
|
||||||
if (ioctl(fileno(stdin), TIOCGWINSZ, &ws) != -1)
|
if (ioctl(fileno(stdin), TIOCGWINSZ, &ws) != -1)
|
||||||
width = ws.ws_col;
|
width = ws.ws_col;
|
||||||
@ -941,8 +939,7 @@ do_globbed_ls(struct sftp_conn *conn, char *path, char *strip_path,
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
ConSetScreenX();
|
width = ConScreenSizeX();
|
||||||
width = ScreenX;
|
|
||||||
#else
|
#else
|
||||||
if (ioctl(fileno(stdin), TIOCGWINSZ, &ws) != -1)
|
if (ioctl(fileno(stdin), TIOCGWINSZ, &ws) != -1)
|
||||||
width = ws.ws_col;
|
width = ws.ws_col;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user