mirror of
https://github.com/PowerShell/Win32-OpenSSH.git
synced 2025-07-23 05:55:41 +02:00
Fix input formatting and add a directive.
This commit is contained in:
parent
78306c910d
commit
f5c9367145
@ -30,6 +30,7 @@
|
|||||||
#define lstat w32_stat
|
#define lstat w32_stat
|
||||||
#define mkdir w32_mkdir
|
#define mkdir w32_mkdir
|
||||||
#define chdir w32_chdir
|
#define chdir w32_chdir
|
||||||
|
#define getcwd w32_getcwd
|
||||||
|
|
||||||
struct w32_stat {
|
struct w32_stat {
|
||||||
dev_t st_dev; /* ID of device containing file */
|
dev_t st_dev; /* ID of device containing file */
|
||||||
|
@ -53,6 +53,7 @@ int w32_isatty(int fd);
|
|||||||
FILE* w32_fdopen(int fd, const char *mode);
|
FILE* w32_fdopen(int fd, const char *mode);
|
||||||
int w32_mkdir(const char *pathname, unsigned short mode);
|
int w32_mkdir(const char *pathname, unsigned short mode);
|
||||||
int w32_chdir(const char *dirname);
|
int w32_chdir(const char *dirname);
|
||||||
|
char *w32_getcwd(char *buffer, int maxlen);
|
||||||
|
|
||||||
/*common i/o*/
|
/*common i/o*/
|
||||||
#define fcntl(a,b,...) w32_fcntl((a), (b), __VA_ARGS__)
|
#define fcntl(a,b,...) w32_fcntl((a), (b), __VA_ARGS__)
|
||||||
|
@ -437,6 +437,19 @@ int w32_chdir(const char *dirname) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
char *w32_getcwd(char *buffer, int maxlen) {
|
||||||
|
wchar_t wdirname[MAX_PATH];
|
||||||
|
int needed;
|
||||||
|
|
||||||
|
wchar_t *wpwd = _wgetcwd(wdirname, MAX_PATH);
|
||||||
|
|
||||||
|
if ((needed = WideCharToMultiByte(CP_UTF8, WC_ERR_INVALID_CHARS, wdirname, -1, NULL, 0, NULL, NULL)) == 0 ||
|
||||||
|
WideCharToMultiByte(CP_UTF8, WC_ERR_INVALID_CHARS, wdirname, -1, buffer, needed, NULL, NULL) != needed)
|
||||||
|
fatal("failed to covert input arguments");
|
||||||
|
|
||||||
|
return buffer;
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
w32_isatty(int fd) {
|
w32_isatty(int fd) {
|
||||||
struct w32_io* pio;
|
struct w32_io* pio;
|
||||||
|
6
sftp.c
6
sftp.c
@ -2357,8 +2357,10 @@ main(int argc, char **argv)
|
|||||||
addargs(&args, "\"-oClearAllForwardings yes\"");
|
addargs(&args, "\"-oClearAllForwardings yes\"");
|
||||||
|
|
||||||
ll = SYSLOG_LEVEL_INFO;
|
ll = SYSLOG_LEVEL_INFO;
|
||||||
infile = stdin;
|
#ifdef WINDOWS
|
||||||
_setmode(_fileno(infile), O_U16TEXT);
|
_setmode(_fileno(stdin), O_U16TEXT);
|
||||||
|
#endif
|
||||||
|
infile = stdin;
|
||||||
|
|
||||||
while ((ch = getopt(argc, argv,
|
while ((ch = getopt(argc, argv,
|
||||||
"1246afhpqrvCc:D:i:l:o:s:S:b:B:F:P:R:")) != -1) {
|
"1246afhpqrvCc:D:i:l:o:s:S:b:B:F:P:R:")) != -1) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user