Merge branch '2845_cleanup'

* 2845_cleanup:
  Clarify cvs dependency.
  (mcview_moveto_eol): comparison of unsigned expression < 0 fixup.
  Makefile.ams cleanup.
  Code indentation.
  Try fix of compile warnings about assigned but unused variables
  Code cleanup: removed unused variables amd removed unnedeed code.
  (exec_extension): ret rid of double filename conversion.
  Ticket #2839: Fix keybindings for Quit command of mcedit.
  Tweak of select codepage code in case of --disable-charset
  Fix of 'External panelize' dialog: update of 'Command' field content after mouse click.
  Fix of f13 key handling.
  Fix typos.
  Ticket #2538: mcviewer: unused result of str_term_width1().
  src/filemanager/mountlist.c: apply mc code indentation policy.
  Ticket #2845: code cleanup before 4.8.4 release.
This commit is contained in:
Andrew Borodin 2012-07-17 17:04:42 +04:00
commit 03916ee15b
141 changed files with 13335 additions and 12078 deletions

View File

@ -19,7 +19,7 @@ Build requirements for GNU Midnight Commander
- pcre (if glib < 2.14)
- slang or ncurses
- gettext
- cvs
- cvs (for gettext < 0.18 or if gettext >= 0.18 is built with --with-cvs)
- libssh2 >= 1.2.5 is required only for sftp vfs (1.2.7 if you need ssh-agent support)
- libaspell to support spell checking in the internal editor

View File

@ -5,7 +5,7 @@ if ENABLE_MCLIB
tr '.' ' '| \
while read v1 v2 v3; do echo $$v2':'$$v3':'$$v1; done`
libmc_la_LDFLAGS=-no-undefined -version-info $(LIB_VERSION) -release $(LIBMC_RELEASE)
AM_LDFLAGS=-no-undefined -version-info $(LIB_VERSION) -release $(LIBMC_RELEASE)
lib_LTLIBRARIES = libmc.la
else
@ -50,7 +50,7 @@ if CHARSET
libmc_la_SOURCES += charsets.c charsets.h
endif
libmc_la_CFLAGS= $(GLIB_CFLAGS) -I$(top_srcdir) $(PCRE_CFLAGS)
AM_CFLAGS= $(GLIB_CFLAGS) -I$(top_srcdir) $(PCRE_CFLAGS)
libmc_la_LIBADD = \
event/libmcevent.la \
@ -72,4 +72,3 @@ else
endif
libmc_la_LIBADD += $(PCRE_LIBS) $(LIBICONV) $(INTLLIBS)

View File

@ -99,7 +99,6 @@ static void
load_codepages_list_from_file (GPtrArray ** list, const char *fname)
{
FILE *f;
guint i;
char buf[BUF_MEDIUM];
char *default_codepage = NULL;
@ -107,7 +106,7 @@ load_codepages_list_from_file (GPtrArray ** list, const char *fname)
if (f == NULL)
return;
for (i = 0; fgets (buf, sizeof buf, f) != NULL;)
while (fgets (buf, sizeof buf, f) != NULL)
{
/* split string into id and cpname */
char *p = buf;
@ -141,6 +140,8 @@ load_codepages_list_from_file (GPtrArray ** list, const char *fname)
}
else
{
unsigned int i;
/* whether id is already present in list */
/* if yes, overwrite description */
for (i = 0; i < (*list)->len; i++)

View File

@ -7,6 +7,8 @@ libmcevent_la_SOURCES = \
manage.c \
raise.c
libmcevent_la_CFLAGS=-I$(top_srcdir) \
$(GLIB_CFLAGS) $(PCRE_CFLAGS) \
-DDATADIR=\""$(pkgdatadir)/"\" -DLOCALEDIR=\""$(localedir)"\"
AM_CPPFLAGS = \
-DDATADIR=\""$(pkgdatadir)/"\" \
-DLOCALEDIR=\""$(localedir)"\"
AM_CFLAGS = -I$(top_srcdir) $(GLIB_CFLAGS) $(PCRE_CFLAGS)

View File

@ -25,7 +25,8 @@ GTree *mc_event_get_event_group_by_name (const gchar * event_group_name, gboolea
GPtrArray *mc_event_get_event_by_name (GTree * event_group, const gchar * event_name,
gboolean create_new, GError ** mcerror);
mc_event_callback_t *mc_event_is_callback_in_array (GPtrArray * callbacks,
mc_event_callback_func_t event_callback, gpointer event_init_data);
mc_event_callback_func_t event_callback,
gpointer event_init_data);
/*** inline functions ****************************************************************************/
#endif /* MC_EVENT_INTERNAL_H */

View File

@ -6,6 +6,8 @@ libmcfilehighlight_la_SOURCES = \
ini-file-read.c \
internal.h
libmcfilehighlight_la_CFLAGS = -I$(top_srcdir) \
$(GLIB_CFLAGS) $(PCRE_CFLAGS) \
-DDATADIR=\""$(pkgdatadir)/"\" -DLOCALEDIR=\""$(localedir)"\"
AM_CPPFLAGS = \
-DDATADIR=\""$(pkgdatadir)/"\" \
-DLOCALEDIR=\""$(localedir)"\"
AM_CFLAGS = -I$(top_srcdir) $(GLIB_CFLAGS) $(PCRE_CFLAGS)

View File

@ -208,7 +208,7 @@ typedef struct
/* Ugly hack in order to distinguish between left and right panel in menubar */
/* Set if the command is being run from the "Right" menu */
gboolean is_right; /* If the selected menu was the right */
gboolean is_right; /* If the selected menu was the right */
} widget;
struct

View File

@ -2,7 +2,7 @@
Hooks.
Slavaz: Warning! this file is deprecated and should be replaced
by mcevents functional.
by mcevents functional.
Copyright (C) 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002, 2003,
2004, 2005, 2007, 2009, 2010, 2011

View File

@ -7,6 +7,7 @@ libmcconfig_la_SOURCES = \
set.c \
paths.c
libmcconfig_la_CFLAGS = -I$(top_srcdir) \
$(GLIB_CFLAGS) \
AM_CPPFLAGS = \
-DLOCALEDIR=\""$(localedir)"\"
AM_CFLAGS = -I$(top_srcdir) $(GLIB_CFLAGS)

View File

@ -9,6 +9,8 @@ libsearch_la_SOURCES = \
glob.c \
hex.c
libsearch_la_CFLAGS = -I$(top_srcdir) \
$(GLIB_CFLAGS) \
-DDATADIR=\""$(pkgdatadir)/"\" -DLOCALEDIR=\""$(localedir)"\" $(PCRE_CFLAGS)
AM_CPPFLAGS = \
-DDATADIR=\""$(pkgdatadir)/"\" \
-DLOCALEDIR=\""$(localedir)"\"
AM_CFLAGS = -I$(top_srcdir) $(GLIB_CFLAGS) $(PCRE_CFLAGS)

View File

@ -9,6 +9,8 @@ libmcskin_la_SOURCES = \
lines.c \
internal.h
libmcskin_la_CFLAGS = -I$(top_srcdir) \
$(GLIB_CFLAGS) $(PCRE_CFLAGS) \
-DDATADIR=\""$(pkgdatadir)/"\" -DLOCALEDIR=\""$(localedir)"\"
AM_CPPFLAGS = \
-DDATADIR=\""$(pkgdatadir)/"\" \
-DLOCALEDIR=\""$(localedir)"\"
AM_CFLAGS = -I$(top_srcdir) $(GLIB_CFLAGS) $(PCRE_CFLAGS)

View File

@ -8,6 +8,4 @@ libmcstrutil_la_SOURCES = \
strutilutf8.c \
strverscmp.c
libmcstrutil_la_CFLAGS = -I$(top_srcdir) $(GLIB_CFLAGS)
AM_CFLAGS = -I$(top_srcdir) $(GLIB_CFLAGS)

View File

@ -319,7 +319,6 @@ str_8bit_fit_to_term (const char *text, int width, align_crt_t just_mode)
goto finally;
memset (actual, ' ', width - length - ident);
actual += width - length - ident;
remain -= width - length - ident;
}
}
else
@ -393,7 +392,6 @@ str_8bit_term_trim (const char *text, int width)
{
memset (actual, '.', width);
actual += width;
remain -= width;
}
else
{

View File

@ -260,7 +260,6 @@ str_ascii_fit_to_term (const char *text, int width, align_crt_t just_mode)
goto finally;
memset (actual, ' ', width - length - ident);
actual += width - length - ident;
remain -= width - length - ident;
}
}
else
@ -340,7 +339,6 @@ str_ascii_term_trim (const char *text, int width)
{
memset (actual, '.', width);
actual += width;
remain -= width;
}
else
{

View File

@ -675,7 +675,7 @@ str_utf8_term_trim (const char *text, int width)
if (width < 1)
{
result [0] = '\0';
result[0] = '\0';
return result;
}

View File

@ -22,13 +22,15 @@ TTY_SRC = \
libmctty_la_SOURCES = $(TTY_SRC) $(TTY_SCREEN_SRC)
libmctty_la_CFLAGS = -I$(top_srcdir)
AM_CPPFLAGS = \
-DDATADIR=\""$(pkgdatadir)/"\" \
-DLOCALEDIR=\""$(localedir)"\"
AM_CFLAGS = -I$(top_srcdir)
if HAVE_GMODULE
libmctty_la_CFLAGS += $(GMODULE_CFLAGS)
AM_CFLAGS += $(GMODULE_CFLAGS)
else
libmctty_la_CFLAGS += $(GLIB_CFLAGS)
AM_CFLAGS += $(GLIB_CFLAGS)
endif
libmctty_la_CFLAGS += -DDATADIR=\""$(pkgdatadir)/"\" -DLOCALEDIR=\""$(localedir)"\"

View File

@ -47,7 +47,7 @@ void tty_set_normal_attrs (void);
void tty_color_set_defaults (const char *, const char *, const char *);
extern gboolean tty_use_256colors(void);
extern gboolean tty_use_256colors (void);
/*** inline functions ****************************************************************************/
#endif /* MC_COLOR_H */

View File

@ -110,7 +110,7 @@ is_8bit_printable (unsigned char c)
/* --------------------------------------------------------------------------------------------- */
static char *
resolve_symlinks (const vfs_path_t *vpath)
resolve_symlinks (const vfs_path_t * vpath)
{
char *p, *p2;
char *buf, *buf2, *q, *r, c;
@ -164,7 +164,7 @@ resolve_symlinks (const vfs_path_t *vpath)
canonicalize_pathname (buf);
r = strchr (buf, 0);
if (!*r || *(r - 1) != PATH_SEP)
/* FIXME: this condition is always true because r points to the EOL */
/* FIXME: this condition is always true because r points to the EOL */
{
*r++ = PATH_SEP;
*r = 0;
@ -208,9 +208,8 @@ mc_util_write_backup_content (const char *from_file_name, const char *to_file_na
if (fwrite ((const void *) contents, 1, length, backup_fd) != length)
ret1 = FALSE;
{
int ret2;
ret2 = fflush (backup_fd);
ret2 = fclose (backup_fd);
(void) fflush (backup_fd);
(void) fclose (backup_fd);
}
g_free (contents);
return ret1;

View File

@ -1523,10 +1523,8 @@ vfs_s_get_line (struct vfs_class *me, int sock, char *buf, int buf_len, char ter
{
if (logfile)
{
size_t ret1;
int ret2;
ret1 = fwrite (&c, 1, 1, logfile);
ret2 = fflush (logfile);
(void) fwrite (&c, 1, 1, logfile);
(void) fflush (logfile);
}
if (c == '\n')
return 1;

View File

@ -104,13 +104,11 @@ mc_def_getlocalcopy (const vfs_path_t * filename_vpath)
fdin = -1;
if (i == -1)
goto fail;
i = close (fdout);
fdout = -1;
if (i == -1)
{
fdout = -1;
goto fail;
}
if (mc_stat (filename_vpath, &mystat) != -1)
mc_chmod (tmp_vpath, mystat.st_mode);

View File

@ -174,7 +174,7 @@ _vfs_translate_path (const char *path, int size, GIConv defcnv, GString * buffer
(void) defcnv;
g_string_assign (buffer, path);
#endif /* HAVE_CHARSET */
#endif /* HAVE_CHARSET */
return state;
}
@ -614,7 +614,7 @@ vfs_change_encoding (vfs_path_t * vpath, const char *encoding)
return vpath;
}
#endif /* HAVE_CHARSET */
#endif /* HAVE_CHARSET */
/* --------------------------------------------------------------------------------------------- */

View File

@ -176,7 +176,7 @@ struct vfs_s_inode *vfs_s_find_root (struct vfs_class *me, struct vfs_s_entry *e
/* outside interface */
void vfs_s_init_class (struct vfs_class *vclass, struct vfs_s_subclass *sub);
const char *vfs_s_get_path (const vfs_path_t * vpath, struct vfs_s_super **archive, int flags);
struct vfs_s_super *vfs_get_super_by_vpath(const vfs_path_t * vpath);
struct vfs_s_super *vfs_get_super_by_vpath (const vfs_path_t * vpath);
void vfs_s_invalidate (struct vfs_class *me, struct vfs_s_super *super);
char *vfs_s_fullpath (struct vfs_class *me, struct vfs_s_inode *ino);

View File

@ -22,6 +22,8 @@ libmcwidget_la_SOURCES = \
widget-common.c widget-common.h \
wtools.c wtools.h
libmcwidget_la_CFLAGS = -I$(top_srcdir) \
$(GLIB_CFLAGS) $(PCRE_CFLAGS) \
-DDATADIR=\""$(pkgdatadir)/"\" -DLOCALEDIR=\""$(localedir)"\"
AM_CPPFLAGS = \
-DDATADIR=\""$(pkgdatadir)/"\" \
-DLOCALEDIR=\""$(localedir)"\"
AM_CFLAGS = -I$(top_srcdir) $(GLIB_CFLAGS) $(PCRE_CFLAGS)

View File

@ -365,8 +365,7 @@ dlg_mouse_event (Dlg_head * h, Gpm_Event * event)
int y = event->y;
/* close the dialog by mouse click out of dialog area */
if (mouse_close_dialog && !h->fullscreen && ((event->buttons & GPM_B_LEFT) != 0)
&& ((event->type & GPM_DOWN) != 0) /* left click */
if (mouse_close_dialog && !h->fullscreen && ((event->buttons & GPM_B_LEFT) != 0) && ((event->type & GPM_DOWN) != 0) /* left click */
&& !((x > h->x) && (x <= h->x + h->cols) && (y > h->y) && (y <= h->y + h->lines)))
{
h->ret_value = B_CANCEL;
@ -766,7 +765,7 @@ default_dlg_callback (Dlg_head * h, Widget * sender, dlg_msg_t msg, int parm, vo
Dlg_head *
create_dlg (gboolean modal, int y1, int x1, int lines, int cols,
const int *colors, dlg_cb_fn callback, mouse_h mouse_handler,
const int *colors, dlg_cb_fn callback, mouse_h mouse_handler,
const char *help_ctx, const char *title, dlg_flags_t flags)
{
Dlg_head *new_d;

View File

@ -63,7 +63,7 @@ typedef enum
/* Dialog state */
typedef enum
{
DLG_CONSTRUCT = 0, /* DIalog has been constructed but bot run yet */
DLG_CONSTRUCT = 0, /* Dialog has been constructed but not run yet */
DLG_ACTIVE = 1, /* Dialog is visible and active */
DLG_SUSPENDED = 2, /* Dialog is suspended */
DLG_CLOSED = 3 /* Dialog is closed */

View File

@ -24,9 +24,9 @@ extern int num_history_items_recorded;
/* read history to the mc_config, but don't save config to file */
GList *history_get (const char *input_name);
/* load history form the mc_config */
GList *history_load (struct mc_config_t * cfg, const char *name);
GList *history_load (struct mc_config_t *cfg, const char *name);
/* save history to the mc_config, but don't save config to file */
void history_save (struct mc_config_t * cfg, const char *name, GList * h);
void history_save (struct mc_config_t *cfg, const char *name, GList * h);
/* for repositioning of history dialog we should pass widget to this
* function, as position of history dialog depends on widget's position */
char *history_show (GList ** history, Widget * widget, int current);

View File

@ -114,14 +114,12 @@ draw_history_button (WInput * in)
widget_move (&in->widget, 0, in->field_width - HISTORY_BUTTON_WIDTH);
tty_setcolor (disabled ? DISABLED_COLOR : in->color[WINPUTC_HISTORY]);
#ifdef LARGE_HISTORY_BUTTON
{
Dlg_head *h;
h = in->widget.owner;
tty_print_string ("[ ]");
widget_move (&in->widget, 0, in->field_width - HISTORY_BUTTON_WIDTH + 1);
}
tty_print_string ("[ ]");
widget_move (&in->widget, 0, in->field_width - HISTORY_BUTTON_WIDTH + 1);
#endif
tty_print_char (c);
}
@ -197,7 +195,8 @@ do_show_hist (WInput * in)
len = get_history_length (in->history);
r = history_show (&in->history, &in->widget, g_list_position (in->history_current, in->history));
r = history_show (&in->history, &in->widget,
g_list_position (in->history_current, in->history));
if (r != NULL)
{
input_assign_text (in, r);
@ -1137,8 +1136,6 @@ input_handle_char (WInput * in, int key)
cb_ret_t v;
unsigned long command;
v = MSG_NOT_HANDLED;
if (quote != 0)
{
input_free_completions (in);

View File

@ -123,9 +123,13 @@ listbox_draw (WListbox * l, gboolean focused)
const Dlg_head *h = l->widget.owner;
const gboolean disabled = (((Widget *) l)->options & W_DISABLED) != 0;
const int normalc = disabled ? DISABLED_COLOR : h->color[DLG_COLOR_NORMAL];
int selc =
disabled ? DISABLED_COLOR : focused ? h->
color[DLG_COLOR_HOT_FOCUS] : h->color[DLG_COLOR_FOCUS];
/* *INDENT-OFF* */
int selc = disabled
? DISABLED_COLOR
: focused
? h->color[DLG_COLOR_HOT_FOCUS]
: h->color[DLG_COLOR_FOCUS];
/* *INDENT-ON* */
GList *le;
int pos;

View File

@ -77,8 +77,7 @@ quick_dialog_skip (QuickDialog * qd, int nskip)
DLG_CENTER | DLG_TRYUP | DLG_REVERSE);
else
dd = create_dlg (TRUE, qd->ypos, qd->xpos, qd->ylen, qd->xlen,
dialog_colors, qd->callback, qd->mouse, qd->help, qd->title,
DLG_REVERSE);
dialog_colors, qd->callback, qd->mouse, qd->help, qd->title, DLG_REVERSE);
for (qw = qd->widgets; qw->widget_type != quick_end; qw++)
{

View File

@ -33,7 +33,7 @@ dnl Enable large-file support. This has the effect of changing the size
dnl of field f_blocks in 'struct statvfs' from 32 bit to 64 bit on
dnl glibc/Hurd, HP-UX 11, Solaris (32-bit mode). It also changes the size
dnl of field f_blocks in 'struct statfs' from 32 bit to 64 bit on
dnl MacOS X >= 10.5 (32-bit mode).
dnl Mac OS X >= 10.5 (32-bit mode).
AC_REQUIRE([AC_SYS_LARGEFILE])
AC_MSG_NOTICE([checking how to get file system space usage])
@ -68,7 +68,7 @@ struct statvfs fsd;
#if defined __APPLE__ && defined __MACH__
#include <limits.h>
/* On MacOS X >= 10.5, f_blocks in 'struct statvfs' is a 32-bit quantity;
/* On Mac OS X >= 10.5, f_blocks in 'struct statvfs' is a 32-bit quantity;
that commonly limits file systems to 4 TiB. Whereas f_blocks in
'struct statfs' is a 64-bit type, thanks to the large-file support
that was enabled above. In this case, don't use statvfs(); use statfs()
@ -137,7 +137,7 @@ if test $ac_fsusage_space = no; then
fi
if test $ac_fsusage_space = no; then
# glibc/Linux, MacOS X, FreeBSD < 5.0, NetBSD < 3.0, OpenBSD < 4.4.
# glibc/Linux, Mac OS X, FreeBSD < 5.0, NetBSD < 3.0, OpenBSD < 4.4.
# (glibc/{Hurd,kFreeBSD}, FreeBSD >= 5.0, NetBSD >= 3.0,
# OpenBSD >= 4.4, AIX, HP-UX, OSF/1, Cygwin already handled above.)
# (On IRIX you need to include <sys/statfs.h>, not only <sys/mount.h> and

View File

@ -301,7 +301,7 @@ Replace = f4
ReplaceContinue = f14
Complete = alt-tab
InsertFile = f15
Quit = f10, esc
Quit = f10; esc
InsertOverwrite = insert
Help = f1
Date =

View File

@ -301,7 +301,7 @@ Replace = f4
ReplaceContinue = f14
Complete = alt-tab
InsertFile = f15
Quit = f10, esc
Quit = f10; esc
InsertOverwrite = insert
Help = f1
Date =

View File

@ -19,7 +19,7 @@ SUBDIRS += consaver
AM_CPPFLAGS += -DSAVERDIR=\""$(pkglibexecdir)"\"
endif
AM_CFLAGS = $(GLIB_CFLAGS) -I$(top_srcdir) $(PCRE_CFLAGS)
AM_CFLAGS = -I$(top_srcdir) $(GLIB_CFLAGS) $(PCRE_CFLAGS)
localedir = $(datadir)/locale
pkglibexecdir = $(libexecdir)/@PACKAGE@

View File

@ -86,7 +86,9 @@ static gboolean parse_mc_v_argument (const gchar * option_name, const gchar * va
static GOptionContext *context;
#ifdef HAVE_SUBSHELL_SUPPORT
static gboolean mc_args__nouse_subshell = FALSE;
#endif /* HAVE_SUBSHELL_SUPPORT */
static gboolean mc_args__show_datadirs = FALSE;
static gboolean mc_args__show_datadirs_extended = FALSE;
static gboolean mc_args__show_configure_opts = FALSE;

View File

@ -200,7 +200,7 @@ background_attention (int fd, void *closure)
/* void *routine; */
int argc, i, result, status;
char *data[MAXCALLARGS];
ssize_t bytes, ret;
ssize_t bytes;
struct TaskList *p;
int to_child_fd = -1;
enum ReturnType type;
@ -330,9 +330,9 @@ background_attention (int fd, void *closure)
}
/* Send the result code and the value for shared variables */
ret = write (to_child_fd, &result, sizeof (int));
(void) write (to_child_fd, &result, sizeof (int));
if (have_ctx && to_child_fd != -1)
ret = write (to_child_fd, ctx, sizeof (FileOpContext));
(void) write (to_child_fd, ctx, sizeof (FileOpContext));
}
else if (type == Return_String)
{
@ -365,15 +365,15 @@ background_attention (int fd, void *closure)
if (resstr)
{
len = strlen (resstr);
ret = write (to_child_fd, &len, sizeof (len));
(void) write (to_child_fd, &len, sizeof (len));
if (len != 0)
ret = write (to_child_fd, resstr, len);
(void) write (to_child_fd, resstr, len);
g_free (resstr);
}
else
{
len = 0;
ret = write (to_child_fd, &len, sizeof (len));
(void) write (to_child_fd, &len, sizeof (len));
}
}
for (i = 0; i < argc; i++)
@ -398,17 +398,16 @@ static void
parent_call_header (void *routine, int argc, enum ReturnType type, FileOpContext * ctx)
{
int have_ctx;
ssize_t ret;
have_ctx = (ctx != NULL);
ret = write (parent_fd, &routine, sizeof (routine));
ret = write (parent_fd, &argc, sizeof (int));
ret = write (parent_fd, &type, sizeof (type));
ret = write (parent_fd, &have_ctx, sizeof (have_ctx));
(void) write (parent_fd, &routine, sizeof (routine));
(void) write (parent_fd, &argc, sizeof (int));
(void) write (parent_fd, &type, sizeof (type));
(void) write (parent_fd, &have_ctx, sizeof (have_ctx));
if (have_ctx)
ret = write (parent_fd, ctx, sizeof (FileOpContext));
(void) write (parent_fd, ctx, sizeof (FileOpContext));
}
/* --------------------------------------------------------------------------------------------- */
@ -417,7 +416,6 @@ static int
parent_va_call (void *routine, gpointer data, int argc, va_list ap)
{
int i;
ssize_t ret;
struct FileOpContext *ctx = (struct FileOpContext *) data;
parent_call_header (routine, argc, Return_Integer, ctx);
@ -428,13 +426,13 @@ parent_va_call (void *routine, gpointer data, int argc, va_list ap)
len = va_arg (ap, int);
value = va_arg (ap, void *);
ret = write (parent_fd, &len, sizeof (int));
ret = write (parent_fd, value, len);
(void) write (parent_fd, &len, sizeof (int));
(void) write (parent_fd, value, len);
}
ret = read (from_parent_fd, &i, sizeof (int));
(void) read (from_parent_fd, &i, sizeof (int));
if (ctx)
ret = read (from_parent_fd, ctx, sizeof (FileOpContext));
(void) read (from_parent_fd, ctx, sizeof (FileOpContext));
return i;
}

View File

@ -66,7 +66,6 @@ clipboard_file_to_ext_clip (const gchar * event_group_name, const gchar * event_
gpointer init_data, gpointer data)
{
char *tmp, *cmd;
int res = 0;
const char *d = getenv ("DISPLAY");
(void) event_group_name;
@ -81,7 +80,7 @@ clipboard_file_to_ext_clip (const gchar * event_group_name, const gchar * event_
cmd = g_strconcat (clipboard_store_path, " ", tmp, " 2>/dev/null", (char *) NULL);
if (cmd != NULL)
res = my_system (EXECUTE_AS_SHELL, shell, cmd);
(void) my_system (EXECUTE_AS_SHELL, shell, cmd);
g_free (cmd);
g_free (tmp);
@ -127,7 +126,6 @@ clipboard_text_to_file (const gchar * event_group_name, const gchar * event_name
{
int file;
vfs_path_t *fname_vpath = NULL;
ssize_t ret;
size_t str_len;
const char *text = (const char *) data;
@ -147,7 +145,7 @@ clipboard_text_to_file (const gchar * event_group_name, const gchar * event_name
return TRUE;
str_len = strlen (text);
ret = mc_write (file, (char *) text, str_len);
(void) mc_write (file, (char *) text, str_len);
mc_close (file);
return TRUE;
}

View File

@ -90,7 +90,6 @@ show_console_contents_linux (int starty, unsigned char begin_line, unsigned char
unsigned char message = 0;
unsigned short bytes = 0;
int i;
ssize_t ret;
/* Is tty console? */
if (mc_global.tty.console_flag == '\0')
@ -105,29 +104,29 @@ show_console_contents_linux (int starty, unsigned char begin_line, unsigned char
/* Send command to the console handler */
message = CONSOLE_CONTENTS;
ret = write (pipefd1[1], &message, 1);
(void) write (pipefd1[1], &message, 1);
/* Check for outdated cons.saver */
ret = read (pipefd2[0], &message, 1);
(void) read (pipefd2[0], &message, 1);
if (message != CONSOLE_CONTENTS)
return;
/* Send the range of lines that we want */
ret = write (pipefd1[1], &begin_line, 1);
ret = write (pipefd1[1], &end_line, 1);
(void) write (pipefd1[1], &begin_line, 1);
(void) write (pipefd1[1], &end_line, 1);
/* Read the corresponding number of bytes */
ret = read (pipefd2[0], &bytes, 2);
(void) read (pipefd2[0], &bytes, 2);
/* Read the bytes and output them */
for (i = 0; i < bytes; i++)
{
if ((i % COLS) == 0)
tty_gotoyx (starty + (i / COLS), 0);
ret = read (pipefd2[0], &message, 1);
(void) read (pipefd2[0], &message, 1);
tty_print_char (message);
}
/* Read the value of the mc_global.tty.console_flag */
ret = read (pipefd2[0], &message, 1);
(void) read (pipefd2[0], &message, 1);
}
/* --------------------------------------------------------------------------------------------- */
@ -240,10 +239,9 @@ handle_console_linux (console_action_t action)
if (action == CONSOLE_DONE || mc_global.tty.console_flag == '\0')
{
/* We are done -> Let's clean up */
pid_t ret;
close (pipefd1[1]);
close (pipefd2[0]);
ret = waitpid (cons_saver_pid, &status, 0);
(void) waitpid (cons_saver_pid, &status, 0);
mc_global.tty.console_flag = '\0';
}
break;
@ -382,9 +380,10 @@ console_save (void)
for (i = 0; i < screen_shot.xsize * screen_shot.ysize; i++)
{
screen_shot.buf[i] =
(screen_shot.buf[i] & 0xff00) | (unsigned char) revmap.
scrmap[screen_shot.buf[i] & 0xff];
/* *INDENT-OFF* */
screen_shot.buf[i] = (screen_shot.buf[i] & 0xff00)
| (unsigned char) revmap.scrmap[screen_shot.buf[i] & 0xff];
/* *INDENT-ON* */
}
}

View File

@ -4,4 +4,4 @@ pkglibexec_PROGRAMS = cons.saver
cons_saver_SOURCES = cons.saver.c
cons_saver_CFLAGS= -I$(top_srcdir)
AM_CFLAGS= -I$(top_srcdir)

View File

@ -143,8 +143,7 @@ send_contents (char *buffer, unsigned int columns, unsigned int rows)
static void __attribute__ ((noreturn)) die (void)
{
unsigned char zero = 0;
ssize_t ret;
ret = write (1, &zero, 1);
(void) write (1, &zero, 1);
exit (3);
}

View File

@ -5,9 +5,10 @@ libdiffviewer_la_SOURCES = \
search.c \
ydiff.c ydiff.h
AM_CPPFLAGS = \
-DDATADIR=\""$(pkgdatadir)/"\" \
-DLOCALEDIR=\""$(localedir)"\"
libdiffviewer_la_CFLAGS = -I$(top_srcdir) \
$(GLIB_CFLAGS) $(PCRE_CFLAGS) \
-DDATADIR=\""$(pkgdatadir)/"\" -DLOCALEDIR=\""$(localedir)"\"
AM_CFLAGS = -I$(top_srcdir) $(GLIB_CFLAGS) $(PCRE_CFLAGS)
libdiffviewer_la_LIBADD = ../../lib/libmc.la

View File

@ -117,46 +117,6 @@ TAB_SKIP (int ts, int pos)
/* --------------------------------------------------------------------------------------------- */
static void
dview_set_codeset (WDiff * dview)
{
#ifdef HAVE_CHARSET
const char *encoding_id = NULL;
dview->utf8 = TRUE;
encoding_id =
get_codepage_id (mc_global.source_codepage >=
0 ? mc_global.source_codepage : mc_global.display_codepage);
if (encoding_id != NULL)
{
GIConv conv;
conv = str_crt_conv_from (encoding_id);
if (conv != INVALID_CONV)
{
if (dview->converter != str_cnv_from_term)
str_close_conv (dview->converter);
dview->converter = conv;
}
dview->utf8 = (gboolean) str_isutf8 (encoding_id);
}
#else
(void) dview;
#endif
}
/* --------------------------------------------------------------------------------------------- */
#ifdef HAVE_CHARSET
static void
dview_select_encoding (WDiff * dview)
{
if (do_select_codepage ())
dview_set_codeset (dview);
}
#endif /* HAVE_CHARSET */
/* --------------------------------------------------------------------------------------------- */
static gboolean
rewrite_backup_content (const vfs_path_t * from_file_name_vpath, const char *to_file_name)
{
@ -632,31 +592,22 @@ dview_get_utf (char *str, int *char_width, gboolean * result)
if (str == NULL)
{
*result = FALSE;
width = 0;
return 0;
}
res = g_utf8_get_char_validated (str, -1);
if (res < 0)
{
ch = *str;
width = 0;
}
else
{
ch = res;
/* Calculate UTF-8 char width */
next_ch = g_utf8_next_char (str);
if (next_ch)
{
if (next_ch != NULL)
width = next_ch - str;
}
else
{
ch = 0;
width = 0;
}
}
*char_width = width;
return ch;
@ -2197,7 +2148,6 @@ static void
do_merge_hunk (WDiff * dview)
{
int from1, to1, from2, to2;
int res;
int hunk;
hunk = get_current_hunk (dview, &from1, &to1, &from2, &to2);
@ -2244,7 +2194,7 @@ do_merge_hunk (WDiff * dview)
}
fflush (merge_file);
fclose (merge_file);
res = rewrite_backup_content (merge_file_name_vpath, dview->file[0]);
rewrite_backup_content (merge_file_name_vpath, dview->file[0]);
mc_unlink (merge_file_name_vpath);
vfs_path_free (merge_file_name_vpath);
}
@ -2281,6 +2231,118 @@ dview_compute_areas (WDiff * dview)
/* --------------------------------------------------------------------------------------------- */
static void
dview_reread (WDiff * dview)
{
int ndiff;
destroy_hdiff (dview);
if (dview->a[0] != NULL)
{
g_array_foreach (dview->a[0], DIFFLN, cc_free_elt);
g_array_free (dview->a[0], TRUE);
}
if (dview->a[1] != NULL)
{
g_array_foreach (dview->a[1], DIFFLN, cc_free_elt);
g_array_free (dview->a[1], TRUE);
}
dview->a[0] = g_array_new (FALSE, FALSE, sizeof (DIFFLN));
dview->a[1] = g_array_new (FALSE, FALSE, sizeof (DIFFLN));
ndiff = redo_diff (dview);
if (ndiff >= 0)
dview->ndiff = ndiff;
}
/* --------------------------------------------------------------------------------------------- */
#ifdef HAVE_CHARSET
static void
dview_set_codeset (WDiff * dview)
{
const char *encoding_id = NULL;
dview->utf8 = TRUE;
encoding_id =
get_codepage_id (mc_global.source_codepage >=
0 ? mc_global.source_codepage : mc_global.display_codepage);
if (encoding_id != NULL)
{
GIConv conv;
conv = str_crt_conv_from (encoding_id);
if (conv != INVALID_CONV)
{
if (dview->converter != str_cnv_from_term)
str_close_conv (dview->converter);
dview->converter = conv;
}
dview->utf8 = (gboolean) str_isutf8 (encoding_id);
}
}
/* --------------------------------------------------------------------------------------------- */
static void
dview_select_encoding (WDiff * dview)
{
if (do_select_codepage ())
dview_set_codeset (dview);
dview_reread (dview);
tty_touch_screen ();
repaint_screen ();
}
#endif /* HAVE_CHARSET */
/* --------------------------------------------------------------------------------------------- */
static void
dview_diff_options (WDiff * dview)
{
const char *quality_str[] = {
N_("No&rmal"),
N_("&Fastest (Assume large files)"),
N_("&Minimal (Find a smaller set of change)")
};
QuickWidget diffopt_widgets[] = {
QUICK_BUTTON (6, 10, 14, OPTY, N_("&Cancel"), B_CANCEL, NULL),
QUICK_BUTTON (2, 10, 14, OPTY, N_("&OK"), B_ENTER, NULL),
QUICK_CHECKBOX (3, OPTX, 12, OPTY,
N_("Strip &trailing carriage return"), &dview->opt.strip_trailing_cr),
QUICK_CHECKBOX (3, OPTX, 11, OPTY,
N_("Ignore all &whitespace"), &dview->opt.ignore_all_space),
QUICK_CHECKBOX (3, OPTX, 10, OPTY,
N_("Ignore &space change"), &dview->opt.ignore_space_change),
QUICK_CHECKBOX (3, OPTX, 9, OPTY,
N_("Ignore tab &expansion"), &dview->opt.ignore_tab_expansion),
QUICK_CHECKBOX (3, OPTX, 8, OPTY,
N_("&Ignore case"), &dview->opt.ignore_case),
QUICK_LABEL (3, OPTX, 7, OPTY, N_("Diff extra options")),
QUICK_RADIO (3, OPTX, 3, OPTY,
3, (const char **) quality_str, (int *) &dview->opt.quality),
QUICK_LABEL (3, OPTX, 2, OPTY, N_("Diff algorithm")),
QUICK_END
};
QuickDialog diffopt = {
OPTX, OPTY, -1, -1,
N_("Diff Options"), "[Diff Options]",
diffopt_widgets, NULL, NULL, FALSE
};
if (quick_dialog (&diffopt) != B_CANCEL)
{
dview_reread (dview);
}
}
/* --------------------------------------------------------------------------------------------- */
static int
dview_init (WDiff * dview, const char *args, const char *file1, const char *file2,
const char *label1, const char *label2, DSRC dsrc)
@ -2328,8 +2390,9 @@ dview_init (WDiff * dview, const char *args, const char *file1, const char *file
dview->hdiff = NULL;
dview->dsrc = dsrc;
dview->converter = str_cnv_from_term;
#ifdef HAVE_CHARSET
dview_set_codeset (dview);
#endif
dview->a[0] = g_array_new (FALSE, FALSE, sizeof (DIFFLN));
dview->a[1] = g_array_new (FALSE, FALSE, sizeof (DIFFLN));
@ -2374,77 +2437,6 @@ dview_init (WDiff * dview, const char *args, const char *file1, const char *file
/* --------------------------------------------------------------------------------------------- */
static void
dview_reread (WDiff * dview)
{
int ndiff = dview->ndiff;
destroy_hdiff (dview);
if (dview->a[0] != NULL)
{
g_array_foreach (dview->a[0], DIFFLN, cc_free_elt);
g_array_free (dview->a[0], TRUE);
}
if (dview->a[1] != NULL)
{
g_array_foreach (dview->a[1], DIFFLN, cc_free_elt);
g_array_free (dview->a[1], TRUE);
}
dview->a[0] = g_array_new (FALSE, FALSE, sizeof (DIFFLN));
dview->a[1] = g_array_new (FALSE, FALSE, sizeof (DIFFLN));
ndiff = redo_diff (dview);
if (ndiff >= 0)
dview->ndiff = ndiff;
}
/* --------------------------------------------------------------------------------------------- */
static void
dview_diff_options (WDiff * dview)
{
const char *quality_str[] = {
N_("No&rmal"),
N_("&Fastest (Assume large files)"),
N_("&Minimal (Find a smaller set of change)")
};
QuickWidget diffopt_widgets[] = {
QUICK_BUTTON (6, 10, 14, OPTY, N_("&Cancel"), B_CANCEL, NULL),
QUICK_BUTTON (2, 10, 14, OPTY, N_("&OK"), B_ENTER, NULL),
QUICK_CHECKBOX (3, OPTX, 12, OPTY,
N_("Strip &trailing carriage return"), &dview->opt.strip_trailing_cr),
QUICK_CHECKBOX (3, OPTX, 11, OPTY,
N_("Ignore all &whitespace"), &dview->opt.ignore_all_space),
QUICK_CHECKBOX (3, OPTX, 10, OPTY,
N_("Ignore &space change"), &dview->opt.ignore_space_change),
QUICK_CHECKBOX (3, OPTX, 9, OPTY,
N_("Ignore tab &expansion"), &dview->opt.ignore_tab_expansion),
QUICK_CHECKBOX (3, OPTX, 8, OPTY,
N_("&Ignore case"), &dview->opt.ignore_case),
QUICK_LABEL (3, OPTX, 7, OPTY, N_("Diff extra options")),
QUICK_RADIO (3, OPTX, 3, OPTY,
3, (const char **) quality_str, (int *) &dview->opt.quality),
QUICK_LABEL (3, OPTX, 2, OPTY, N_("Diff algorithm")),
QUICK_END
};
QuickDialog diffopt = {
OPTX, OPTY, -1, -1,
N_("Diff Options"), "[Diff Options]",
diffopt_widgets, NULL, NULL, FALSE
};
if (quick_dialog (&diffopt) != B_CANCEL)
{
dview_reread (dview);
}
}
/* --------------------------------------------------------------------------------------------- */
static void
dview_fini (WDiff * dview)
{
@ -2984,7 +2976,7 @@ dview_ok_to_exit (WDiff * dview)
break;
case 1: /* No */
if (mc_util_restore_from_backup_if_possible (dview->file[0], "~~~"))
res = mc_util_unlink_backup_if_possible (dview->file[0], "~~~");
mc_util_unlink_backup_if_possible (dview->file[0], "~~~");
/* fall through */
default:
res = TRUE;
@ -3141,9 +3133,6 @@ dview_execute_cmd (WDiff * dview, unsigned long command)
#ifdef HAVE_CHARSET
case CK_SelectCodepage:
dview_select_encoding (dview);
dview_reread (dview);
tty_touch_screen ();
repaint_screen ();
break;
#endif
case CK_Cancel:

View File

@ -21,4 +21,4 @@ libedit_la_SOURCES += \
endif
endif
libedit_la_CFLAGS = $(GLIB_CFLAGS) -I$(top_srcdir) $(PCRE_CFLAGS)
AM_CFLAGS = $(GLIB_CFLAGS) -I$(top_srcdir) $(PCRE_CFLAGS)

View File

@ -257,7 +257,7 @@ void edit_insert_over (WEdit * edit);
int edit_insert_column_of_text_from_file (WEdit * edit, int file,
long *start_pos, long *end_pos, int *col1, int *col2);
char *edit_get_word_from_pos (WEdit * edit, long start_pos, long *start, gsize *len, gsize *cut);
char *edit_get_word_from_pos (WEdit * edit, long start_pos, long *start, gsize * len, gsize * cut);
long edit_insert_file (WEdit * edit, const vfs_path_t * filename_vpath);
gboolean edit_load_back_cmd (WEdit * edit);
gboolean edit_load_forward_cmd (WEdit * edit);

View File

@ -2001,7 +2001,7 @@ is_break_char (char c)
/* --------------------------------------------------------------------------------------------- */
char *
edit_get_word_from_pos (WEdit *edit, long start_pos, long *start, gsize *len, gsize *cut)
edit_get_word_from_pos (WEdit * edit, long start_pos, long *start, gsize * len, gsize * cut)
{
long word_start;
long cut_len = 0;

View File

@ -504,7 +504,7 @@ edit_save_cmd (WEdit * edit)
*/
static inline gboolean
edit_load_file_from_filename (Dlg_head *h, const vfs_path_t *vpath)
edit_load_file_from_filename (Dlg_head * h, const vfs_path_t * vpath)
{
return edit_add_window (h, h->y + 1, h->x, h->lines - 2, h->cols, vpath, 0);
}
@ -555,7 +555,7 @@ edit_block_delete (WEdit * edit)
{
long count;
long start_mark, end_mark;
int curs_pos, line_width;
int curs_pos;
long curs_line, c1, c2;
if (eval_marks (edit, &start_mark, &end_mark))
@ -583,9 +583,6 @@ edit_block_delete (WEdit * edit)
curs_line = edit->curs_line;
/* calculate line width and cursor position before cut */
line_width = edit_move_forward3 (edit, edit_bol (edit, edit->curs1), 0,
edit_eol (edit, edit->curs1));
curs_pos = edit->curs_col + edit->over_col;
/* move cursor to start of selection */
@ -596,12 +593,14 @@ edit_block_delete (WEdit * edit)
{
if (edit->column_highlight)
{
int line_width;
if (edit->mark2 < 0)
edit_mark_cmd (edit, 0);
edit_delete_column_of_text (edit);
/* move cursor to the saved position */
edit_move_to_line (edit, curs_line);
/* calculate line width after cut */
/* calculate line width and cursor position before cut */
line_width = edit_move_forward3 (edit, edit_bol (edit, edit->curs1), 0,
edit_eol (edit, edit->curs1));
if (option_cursor_beyond_eol && curs_pos > line_width)
@ -2147,7 +2146,7 @@ edit_load_menu_file (Dlg_head * h)
{
vfs_path_free (menufile_vpath);
menufile_vpath = vfs_path_build_filename (mc_global.share_data_dir, EDIT_GLOBAL_MENU, NULL);
}
}
switch (dir)
{
@ -2172,7 +2171,7 @@ edit_load_menu_file (Dlg_head * h)
}
break;
default:
default:
vfs_path_free (menufile_vpath);
return FALSE;
}
@ -3401,19 +3400,17 @@ edit_complete_word_cmd (WEdit * edit)
/* --------------------------------------------------------------------------------------------- */
#ifdef HAVE_CHARSET
void
edit_select_codepage_cmd (WEdit * edit)
{
#ifdef HAVE_CHARSET
if (do_select_codepage ())
edit_set_codeset (edit);
edit->force = REDRAW_PAGE;
send_message ((Widget *) edit, WIDGET_DRAW, 0);
#else
(void) edit;
#endif
}
#endif
/* --------------------------------------------------------------------------------------------- */
@ -3702,6 +3699,6 @@ edit_set_spell_lang (void)
}
aspell_array_clean (lang_list);
}
#endif /* HAVE_ASPELL */
#endif /* HAVE_ASPELL */
/* --------------------------------------------------------------------------------------------- */

View File

@ -27,7 +27,7 @@ struct selection
void editcmd_dialog_replace_show (WEdit *, const char *, const char *, char **, char **);
gboolean editcmd_dialog_search_show (WEdit *edit);
gboolean editcmd_dialog_search_show (WEdit * edit);
int editcmd_dialog_raw_key_query (const char *, const char *, int);

View File

@ -176,12 +176,13 @@ create_command_menu (void)
menu_entry_create (_("Record/Repeat &actions"), CK_RepeatStartStopRecord));
entries = g_list_prepend (entries, menu_separator_create ());
#ifdef HAVE_ASPELL
entries =
g_list_prepend (entries, menu_entry_create (_("S&pell check"), CK_SpellCheck));
entries = g_list_prepend (entries, menu_entry_create (_("S&pell check"), CK_SpellCheck));
entries =
g_list_prepend (entries, menu_entry_create (_("C&heck word"), CK_SpellCheckCurrentWord));
entries =
g_list_prepend (entries, menu_entry_create (_("Change spelling &language"), CK_SpellCheckSelectLang));
g_list_prepend (entries,
menu_entry_create (_("Change spelling &language"),
CK_SpellCheckSelectLang));
entries = g_list_prepend (entries, menu_separator_create ());
#endif /* HAVE_ASPELL */
entries = g_list_prepend (entries, menu_entry_create (_("&Mail..."), CK_Mail));

View File

@ -672,7 +672,7 @@ edit_event (Gpm_Event * event, void *data)
*/
static int
edit_dialog_event (Gpm_Event *event, void *data)
edit_dialog_event (Gpm_Event * event, void *data)
{
Dlg_head *h = (Dlg_head *) data;
Widget *w;
@ -1081,10 +1081,11 @@ edit_file (const vfs_path_t * file_vpath, int line)
return ok;
}
/* --------------------------------------------------------------------------------------------- */
gboolean
edit_files (const GList *files)
edit_files (const GList * files)
{
static gboolean made_directory = FALSE;
Dlg_head *edit_dlg;
@ -1129,8 +1130,7 @@ edit_files (const GList *files)
gboolean f_ok;
f_ok = edit_add_window (edit_dlg, edit_dlg->y + 1, edit_dlg->x,
edit_dlg->lines - 2, edit_dlg->cols,
f->file_vpath, f->line_number);
edit_dlg->lines - 2, edit_dlg->cols, f->file_vpath, f->line_number);
/* at least one file has been opened succefully */
ok = ok || f_ok;
}
@ -1185,7 +1185,7 @@ edit_update_screen (WEdit * e)
edit_update_curs_col (e);
edit_status (e, (e->force & REDRAW_COMPLETELY) != 0 &&
(void *) e == ((Widget *) e)->owner->current->data);
(void *) e == ((Widget *) e)->owner->current->data);
/* pop all events for this window for internal handling */
if (!is_idle ())
@ -1232,7 +1232,7 @@ edit_save_size (WEdit * edit)
*/
gboolean
edit_add_window (Dlg_head * h, int y, int x, int lines, int cols, const vfs_path_t *f, int fline)
edit_add_window (Dlg_head * h, int y, int x, int lines, int cols, const vfs_path_t * f, int fline)
{
WEdit *edit;
Widget *w;

View File

@ -72,8 +72,8 @@ static struct AspellStringEnumeration *(*mc_aspell_word_list_elements) (const st
static const char *(*mc_aspell_config_retrieve) (struct AspellConfig * ths, const char *key);
static void (*mc_delete_aspell_speller) (struct AspellSpeller * ths);
/*
static void (*mc_delete_aspell_config) (struct AspellConfig * ths);
*/
static void (*mc_delete_aspell_config) (struct AspellConfig * ths);
*/
static void (*mc_delete_aspell_can_have_error) (struct AspellCanHaveError * ths);
static const char *(*mc_aspell_error_message) (const struct AspellCanHaveError * ths);
static void (*mc_delete_aspell_string_enumeration) (struct AspellStringEnumeration * ths);
@ -86,7 +86,7 @@ static const char *(*mc_aspell_string_enumeration_next) (struct AspellStringEnum
static void (*mc_delete_aspell_dict_info_enumeration) (struct AspellDictInfoEnumeration * ths);
static unsigned int (*mc_aspell_word_list_size) (const struct AspellWordList * ths);
static const struct AspellError *(*mc_aspell_error) (const struct AspellCanHaveError * ths);
static int (*mc_aspell_speller_add_to_personal) (struct AspellSpeller * ths, const char * word,
static int (*mc_aspell_speller_add_to_personal) (struct AspellSpeller * ths, const char *word,
int word_size);
static int (*mc_aspell_speller_save_all_word_lists) (struct AspellSpeller * ths);
@ -193,8 +193,7 @@ spell_available (void)
(void *) &mc_aspell_speller_error_message))
goto error_ret;
if (!g_module_symbol (spell_module, "aspell_speller_error",
(void *) &mc_aspell_speller_error))
if (!g_module_symbol (spell_module, "aspell_speller_error", (void *) &mc_aspell_speller_error))
goto error_ret;
if (!g_module_symbol (spell_module, "aspell_error", (void *) &mc_aspell_error))

View File

@ -16,9 +16,9 @@
void aspell_init (void);
void aspell_clean (void);
gboolean aspell_check (const char *word, const int word_size);
unsigned int aspell_suggest (GArray *suggest, const char *word, const int word_size);
void aspell_array_clean (GArray *array);
unsigned int aspell_get_lang_list (GArray *lang_list);
unsigned int aspell_suggest (GArray * suggest, const char *word, const int word_size);
void aspell_array_clean (GArray * array);
unsigned int aspell_get_lang_list (GArray * lang_list);
const char *aspell_get_lang (void);
gboolean aspell_set_lang (const char *lang);
gboolean aspell_add_to_dict (const char *word, const int word_size);

View File

@ -59,7 +59,7 @@
*/
int
spell_dialog_spell_suggest_show (WEdit * edit, const char *word, char **new_word, GArray *suggest)
spell_dialog_spell_suggest_show (WEdit * edit, const char *word, char **new_word, GArray * suggest)
{
int sug_dlg_h = 14; /* dialog height */
@ -154,11 +154,11 @@ spell_dialog_spell_suggest_show (WEdit * edit, const char *word, char **new_word
*/
char *
spell_dialog_lang_list_show (GArray *languages)
spell_dialog_lang_list_show (GArray * languages)
{
int lang_dlg_h = 12; /* dialog height */
int lang_dlg_w = 30; /* dialog width */
int lang_dlg_h = 12; /* dialog height */
int lang_dlg_w = 30; /* dialog width */
char *selected_lang = NULL;
unsigned int i;
int res;

View File

@ -17,8 +17,8 @@
/*** declarations of public functions ************************************************************/
int spell_dialog_spell_suggest_show (WEdit * edit, const char *word, char **new_word,
GArray *suggest);
char *spell_dialog_lang_list_show (GArray *languages);
GArray * suggest);
char *spell_dialog_lang_list_show (GArray * languages);
/*** inline functions ****************************************************************************/

View File

@ -340,7 +340,7 @@ toggle_panels (void)
#ifdef HAVE_SUBSHELL_SUPPORT
if (mc_global.tty.use_subshell)
{
new_dir_p = vfs_current_is_local () ? &new_dir_vpath : NULL;
new_dir_p = vfs_current_is_local ()? &new_dir_vpath : NULL;
invoke_subshell (NULL, VISIBLY, new_dir_p);
}
else

View File

@ -31,8 +31,10 @@ libmcfilemanager_la_SOURCES = \
libmcfilemanager_la_SOURCES += mountlist.c mountlist.h
#endif
libmcfilemanager_la_CFLAGS = -I$(top_srcdir) \
$(GLIB_CFLAGS) $(PCRE_CFLAGS) \
-DDATADIR=\""$(pkgdatadir)/"\" -DLOCALEDIR=\""$(localedir)"\"
AM_CPPFLAGS = \
-DDATADIR=\""$(pkgdatadir)/"\" \
-DLOCALEDIR=\""$(localedir)"\"
AM_CFLAGS = -I$(top_srcdir) $(GLIB_CFLAGS) $(PCRE_CFLAGS)
libmcfilemanager_la_LIBADD = ../../lib/libmc.la

View File

@ -258,15 +258,13 @@ do_chown (uid_t u, gid_t g)
static void
apply_chowns (uid_t u, gid_t g)
{
char *fname;
need_update = end_chown = 1;
do_chown (u, g);
do
{
fname = next_file ();
next_file ();
do_chown (u, g);
}
while (current_panel->marked);

View File

@ -236,7 +236,7 @@ select_unselect_cmd (const char *title, const char *history_name, gboolean do_se
if (quick_dialog (&quick_dlg) == B_CANCEL)
return;
if (!reg_exp)
if (reg_exp == NULL)
return;
if (!*reg_exp)
{

View File

@ -83,7 +83,8 @@ WInput *cmdline;
static char *
examine_cd (const char *_path)
{
typedef enum { copy_sym, subst_var } state_t;
typedef enum
{ copy_sym, subst_var } state_t;
state_t state = copy_sym;
char *q;
@ -424,7 +425,7 @@ do_cd_command (char *orig_cmd)
path = examine_cd (&cmd[operand_pos]);
if (*path == '\0')
q_vpath = vfs_path_from_str (mc_config_get_home_dir());
q_vpath = vfs_path_from_str (mc_config_get_home_dir ());
else
q_vpath = vfs_path_from_str_flags (path, VPF_NO_CANON);

View File

@ -102,7 +102,7 @@ static gboolean do_local_copy = FALSE;
/* --------------------------------------------------------------------------------------------- */
static void
exec_cleanup_file_name (vfs_path_t * filename_vpath, gboolean has_changed)
exec_cleanup_file_name (const vfs_path_t * filename_vpath, gboolean has_changed)
{
if (localfilecopy_vpath == NULL)
return;
@ -122,7 +122,7 @@ exec_cleanup_file_name (vfs_path_t * filename_vpath, gboolean has_changed)
/* --------------------------------------------------------------------------------------------- */
static char *
exec_get_file_name (vfs_path_t * filename_vpath)
exec_get_file_name (const vfs_path_t * filename_vpath)
{
if (!do_local_copy)
return quote_func (vfs_path_get_last_path_str (filename_vpath), 0);
@ -144,7 +144,7 @@ exec_get_file_name (vfs_path_t * filename_vpath)
/* --------------------------------------------------------------------------------------------- */
static char *
exec_get_export_variables (vfs_path_t * filename_vpath)
exec_get_export_variables (const vfs_path_t * filename_vpath)
{
char *text;
GString *export_vars_string;
@ -189,7 +189,7 @@ exec_get_export_variables (vfs_path_t * filename_vpath)
/* --------------------------------------------------------------------------------------------- */
static char *
exec_make_shell_string (const char *lc_data, vfs_path_t * filename_vpath)
exec_make_shell_string (const char *lc_data, const vfs_path_t * filename_vpath)
{
GString *shell_string;
char lc_prompt[80] = "\0";
@ -315,7 +315,7 @@ exec_make_shell_string (const char *lc_data, vfs_path_t * filename_vpath)
/* --------------------------------------------------------------------------------------------- */
static void
exec_extension_view (char *cmd, vfs_path_t * filename_vpath, int start_line,
exec_extension_view (char *cmd, const vfs_path_t * filename_vpath, int start_line,
vfs_path_t * temp_file_name_vpath)
{
int def_hex_mode = mcview_default_hex_mode, changed_hex_mode = 0;
@ -376,16 +376,14 @@ exec_extension_cd (void)
/* --------------------------------------------------------------------------------------------- */
static void
exec_extension (const char *filename, const char *lc_data, int start_line)
exec_extension (const vfs_path_t * filename_vpath, const char *lc_data, int start_line)
{
char *shell_string, *export_variables;
vfs_path_t *temp_file_name_vpath = NULL;
int cmd_file_fd;
FILE *cmd_file;
char *cmd = NULL;
vfs_path_t *filename_vpath;
g_return_if_fail (filename != NULL);
g_return_if_fail (lc_data != NULL);
pbuffer = NULL;
@ -395,8 +393,6 @@ exec_extension (const char *filename, const char *lc_data, int start_line)
is_cd = FALSE;
written_nonspace = FALSE;
filename_vpath = vfs_path_from_str (filename);
/* Avoid making a local copy if we are doing a cd */
do_local_copy = !vfs_file_is_local (filename_vpath);
@ -494,7 +490,6 @@ exec_extension (const char *filename, const char *lc_data, int start_line)
exec_cleanup_file_name (filename_vpath, TRUE);
ret:
vfs_path_free (temp_file_name_vpath);
vfs_path_free (filename_vpath);
}
/* --------------------------------------------------------------------------------------------- */
@ -947,7 +942,7 @@ regex_command (const vfs_path_t * filename_vpath, const char *action)
*/
if (p < q)
{
exec_extension (filename, r + 1, view_at_line_number);
exec_extension (filename_vpath, r + 1, view_at_line_number);
ret = 1;
}
break;

View File

@ -238,7 +238,7 @@ free_link (void *data)
/* --------------------------------------------------------------------------------------------- */
static void *
free_linklist (GSList *lp)
free_linklist (GSList * lp)
{
g_slist_foreach (lp, (GFunc) free_link, NULL);
g_slist_free (lp);
@ -249,7 +249,7 @@ free_linklist (GSList *lp)
/* --------------------------------------------------------------------------------------------- */
static gboolean
is_in_linklist (const GSList *lp, const vfs_path_t * vpath, const struct stat *sb)
is_in_linklist (const GSList * lp, const vfs_path_t * vpath, const struct stat *sb)
{
const struct vfs_class *class;
ino_t ino = sb->st_ino;

View File

@ -57,9 +57,9 @@
#if ((STAT_STATVFS || STAT_STATVFS64) \
&& (HAVE_STRUCT_STATVFS_F_BASETYPE || HAVE_STRUCT_STATVFS_F_FSTYPENAME \
|| (! HAVE_STRUCT_STATFS_F_FSTYPENAME)))
# define USE_STATVFS 1
#define USE_STATVFS 1
#else
# define USE_STATVFS 0
#define USE_STATVFS 0
#endif
#include <errno.h>
@ -70,36 +70,36 @@
#include <sys/stat.h>
#if USE_STATVFS
# include <sys/statvfs.h>
#include <sys/statvfs.h>
#elif HAVE_SYS_VFS_H
# include <sys/vfs.h>
#include <sys/vfs.h>
#elif HAVE_SYS_MOUNT_H && HAVE_SYS_PARAM_H
/* NOTE: freebsd5.0 needs sys/param.h and sys/mount.h for statfs.
It does have statvfs.h, but shouldn't use it, since it doesn't
HAVE_STRUCT_STATVFS_F_BASETYPE. So find a clean way to fix it. */
/* NetBSD 1.5.2 needs these, for the declaration of struct statfs. */
# include <sys/param.h>
# include <sys/mount.h>
# if HAVE_NFS_NFS_CLNT_H && HAVE_NFS_VFS_H
#include <sys/param.h>
#include <sys/mount.h>
#if HAVE_NFS_NFS_CLNT_H && HAVE_NFS_VFS_H
/* Ultrix 4.4 needs these for the declaration of struct statfs. */
# include <netinet/in.h>
# include <nfs/nfs_clnt.h>
# include <nfs/vfs.h>
# endif
#include <netinet/in.h>
#include <nfs/nfs_clnt.h>
#include <nfs/vfs.h>
#endif
#elif HAVE_OS_H /* BeOS */
# include <fs_info.h>
#include <fs_info.h>
#endif
#if USE_STATVFS
# define STRUCT_STATVFS struct statvfs
# if ! STAT_STATVFS && STAT_STATVFS64
# define STATFS statvfs64
# else
# define STATFS statvfs
# endif
#define STRUCT_STATVFS struct statvfs
#if ! STAT_STATVFS && STAT_STATVFS64
#define STATFS statvfs64
#else
# define STATFS statfs
# if HAVE_OS_H /* BeOS */
#define STATFS statvfs
#endif
#else
#define STATFS statfs
#if HAVE_OS_H /* BeOS */
/* BeOS has a statvfs function, but it does not return sensible values
for f_files, f_ffree and f_favail, and lacks f_type, f_basetype and
f_fstypename. Use 'struct fs_info' instead. */
@ -113,29 +113,27 @@ statfs (char const *filename, struct fs_info *buf)
errno = (device == B_ENTRY_NOT_FOUND ? ENOENT
: device == B_BAD_VALUE ? EINVAL
: device == B_NAME_TOO_LONG ? ENAMETOOLONG
: device == B_NO_MEMORY ? ENOMEM
: device == B_FILE_ERROR ? EIO
: 0);
: device == B_NO_MEMORY ? ENOMEM : device == B_FILE_ERROR ? EIO : 0);
return -1;
}
/* If successful, buf->dev will be == device. */
return fs_stat_dev (device, buf);
}
# define STRUCT_STATVFS struct fs_info
# else
# define STRUCT_STATVFS struct statfs
# endif
#define STRUCT_STATVFS struct fs_info
#else
#define STRUCT_STATVFS struct statfs
#endif
#endif
#if HAVE_STRUCT_STATVFS_F_BASETYPE
# define STATXFS_FILE_SYSTEM_TYPE_MEMBER_NAME f_basetype
#define STATXFS_FILE_SYSTEM_TYPE_MEMBER_NAME f_basetype
#else
# if HAVE_STRUCT_STATVFS_F_FSTYPENAME || HAVE_STRUCT_STATFS_F_FSTYPENAME
# define STATXFS_FILE_SYSTEM_TYPE_MEMBER_NAME f_fstypename
# elif HAVE_OS_H /* BeOS */
# define STATXFS_FILE_SYSTEM_TYPE_MEMBER_NAME fsh_name
# endif
#if HAVE_STRUCT_STATVFS_F_FSTYPENAME || HAVE_STRUCT_STATFS_F_FSTYPENAME
#define STATXFS_FILE_SYSTEM_TYPE_MEMBER_NAME f_fstypename
#elif HAVE_OS_H /* BeOS */
#define STATXFS_FILE_SYSTEM_TYPE_MEMBER_NAME fsh_name
#endif
#endif
#include <unistd.h>

View File

@ -1694,10 +1694,9 @@ do_find (const char *start_dir, ssize_t start_dir_len, const char *ignore_dirs,
/* absolute path */
if (start_dir_len < 0)
{
int ret;
vfs_path_free (current_panel->cwd_vpath);
current_panel->cwd_vpath = vfs_path_from_str (PATH_SEP_STR);
ret = chdir (PATH_SEP_STR);
chdir (PATH_SEP_STR);
}
panelize_save_panel (current_panel);
}

View File

@ -557,7 +557,7 @@ init_layout (void)
}
equal_split = panels_layout.horizontal_split ?
panels_layout.horizontal_equal : panels_layout.vertical_equal;
panels_layout.horizontal_equal : panels_layout.vertical_equal;
/* "Panel split" groupbox */
bright_widget = button_new (6, 14, B_2RIGHT, NARROW_BUTTON, "&>", b_left_right_cback);

View File

@ -73,7 +73,7 @@ struct Widget *get_panel_widget (int idx);
struct WPanel *get_other_panel (void);
void save_panel_dir (int idx);
char *get_panel_dir_for (const struct WPanel * widget);
char *get_panel_dir_for (const struct WPanel *widget);
void set_hintbar (const char *str);

View File

@ -631,10 +631,7 @@ create_panels (void)
/* 3. Create active panel */
if (current_dir == NULL)
{
current_dir = vfs_path_to_str (original_dir);
mc_chdir (original_dir);
}
else
{
vfs_path_t *vpath;
@ -1603,7 +1600,7 @@ midnight_callback (Dlg_head * h, Widget * sender, dlg_msg_t msg, int parm, void
/* --------------------------------------------------------------------------------------------- */
static int
midnight_event (Gpm_Event *event, void *data)
midnight_event (Gpm_Event * event, void *data)
{
Dlg_head *h = (Dlg_head *) data;
int ret = MOU_UNHANDLED;

View File

@ -33,7 +33,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h> /* SIZE_MAX */
#include <stdint.h> /* SIZE_MAX */
#include <sys/types.h>
#include <errno.h>
@ -43,7 +43,7 @@
#include <sys/param.h>
#endif
#if defined STAT_STATVFS || defined STAT_STATVFS64 /* POSIX 1003.1-2001 (and later) with XSI */
#if defined STAT_STATVFS || defined STAT_STATVFS64 /* POSIX 1003.1-2001 (and later) with XSI */
#include <sys/statvfs.h>
#else
/* Don't include backward-compatibility files unless they're needed.
@ -202,7 +202,7 @@
#undef closedir
#ifndef ME_DUMMY
# define ME_DUMMY(Fs_name, Fs_type) \
#define ME_DUMMY(Fs_name, Fs_type) \
(strcmp (Fs_type, "autofs") == 0 \
|| strcmp (Fs_type, "none") == 0 \
|| strcmp (Fs_type, "proc") == 0 \
@ -240,7 +240,7 @@ me_remote (char const *fs_name, char const *fs_type _GL_UNUSED)
#ifndef ME_REMOTE
/* A file system is `remote' if its Fs_name contains a `:'
or if (it is of type (smbfs or cifs) and its Fs_name starts with `//'). */
# define ME_REMOTE(Fs_name, Fs_type) \
#define ME_REMOTE(Fs_name, Fs_type) \
(strchr (Fs_name, ':') != NULL \
|| ((Fs_name)[0] == '/' \
&& (Fs_name)[1] == '/' \
@ -270,7 +270,7 @@ me_remote (char const *fs_name, char const *fs_type _GL_UNUSED)
otherwise, use PROPAGATE_ALL_ONES. */
#define PROPAGATE_TOP_BIT(x) ((x) | ~ (EXTRACT_TOP_BIT (x) - 1))
#ifdef STAT_READ_FILSYS /* SVR2 */
#ifdef STAT_READ_FILSYS /* SVR2 */
/* Set errno to zero upon EOF. */
#define ZERO_BYTE_TRANSFER_ERRNO 0
@ -279,32 +279,32 @@ me_remote (char const *fs_name, char const *fs_type _GL_UNUSED)
#else
#define IS_EINTR(x) 0
#endif
#endif /* STAT_READ_FILSYS */
#endif /* STAT_READ_FILSYS */
/*** file scope type declarations ****************************************************************/
/* A mount table entry. */
struct mount_entry
{
char *me_devname; /* Device node name, including "/dev/". */
char *me_mountdir; /* Mount point directory name. */
char *me_type; /* "nfs", "4.2", etc. */
dev_t me_dev; /* Device number of me_mountdir. */
unsigned int me_dummy : 1; /* Nonzero for dummy file systems. */
unsigned int me_remote : 1; /* Nonzero for remote fileystems. */
unsigned int me_type_malloced : 1; /* Nonzero if me_type was malloced. */
char *me_devname; /* Device node name, including "/dev/". */
char *me_mountdir; /* Mount point directory name. */
char *me_type; /* "nfs", "4.2", etc. */
dev_t me_dev; /* Device number of me_mountdir. */
unsigned int me_dummy:1; /* Nonzero for dummy file systems. */
unsigned int me_remote:1; /* Nonzero for remote fileystems. */
unsigned int me_type_malloced:1; /* Nonzero if me_type was malloced. */
struct mount_entry *me_next;
};
struct fs_usage
{
uintmax_t fsu_blocksize; /* Size of a block. */
uintmax_t fsu_blocks; /* Total blocks. */
uintmax_t fsu_bfree; /* Free blocks available to superuser. */
uintmax_t fsu_bavail; /* Free blocks available to non-superuser. */
int fsu_bavail_top_bit_set; /* 1 if fsu_bavail represents a value < 0. */
uintmax_t fsu_files; /* Total file nodes. */
uintmax_t fsu_ffree; /* Free file nodes. */
uintmax_t fsu_blocksize; /* Size of a block. */
uintmax_t fsu_blocks; /* Total blocks. */
uintmax_t fsu_bfree; /* Free blocks available to superuser. */
uintmax_t fsu_bavail; /* Free blocks available to non-superuser. */
int fsu_bavail_top_bit_set; /* 1 if fsu_bavail represents a value < 0. */
uintmax_t fsu_files; /* Total file nodes. */
uintmax_t fsu_ffree; /* Free file nodes. */
};
/*** file scope variables ************************************************************************/
@ -1044,7 +1044,7 @@ read_file_system_list (int need_fs_type)
&& (ignore == options || ignore[-1] == ',')
&& (ignore[sizeof ("ignore") - 1] == ','
|| ignore[sizeof ("ignore") - 1] == '\0'));
me->me_dev = (dev_t)(-1); /* vmt_fsid might be the info we want. */
me->me_dev = (dev_t) (-1); /* vmt_fsid might be the info we want. */
/* Add to the linked list. */
*mtail = me;
@ -1221,7 +1221,7 @@ read_file_system_list (int need_fs_type, int all_fs)
/* --------------------------------------------------------------------------------------------- */
#ifdef STAT_READ_FILSYS /* SVR2 */
#ifdef STAT_READ_FILSYS /* SVR2 */
/* Read(write) up to COUNT bytes at BUF from(to) descriptor FD, retrying if
interrupted. Return the actual number of bytes read(written), zero for EOF,
@ -1229,24 +1229,26 @@ read_file_system_list (int need_fs_type, int all_fs)
static size_t
safe_read (int fd, void *buf, size_t count)
{
/* Work around a bug in Tru64 5.1. Attempting to read more than
INT_MAX bytes fails with errno == EINVAL. See
<http://lists.gnu.org/archive/html/bug-gnu-utils/2002-04/msg00010.html>.
When decreasing COUNT, keep it block-aligned. */
enum { BUGGY_READ_MAXIMUM = INT_MAX & ~8191 };
/* Work around a bug in Tru64 5.1. Attempting to read more than
INT_MAX bytes fails with errno == EINVAL. See
<http://lists.gnu.org/archive/html/bug-gnu-utils/2002-04/msg00010.html>.
When decreasing COUNT, keep it block-aligned. */
/* *INDENT-OFF* */
enum { BUGGY_READ_MAXIMUM = INT_MAX & ~8191 };
/* *INDENT-ON* */
for (;;)
for (;;)
{
ssize_t result = read (fd, buf, count);
ssize_t result = read (fd, buf, count);
if (0 <= result)
return result;
else if (IS_EINTR (errno))
continue;
else if (errno == EINVAL && BUGGY_READ_MAXIMUM < count)
count = BUGGY_READ_MAXIMUM;
else
return result;
if (0 <= result)
return result;
else if (IS_EINTR (errno))
continue;
else if (errno == EINVAL && BUGGY_READ_MAXIMUM < count)
count = BUGGY_READ_MAXIMUM;
else
return result;
}
}
@ -1262,28 +1264,28 @@ safe_read (int fd, void *buf, size_t count)
static size_t
full_read (int fd, void *buf, size_t count)
{
size_t total = 0;
char *ptr = (char *) buf;
size_t total = 0;
char *ptr = (char *) buf;
while (count > 0)
while (count > 0)
{
size_t n_rw = safe_read (fd, ptr, count);
if (n_rw == (size_t) (-1))
break;
if (n_rw == 0)
size_t n_rw = safe_read (fd, ptr, count);
if (n_rw == (size_t) (-1))
break;
if (n_rw == 0)
{
errno = ZERO_BYTE_TRANSFER_ERRNO;
break;
errno = ZERO_BYTE_TRANSFER_ERRNO;
break;
}
total += n_rw;
ptr += n_rw;
count -= n_rw;
total += n_rw;
ptr += n_rw;
count -= n_rw;
}
return total;
return total;
}
#endif /* STAT_READ_FILSYS */
#endif /* STAT_READ_FILSYS */
/* --------------------------------------------------------------------------------------------- */
@ -1298,7 +1300,7 @@ full_read (int fd, void *buf, size_t count)
static int
get_fs_usage (char const *file, char const *disk, struct fs_usage *fsp)
{
#ifdef STAT_STATVFS /* POSIX, except glibc/Linux */
#ifdef STAT_STATVFS /* POSIX, except glibc/Linux */
struct statvfs fsd;
@ -1306,8 +1308,11 @@ get_fs_usage (char const *file, char const *disk, struct fs_usage *fsp)
return -1;
/* f_frsize isn't guaranteed to be supported. */
fsp->fsu_blocksize = (fsd.f_frsize
? PROPAGATE_ALL_ONES (fsd.f_frsize) : PROPAGATE_ALL_ONES (fsd.f_bsize));
/* *INDENT-OFF* */
fsp->fsu_blocksize = fsd.f_frsize
? PROPAGATE_ALL_ONES (fsd.f_frsize)
: PROPAGATE_ALL_ONES (fsd.f_bsize);
/* *INDENT-ON* */
#elif defined STAT_STATVFS64 /* AIX */
@ -1317,8 +1322,11 @@ get_fs_usage (char const *file, char const *disk, struct fs_usage *fsp)
return -1;
/* f_frsize isn't guaranteed to be supported. */
fsp->fsu_blocksize = (fsd.f_frsize
? PROPAGATE_ALL_ONES (fsd.f_frsize) : PROPAGATE_ALL_ONES (fsd.f_bsize));
/* *INDENT-OFF* */
fsp->fsu_blocksize = fsd.f_frsize
? PROPAGATE_ALL_ONES (fsd.f_frsize)
: PROPAGATE_ALL_ONES (fsd.f_bsize);
/* *INDENT-ON* */
#elif defined STAT_STATFS2_FS_DATA /* Ultrix */
@ -1379,7 +1387,7 @@ get_fs_usage (char const *file, char const *disk, struct fs_usage *fsp)
fsp->fsu_blocksize = PROPAGATE_ALL_ONES (fsd.f_fsize);
#elif defined STAT_STATFS2_BSIZE /* glibc/Linux, 4.3BSD, SunOS 4, \
MacOS X < 10.4, FreeBSD < 5.0, \
Mac OS X < 10.4, FreeBSD < 5.0, \
NetBSD < 3.0, OpenBSD < 4.4 */
struct statfs fsd;
@ -1447,7 +1455,6 @@ get_fs_usage (char const *file, char const *disk, struct fs_usage *fsp)
fsp->fsu_ffree = PROPAGATE_ALL_ONES (fsd.f_ffree);
#endif
(void) disk; /* avoid argument-unused warning */
return 0;
}
@ -1517,7 +1524,9 @@ my_statfs (struct my_statfs *myfs_stats, const char *path)
myfs_stats->typename = entry->me_type;
myfs_stats->mpoint = entry->me_mountdir;
myfs_stats->device = entry->me_devname;
myfs_stats->avail = ((uintmax_t) (getuid () ? fs_use.fsu_bavail : fs_use.fsu_bfree) * fs_use.fsu_blocksize) >> 10;
myfs_stats->avail =
((uintmax_t) (getuid ()? fs_use.fsu_bavail : fs_use.fsu_bfree) *
fs_use.fsu_blocksize) >> 10;
myfs_stats->total = ((uintmax_t) fs_use.fsu_blocks * fs_use.fsu_blocksize) >> 10;
myfs_stats->nfree = (uintmax_t) fs_use.fsu_ffree;
myfs_stats->nodes = (uintmax_t) fs_use.fsu_files;

View File

@ -1,6 +1,6 @@
/*
Declarations for list of mounted filesystems
*/
*/
/** \file mountlist.h
* \brief Header: list of mounted filesystems
@ -24,8 +24,8 @@ struct my_statfs
char *typename;
const char *mpoint;
const char *device;
uintmax_t avail; /* in kB */
uintmax_t total; /* in kB */
uintmax_t avail; /* in kB */
uintmax_t total; /* in kB */
uintmax_t nfree;
uintmax_t nodes;
};

View File

@ -3015,6 +3015,8 @@ subshell_chdir (const vfs_path_t * vpath)
#ifdef HAVE_SUBSHELL_SUPPORT
if (mc_global.tty.use_subshell && vfs_current_is_local ())
do_subshell_chdir (vpath, FALSE, TRUE);
#else /* HAVE_SUBSHELL_SUPPORT */
(void) vpath;
#endif /* HAVE_SUBSHELL_SUPPORT */
}
@ -4121,7 +4123,7 @@ panel_new_with_dir (const char *panel_name, const char *wpath)
vfs_path_t *vpath;
vpath = vfs_path_from_str (curdir);
err = mc_chdir (vpath);
mc_chdir (vpath);
vfs_path_free (vpath);
}
g_free (curdir);
@ -4580,7 +4582,7 @@ remove_encoding_from_path (const vfs_path_t * vpath)
g_string_free (tmp_conv, TRUE);
return ret_vpath;
}
#endif /* HAVE_CHARSET */
#endif /* HAVE_CHARSET */
/* --------------------------------------------------------------------------------------------- */
/**

View File

@ -138,6 +138,7 @@ panelize_callback (Dlg_head * h, Widget * sender, dlg_msg_t msg, int parm, void
{
case DLG_INIT:
case DLG_POST_KEY:
case DLG_FOCUS:
tty_setcolor (MENU_ENTRY_COLOR);
update_command ();
return MSG_HANDLED;
@ -387,9 +388,8 @@ do_external_panelize (char *command)
current_panel->count = next_free;
if (list->list[0].fname[0] == PATH_SEP)
{
int ret;
panel_set_cwd (current_panel, PATH_SEP_STR);
ret = chdir (PATH_SEP_STR);
chdir (PATH_SEP_STR);
}
}
else
@ -599,8 +599,7 @@ load_panelize (void)
if (!profile_keys || *profile_keys == NULL)
{
add2panelize (g_strdup (_("Modified git files")),
g_strdup ("git ls-files --modified"));
add2panelize (g_strdup (_("Modified git files")), g_strdup ("git ls-files --modified"));
add2panelize (g_strdup (_("Find rejects after patching")),
g_strdup ("find . -name \\*.rej -print"));
add2panelize (g_strdup (_("Find *.orig after patching")),

View File

@ -739,7 +739,6 @@ static void
tree_rescan (void *data)
{
WTree *tree = data;
int ret;
vfs_path_t *old_vpath;
old_vpath = vfs_path_clone (vfs_get_raw_current_dir ());
@ -749,7 +748,7 @@ tree_rescan (void *data)
if (tree->selected_ptr != NULL && mc_chdir (tree->selected_ptr->name) == 0)
{
tree_store_rescan (tree->selected_ptr->name);
ret = mc_chdir (old_vpath);
mc_chdir (old_vpath);
}
vfs_path_free (old_vpath);
}

View File

@ -408,7 +408,7 @@ tree_store_add_entry (const vfs_path_t * name)
abort ();
/* Search for the correct place */
while (current && (flag = pathcmp (current->name, name)) < 0)
while (current != NULL && (flag = pathcmp (current->name, name)) < 0)
{
old = current;
current = current->next;
@ -430,7 +430,8 @@ tree_store_add_entry (const vfs_path_t * name)
}
else
{
old->next = new;
if (old != NULL)
old->next = new;
new->prev = old;
}
new->next = NULL;
@ -440,7 +441,7 @@ tree_store_add_entry (const vfs_path_t * name)
{
/* Insert in to the middle of the list */
new->prev = old;
if (old)
if (old != NULL)
{
/* Yes, in the middle */
new->next = old->next;

View File

@ -19,7 +19,7 @@ struct WEdit;
/*** declarations of public functions ************************************************************/
gboolean user_menu_cmd (struct WEdit *edit_widget, const char * menu_file, int selected_entry);
gboolean user_menu_cmd (struct WEdit *edit_widget, const char *menu_file, int selected_entry);
char *expand_format (struct WEdit *edit_widget, char c, gboolean do_quote);
int check_format_view (const char *);
int check_format_var (const char *, char **);

View File

@ -93,7 +93,6 @@ static const global_keymap_ini_t default_main_keymap[] = {
{"Delete", "f8"},
{"Menu", "f9"},
{"Quit", "f10"},
{"ViewFile", "f13"},
{"MenuLastSelected", "f19"},
{"QuitQuiet", "f20"},
{"History", "alt-h"},

View File

@ -373,7 +373,8 @@ learn_save (void)
esc_str = strutils_escape (learnkeys[i].sequence, -1, ";\\", TRUE);
mc_config_set_string_raw_value (mc_main_config, section, key_name_conv_tab[i].name, esc_str);
mc_config_set_string_raw_value (mc_main_config, section, key_name_conv_tab[i].name,
esc_str);
g_free (esc_str);
}

View File

@ -603,10 +603,8 @@ main (int argc, char *argv[])
S_IRUSR | S_IWUSR);
if (last_wd_fd != -1)
{
ssize_t ret1;
int ret2;
ret1 = write (last_wd_fd, last_wd_string, strlen (last_wd_string));
ret2 = close (last_wd_fd);
(void) write (last_wd_fd, last_wd_string, strlen (last_wd_string));
(void) close (last_wd_fd);
}
}
g_free (last_wd_string);

View File

@ -108,8 +108,8 @@ char *load_anon_passwd (void);
void load_keymap_defs (gboolean load_from_file);
void free_keymap_defs (void);
void panel_load_setup (struct WPanel * panel, const char *section);
void panel_save_setup (struct WPanel * panel, const char *section);
void panel_load_setup (struct WPanel *panel, const char *section);
void panel_save_setup (struct WPanel *panel, const char *section);
void panels_load_options (void);
void panels_save_options (void);

View File

@ -252,10 +252,7 @@ init_subshell_child (const char *pty_name)
/* It simplifies things to change to our home directory here, */
/* and the user's startup file may do a `cd' command anyway */
{
int ret;
ret = chdir (mc_config_get_home_dir ()); /* FIXME? What about when we re-run the subshell? */
}
chdir (mc_config_get_home_dir ()); /* FIXME? What about when we re-run the subshell? */
/* Set MC_SID to prevent running one mc from another */
mc_sid = getsid (0);

View File

@ -1,5 +1,4 @@
AM_CFLAGS = $(GLIB_CFLAGS) -I$(top_srcdir)
AM_CPPFLAGS =
noinst_LTLIBRARIES = libvfs-cpio.la

View File

@ -854,7 +854,7 @@ init_cpiofs (void)
{
static struct vfs_s_subclass cpio_subclass;
cpio_subclass.flags = VFS_S_READONLY; /* FIXME: cpiofs used own temp files */
cpio_subclass.flags = VFS_S_READONLY; /* FIXME: cpiofs used own temp files */
cpio_subclass.archive_check = cpio_super_check;
cpio_subclass.archive_same = cpio_super_same;
cpio_subclass.open_archive = cpio_open_archive;

View File

@ -11,7 +11,7 @@
/*** declarations of public functions ************************************************************/
void init_cpiofs(void);
void init_cpiofs (void);
/*** inline functions ****************************************************************************/

View File

@ -1,8 +1,8 @@
SUBDIRS = helpers
DIST_SUBDIRS = helpers
AM_CFLAGS = $(GLIB_CFLAGS) -I$(top_srcdir)
AM_CPPFLAGS = -DLIBEXECDIR=\""$(libexecdir)/@PACKAGE@/"\"
AM_CFLAGS = $(GLIB_CFLAGS) -I$(top_srcdir)
noinst_LTLIBRARIES = libvfs-extfs.la

View File

@ -422,7 +422,7 @@ extfs_open_archive (int fstype, const char *name, struct archive **pparc)
goto ret;
}
tmp = name_quote ( vfs_path_get_last_path_str (name_vpath), 0);
tmp = name_quote (vfs_path_get_last_path_str (name_vpath), 0);
}
cmd = g_strconcat (info->path, info->prefix, " list ",

View File

@ -1,8 +1,8 @@
SUBDIRS = helpers
DIST_SUBDIRS = helpers
AM_CFLAGS = $(GLIB_CFLAGS) -I$(top_srcdir)
AM_CPPFLAGS = -DLIBEXECDIR=\""$(libexecdir)/@PACKAGE@/"\"
AM_CFLAGS = $(GLIB_CFLAGS) -I$(top_srcdir)
noinst_LTLIBRARIES = libvfs-fish.la

View File

@ -251,9 +251,8 @@ fish_command (struct vfs_class *me, struct vfs_s_super *super, int wait_reply, c
if (logfile)
{
size_t ret;
ret = fwrite (str, strlen (str), 1, logfile);
ret = fflush (logfile);
(void) fwrite (str, strlen (str), 1, logfile);
(void) fflush (logfile);
}
tty_enable_interrupt_key ();
@ -330,13 +329,13 @@ fish_pipeopen (struct vfs_s_super *super, const char *path, const char *argv[])
}
else
{
res = dup2 (fileset1[0], 0);
(void) dup2 (fileset1[0], 0);
close (fileset1[0]);
close (fileset1[1]);
res = dup2 (fileset2[1], 1);
(void) dup2 (fileset2[1], 1);
close (2);
/* stderr to /dev/null */
res = open ("/dev/null", O_WRONLY);
(void) open ("/dev/null", O_WRONLY);
close (fileset2[0]);
close (fileset2[1]);
execvp (path, const_cast (char **, argv));
@ -710,18 +709,24 @@ fish_dir_load (struct vfs_class *me, struct vfs_s_inode *dir, char *remote_path)
char *temp;
char *data_start = buffer + 1;
char *filename = data_start;
char *linkname = data_start;
char *filename_bound = filename + strlen (filename);
char *linkname_bound = filename_bound;
char *filename_bound;
filename_bound = filename + strlen (filename);
if (!strcmp (data_start, "\".\"") || !strcmp (data_start, "\"..\""))
break; /* We'll do "." and ".." ourselves */
if (S_ISLNK (ST.st_mode))
{
char *linkname;
char *linkname_bound;
/* we expect: "escaped-name" -> "escaped-name"
// -> cannot occur in filenames,
// because it will be escaped to -\> */
linkname_bound = filename_bound;
if (*filename == '"')
++filename;

View File

@ -21,7 +21,7 @@ extern int fish_directory_timeout;
/*** declarations of public functions ************************************************************/
void init_fish(void);
void init_fish (void);
/*** inline functions ****************************************************************************/

View File

@ -1,5 +1,4 @@
AM_CFLAGS = $(GLIB_CFLAGS) -I$(top_srcdir)
AM_CPPFLAGS =
noinst_LTLIBRARIES = libvfs-ftpfs.la

View File

@ -477,8 +477,7 @@ ftpfs_command (struct vfs_class *me, struct vfs_s_super *super, int wait_reply,
}
else
{
size_t ret;
ret = fwrite (cmdstr, cmdlen, 1, MEDATA->logfile);
(void) fwrite (cmdstr, cmdlen, 1, MEDATA->logfile);
}
fflush (MEDATA->logfile);
@ -2488,7 +2487,8 @@ ftpfs_netrc_lookup (const char *host, char **login, char **pass)
}
/* Ignore unsafe passwords */
if (strcmp (*login, "anonymous") && strcmp (*login, "ftp")
if (*login != NULL &&
strcmp (*login, "anonymous") != 0 && strcmp (*login, "ftp") != 0
&& ftpfs_netrc_bad_mode (netrcname))
{
need_break = 1;

View File

@ -1,5 +1,4 @@
AM_CFLAGS = $(GLIB_CFLAGS) -I$(top_srcdir)
AM_CPPFLAGS =
noinst_LTLIBRARIES = libvfs-local.la

View File

@ -11,7 +11,7 @@
/*** declarations of public functions ************************************************************/
void vfs_plugins_init(void);
void vfs_plugins_init (void);
/*** inline functions ****************************************************************************/

View File

@ -1,5 +1,4 @@
AM_CFLAGS = $(GLIB_CFLAGS) -I$(top_srcdir)
AM_CPPFLAGS =
noinst_LTLIBRARIES = libvfs-sfs.la

View File

@ -190,7 +190,10 @@ sfs_vfmake (const vfs_path_t * vpath, vfs_path_t * cache_vpath)
COPY_CHAR;
continue;
}
COPY_STRING (ptr);
if (ptr != NULL)
{
COPY_STRING (ptr);
}
}
else
{

View File

@ -1,5 +1,4 @@
AM_CFLAGS = $(GLIB_CFLAGS) $(LIBSSH_CFLAGS) -I$(top_srcdir)
AM_CPPFLAGS =
noinst_LTLIBRARIES = libvfs-sftpfs.la

View File

@ -27,7 +27,7 @@
#include <config.h>
#include <errno.h>
#include <stddef.h>
#include <stdlib.h> /* atoi() */
#include <stdlib.h> /* atoi() */
#include "lib/global.h"
@ -300,7 +300,7 @@ sftpfs_get_config_entity (const vfs_path_element_t * vpath_element, GError ** er
gboolean ok;
ok = sftpfs_fill_config_entity_from_config
(ssh_config_handler, config_entity, vpath_element, error);
(ssh_config_handler, config_entity, vpath_element, error);
fclose (ssh_config_handler);
if (!ok)
@ -380,13 +380,13 @@ void
sftpfs_init_config_variables_patterns (void)
{
size_t structure_offsets[] = {
offsetof(sftpfs_ssh_config_entity_t, user),
offsetof(sftpfs_ssh_config_entity_t, real_host),
offsetof(sftpfs_ssh_config_entity_t, identities_only),
offsetof(sftpfs_ssh_config_entity_t, identity_file),
offsetof(sftpfs_ssh_config_entity_t, port),
offsetof(sftpfs_ssh_config_entity_t, password_auth),
offsetof(sftpfs_ssh_config_entity_t, pubkey_auth)
offsetof (sftpfs_ssh_config_entity_t, user),
offsetof (sftpfs_ssh_config_entity_t, real_host),
offsetof (sftpfs_ssh_config_entity_t, identities_only),
offsetof (sftpfs_ssh_config_entity_t, identity_file),
offsetof (sftpfs_ssh_config_entity_t, port),
offsetof (sftpfs_ssh_config_entity_t, password_auth),
offsetof (sftpfs_ssh_config_entity_t, pubkey_auth)
};
int i;

View File

@ -2,8 +2,8 @@ DIST_SUBDIRS =
SUBDIRS = helpers
AM_CFLAGS = $(GLIB_CFLAGS) -I$(top_srcdir) -DCONFIGDIR=\""@smbconfigdir@"\"
AM_CPPFLAGS =
AM_CPPFLAGS = -DCONFIGDIR=\""@smbconfigdir@"\"
AM_CFLAGS = $(GLIB_CFLAGS) -I$(top_srcdir)
noinst_LTLIBRARIES = libvfs-smbfs.la

View File

@ -2,7 +2,7 @@
Unix SMB/Netbios implementation.
Version 1.9.
SMB Byte handling
*/
*/
#ifndef _BYTEORDER_H
#define _BYTEORDER_H
@ -11,73 +11,73 @@
This file implements macros for machine independent short and
int manipulation
Here is a description of this file that I emailed to the samba list once:
Here is a description of this file that I emailed to the samba list once:
> I am confused about the way that byteorder.h works in Samba. I have
> looked at it, and I would have thought that you might make a distinction
> between LE and BE machines, but you only seem to distinguish between 386
> and all other architectures.
>
> Can you give me a clue?
> I am confused about the way that byteorder.h works in Samba. I have
> looked at it, and I would have thought that you might make a distinction
> between LE and BE machines, but you only seem to distinguish between 386
> and all other architectures.
>
> Can you give me a clue?
sure.
sure.
The distinction between 386 and other architectures is only there as
an optimisation. You can take it out completely and it will make no
difference. The routines (macros) in byteorder.h are totally byteorder
independent. The 386 optimsation just takes advantage of the fact that
the x86 processors don't care about alignment, so we don't have to
align ints on int boundaries etc. If there are other processors out
there that aren't alignment sensitive then you could also define
CAREFUL_ALIGNMENT=0 on those processors as well.
The distinction between 386 and other architectures is only there as
an optimisation. You can take it out completely and it will make no
difference. The routines (macros) in byteorder.h are totally byteorder
independent. The 386 optimsation just takes advantage of the fact that
the x86 processors don't care about alignment, so we don't have to
align ints on int boundaries etc. If there are other processors out
there that aren't alignment sensitive then you could also define
CAREFUL_ALIGNMENT=0 on those processors as well.
Ok, now to the macros themselves. I'll take a simple example, say we
want to extract a 2 byte integer from a SMB packet and put it into a
type called uint16 that is in the local machines byte order, and you
want to do it with only the assumption that uint16 is _at_least_ 16
bits long (this last condition is very important for architectures
that don't have any int types that are 2 bytes long)
Ok, now to the macros themselves. I'll take a simple example, say we
want to extract a 2 byte integer from a SMB packet and put it into a
type called uint16 that is in the local machines byte order, and you
want to do it with only the assumption that uint16 is _at_least_ 16
bits long (this last condition is very important for architectures
that don't have any int types that are 2 bytes long)
You do this:
You do this:
#define CVAL(buf,pos) (((unsigned char *)(buf))[pos])
#define PVAL(buf,pos) ((unsigned)CVAL(buf,pos))
#define SVAL(buf,pos) (PVAL(buf,pos)|PVAL(buf,(pos)+1)<<8)
#define CVAL(buf,pos) (((unsigned char *)(buf))[pos])
#define PVAL(buf,pos) ((unsigned)CVAL(buf,pos))
#define SVAL(buf,pos) (PVAL(buf,pos)|PVAL(buf,(pos)+1)<<8)
then to extract a uint16 value at offset 25 in a buffer you do this:
then to extract a uint16 value at offset 25 in a buffer you do this:
char *buffer = foo_bar();
uint16 xx = SVAL(buffer,25);
char *buffer = foo_bar();
uint16 xx = SVAL(buffer,25);
We are using the byteoder independence of the ANSI C bitshifts to do
the work. A good optimising compiler should turn this into efficient
code, especially if it happens to have the right byteorder :-)
We are using the byteoder independence of the ANSI C bitshifts to do
the work. A good optimising compiler should turn this into efficient
code, especially if it happens to have the right byteorder :-)
I know these macros can be made a bit tidier by removing some of the
casts, but you need to look at byteorder.h as a whole to see the
reasoning behind them. byteorder.h defines the following macros:
I know these macros can be made a bit tidier by removing some of the
casts, but you need to look at byteorder.h as a whole to see the
reasoning behind them. byteorder.h defines the following macros:
SVAL(buf,pos) - extract a 2 byte SMB value
IVAL(buf,pos) - extract a 4 byte SMB value
SVALS(buf,pos) signed version of SVAL()
IVALS(buf,pos) signed version of IVAL()
SVAL(buf,pos) - extract a 2 byte SMB value
IVAL(buf,pos) - extract a 4 byte SMB value
SVALS(buf,pos) signed version of SVAL()
IVALS(buf,pos) signed version of IVAL()
SSVAL(buf,pos,val) - put a 2 byte SMB value into a buffer
SIVAL(buf,pos,val) - put a 4 byte SMB value into a buffer
SSVALS(buf,pos,val) - signed version of SSVAL()
SIVALS(buf,pos,val) - signed version of SIVAL()
SSVAL(buf,pos,val) - put a 2 byte SMB value into a buffer
SIVAL(buf,pos,val) - put a 4 byte SMB value into a buffer
SSVALS(buf,pos,val) - signed version of SSVAL()
SIVALS(buf,pos,val) - signed version of SIVAL()
RSVAL(buf,pos) - like SVAL() but for NMB byte ordering
RSVALS(buf,pos) - like SVALS() but for NMB byte ordering
RIVAL(buf,pos) - like IVAL() but for NMB byte ordering
RIVALS(buf,pos) - like IVALS() but for NMB byte ordering
RSSVAL(buf,pos,val) - like SSVAL() but for NMB ordering
RSIVAL(buf,pos,val) - like SIVAL() but for NMB ordering
RSIVALS(buf,pos,val) - like SIVALS() but for NMB ordering
RSVAL(buf,pos) - like SVAL() but for NMB byte ordering
RSVALS(buf,pos) - like SVALS() but for NMB byte ordering
RIVAL(buf,pos) - like IVAL() but for NMB byte ordering
RIVALS(buf,pos) - like IVALS() but for NMB byte ordering
RSSVAL(buf,pos,val) - like SSVAL() but for NMB ordering
RSIVAL(buf,pos,val) - like SIVAL() but for NMB ordering
RSIVALS(buf,pos,val) - like SIVALS() but for NMB ordering
it also defines lots of intermediate macros, just ignore those :-)
it also defines lots of intermediate macros, just ignore those :-)
*/
*/
/* some switch macros that do both store and read to and from SMB buffers */
@ -142,7 +142,7 @@ it also defines lots of intermediate macros, just ignore those :-)
/*
WARNING: This section is dependent on the length of int16 and int32
being correct
*/
*/
/* get single value from an SMB buffer */
#define SVAL(buf,pos) (*(uint16 *)((char *)(buf) + (pos)))

View File

@ -2,7 +2,7 @@
Unix SMB/Netbios implementation.
Version 1.9.
Character set handling
*/
*/
#ifndef CHARSET_C
@ -44,7 +44,7 @@ extern char *lower_char_map;
/* this is used to determine if a character is safe to use in
something that may be put on a command line */
#define issafe(c) (isalnum((c&0xff)) || strchr("-._",c))
#endif /* !CHARSET_C */
#endif /* !CHARSET_C */
/* Dynamic codepage files defines. */

View File

@ -2,7 +2,7 @@
Unix SMB/Netbios implementation.
Version 1.9.
SMB parameters and setup
*/
*/
#ifndef _CLIENT_H
#define _CLIENT_H
@ -18,25 +18,25 @@
typedef struct file_info
{
SMB_OFF_T size;
uint16 mode;
uid_t uid;
gid_t gid;
/* these times are normally kept in GMT */
time_t mtime;
time_t atime;
time_t ctime;
pstring name;
SMB_OFF_T size;
uint16 mode;
uid_t uid;
gid_t gid;
/* these times are normally kept in GMT */
time_t mtime;
time_t atime;
time_t ctime;
pstring name;
} file_info;
struct print_job_info
{
uint16 id;
uint16 priority;
size_t size;
fstring user;
fstring name;
time_t t;
uint16 id;
uint16 priority;
size_t size;
fstring user;
fstring name;
time_t t;
};
struct pwd_info
@ -54,73 +54,74 @@ struct pwd_info
uchar smb_nt_owf[24];
};
struct cli_state {
int port;
int fd;
uint16 cnum;
uint16 pid;
uint16 mid;
uint16 vuid;
int protocol;
int sec_mode;
int rap_error;
int privileges;
struct cli_state
{
int port;
int fd;
uint16 cnum;
uint16 pid;
uint16 mid;
uint16 vuid;
int protocol;
int sec_mode;
int rap_error;
int privileges;
fstring eff_name;
fstring desthost;
fstring user_name;
fstring domain;
fstring eff_name;
fstring desthost;
fstring user_name;
fstring domain;
/*
* The following strings are the
* ones returned by the server if
* the protocol > NT1.
*/
fstring server_type;
fstring server_os;
fstring server_domain;
/*
* The following strings are the
* ones returned by the server if
* the protocol > NT1.
*/
fstring server_type;
fstring server_os;
fstring server_domain;
fstring share;
fstring dev;
struct nmb_name called;
struct nmb_name calling;
fstring full_dest_host_name;
struct in_addr dest_ip;
fstring share;
fstring dev;
struct nmb_name called;
struct nmb_name calling;
fstring full_dest_host_name;
struct in_addr dest_ip;
struct pwd_info pwd;
unsigned char cryptkey[8];
uint32 sesskey;
int serverzone;
uint32 servertime;
int readbraw_supported;
int writebraw_supported;
int timeout; /* in milliseconds. */
int max_xmit;
int max_mux;
char *outbuf;
char *inbuf;
int bufsize;
int initialised;
int win95;
uint32 capabilities;
struct pwd_info pwd;
unsigned char cryptkey[8];
uint32 sesskey;
int serverzone;
uint32 servertime;
int readbraw_supported;
int writebraw_supported;
int timeout; /* in milliseconds. */
int max_xmit;
int max_mux;
char *outbuf;
char *inbuf;
int bufsize;
int initialised;
int win95;
uint32 capabilities;
/*
* Only used in NT domain calls.
*/
/*
* Only used in NT domain calls.
*/
uint32 nt_error; /* NT RPC error code. */
uint16 nt_pipe_fnum; /* Pipe handle. */
unsigned char sess_key[16]; /* Current session key. */
unsigned char ntlmssp_hash[258]; /* ntlmssp data. */
uint32 ntlmssp_cli_flgs; /* ntlmssp client flags */
uint32 ntlmssp_srv_flgs; /* ntlmssp server flags */
uint32 ntlmssp_seq_num; /* ntlmssp sequence number */
DOM_CRED clnt_cred; /* Client credential. */
fstring mach_acct; /* MYNAME$. */
fstring srv_name_slash; /* \\remote server. */
fstring clnt_name_slash; /* \\local client. */
uint16 max_xmit_frag;
uint16 max_recv_frag;
uint32 nt_error; /* NT RPC error code. */
uint16 nt_pipe_fnum; /* Pipe handle. */
unsigned char sess_key[16]; /* Current session key. */
unsigned char ntlmssp_hash[258]; /* ntlmssp data. */
uint32 ntlmssp_cli_flgs; /* ntlmssp client flags */
uint32 ntlmssp_srv_flgs; /* ntlmssp server flags */
uint32 ntlmssp_seq_num; /* ntlmssp sequence number */
DOM_CRED clnt_cred; /* Client credential. */
fstring mach_acct; /* MYNAME$. */
fstring srv_name_slash; /* \\remote server. */
fstring clnt_name_slash; /* \\local client. */
uint16 max_xmit_frag;
uint16 max_recv_frag;
};
#endif /* _CLIENT_H */

View File

@ -4,9 +4,9 @@
Unix SMB/Netbios implementation.
Version 1.9.
Machine customisation and include handling
*/
*/
#ifndef NO_CONFIG_H /* for some tests */
#ifndef NO_CONFIG_H /* for some tests */
#include "config.h"
#endif
@ -156,7 +156,7 @@
/* POSIX terminal handling. */
#include <termios.h>
# include <dirent.h>
#include <dirent.h>
#ifdef HAVE_SYS_MMAN_H
#include <sys/mman.h>
@ -194,7 +194,7 @@
#endif
#ifdef HAVE_SYS_STATFS_H
# include <sys/statfs.h>
#include <sys/statfs.h>
#endif
#ifdef HAVE_DUSTAT_H
@ -219,7 +219,7 @@
#include <sys/security.h>
#include <prot.h>
#define PASSWORD_LENGTH 16
#endif /* HAVE_SYS_SECURITY_H */
#endif /* HAVE_SYS_SECURITY_H */
#ifdef HAVE_COMPAT_H
#include <compat.h>
@ -269,7 +269,7 @@
they actually only need to be at least 16 and 32 bits
respectively. Thus if your word size is 8 bytes just defining them
as signed and unsigned int will work.
*/
*/
#ifndef uint8
#define uint8 unsigned char
@ -334,13 +334,13 @@
*/
#ifndef SMB_INO_T
# define SMB_INO_T ino_t
#define SMB_INO_T ino_t
#endif
#ifndef LARGE_SMB_INO_T
# if defined(SIZEOF_INO_T) && (SIZEOF_INO_T == 8)
# define LARGE_SMB_INO_T 1
# endif
#if defined(SIZEOF_INO_T) && (SIZEOF_INO_T == 8)
#define LARGE_SMB_INO_T 1
#endif
#endif
#ifdef LARGE_SMB_INO_T
@ -350,7 +350,7 @@
#endif
#ifndef SMB_OFF_T
# define SMB_OFF_T off_t
#define SMB_OFF_T off_t
#endif
#define SMB_OFF_T_BITS (sizeof(SMB_OFF_T)*8)
@ -361,9 +361,9 @@
*/
#ifndef LARGE_SMB_OFF_T
# if defined(SIZEOF_OFF_T) && (SIZEOF_OFF_T == 8)
# define LARGE_SMB_OFF_T 1
# endif
#if defined(SIZEOF_OFF_T) && (SIZEOF_OFF_T == 8)
#define LARGE_SMB_OFF_T 1
#endif
#endif
#ifdef LARGE_SMB_OFF_T
@ -377,7 +377,7 @@
*/
#ifndef SMB_STRUCT_STAT
# define SMB_STRUCT_STAT struct stat
#define SMB_STRUCT_STAT struct stat
#endif
/*
@ -385,7 +385,7 @@
*/
#ifndef SMB_STRUCT_DIRENT
# define SMB_STRUCT_DIRENT struct dirent
#define SMB_STRUCT_DIRENT struct dirent
#endif
/*
@ -393,19 +393,19 @@
*/
#ifndef SMB_STRUCT_FLOCK
# define SMB_STRUCT_FLOCK struct flock
#define SMB_STRUCT_FLOCK struct flock
#endif
#ifndef SMB_F_SETLKW
# define SMB_F_SETLKW F_SETLKW
#define SMB_F_SETLKW F_SETLKW
#endif
#ifndef SMB_F_SETLK
# define SMB_F_SETLK F_SETLK
#define SMB_F_SETLK F_SETLK
#endif
#ifndef SMB_F_GETLK
# define SMB_F_GETLK F_GETLK
#define SMB_F_GETLK F_GETLK
#endif
#if defined(HAVE_LONGLONG)
@ -515,7 +515,7 @@
#endif
/* what is the longest significant password available on your system?
Knowing this speeds up password searches a lot */
Knowing this speeds up password searches a lot */
#ifndef PASSWORD_LENGTH
#define PASSWORD_LENGTH 8
#endif
@ -549,19 +549,19 @@
#endif
#ifndef HAVE_INITGROUPS
int initgroups(char *name,gid_t id);
int initgroups (char *name, gid_t id);
#endif
#ifndef HAVE_RENAME
int rename(const char *zfrom, const char *zto);
int rename (const char *zfrom, const char *zto);
#endif
#ifndef HAVE_MKTIME
time_t mktime(struct tm *t);
time_t mktime (struct tm *t);
#endif
#ifndef HAVE_STRTOUL
unsigned long strtoul(const char *nptr, char **endptr, int base);
unsigned long strtoul (const char *nptr, char **endptr, int base);
#endif
#ifdef REPLACE_GETPASS

View File

@ -2,7 +2,7 @@
Unix SMB/Netbios implementation.
Version 1.9.
Kanji Extensions
*/
*/
#ifndef _KANJI_H_
#define _KANJI_H_
@ -118,14 +118,14 @@
/* Ensure we use our definitions in all other files than kanji.c. */
/* Function pointers we will replace. */
extern char *(*multibyte_strchr)(const char *s, int c);
extern char *(*multibyte_strrchr)(const char *s, int c);
extern char *(*multibyte_strstr)(const char *s1, const char *s2);
extern char *(*multibyte_strtok)(char *s1, const char *s2);
extern char *(*_dos_to_unix)(char *str, BOOL overwrite);
extern char *(*_unix_to_dos)(char *str, BOOL overwrite);
extern BOOL (*is_multibyte_char)(char c);
extern int (*_skip_multibyte_char)(char c);
extern char *(*multibyte_strchr) (const char *s, int c);
extern char *(*multibyte_strrchr) (const char *s, int c);
extern char *(*multibyte_strstr) (const char *s1, const char *s2);
extern char *(*multibyte_strtok) (char *s1, const char *s2);
extern char *(*_dos_to_unix) (char *str, BOOL overwrite);
extern char *(*_unix_to_dos) (char *str, BOOL overwrite);
extern BOOL (*is_multibyte_char) (char c);
extern int (*_skip_multibyte_char) (char c);
#define strchr(s1, c) ((*multibyte_strchr)((s1), (c)))
#define strrchr(s1, c) ((*multibyte_strrchr)((s1), (c)))

View File

@ -25,7 +25,7 @@
refer to the special "printers" service */
#define PRINTERS_NAME "printers"
/* Yves Gaige <yvesg@hptnodur.grenoble.hp.com> requested this set this */
/* Yves Gaige <yvesg@hptnodur.grenoble.hp.com> requested this set this */
/* to a maximum of 8 if old smb clients break because of long printer names. */
#define MAXPRINTERLEN 15
@ -152,7 +152,7 @@
#define SHORT_CONNECT_TIMEOUT 5000
/* default socket options. Dave Miller thinks we should default to TCP_NODELAY
given the socket IO pattern that Samba uses*/
given the socket IO pattern that Samba uses */
#ifdef TCP_NODELAY
#define DEFAULT_SOCKET_OPTIONS "TCP_NODELAY"
#else

View File

@ -4,7 +4,7 @@
Unix SMB/Netbios implementation.
Version 1.9.
NBT netbios header - version 2
*/
*/
#define PERMANENT_TTL 0
@ -12,16 +12,18 @@
#define MAINTAIN_LIST 2
#define ELECTION_VERSION 1
#define MAX_DGRAM_SIZE (576) /* tcp/ip datagram limit is 576 bytes */
#define MAX_DGRAM_SIZE (576) /* tcp/ip datagram limit is 576 bytes */
#define MIN_DGRAM_SIZE 12
/*********************************************************
Types of reply packet.
**********************************************************/
enum netbios_reply_type_code { NMB_QUERY, NMB_STATUS, NMB_REG, NMB_REG_REFRESH,
NMB_REL, NMB_WAIT_ACK, NMB_MULTIHOMED_REG,
WINS_REG, WINS_QUERY };
enum netbios_reply_type_code
{ NMB_QUERY, NMB_STATUS, NMB_REG, NMB_REG_REFRESH,
NMB_REL, NMB_WAIT_ACK, NMB_MULTIHOMED_REG,
WINS_REG, WINS_QUERY
};
/* From rfc1002, 4.2.1.2 */
/* Question types. */
@ -33,14 +35,14 @@ enum netbios_reply_type_code { NMB_QUERY, NMB_STATUS, NMB_REG, NMB_REG_REFRESH,
/* Opcode definitions */
#define NMB_NAME_QUERY_OPCODE 0x0
#define NMB_NAME_REG_OPCODE 0x05 /* see rfc1002.txt 4.2.2,3,5,6,7,8 */
#define NMB_NAME_RELEASE_OPCODE 0x06 /* see rfc1002.txt 4.2.9,10,11 */
#define NMB_WACK_OPCODE 0x07 /* see rfc1002.txt 4.2.16 */
#define NMB_NAME_REG_OPCODE 0x05 /* see rfc1002.txt 4.2.2,3,5,6,7,8 */
#define NMB_NAME_RELEASE_OPCODE 0x06 /* see rfc1002.txt 4.2.9,10,11 */
#define NMB_WACK_OPCODE 0x07 /* see rfc1002.txt 4.2.16 */
/* Ambiguity in rfc1002 about which of these is correct. */
/* WinNT uses 8 by default but can be made to use 9. */
#define NMB_NAME_REFRESH_OPCODE_8 0x08 /* see rfc1002.txt 4.2.4 */
#define NMB_NAME_REFRESH_OPCODE_9 0x09 /* see rfc1002.txt 4.2.4 */
#define NMB_NAME_MULTIHOMED_REG_OPCODE 0x0F /* Invented by Microsoft. */
#define NMB_NAME_REFRESH_OPCODE_8 0x08 /* see rfc1002.txt 4.2.4 */
#define NMB_NAME_REFRESH_OPCODE_9 0x09 /* see rfc1002.txt 4.2.4 */
#define NMB_NAME_MULTIHOMED_REG_OPCODE 0x0F /* Invented by Microsoft. */
/* XXXX what about all the other types?? 0x1, 0x2, 0x3, 0x4, 0x8? */
@ -60,10 +62,10 @@ enum netbios_reply_type_code { NMB_QUERY, NMB_STATUS, NMB_REG, NMB_REG_REFRESH,
#define NB_ACTIVE 0x04
#define NB_CONFL 0x08
#define NB_DEREG 0x10
#define NB_BFLAG 0x00 /* Broadcast node type. */
#define NB_PFLAG 0x20 /* Point-to-point node type. */
#define NB_MFLAG 0x40 /* Mixed bcast & p-p node type. */
#define NB_HFLAG 0x60 /* Microsoft 'hybrid' node type. */
#define NB_BFLAG 0x00 /* Broadcast node type. */
#define NB_PFLAG 0x20 /* Point-to-point node type. */
#define NB_MFLAG 0x40 /* Mixed bcast & p-p node type. */
#define NB_HFLAG 0x60 /* Microsoft 'hybrid' node type. */
#define NB_NODETYPEMASK 0x60
/* Mask applied to outgoing NetBIOS flags. */
#define NB_FLGMSK 0xE0
@ -81,13 +83,13 @@ enum netbios_reply_type_code { NMB_QUERY, NMB_STATUS, NMB_REG, NMB_REG_REFRESH,
#define NAME_IS_DEREGISTERING(p) ((p)->data.nb_flags & NB_DEREG)
/* Error codes for NetBIOS requests. */
#define FMT_ERR 0x1 /* Packet format error. */
#define SRV_ERR 0x2 /* Internal server error. */
#define NAM_ERR 0x3 /* Name does not exist. */
#define IMP_ERR 0x4 /* Request not implemented. */
#define RFS_ERR 0x5 /* Request refused. */
#define ACT_ERR 0x6 /* Active error - name owned by another host. */
#define CFT_ERR 0x7 /* Name in conflict error. */
#define FMT_ERR 0x1 /* Packet format error. */
#define SRV_ERR 0x2 /* Internal server error. */
#define NAM_ERR 0x3 /* Name does not exist. */
#define IMP_ERR 0x4 /* Request not implemented. */
#define RFS_ERR 0x5 /* Request refused. */
#define ACT_ERR 0x6 /* Active error - name owned by another host. */
#define CFT_ERR 0x7 /* Name in conflict error. */
#define REFRESH_TIME (15*60)
#define NAME_POLL_REFRESH_TIME (5*60)
@ -123,47 +125,51 @@ enum netbios_reply_type_code { NMB_QUERY, NMB_STATUS, NMB_REG, NMB_REG_REFRESH,
*
*/
enum name_source {LMHOSTS_NAME, REGISTER_NAME, SELF_NAME, DNS_NAME,
DNSFAIL_NAME, PERMANENT_NAME, WINS_PROXY_NAME};
enum node_type {B_NODE=0, P_NODE=1, M_NODE=2, NBDD_NODE=3};
enum packet_type {NMB_PACKET, DGRAM_PACKET};
enum name_source
{ LMHOSTS_NAME, REGISTER_NAME, SELF_NAME, DNS_NAME,
DNSFAIL_NAME, PERMANENT_NAME, WINS_PROXY_NAME
};
enum node_type
{ B_NODE = 0, P_NODE = 1, M_NODE = 2, NBDD_NODE = 3 };
enum packet_type
{ NMB_PACKET, DGRAM_PACKET };
enum master_state
{
MST_NONE,
MST_POTENTIAL,
MST_BACKUP,
MST_MSB,
MST_BROWSER,
MST_UNBECOMING_MASTER
MST_NONE,
MST_POTENTIAL,
MST_BACKUP,
MST_MSB,
MST_BROWSER,
MST_UNBECOMING_MASTER
};
enum domain_state
{
DOMAIN_NONE,
DOMAIN_WAIT,
DOMAIN_MST
DOMAIN_NONE,
DOMAIN_WAIT,
DOMAIN_MST
};
enum logon_state
{
LOGON_NONE,
LOGON_WAIT,
LOGON_SRV
LOGON_NONE,
LOGON_WAIT,
LOGON_SRV
};
struct subnet_record;
struct nmb_data
{
uint16 nb_flags; /* Netbios flags. */
int num_ips; /* Number of ip entries. */
struct in_addr *ip; /* The ip list for this name. */
uint16 nb_flags; /* Netbios flags. */
int num_ips; /* Number of ip entries. */
struct in_addr *ip; /* The ip list for this name. */
enum name_source source; /* Where the name came from. */
enum name_source source; /* Where the name came from. */
time_t death_time; /* The time the record must be removed (do not remove if 0). */
time_t refresh_time; /* The time the record should be refreshed. */
time_t death_time; /* The time the record must be removed (do not remove if 0). */
time_t refresh_time; /* The time the record should be refreshed. */
};
/* This is used to hold the list of servers in my domain, and is
@ -171,71 +177,72 @@ struct nmb_data
struct server_record
{
struct server_record *next;
struct server_record *prev;
struct server_record *next;
struct server_record *prev;
struct subnet_record *subnet;
struct subnet_record *subnet;
struct server_info_struct serv;
time_t death_time;
struct server_info_struct serv;
time_t death_time;
};
/* A workgroup structure. It contains a list of servers. */
struct work_record
{
struct work_record *next;
struct work_record *prev;
struct work_record *next;
struct work_record *prev;
struct subnet_record *subnet;
struct subnet_record *subnet;
struct server_record *serverlist;
struct server_record *serverlist;
/* Stage of development from non-local-master up to local-master browser. */
enum master_state mst_state;
/* Stage of development from non-local-master up to local-master browser. */
enum master_state mst_state;
/* Stage of development from non-domain-master to domain-master browser. */
enum domain_state dom_state;
/* Stage of development from non-domain-master to domain-master browser. */
enum domain_state dom_state;
/* Stage of development from non-logon-server to logon server. */
enum logon_state log_state;
/* Stage of development from non-logon-server to logon server. */
enum logon_state log_state;
/* Work group info. */
fstring work_group;
int token; /* Used when communicating with backup browsers. */
fstring local_master_browser_name; /* Current local master browser. */
/* Work group info. */
fstring work_group;
int token; /* Used when communicating with backup browsers. */
fstring local_master_browser_name; /* Current local master browser. */
/* Announce info. */
time_t lastannounce_time;
int announce_interval;
BOOL needannounce;
/* Announce info. */
time_t lastannounce_time;
int announce_interval;
BOOL needannounce;
/* Timeout time for this workgroup. 0 means permanent. */
time_t death_time;
/* Timeout time for this workgroup. 0 means permanent. */
time_t death_time;
/* Election info */
BOOL RunningElection;
BOOL needelection;
int ElectionCount;
uint32 ElectionCriterion;
/* Election info */
BOOL RunningElection;
BOOL needelection;
int ElectionCount;
uint32 ElectionCriterion;
/* Domain master browser info. Used for efficient syncs. */
struct nmb_name dmb_name;
struct in_addr dmb_addr;
/* Domain master browser info. Used for efficient syncs. */
struct nmb_name dmb_name;
struct in_addr dmb_addr;
};
/* typedefs needed to define copy & free functions for userdata. */
struct userdata_struct;
typedef struct userdata_struct * (*userdata_copy_fn)(struct userdata_struct *);
typedef void (*userdata_free_fn)(struct userdata_struct *);
typedef struct userdata_struct *(*userdata_copy_fn) (struct userdata_struct *);
typedef void (*userdata_free_fn) (struct userdata_struct *);
/* Structure to define any userdata passed around. */
struct userdata_struct {
userdata_copy_fn copy_fn;
userdata_free_fn free_fn;
unsigned int userdata_len;
char data[16]; /* 16 is to ensure alignment/padding on all systems */
struct userdata_struct
{
userdata_copy_fn copy_fn;
userdata_free_fn free_fn;
unsigned int userdata_len;
char data[16]; /* 16 is to ensure alignment/padding on all systems */
};
struct response_record;
@ -243,99 +250,83 @@ struct packet_struct;
struct res_rec;
/* typedef to define the function called when this response packet comes in. */
typedef void (*response_function)(struct subnet_record *, struct response_record *,
struct packet_struct *);
typedef void (*response_function) (struct subnet_record *, struct response_record *,
struct packet_struct *);
/* typedef to define the function called when this response record times out. */
typedef void (*timeout_response_function)(struct subnet_record *,
struct response_record *);
typedef void (*timeout_response_function) (struct subnet_record *, struct response_record *);
/* typedef to define the function called when the request that caused this
response record to be created is successful. */
typedef void (*success_function)(struct subnet_record *, struct userdata_struct *, ...);
typedef void (*success_function) (struct subnet_record *, struct userdata_struct *, ...);
/* typedef to define the function called when the request that caused this
response record to be created is unsuccessful. */
typedef void (*fail_function)(struct subnet_record *, struct response_record *, ...);
typedef void (*fail_function) (struct subnet_record *, struct response_record *, ...);
/* List of typedefs for success and fail functions of the different query
types. Used to catch any compile time prototype errors. */
typedef void (*register_name_success_function)( struct subnet_record *,
typedef void (*register_name_success_function) (struct subnet_record *,
struct userdata_struct *,
struct nmb_name *,
uint16,
int,
struct in_addr);
typedef void (*register_name_fail_function)( struct subnet_record *,
struct response_record *,
struct nmb_name *);
struct nmb_name *, uint16, int, struct in_addr);
typedef void (*register_name_fail_function) (struct subnet_record *,
struct response_record *, struct nmb_name *);
typedef void (*release_name_success_function)( struct subnet_record *,
typedef void (*release_name_success_function) (struct subnet_record *,
struct userdata_struct *,
struct nmb_name *,
struct in_addr);
typedef void (*release_name_fail_function)( struct subnet_record *,
struct response_record *,
struct nmb_name *);
struct nmb_name *, struct in_addr);
typedef void (*release_name_fail_function) (struct subnet_record *,
struct response_record *, struct nmb_name *);
typedef void (*refresh_name_success_function)( struct subnet_record *,
typedef void (*refresh_name_success_function) (struct subnet_record *,
struct userdata_struct *,
struct nmb_name *,
uint16,
int,
struct in_addr);
typedef void (*refresh_name_fail_function)( struct subnet_record *,
struct response_record *,
struct nmb_name *);
struct nmb_name *, uint16, int, struct in_addr);
typedef void (*refresh_name_fail_function) (struct subnet_record *,
struct response_record *, struct nmb_name *);
typedef void (*query_name_success_function)( struct subnet_record *,
typedef void (*query_name_success_function) (struct subnet_record *,
struct userdata_struct *,
struct nmb_name *,
struct in_addr,
struct res_rec *answers);
struct in_addr, struct res_rec * answers);
typedef void (*query_name_fail_function)( struct subnet_record *,
struct response_record *,
struct nmb_name *,
int);
typedef void (*query_name_fail_function) (struct subnet_record *,
struct response_record *, struct nmb_name *, int);
typedef void (*node_status_success_function)( struct subnet_record *,
typedef void (*node_status_success_function) (struct subnet_record *,
struct userdata_struct *,
struct res_rec *,
struct in_addr);
typedef void (*node_status_fail_function)( struct subnet_record *,
struct response_record *);
struct res_rec *, struct in_addr);
typedef void (*node_status_fail_function) (struct subnet_record *, struct response_record *);
/* Initiated name queries are recorded in this list to track any responses. */
struct response_record
{
struct response_record *next;
struct response_record *prev;
struct response_record *next;
struct response_record *prev;
uint16 response_id;
uint16 response_id;
/* Callbacks for packets received or not. */
response_function resp_fn;
timeout_response_function timeout_fn;
/* Callbacks for packets received or not. */
response_function resp_fn;
timeout_response_function timeout_fn;
/* Callbacks for the request succeeding or not. */
success_function success_fn;
fail_function fail_fn;
/* Callbacks for the request succeeding or not. */
success_function success_fn;
fail_function fail_fn;
struct packet_struct *packet;
struct packet_struct *packet;
struct userdata_struct *userdata;
struct userdata_struct *userdata;
int num_msgs;
int num_msgs;
time_t repeat_time;
time_t repeat_interval;
int repeat_count;
time_t repeat_time;
time_t repeat_interval;
int repeat_count;
/* Recursion protection. */
BOOL in_expiration_processing;
/* Recursion protection. */
BOOL in_expiration_processing;
};
/* A subnet structure. It contains a list of workgroups and netbios names. */
@ -344,103 +335,112 @@ struct response_record
B nodes will have their own, totally separate subnet record, with their
own netbios name set. These do NOT interact with other subnet records'
netbios names.
*/
*/
enum subnet_type {
NORMAL_SUBNET = 0, /* Subnet listed in interfaces list. */
UNICAST_SUBNET = 1, /* Subnet for unicast packets. */
REMOTE_BROADCAST_SUBNET = 2, /* Subnet for remote broadcasts. */
WINS_SERVER_SUBNET = 3 /* Only created if we are a WINS server. */
enum subnet_type
{
NORMAL_SUBNET = 0, /* Subnet listed in interfaces list. */
UNICAST_SUBNET = 1, /* Subnet for unicast packets. */
REMOTE_BROADCAST_SUBNET = 2, /* Subnet for remote broadcasts. */
WINS_SERVER_SUBNET = 3 /* Only created if we are a WINS server. */
};
/* A resource record. */
struct res_rec {
struct nmb_name rr_name;
int rr_type;
int rr_class;
int ttl;
int rdlength;
char rdata[MAX_DGRAM_SIZE];
struct res_rec
{
struct nmb_name rr_name;
int rr_type;
int rr_class;
int ttl;
int rdlength;
char rdata[MAX_DGRAM_SIZE];
};
/* An nmb packet. */
struct nmb_packet
{
struct {
int name_trn_id;
int opcode;
BOOL response;
struct {
BOOL bcast;
BOOL recursion_available;
BOOL recursion_desired;
BOOL trunc;
BOOL authoritative;
} nm_flags;
int rcode;
int qdcount;
int ancount;
int nscount;
int arcount;
} header;
struct
{
int name_trn_id;
int opcode;
BOOL response;
struct
{
BOOL bcast;
BOOL recursion_available;
BOOL recursion_desired;
BOOL trunc;
BOOL authoritative;
} nm_flags;
int rcode;
int qdcount;
int ancount;
int nscount;
int arcount;
} header;
struct {
struct nmb_name question_name;
int question_type;
int question_class;
} question;
struct
{
struct nmb_name question_name;
int question_type;
int question_class;
} question;
struct res_rec *answers;
struct res_rec *nsrecs;
struct res_rec *additional;
struct res_rec *answers;
struct res_rec *nsrecs;
struct res_rec *additional;
};
/* A datagram - this normally contains SMB data in the data[] array. */
struct dgram_packet {
struct {
int msg_type;
struct {
enum node_type node_type;
BOOL first;
BOOL more;
} flags;
int dgm_id;
struct in_addr source_ip;
int source_port;
int dgm_length;
int packet_offset;
} header;
struct nmb_name source_name;
struct nmb_name dest_name;
int datasize;
char data[MAX_DGRAM_SIZE];
struct dgram_packet
{
struct
{
int msg_type;
struct
{
enum node_type node_type;
BOOL first;
BOOL more;
} flags;
int dgm_id;
struct in_addr source_ip;
int source_port;
int dgm_length;
int packet_offset;
} header;
struct nmb_name source_name;
struct nmb_name dest_name;
int datasize;
char data[MAX_DGRAM_SIZE];
};
/* Define a structure used to queue packets. This will be a linked
list of nmb packets. */
list of nmb packets. */
struct packet_struct
{
struct packet_struct *next;
struct packet_struct *prev;
BOOL locked;
struct in_addr ip;
int port;
int fd;
time_t timestamp;
enum packet_type packet_type;
union {
struct nmb_packet nmb;
struct dgram_packet dgram;
} packet;
struct packet_struct *next;
struct packet_struct *prev;
BOOL locked;
struct in_addr ip;
int port;
int fd;
time_t timestamp;
enum packet_type packet_type;
union
{
struct nmb_packet nmb;
struct dgram_packet dgram;
} packet;
};
/* NETLOGON opcodes */
#define QUERYFORPDC 7 /* Query for PDC. */
#define QUERYFORPDC_R 12 /* Response to Query for PDC. */
#define QUERYFORPDC 7 /* Query for PDC. */
#define QUERYFORPDC_R 12 /* Response to Query for PDC. */
#define SAMLOGON 18
#define SAMLOGON_R 19
@ -501,5 +501,6 @@ extern struct subnet_record *remote_broadcast_subnet;
#define NEXT_SUBNET_INCLUDING_UNICAST(x) (get_next_subnet_maybe_unicast((x)))
/* To be removed. */
enum state_type { TEST };
enum state_type
{ TEST };
#endif /* _NAMESERV_H_ */

Some files were not shown because too many files have changed in this diff Show More