diff --git a/configure.ac b/configure.ac index 0f1f86366..d1f6ae553 100644 --- a/configure.ac +++ b/configure.ac @@ -166,7 +166,7 @@ AC_CHECK_FUNCS([\ initgroups isascii \ memcpy memset \ putenv \ - setreuid setuid statfs strerror strftime sysconf \ + setreuid setuid statfs strerror sysconf \ tcgetattr tcsetattr truncate \ ]) diff --git a/m4.include/ac-get-fs-info.m4 b/m4.include/ac-get-fs-info.m4 index 97b64dae2..b1a65132d 100644 --- a/m4.include/ac-get-fs-info.m4 +++ b/m4.include/ac-get-fs-info.m4 @@ -142,7 +142,7 @@ if test x"$ac_cv_func_getmntent" = xyes; then # endif #endif ], - [ struct mntent *mnt = 0; char *table = MOUNTED; + [ struct mntent *mnt = 0; const char *table = MOUNTED; if (sizeof mnt && sizeof table) return 0;], fu_cv_sys_mounted_getmntent1=yes, fu_cv_sys_mounted_getmntent1=no)]) diff --git a/m4.include/mc-use-termcap.m4 b/m4.include/mc-use-termcap.m4 index 6e362140a..ec34b3132 100644 --- a/m4.include/mc-use-termcap.m4 +++ b/m4.include/mc-use-termcap.m4 @@ -24,7 +24,7 @@ AC_DEFUN([MC_SLANG_TERMCAP], [ #include #endif ], - [SLtt_get_terminfo(); SLtt_tgetflag("");], + [SLtt_get_terminfo(); SLtt_tgetflag((char*)"");], [mc_cv_slang_termcap=no], [mc_cv_slang_termcap=yes]) LIBS="$ac_save_LIBS" diff --git a/src/args.c b/src/args.c index 02607a69a..05202fa8d 100644 --- a/src/args.c +++ b/src/args.c @@ -32,7 +32,7 @@ #include "../src/tty/tty.h" #include "../src/args.h" #include "../src/strutil.h" - +#include "../src/textconf.h" /*** external variables **************************************************************************/ diff --git a/src/filehighlight/ini-file-read.c b/src/filehighlight/ini-file-read.c index 167a0df4b..b2f4901fe 100644 --- a/src/filehighlight/ini-file-read.c +++ b/src/filehighlight/ini-file-read.c @@ -33,6 +33,7 @@ #include "../src/fileloc.h" #include "../src/strescape.h" #include "../src/skin/skin.h" +#include "../../src/util.h" #include "fhl.h" #include "internal.h" diff --git a/src/mcconfig/common.c b/src/mcconfig/common.c index 39b2e2159..b0999ba59 100644 --- a/src/mcconfig/common.c +++ b/src/mcconfig/common.c @@ -30,6 +30,7 @@ #include "global.h" #include "../../vfs/vfs.h" /* mc_stat */ +#include "../../src/util.h" #include "mcconfig.h" diff --git a/src/screen.c b/src/screen.c index 7ddc31aa0..0ad69b852 100644 --- a/src/screen.c +++ b/src/screen.c @@ -1372,8 +1372,8 @@ panel_paint_sort_info(WPanel *panel) static gchar* panel_get_title_without_hotkey(const char *title) { - gchar *translated_title; - const gchar *hkey; + char *translated_title; + char *hkey; if (title == NULL) return NULL; diff --git a/src/skin/ini-file.c b/src/skin/ini-file.c index ce12e137b..1a2b3fb51 100644 --- a/src/skin/ini-file.c +++ b/src/skin/ini-file.c @@ -31,6 +31,7 @@ #include "../src/global.h" #include "../src/main.h" #include "../src/fileloc.h" +#include "../../src/util.h" #include "skin.h" #include "internal.h" diff --git a/src/textconf.c b/src/textconf.c index 8fe02b3d0..9bfc84c16 100644 --- a/src/textconf.c +++ b/src/textconf.c @@ -31,6 +31,7 @@ #include "global.h" #include "ecs.h" +#include "../src/textconf.h" #ifdef USE_VFS static const char *const vfs_supported[] = { diff --git a/src/timefmt.h b/src/timefmt.h index b93a13585..ef588670c 100644 --- a/src/timefmt.h +++ b/src/timefmt.h @@ -10,8 +10,6 @@ #define INVALID_TIME_TEXT "(invalid)" -#ifdef HAVE_STRFTIME - /* safe localtime formatting - strftime()-using version */ #define FMT_LOCALTIME(buffer, bufsize, fmt, when) \ { \ @@ -28,16 +26,6 @@ } \ } \ -#else - -/* fallback when strftime/localtime not available */ -#define FMT_LOCALTIME(buffer,bufsize,fmt,when) \ - { \ - ctime_r(when,buffer); \ - } \ - -#endif - #define FMT_LOCALTIME_CURRENT(buffer, bufsize, fmt) \ { \ time_t __current_time; \ diff --git a/src/tty/win.c b/src/tty/win.c index ce5922d22..86cf6a1e3 100644 --- a/src/tty/win.c +++ b/src/tty/win.c @@ -34,7 +34,7 @@ #include "../../src/tty/tty.h" /* tty_gotoyx, tty_print_char */ #include "../../src/tty/win.h" - +#include "../../src/util.h" #include "../../src/cons.saver.h" /* console_flag */ /*** global variables **************************************************/ diff --git a/vfs/mcserv.c b/vfs/mcserv.c index 4c4986adb..5fedc5554 100644 --- a/vfs/mcserv.c +++ b/vfs/mcserv.c @@ -42,6 +42,7 @@ #include #include #include +#include #ifdef HAVE_LIMITS_H # include #endif @@ -297,13 +298,13 @@ do_close (void) /* {{{ Stat family routines */ static void -send_time (int sock, time_t time) +send_time (int sock, time_t t) { if (clnt_version == 1) { char *ct; int month; - ct = ctime (&time); + ct = ctime (&t); ct[3] = ct[10] = ct[13] = ct[16] = ct[19] = 0; /* Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec */ @@ -326,7 +327,7 @@ send_time (int sock, time_t time) month = 10; } else month = 11; - rpc_send (msock, RPC_INT, atoi (&ct[17]), /* sec */ + rpc_send (sock, RPC_INT, atoi (&ct[17]), /* sec */ RPC_INT, atoi (&ct[14]), /* min */ RPC_INT, atoi (&ct[11]), /* hour */ RPC_INT, atoi (&ct[8]), /* mday */ @@ -334,11 +335,11 @@ send_time (int sock, time_t time) RPC_INT, month, /* month */ RPC_END); } else { - long ltime = (long) time; + long ltime = (long) t; char buf[BUF_SMALL]; snprintf (buf, sizeof (buf), "%lx", ltime); - rpc_send (msock, RPC_STRING, buf, RPC_END); + rpc_send (sock, RPC_STRING, buf, RPC_END); } } @@ -594,16 +595,16 @@ do_mknod (void) static void do_readlink (void) { - char buffer[2048]; + char buf[2048]; char *file; int n; rpc_get (msock, RPC_STRING, &file, RPC_END); - n = readlink (file, buffer, 2048 - 1); + n = readlink (file, buf, 2048 - 1); send_status (n, errno); if (n >= 0) { - buffer[n] = 0; - rpc_send (msock, RPC_STRING, buffer, RPC_END); + buf[n] = 0; + rpc_send (msock, RPC_STRING, buf, RPC_END); } g_free (file); } @@ -818,12 +819,12 @@ mc_pam_auth (const char *username, const char *password) /* Keep reading until we find a \n */ static int -next_line (int socket) +next_line (int sock) { char c; while (1) { - if (read (socket, &c, 1) <= 0) + if (read (sock, &c, 1) <= 0) return 0; if (c == '\n') return 1; @@ -1048,15 +1049,16 @@ do_rauth (int socket) #endif static int -do_rauth (int msock) +do_rauth (int sock) { + sock = 0; /* prevent warning */ return 0; } static void -login_reply (int logged_in) +login_reply (int _logged_in) { - rpc_send (msock, RPC_INT, logged_in ? MC_LOGINOK : MC_INVALID_PASS, + rpc_send (msock, RPC_INT, _logged_in ? MC_LOGINOK : MC_INVALID_PASS, RPC_END); } @@ -1168,7 +1170,7 @@ void tcp_invalidate_socket (int sock) { if (verbose) - printf ("Connection closed\n"); + printf ("Connection closed [socket %d]\n", sock); DO_QUIT_VOID (); } @@ -1193,7 +1195,7 @@ server (int sock) /* {{{ Net support code */ static const char * -get_client (int portnum) +get_client (int port) { int sock, newsocket; unsigned int clilen; @@ -1211,7 +1213,7 @@ get_client (int portnum) memset ((char *) &server_address, 0, sizeof (server_address)); server_address.sin_family = AF_INET; server_address.sin_addr.s_addr = htonl (INADDR_ANY); - server_address.sin_port = htons (portnum); + server_address.sin_port = htons (port); if (bind (sock, (struct sockaddr *) &server_address, @@ -1285,13 +1287,13 @@ get_port_number (void) } static void -register_port (int portnum, int abort_if_fail) +register_port (int port, int abort_if_fail) { #ifdef HAVE_PMAP_SET /* Register our service with the portmapper */ /* protocol: pmap_set (prognum, versnum, protocol, portp) */ - if (pmap_set (RPC_PROGNUM, RPC_PROGVER, IPPROTO_TCP, portnum)) + if (pmap_set (RPC_PROGNUM, RPC_PROGVER, IPPROTO_TCP, port)) signal (SIGINT, signal_int_handler); else { fprintf (stderr, "Cannot register service with portmapper\n"); diff --git a/vfs/samba/configure.ac b/vfs/samba/configure.ac index 3a9e1fbff..a6c5dbe0c 100644 --- a/vfs/samba/configure.ac +++ b/vfs/samba/configure.ac @@ -142,7 +142,7 @@ fi AC_CHECK_FUNCS(waitpid getcwd strdup strtoul strerror chown chmod) AC_CHECK_FUNCS(fstat strchr utime utimes getrlimit fsync bzero memset) AC_CHECK_FUNCS(memmove vsnprintf snprintf setsid glob pipe crypt16 getauthuid) -AC_CHECK_FUNCS(strftime sigprocmask sigblock sigaction innetgr setnetgrent getnetgrent endnetgrent) +AC_CHECK_FUNCS(sigprocmask sigblock sigaction innetgr setnetgrent getnetgrent endnetgrent) AC_CHECK_FUNCS(initgroups select rdchk getgrnam pathconf) AC_CHECK_FUNCS(setpriv setgidx setuidx setgroups mktime rename ftruncate) AC_CHECK_FUNCS(grantpt dup2 yp_get_default_domain getpwanam) diff --git a/vfs/samba/lib/time.c b/vfs/samba/lib/time.c index c76af3b5d..088d6bcb5 100644 --- a/vfs/samba/lib/time.c +++ b/vfs/samba/lib/time.c @@ -493,11 +493,7 @@ char *http_timestring(time_t t) if (!tm) slprintf(buf,sizeof(buf)-1,"%ld seconds since the Epoch",(long)t); else -#ifndef HAVE_STRFTIME - fstrcpy(buf, asctime(tm)); -#else /* !HAVE_STRFTIME */ strftime(buf, sizeof(buf)-1, "%a, %d %b %Y %H:%M:%S %Z", tm); -#endif /* !HAVE_STRFTIME */ return buf; } #endif /*0 */ @@ -515,11 +511,7 @@ char *timestring(void ) if (!tm) { slprintf(TimeBuf,sizeof(TimeBuf)-1,"%ld seconds since the Epoch",(long)t); } else { -#ifdef HAVE_STRFTIME strftime(TimeBuf,100,"%Y/%m/%d %H:%M:%S",tm); -#else - fstrcpy(TimeBuf, asctime(tm)); -#endif } return(TimeBuf); } diff --git a/vfs/undelfs.c b/vfs/undelfs.c index c2c5313f5..3f4557004 100644 --- a/vfs/undelfs.c +++ b/vfs/undelfs.c @@ -158,20 +158,20 @@ undelfs_get_path (const char *dirname, char **fsname, char **file) } static int -undelfs_lsdel_proc(ext2_filsys fs, blk_t *block_nr, int blockcnt, void *private) +undelfs_lsdel_proc(ext2_filsys _fs, blk_t *block_nr, int blockcnt, void *private) { - struct lsdel_struct *lsd = (struct lsdel_struct *) private; + struct lsdel_struct *_lsd = (struct lsdel_struct *) private; (void) blockcnt; - lsd->num_blocks++; + _lsd->num_blocks++; - if (*block_nr < fs->super->s_first_data_block || - *block_nr >= fs->super->s_blocks_count) { - lsd->bad_blocks++; + if (*block_nr < _fs->super->s_first_data_block || + *block_nr >= _fs->super->s_blocks_count) { + _lsd->bad_blocks++; return BLOCK_ABORT; } - if (!ext2fs_test_block_bitmap(fs->block_map,*block_nr)) - lsd->free_blocks++; + if (!ext2fs_test_block_bitmap(_fs->block_map,*block_nr)) + _lsd->free_blocks++; return 0; } diff --git a/vfs/utilvfs.h b/vfs/utilvfs.h index 5747ee32a..60b7a1a60 100644 --- a/vfs/utilvfs.h +++ b/vfs/utilvfs.h @@ -11,6 +11,8 @@ #include +#include "../src/global.h" + /* Flags for vfs_split_url() */ #define URL_ALLOW_ANON 1 #define URL_NOSLASH 2 diff --git a/vfs/vfs-impl.h b/vfs/vfs-impl.h index e61564723..00c752f78 100644 --- a/vfs/vfs-impl.h +++ b/vfs/vfs-impl.h @@ -11,6 +11,8 @@ #include #include +#include +#include #include "../src/fs.h" /* MC_MAXPATHLEN */