diff --git a/src/dialog.h b/src/dialog.h index a7798efac..458aaa4f0 100644 --- a/src/dialog.h +++ b/src/dialog.h @@ -85,9 +85,9 @@ typedef struct Dlg_head { /* Set by the user */ int flags; /* User flags */ - char *help_ctx; /* Name of the help entry */ + const char *help_ctx; /* Name of the help entry */ const int *color; /* Color set */ - char *title; /* Title of the dialog */ + const char *title; /* Title of the dialog */ /* Set and received by the user */ int ret_value; /* Result of run_dlg() */ diff --git a/src/main.c b/src/main.c index 080aa9cf4..8b03543e5 100644 --- a/src/main.c +++ b/src/main.c @@ -272,7 +272,7 @@ static int edit_one_file_start_line = 0; int midnight_shutdown = 0; /* The user's shell */ -char *shell = NULL; +const char *shell = NULL; /* mc_home: The home of MC */ char *mc_home = NULL; @@ -319,7 +319,7 @@ reload_panelized (WPanel *panel) static void update_one_panel_widget (WPanel *panel, int force_update, - char *current_file) + const char *current_file) { int free_pointer; @@ -367,7 +367,7 @@ panel_clean_dir (WPanel *panel) } static void -update_one_panel (int which, int force_update, char *current_file) +update_one_panel (int which, int force_update, const char *current_file) { WPanel *panel; @@ -387,7 +387,7 @@ update_one_panel (int which, int force_update, char *current_file) * will not reload the other panel. */ void -update_panels (int force_update, char *current_file) +update_panels (int force_update, const char *current_file) { int reload_other = !(force_update & UP_ONLY_CURRENT); WPanel *panel; @@ -418,7 +418,7 @@ save_cwds_stat (void) #ifdef HAVE_SUBSHELL_SUPPORT void -do_possible_cd (char *new_dir) +do_possible_cd (const char *new_dir) { if (!do_cd (new_dir, cd_exact)) message (1, _("Warning"), @@ -514,7 +514,7 @@ repaint_screen (void) /* Wrapper for do_subshell_chdir, check for availability of subshell */ void -subshell_chdir (char *directory) +subshell_chdir (const char *directory) { #ifdef HAVE_SUBSHELL_SUPPORT if (use_subshell) { @@ -543,7 +543,7 @@ directory_history_add (struct WPanel *panel, const char *dir) * You do _NOT_ want to add any vfs aware code here. */ static char * -get_parent_dir_name (char *cwd, char *lwd) +get_parent_dir_name (const char *cwd, const char *lwd) { char *p; if (strlen (lwd) > strlen (cwd)) @@ -558,7 +558,7 @@ get_parent_dir_name (char *cwd, char *lwd) * Don't record change in the directory history. */ static int -_do_panel_cd (WPanel *panel, char *new_dir, enum cd_enum cd_type) +_do_panel_cd (WPanel *panel, const char *new_dir, enum cd_enum cd_type) { char *directory, *olddir; char temp[MC_MAXPATHLEN]; @@ -618,7 +618,7 @@ _do_panel_cd (WPanel *panel, char *new_dir, enum cd_enum cd_type) * Record change in the directory history. */ int -do_panel_cd (struct WPanel *panel, char *new_dir, enum cd_enum cd_type) +do_panel_cd (struct WPanel *panel, const char *new_dir, enum cd_enum cd_type) { int r; @@ -629,7 +629,7 @@ do_panel_cd (struct WPanel *panel, char *new_dir, enum cd_enum cd_type) } int -do_cd (char *new_dir, enum cd_enum exact) +do_cd (const char *new_dir, enum cd_enum exact) { return (do_panel_cd (current_panel, new_dir, exact)); } @@ -2088,7 +2088,7 @@ handle_args (int argc, char *argv[]) */ static int -do_mc_filename_rename (char *mc_dir, char *o_name, char *n_name) +do_mc_filename_rename (const char *mc_dir, const char *o_name, const char *n_name) { char *full_o_name = concat_dir_and_file (home_dir, o_name); char *full_n_name = g_strconcat (home_dir, MC_BASE, n_name, NULL); diff --git a/src/main.h b/src/main.h index 3dfdfb601..4abea684a 100644 --- a/src/main.h +++ b/src/main.h @@ -18,7 +18,7 @@ extern volatile int quit; /* If true, after executing a command, wait for a keystroke */ enum { pause_never, pause_on_dumb_terminals, pause_always }; -void subshell_chdir (char *command); +void subshell_chdir (const char *command); /* See main.c for details on these variables */ extern int mark_moves_down; @@ -65,7 +65,7 @@ extern int only_leading_plus_minus; extern int output_starts_shell; extern int midnight_shutdown; extern char cmd_buf [512]; -extern char *shell; +extern const char *shell; /* Ugly hack in order to distinguish between left and right panel in menubar */ extern int is_right; /* If the selected menu was the right */ @@ -81,7 +81,7 @@ typedef struct { key_callback fn; } key_map; -void update_panels (int force_update, char *current_file); +void update_panels (int force_update, const char *current_file); void repaint_screen (void); void do_update_prompt (void); @@ -90,7 +90,7 @@ enum cd_enum { cd_exact }; -int do_cd (char *new_dir, enum cd_enum cd_type); /* For find.c */ +int do_cd (const char *new_dir, enum cd_enum cd_type); /* For find.c */ void change_panel (void); int load_prompt (int fd, void *unused); void save_cwds_stat (void); @@ -108,7 +108,7 @@ extern char *mc_home; char *get_mc_lib_dir (void); int maybe_cd (int char_code, int move_up_dir); -void do_possible_cd (char *dir); +void do_possible_cd (const char *dir); #ifdef WANT_WIDGETS extern WButtonBar *the_bar; @@ -127,6 +127,6 @@ void init_menu (void); struct WPanel; void directory_history_add (struct WPanel *panel, const char *dir); -int do_panel_cd (struct WPanel *panel, char *new_dir, enum cd_enum cd_type); +int do_panel_cd (struct WPanel *panel, const char *new_dir, enum cd_enum cd_type); #endif /* !__MAIN_H */ diff --git a/src/menu.h b/src/menu.h index e8d9ba4b9..69da58785 100644 --- a/src/menu.h +++ b/src/menu.h @@ -7,7 +7,7 @@ typedef void (*callfn) (void); typedef struct { char first_letter; - char *text; + const char *text; int hot_key; callfn call_back; } menu_entry; diff --git a/src/popt.h b/src/popt.h index bde2959ba..fe7d5773e 100644 --- a/src/popt.h +++ b/src/popt.h @@ -57,8 +57,8 @@ struct poptOption { int argInfo; void * arg; /* depends on argInfo */ int val; /* 0 means don't return, just update flag */ - char * descrip; /* description for autohelp -- may be NULL */ - char * argDescrip; /* argument description for autohelp */ + const char * descrip; /* description for autohelp -- may be NULL */ + const char * argDescrip; /* argument description for autohelp */ }; struct poptAlias { diff --git a/src/screen.c b/src/screen.c index 09ef089be..622179e34 100644 --- a/src/screen.c +++ b/src/screen.c @@ -828,7 +828,7 @@ do_select (WPanel *panel, int i) } static inline void -do_try_to_select (WPanel *panel, char *name) +do_try_to_select (WPanel *panel, const char *name) { int i; char *subdir; diff --git a/vfs/mcfsutil.c b/vfs/mcfsutil.c index b64ea3921..e1ebb55e8 100644 --- a/vfs/mcfsutil.c +++ b/vfs/mcfsutil.c @@ -70,7 +70,7 @@ socket_read_block (int sock, char *dest, int len) } int -socket_write_block (int sock, char *buffer, int len) +socket_write_block (int sock, const char *buffer, int len) { int left, status; diff --git a/vfs/mcfsutil.h b/vfs/mcfsutil.h index b382ef874..a9bd17d09 100644 --- a/vfs/mcfsutil.h +++ b/vfs/mcfsutil.h @@ -19,5 +19,5 @@ enum { int rpc_get (int sock, ...); int rpc_send (int sock, ...); int socket_read_block (int sock, char *dest, int len); -int socket_write_block (int sock, char *buffer, int len); +int socket_write_block (int sock, const char *buffer, int len); #endif /* !__MCFSUTIL_H */ diff --git a/vfs/mcserv.c b/vfs/mcserv.c index 1c5e57b23..bc993dcff 100644 --- a/vfs/mcserv.c +++ b/vfs/mcserv.c @@ -774,7 +774,7 @@ static struct pam_conv conv = { &mc_pam_conversation, NULL }; /* Return 0 if authentication failed, 1 otherwise */ static int -mc_pam_auth (char *username, char *password) +mc_pam_auth (const char *username, const char *password) { pam_handle_t *pamh; struct user_pass up; @@ -818,7 +818,7 @@ next_line (int socket) } static int -ftp_answer (int sock, char *text) +ftp_answer (int sock, const char *text) { char answer[4]; @@ -831,13 +831,13 @@ ftp_answer (int sock, char *text) } static int -send_string (int sock, char *string) +send_string (int sock, const char *string) { return socket_write_block (sock, string, strlen (string)); } static int -do_ftp_auth (char *username, char *password) +do_ftp_auth (const char *username, const char *password) { struct sockaddr_in local_address; unsigned long inaddr; @@ -892,10 +892,10 @@ do_ftp_auth (char *username, char *password) #ifdef HAVE_CRYPT static int -do_classic_auth (char *username, char *password) +do_classic_auth (const char *username, const char *password) { int ret = 0; - char *encr_pwd = NULL; + const char *encr_pwd = NULL; struct passwd *pw; #ifdef HAVE_SHADOW struct spwd *spw; @@ -934,7 +934,7 @@ do_classic_auth (char *username, char *password) - try to contact the local ftp server and login (if -f flag used) */ static int -do_auth (char *username, char *password) +do_auth (const char *username, const char *password) { int auth = 0; struct passwd *this; @@ -1088,7 +1088,7 @@ do_login (void) /* This structure must be kept in synch with mcfs.h enums */ static const struct _command { - char *command; + const char *command; void (*callback) (void); } commands[] = { { @@ -1178,7 +1178,7 @@ server (int sock) /* {{{ Net support code */ -static char * +static const char * get_client (int portnum) { int sock, clilen, newsocket; @@ -1295,7 +1295,7 @@ register_port (int portnum, int abort_if_fail) int main (int argc, char *argv[]) { - char *result; + const char *result; int c; while ((c = getopt (argc, argv, "fdiqp:v")) != -1) {