* canonification fails, at least fall back to returning a _valid_
* pathname (though it may be ugly, eg /home/simon/../foobar).
*/
-char *canonify(char *name)
+char *canonify(const char *name)
{
char *fullname, *canonname;
struct sftp_packet *pktin;
if (name[0] == '/') {
fullname = dupstr(name);
} else {
- char *slash;
+ const char *slash;
if (pwd[strlen(pwd) - 1] == '/')
slash = "";
else
/*
* Return a pointer to the portion of str that comes after the last
* slash (or backslash or colon, if `local' is TRUE).
+ *
+ * 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 :-(
*/
-static char *stripslashes(char *str, int local)
+static char *stripslashes(const char *str, int local)
{
char *p;
if (p) str = p+1;
}
- return str;
+ return (char *)str;
}
/*
struct fxp_names *names;
struct fxp_name **ournames;
int nnames, namesize;
- char *dir, *cdir, *unwcdir, *wildcard;
+ const char *dir;
+ char *cdir, *unwcdir, *wildcard;
struct sftp_packet *pktin;
struct sftp_request *req;
int i;
static int sftp_cmd_help(struct sftp_command *cmd);
static struct sftp_cmd_lookup {
- char *name;
+ const char *name;
/*
* For help purposes, there are two kinds of command:
*
* contains the help that should double up for this command.
*/
int listed; /* do we list this in primary help? */
- char *shorthelp;
- char *longhelp;
+ const char *shorthelp;
+ const char *longhelp;
int (*obey) (struct sftp_command *);
} sftp_lookup[] = {
/*
}
};
-const struct sftp_cmd_lookup *lookup_command(char *name)
+const struct sftp_cmd_lookup *lookup_command(const char *name)
{
int i, j, k, cmp;
/*
* Print an error message and perform a fatal exit.
*/
-void fatalbox(char *fmt, ...)
+void fatalbox(const char *fmt, ...)
{
char *str, *str2;
va_list ap;
cleanup_exit(1);
}
-void modalfatalbox(char *fmt, ...)
+void modalfatalbox(const char *fmt, ...)
{
char *str, *str2;
va_list ap;
cleanup_exit(1);
}
-void nonfatal(char *fmt, ...)
+void nonfatal(const char *fmt, ...)
{
char *str, *str2;
va_list ap;
fputs(str2, stderr);
sfree(str2);
}
-void connection_fatal(void *frontend, char *fmt, ...)
+void connection_fatal(void *frontend, const char *fmt, ...)
{
char *str, *str2;
va_list ap;
cleanup_exit(1);
}
-void ldisc_send(void *handle, char *buf, int len, int interactive)
-{
- /*
- * This is only here because of the calls to ldisc_send(NULL,
- * 0) in ssh.c. Nothing in PSFTP actually needs to use the
- * ldisc as an ldisc. So if we get called with any real data, I
- * want to know about it.
- */
- assert(len == 0);
-}
+void ldisc_echoedit_update(void *handle) { }
/*
* In psftp, all agent requests should be synchronous, so this is a
return 0;
}
-void cmdline_error(char *p, ...)
+void cmdline_error(const char *p, ...)
{
va_list ap;
fprintf(stderr, "psftp: ");