projects
/
u
/
mdw
/
putty
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Brutally simplify out all the junk that MPW left here when it first wrote this
[u/mdw/putty]
/
psftp.c
diff --git
a/psftp.c
b/psftp.c
index
07045f2
..
94d7364
100644
(file)
--- a/
psftp.c
+++ b/
psftp.c
@@
-832,7
+832,7
@@
int sftp_cmd_chmod(struct sftp_command *cmd)
if (!(subset & 06777) && (perms &~ subset)) {
printf("chmod: file mode '%.*s' contains no user/group/other"
" specifier and permissions other than 't' \n",
if (!(subset & 06777) && (perms &~ subset)) {
printf("chmod: file mode '%.*s' contains no user/group/other"
" specifier and permissions other than 't' \n",
- strcspn(modebegin, ","), modebegin
, *mode
);
+ strcspn(modebegin, ","), modebegin);
return 0;
}
perms &= subset;
return 0;
}
perms &= subset;
@@
-1448,40
+1448,43
@@
static int verbose = 0;
*/
void fatalbox(char *fmt, ...)
{
*/
void fatalbox(char *fmt, ...)
{
- char
str[0x100]; /* Make the size big enough */
+ char
*str, *str2;
va_list ap;
va_start(ap, fmt);
va_list ap;
va_start(ap, fmt);
- strcpy(str, "Fatal:");
- vsprintf(str + strlen(str), fmt, ap);
+ str = dupvprintf(fmt, ap);
+ str2 = dupcat("Fatal: ", str, "\n", NULL);
+ sfree(str);
va_end(ap);
va_end(ap);
-
strcat(str, "\n"
);
-
fputs(str, stderr
);
+
fputs(str2, stderr
);
+
sfree(str2
);
cleanup_exit(1);
}
void modalfatalbox(char *fmt, ...)
{
cleanup_exit(1);
}
void modalfatalbox(char *fmt, ...)
{
- char
str[0x100]; /* Make the size big enough */
+ char
*str, *str2;
va_list ap;
va_start(ap, fmt);
va_list ap;
va_start(ap, fmt);
- strcpy(str, "Fatal:");
- vsprintf(str + strlen(str), fmt, ap);
+ str = dupvprintf(fmt, ap);
+ str2 = dupcat("Fatal: ", str, "\n", NULL);
+ sfree(str);
va_end(ap);
va_end(ap);
-
strcat(str, "\n"
);
-
fputs(str, stderr
);
+
fputs(str2, stderr
);
+
sfree(str2
);
cleanup_exit(1);
}
cleanup_exit(1);
}
-void connection_fatal(char *fmt, ...)
+void connection_fatal(
void *frontend,
char *fmt, ...)
{
{
- char
str[0x100]; /* Make the size big enough */
+ char
*str, *str2;
va_list ap;
va_start(ap, fmt);
va_list ap;
va_start(ap, fmt);
- strcpy(str, "Fatal:");
- vsprintf(str + strlen(str), fmt, ap);
+ str = dupvprintf(fmt, ap);
+ str2 = dupcat("Fatal: ", str, "\n", NULL);
+ sfree(str);
va_end(ap);
va_end(ap);
-
strcat(str, "\n"
);
-
fputs(str, stderr
);
+
fputs(str2, stderr
);
+
sfree(str2
);
cleanup_exit(1);
}
cleanup_exit(1);
}
@@
-1769,6
+1772,7
@@
static int psftp_connect(char *userhost, char *user, int portnumber)
}
if (!cfg.username[0]) {
printf("login as: ");
}
if (!cfg.username[0]) {
printf("login as: ");
+ fflush(stdout);
if (!fgets(cfg.username, sizeof(cfg.username), stdin)) {
fprintf(stderr, "psftp: aborting\n");
cleanup_exit(1);
if (!fgets(cfg.username, sizeof(cfg.username), stdin)) {
fprintf(stderr, "psftp: aborting\n");
cleanup_exit(1);
@@
-1829,6
+1833,8
@@
static int psftp_connect(char *userhost, char *user, int portnumber)
fprintf(stderr, "ssh_init: %s\n", err);
return 1;
}
fprintf(stderr, "ssh_init: %s\n", err);
return 1;
}
+ logctx = log_init(NULL);
+ back->provide_logctx(backhandle, logctx);
ssh_sftp_init();
if (verbose && realhost != NULL)
printf("Connected to %s\n", realhost);
ssh_sftp_init();
if (verbose && realhost != NULL)
printf("Connected to %s\n", realhost);
@@
-1838,11
+1844,11
@@
static int psftp_connect(char *userhost, char *user, int portnumber)
void cmdline_error(char *p, ...)
{
va_list ap;
void cmdline_error(char *p, ...)
{
va_list ap;
- fprintf(stderr, "ps
c
p: ");
+ fprintf(stderr, "ps
ft
p: ");
va_start(ap, p);
vfprintf(stderr, p, ap);
va_end(ap);
va_start(ap, p);
vfprintf(stderr, p, ap);
va_end(ap);
- fp
utc('\n', stderr
);
+ fp
rintf(stderr, "\n try typing \"psftp -h\" for help\n"
);
exit(1);
}
exit(1);
}
@@
-1857,6
+1863,7
@@
int main(int argc, char *argv[])
int mode = 0;
int modeflags = 0;
char *batchfile = NULL;
int mode = 0;
int modeflags = 0;
char *batchfile = NULL;
+ int errors = 0;
flags = FLAG_STDERR | FLAG_INTERACTIVE;
cmdline_tooltype = TOOLTYPE_FILETRANSFER;
flags = FLAG_STDERR | FLAG_INTERACTIVE;
cmdline_tooltype = TOOLTYPE_FILETRANSFER;
@@
-1866,6
+1873,7
@@
int main(int argc, char *argv[])
userhost = user = NULL;
userhost = user = NULL;
+ errors = 0;
for (i = 1; i < argc; i++) {
int ret;
if (argv[i][0] != '-') {
for (i = 1; i < argc; i++) {
int ret;
if (argv[i][0] != '-') {
@@
-1900,7
+1908,7
@@
int main(int argc, char *argv[])
i++;
break;
} else {
i++;
break;
} else {
-
usage(
);
+
cmdline_error("unknown option \"%s\"", argv[i]
);
}
}
argc -= i;
}
}
argc -= i;