add const qualifiers to some variables

This commit is contained in:
josch
2014-09-21 15:59:52 +02:00
parent 675679acf7
commit 08c067a352
33 changed files with 123 additions and 98 deletions

View File

@@ -22,36 +22,52 @@
#include "mfshell.h"
int mfshell_cmd_help(mfshell * mfshell, int argc, char **argv);
int mfshell_cmd_help(mfshell * mfshell, int argc,
char *const argv[]);
int mfshell_cmd_debug(mfshell * mfshell, int argc, char **argv);
int mfshell_cmd_debug(mfshell * mfshell, int argc,
char *const argv[]);
int mfshell_cmd_host(mfshell * mfshell, int argc, char **argv);
int mfshell_cmd_host(mfshell * mfshell, int argc,
char *const argv[]);
int mfshell_cmd_auth(mfshell * mfshell, int argc, char **argv);
int mfshell_cmd_auth(mfshell * mfshell, int argc,
char *const argv[]);
int mfshell_cmd_whomai(mfshell * mfshell, int argc, char **argv);
int mfshell_cmd_whomai(mfshell * mfshell, int argc,
char *const argv[]);
int mfshell_cmd_list(mfshell * mfshell, int argc, char **argv);
int mfshell_cmd_list(mfshell * mfshell, int argc,
char *const argv[]);
int mfshell_cmd_chdir(mfshell * mfshell, int argc, char **argv);
int mfshell_cmd_chdir(mfshell * mfshell, int argc,
char *const argv[]);
int mfshell_cmd_pwd(mfshell * mfshell, int argc, char **argv);
int mfshell_cmd_pwd(mfshell * mfshell, int argc,
char *const argv[]);
int mfshell_cmd_lpwd(mfshell * mfshell, int argc, char **argv);
int mfshell_cmd_lpwd(mfshell * mfshell, int argc,
char *const argv[]);
int mfshell_cmd_lcd(mfshell * mfshell, int argc, char **argv);
int mfshell_cmd_lcd(mfshell * mfshell, int argc,
char *const argv[]);
int mfshell_cmd_file(mfshell * mfshell, int argc, char **argv);
int mfshell_cmd_file(mfshell * mfshell, int argc,
char *const argv[]);
int mfshell_cmd_links(mfshell * mfshell, int argc, char **argv);
int mfshell_cmd_links(mfshell * mfshell, int argc,
char *const argv[]);
int mfshell_cmd_mkdir(mfshell * mfshell, int argc, char **argv);
int mfshell_cmd_mkdir(mfshell * mfshell, int argc,
char *const argv[]);
int mfshell_cmd_get(mfshell * mfshell, int argc, char **argv);
int mfshell_cmd_get(mfshell * mfshell, int argc,
char *const argv[]);
int mfshell_cmd_whoami(mfshell * mfshell, int argc, char **argv);
int mfshell_cmd_whoami(mfshell * mfshell, int argc,
char *const argv[]);
int mfshell_cmd_rmdir(mfshell * mfshell, int argc, char **argv);
int mfshell_cmd_rmdir(mfshell * mfshell, int argc,
char *const argv[]);
#endif

View File

@@ -32,7 +32,7 @@ static char *_get_login_from_user(void);
static char *_get_passwd_from_user(void);
int mfshell_cmd_auth(mfshell * mfshell, int argc, char **argv)
int mfshell_cmd_auth(mfshell * mfshell, int argc, char *const argv[])
{
char *username;
char *password;

View File

@@ -26,7 +26,7 @@
#include "../../mfapi/mfconn.h"
#include "../commands.h" // IWYU pragma: keep
int mfshell_cmd_chdir(mfshell * mfshell, int argc, char **argv)
int mfshell_cmd_chdir(mfshell * mfshell, int argc, char *const argv[])
{
mffolder *folder_new;
const char *folder_curr;

View File

@@ -25,7 +25,7 @@
#include "../../mfapi/mfconn.h"
#include "../commands.h" // IWYU pragma: keep
int mfshell_cmd_debug(mfshell * mfshell, int argc, char **argv)
int mfshell_cmd_debug(mfshell * mfshell, int argc, char *const argv[])
{
(void)argv;
if (argc != 1) {

View File

@@ -26,7 +26,7 @@
#include "../../mfapi/mfconn.h"
#include "../commands.h" // IWYU pragma: keep
int mfshell_cmd_file(mfshell * mfshell, int argc, char **argv)
int mfshell_cmd_file(mfshell * mfshell, int argc, char *const argv[])
{
mffile *file;
int len;

View File

@@ -29,7 +29,7 @@
#include "../../mfapi/mfconn.h"
#include "../commands.h" // IWYU pragma: keep
int mfshell_cmd_get(mfshell * mfshell, int argc, char **argv)
int mfshell_cmd_get(mfshell * mfshell, int argc, char *const argv[])
{
mffile *file;
int len;

View File

@@ -23,7 +23,7 @@
#include "../mfshell.h"
#include "../commands.h" // IWYU pragma: keep
int mfshell_cmd_help(mfshell * mfshell, int argc, char **argv)
int mfshell_cmd_help(mfshell * mfshell, int argc, char *const argv[])
{
(void)argv;
unsigned int column1_width = 0;

View File

@@ -28,7 +28,7 @@
static char *_get_host_from_user(void);
int mfshell_cmd_host(mfshell * mfshell, int argc, char **argv)
int mfshell_cmd_host(mfshell * mfshell, int argc, char *const argv[])
{
char *alt_host = NULL;
char *host;

View File

@@ -25,7 +25,7 @@
#include "../mfshell.h"
#include "../commands.h" // IWYU pragma: keep
int mfshell_cmd_lcd(mfshell * mfshell, int argc, char **argv)
int mfshell_cmd_lcd(mfshell * mfshell, int argc, char *const argv[])
{
int retval;
const char *dir;

View File

@@ -26,7 +26,7 @@
#include "../../mfapi/mfconn.h"
#include "../commands.h" // IWYU pragma: keep
int mfshell_cmd_links(mfshell * mfshell, int argc, char **argv)
int mfshell_cmd_links(mfshell * mfshell, int argc, char *const argv[])
{
mffile *file;
int len;

View File

@@ -25,7 +25,7 @@
#include "../../mfapi/mfconn.h"
#include "../commands.h" // IWYU pragma: keep
int mfshell_cmd_list(mfshell * mfshell, int argc, char **argv)
int mfshell_cmd_list(mfshell * mfshell, int argc, char *const argv[])
{
(void)argv;
int retval;

View File

@@ -25,7 +25,7 @@
#include "../mfshell.h"
#include "../commands.h" // IWYU pragma: keep
int mfshell_cmd_lpwd(mfshell * mfshell, int argc, char **argv)
int mfshell_cmd_lpwd(mfshell * mfshell, int argc, char *const argv[])
{
(void)argv;
if (mfshell == NULL)

View File

@@ -25,7 +25,7 @@
#include "../../mfapi/mfconn.h"
#include "../commands.h" // IWYU pragma: keep
int mfshell_cmd_mkdir(mfshell * mfshell, int argc, char **argv)
int mfshell_cmd_mkdir(mfshell * mfshell, int argc, char *const argv[])
{
int retval;
const char *folder_curr;

View File

@@ -25,7 +25,7 @@
#include "../../mfapi/folder.h"
#include "../commands.h" // IWYU pragma: keep
int mfshell_cmd_pwd(mfshell * mfshell, int argc, char **argv)
int mfshell_cmd_pwd(mfshell * mfshell, int argc, char *const argv[])
{
(void)argv;
const char *folder_name;

View File

@@ -25,7 +25,7 @@
#include "../../mfapi/mfconn.h"
#include "../commands.h" // IWYU pragma: keep
int mfshell_cmd_rmdir(mfshell * mfshell, int argc, char **argv)
int mfshell_cmd_rmdir(mfshell * mfshell, int argc, char *const argv[])
{
int retval;
const char *folderkey;

View File

@@ -24,7 +24,7 @@
#include "../../mfapi/mfconn.h"
#include "../commands.h" // IWYU pragma: keep
int mfshell_cmd_whoami(mfshell * mfshell, int argc, char **argv)
int mfshell_cmd_whoami(mfshell * mfshell, int argc, char *const argv[])
{
(void)argv;
int retval;

View File

@@ -31,7 +31,7 @@ static void mfshell_run(mfshell * shell);
static void mfshell_parse_commands(mfshell * shell, char *command);
void print_help(char *cmd)
void print_help(const char *cmd)
{
fprintf(stderr, "A shell to access a MediaFire account.\n");
fprintf(stderr, "\n");
@@ -61,7 +61,7 @@ void print_help(char *cmd)
}
void
parse_argv(int argc, char **argv, char **username,
parse_argv(int argc, char *const argv[], char **username,
char **password, char **server, char **command)
{
static struct option long_options[] = {
@@ -117,7 +117,7 @@ parse_argv(int argc, char **argv, char **username,
}
}
int main(int argc, char **argv)
int main(int argc, char *const argv[])
{
mfshell *shell;
char *server = "www.mediafire.com";

View File

@@ -85,7 +85,7 @@ mfshell *mfshell_create(int app_id, char *app_key, char *server)
return shell;
}
int mfshell_exec(mfshell * shell, int argc, char **argv)
int mfshell_exec(mfshell * shell, int argc, char *const argv[])
{
mfcmd *curr_cmd;

View File

@@ -33,7 +33,7 @@ struct mfcmd {
char *name;
char *argstring;
char *help;
int (*handler) (mfshell * mfshell, int argc, char **argv);
int (*handler) (mfshell * mfshell, int argc, char *const argv[]);
};
struct mfshell {
@@ -57,7 +57,7 @@ mfshell *mfshell_create(int app_id, char *app_key, char *server);
int mfshell_authenticate_user(mfshell * mfshell);
int mfshell_exec(mfshell * mfshell, int argc, char **argv);
int mfshell_exec(mfshell * mfshell, int argc, char *const argv[]);
int mfshell_exec_shell_command(mfshell * mfshell, char *command);