mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-07-09 15:23:50 -05:00
Centralise stripslashes() and make it OS-sensitive.
I noticed that Unix PSCP was unwantedly renaming downloaded files which had a backslash in their names, because pscp.c's stripslashes() treated \ as a path component separator, since it hadn't been modified since PSCP ran on Windows only. It also turns out that pscp.c, psftp.c and winsftp.c all had a stripslashes(), and they didn't all have quite the same prototype. So now there's one in winsftp.c and one in uxsftp.c, with appropriate OS-dependent behaviour, and the ones in pscp.c and psftp.c are gone.
This commit is contained in:
17
psftp.h
17
psftp.h
@ -177,4 +177,21 @@ int create_directory(const char *name);
|
||||
*/
|
||||
char *dir_file_cat(const char *dir, const char *file);
|
||||
|
||||
/*
|
||||
* Return a pointer to the portion of str that comes after the last
|
||||
* path component separator.
|
||||
*
|
||||
* If 'local' is false, path component separators are taken to just be
|
||||
* '/', on the assumption that we're discussing the path syntax on the
|
||||
* server. But if 'local' is true, the separators are whatever the
|
||||
* local OS will treat that way - so that includes '\' and ':' on
|
||||
* Windows.
|
||||
*
|
||||
* This function has the annoying strstr() property of taking a const
|
||||
* char * and returning a char *. You should treat it as if it was a
|
||||
* pair of overloaded functions, one mapping mutable->mutable and the
|
||||
* other const->const :-(
|
||||
*/
|
||||
char *stripslashes(const char *str, int local);
|
||||
|
||||
#endif /* PUTTY_PSFTP_H */
|
||||
|
Reference in New Issue
Block a user