View | Details | Raw Unified | Return to bug 2926 | Differences between
and this patch

Collapse All | Expand All

(-)a/sftp.1 (+7 lines)
Lines 127-132 at connection time (see Link Here
127
and
127
and
128
.Xr ssh-keygen 1
128
.Xr ssh-keygen 1
129
for details).
129
for details).
130
.Pp
130
A
131
A
131
.Ar batchfile
132
.Ar batchfile
132
of
133
of
Lines 141-151 commands fail: Link Here
141
.Ic chgrp , lpwd , df , symlink ,
142
.Ic chgrp , lpwd , df , symlink ,
142
and
143
and
143
.Ic lmkdir .
144
.Ic lmkdir .
145
.Pp
144
Termination on error can be suppressed on a command by command basis by
146
Termination on error can be suppressed on a command by command basis by
145
prefixing the command with a
147
prefixing the command with a
146
.Sq \-
148
.Sq \-
147
character (for example,
149
character (for example,
148
.Ic -rm /tmp/blah* ) .
150
.Ic -rm /tmp/blah* ) .
151
Echo of the command may be suppressed by prefixing the command with a
152
.Sq @
153
character.
154
These two prefixes may be combined in any order, for example
155
.Ic -@ls /bsd .
149
.It Fl C
156
.It Fl C
150
Enables compression (via ssh's
157
Enables compression (via ssh's
151
.Fl C
158
.Fl C
(-)a/sftp.c (-10 / +17 lines)
Lines 1282-1294 parse_args(const char **cpp, int *ignore_errors, int *aflag, Link Here
1282
	/* Skip leading whitespace */
1282
	/* Skip leading whitespace */
1283
	cp = cp + strspn(cp, WHITESPACE);
1283
	cp = cp + strspn(cp, WHITESPACE);
1284
1284
1285
	/* Check for leading '-' (disable error processing) */
1285
	/*
1286
	 * Check for leading '-' (disable error processing) and '@' (suppress
1287
	 * command echo)
1288
	 */
1286
	*ignore_errors = 0;
1289
	*ignore_errors = 0;
1287
	if (*cp == '-') {
1290
	for (;*cp != '\0'; cp++) {
1288
		*ignore_errors = 1;
1291
		if (*cp == '-') {
1289
		cp++;
1292
			*ignore_errors = 1;
1290
		cp = cp + strspn(cp, WHITESPACE);
1293
		} else if (*cp == '@') {
1294
			/* handled elsewhere, but ignore here */
1295
		} else {
1296
			/* all other characters terminate prefix processing */
1297
			break;
1298
		}
1291
	}
1299
	}
1300
	cp = cp + strspn(cp, WHITESPACE);
1292
1301
1293
	/* Ignore blank lines and lines which begin with comment '#' char */
1302
	/* Ignore blank lines and lines which begin with comment '#' char */
1294
	if (*cp == '\0' || *cp == '#')
1303
	if (*cp == '\0' || *cp == '#')
Lines 2167-2173 interactive_loop(struct sftp_conn *conn, char *file1, char *file2) Link Here
2167
	interactive = !batchmode && isatty(STDIN_FILENO);
2176
	interactive = !batchmode && isatty(STDIN_FILENO);
2168
	err = 0;
2177
	err = 0;
2169
	for (;;) {
2178
	for (;;) {
2170
		char *cp;
2171
		const char *line;
2179
		const char *line;
2172
		int count = 0;
2180
		int count = 0;
2173
2181
Lines 2181-2187 interactive_loop(struct sftp_conn *conn, char *file1, char *file2) Link Here
2181
					printf("\n");
2189
					printf("\n");
2182
				break;
2190
				break;
2183
			}
2191
			}
2184
			if (!interactive) { /* Echo command */
2192
			/* Echo command in batchmode unless asked to suppress */
2193
			if (!interactive && *cmd != '@') {
2185
				mprintf("sftp> %s", cmd);
2194
				mprintf("sftp> %s", cmd);
2186
				if (strlen(cmd) > 0 &&
2195
				if (strlen(cmd) > 0 &&
2187
				    cmd[strlen(cmd) - 1] != '\n')
2196
				    cmd[strlen(cmd) - 1] != '\n')
Lines 2200-2208 interactive_loop(struct sftp_conn *conn, char *file1, char *file2) Link Here
2200
			}
2209
			}
2201
		}
2210
		}
2202
2211
2203
		cp = strrchr(cmd, '\n');
2212
		cmd[strcspn(cmd, "\n")] = '\0';
2204
		if (cp)
2205
			*cp = '\0';
2206
2213
2207
		/* Handle user interrupts gracefully during commands */
2214
		/* Handle user interrupts gracefully during commands */
2208
		interrupted = 0;
2215
		interrupted = 0;

Return to bug 2926