|
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; |