Midnight Commander for Win32

svn path=/trunk/; revision=2456
This commit is contained in:
Steven Edwards
2001-12-30 10:02:14 +00:00
parent 2a2768dea3
commit e5c0c7185e
222 changed files with 102081 additions and 0 deletions

105
rosapps/mc/Make.common Normal file
View File

@@ -0,0 +1,105 @@
VERSION=4.1.36
SHELL = /bin/sh
# This variable makes it possible to move the installation root to another
# directory. This is useful when you're creating a binary distribution of mc.
# If empty, normal root will be used.
# You can run e.g. 'make install DESTDIR=/packages/mc/3.0' to accomplish
# that.
# DESTDIR = /opt/apps/mc/$(VERSION)
# Installation target directories & other installation stuff
prefix = /usr/local
exec_prefix = $(prefix)
binprefix =
manprefix =
builddir = /cygdrive/c/user/src/local/mc-4.1.36-mingw
bindir = $(exec_prefix)/bin
libdir = $(exec_prefix)/lib/mc
suppbindir = $(libdir)/bin
tidir = $(libdir)/term
extfsdir = $(libdir)/extfs
icondir = $(prefix)/share/icons/mc
mandir = $(prefix)/man/man1
datadir = $(prefix)/share
localedir = $(datadir)/locale
manext = 1
man8dir = $(prefix)/man/man8
man8ext = 8
xv_bindir =
# Tools & program stuff
SEDCMD = sed 's/-man/-mandoc/'
SEDCMD2 = sed 's%@prefix@%$(prefix)%'
STRIP = @STRIP@
CC = gcc
CPP = gcc -E
AR = /usr/bin/ar
RANLIB = ranlib
RM = /usr/bin/rm
RMF = /usr/bin/rm -f
MV = /usr/bin/mv
CP = /usr/bin/cp
LN_S = ln -s
AWK = gawk
AWK_VAR_OPTION = -v
# Flags & libs
# No way, to make make happy (except GNU), we cannot use := to append
# something to these, so that's why there is a leading _
XCFLAGS = -g
XCPPFLAGS = -I.. -I$(vfsdir) -I$(rootdir) -I$(slangdir) -I.. -DBINDIR=\""$(bindir)/"\" -DLIBDIR=\""$(libdir)/"\" -DICONDIR=\""$(icondir)/"\" $(XINC) -DLOCALEDIR=\""$(localedir)/"\"
XLDFLAGS =
XDEFS = -DHAVE_CONFIG_H
XLIBS = -lintl -lcrypt
# Where do we have the sources?
# You shouldn't have to edit this :)
mcsrcdir = $(rootdir)/src
docdir = $(rootdir)/doc
mclibdir = $(rootdir)/lib
slangdir = $(rootdir)/slang
vfsdir = $(rootdir)/vfs
xvdir = $(rootdir)/xv
tkdir = $(rootdir)/tk
gnomedir = $(rootdir)/gnome
icodir = $(rootdir)/icons
hpath = -I$(mcsrcdir) -I$(slangdir) -I$(vfsdir) -I$(xvdir) -I$(xvdir)/support/xview_private -I$(tkdir)
# Rules
first_rule: all
.PHONY: all check cross TAGS clean install uninstall distcopy depend dep
.PHONY: fastdep fastdepslang fastdepvfs fastdeploc slowdep
../slang/%.o : ../slang/%.c
cd ../slang; $(MAKE) libmcslang.a
../vfs/%.o : ../vfs/%.c
cd ../vfs; $(MAKE) libvfs.a
fastdep: dummy
if test x"`echo $(srcdir)/*.[ch]`" != x'$(srcdir)/*.[ch]'; then { cd $(srcdir); $(AWK) -f $(mcsrcdir)/depend.awk $(AWK_VAR_OPTION) hpath="$(hpath)" $(AWK_VAR_OPTION) srcdir="$(srcdir)" *.[ch];} > .depend; fi
-$(MAKE) fastdeploc
:
fastdepslang:
{ { { cd ../slang; $(MAKE) showlibdep;} | grep OBJS; cat .depend;} | { cd $(slangdir); $(AWK) -f $(mcsrcdir)/depend.awk $(AWK_VAR_OPTION) dolib="../slang libmcslang.a" $(AWK_VAR_OPTION) hpath="$(hpath)" $(AWK_VAR_OPTION) srcdir="$(slangdir)";};} >> .depend
fastdepvfs:
{ { { cd ../vfs; $(MAKE) showlibdep;} | grep OBJS; cat .depend;} | { cd $(vfsdir); $(AWK) -f $(mcsrcdir)/depend.awk $(AWK_VAR_OPTION) dolib="../vfs libvfs.a" $(AWK_VAR_OPTION) hpath="$(hpath)" $(AWK_VAR_OPTION) srcdir="$(vfsdir)";};} >> .depend
slowdep: dummy
if test x"`echo $(srcdir)/*.[ch]`" != x'$(srcdir)/*.[ch]'; then \
$(CPP) -M $(CPPFLAGS) $(DEFS) $(CFLAGS) $(srcdir)/*.c > .depend; fi
:
mcdep: fastdep
dummy:
# End of Make.common

28
rosapps/mc/Makefile Normal file
View File

@@ -0,0 +1,28 @@
TARGET_OS=NT
CC=gcc
LINK=gcc -s
OBJ_SUFFIX=o
OBJ_PLACE=-o
EXE_PLACE=-o
# ---- Compiler-specific optional stuff
MC_MISC_CFLAGS=
OBJS_DIR=release
EXTRA_MC_SRCS=
SPECIFIC_DEFINES=
SPECIFIC_MC_CFLAGS=-O2 $(MC_MISC_CFLAGS)
SPECIFIC_MC_LFLAGS_EXTRA=
SPECIFIC_SLANG_CFLAGS=$(SPECIFIC_MC_CFLAGS)
SPECIFIC_MCEDIT_CFLAGS=$(SPECIFIC_MC_CFLAGS)
# ---- Compiler independent defines
include Makefile.PC
# ---- Linkers are very compiler-specific
SPECIFIC_MC_LFLAGS=$(SPECIFIC_MC_LFLAGS_EXTRA)
MC_LIBS= # -lintl
$(MC_EXE): $(OBJS) $(MCEDIT_OBJS) $(SLANG_OBJS)
$(LINK) $(EXE_PLACE) $(MC_EXE) $(SPECIFIC_MC_LFLAGS) $+ $(MC_LIBS)

180
rosapps/mc/Makefile.PC Normal file
View File

@@ -0,0 +1,180 @@
# Makefile.PC
#
# This is the Makefile for Midnight Commander under OS/2 and Windows NT
#
# Written by Dan Nicolaescu
# 970423 hacked by Juan f. Grigera
# 970525 hacked again by jfg to add internal editor
# 971127 hacked by Pavel Roskin to make it work with mc-4.1.11
# 980206 hacked by Pavel Roskin to make it work with GNU make
# 980329 changed by Pavel Roskin to make it common for OS/2 and NT
#
# Supported Compilers:
#
# For Windows NT:
# Makefile.VC4: Microsoft Visual C++ 4.0 and above
# Makefile.BC5: Borland C++ 5.x
# Makefile.MIN: MinGW
# Makefile.RSX: RSX
# For OS/2:
# Makefile.EMX: EMX/GCC
# Makefile.BC2: Borland C++ 2.x
# Makefile.IBM: IBM CSet or Visual Age C++
# ...
# ---- Directories
MC_PC_DIR=./pc
MC_SRC_DIR=./src
VFS_DIR=./vfs
MCEDIT_SRC_DIR=./edit
MCEDIT_OBJS_DIR=$(OBJS_DIR)/edit
SLANG_SRC_DIR=./slang
SLANG_OBJS_DIR=$(OBJS_DIR)/slang
MC_EXE=$(OBJS_DIR)/mc.exe
# --- Midnight Defines
COMMON_DEFINES=-DMC_$(TARGET_OS) $(SPECIFIC_DEFINES)
MC_DEFINES=$(COMMON_DEFINES) -DHAVE_CONFIG_H
MC_INCLUDES=-I$(MC_PC_DIR) -I$(SLANG_SRC_DIR)
SLANG_DEFINES=$(COMMON_DEFINES)
SLANG_INCLUDES=-I$(MC_PC_DIR) -I$(SLANG_SRC_DIR)
MCEDIT_DEFINES=$(COMMON_DEFINES) -DHAVE_CONFIG_H
MCEDIT_INCLUDES=-I$(MC_PC_DIR) -I$(SLANG_SRC_DIR)
CFLAGS=$(SPECIFIC_MC_CFLAGS) $(MC_INCLUDES) $(MC_DEFINES) -c
SLANG_CFLAGS=$(SPECIFIC_SLANG_CFLAGS) $(SLANG_INCLUDES) $(SLANG_DEFINES) -c
MCEDIT_CFLAGS=$(SPECIFIC_MCEDIT_CFLAGS) $(MCEDIT_INCLUDES) $(MCEDIT_DEFINES) -c
all: object-dirs mc
object-dirs: $(OBJS_DIR) $(SLANG_OBJS_DIR) $(MCEDIT_OBJS_DIR)
mc: $(MC_EXE)
clean:
"../../reactos/tools/rdel" "slang/*.o"
"../../reactos/tools/rdel" "edit/*.o"
"../../reactos/tools/rdel" "src/*.o"
"../../reactos/tools/rdel" "pc/*.o"
"../../reactos/tools/rdel" "release"
$(OBJS_DIR):
mkdir "$@"
$(SLANG_OBJS_DIR):
mkdir "$@"
$(MCEDIT_OBJS_DIR):
mkdir "$@"
$(OBJS_DIR)/%.$(OBJ_SUFFIX): $(MC_PC_DIR)/%.c
$(CC) $(CFLAGS) $(OBJ_PLACE)$@ $<
$(OBJS_DIR)/%.$(OBJ_SUFFIX): $(MC_SRC_DIR)/%.c
$(CC) $(CFLAGS) $(OBJ_PLACE)$@ $<
$(SLANG_OBJS_DIR)/%.$(OBJ_SUFFIX): $(SLANG_SRC_DIR)/%.c
$(CC) $(SLANG_CFLAGS) $(OBJ_PLACE)$@ $<
$(MCEDIT_OBJS_DIR)/%.$(OBJ_SUFFIX): $(MCEDIT_SRC_DIR)/%.c
$(CC) $(MCEDIT_CFLAGS) $(OBJ_PLACE)$@ $<
MC_SRCS= \
terms.c \
user.c \
file.c \
listmode.c \
cmd.c \
command.c \
help.c \
menu.c \
view.c \
dir.c \
info.c \
widget.c \
option.c \
dlg.c \
panelize.c \
profile.c \
util.c \
dialog.c \
ext.c \
color.c \
layout.c \
setup.c \
regex.c \
hotlist.c \
tree.c \
win.c \
complete.c \
find.c \
wtools.c \
boxes.c \
background.c \
main.c \
popt.c \
text.c \
screen.c
PC_SRCS= \
slint_pc.c \
chmod.c \
drive.c
NT_SRCS= \
cons_nt.c \
dirent_nt.c \
key_nt.c \
util_win32.c \
util_winnt.c \
util_nt.c
OS2_SRCS= \
cons_os2.c \
dirent_os2.c \
key_os2.c \
util_os2.c
SLANG_NT=slw32tty.c
SLANG_OS2=slos2tty.c
SLANG_SRCS= \
slerr.c \
slgetkey.c \
slsmg.c \
slvideo.c \
$(SLANG_$(TARGET_OS))
MCEDIT_SRCS= \
edit.c \
editcmd.c \
editdraw.c \
editmenu.c \
editoptions.c \
editwidget.c \
syntax.c \
wordproc.c
SRCS=$(MC_SRCS) $(PC_SRCS) $($(TARGET_OS)_SRCS) $(EXTRA_MC_SRCS)
OBJS=$(addprefix $(OBJS_DIR)/, \
$(patsubst %.c,%.$(OBJ_SUFFIX),$(SRCS)))
SLANG_OBJS=$(addprefix $(SLANG_OBJS_DIR)/, \
$(patsubst %.c,%.$(OBJ_SUFFIX),$(SLANG_SRCS)))
MCEDIT_OBJS=$(addprefix $(MCEDIT_OBJS_DIR)/, \
$(patsubst %.c,%.$(OBJ_SUFFIX),$(MCEDIT_SRCS)))
ifdef RSC
ifndef RES_SUFFIX
RES_SUFFIX=res
endif # RES_SUFFIX
MC_RES=$(OBJS_DIR)/mc.$(RES_SUFFIX)
$(MC_RES): $(MC_PC_DIR)/mc.rc $(MC_PC_DIR)/mc_nt.ico $(MC_PC_DIR)/config.h ../VERSION
$(RSC) $(RES_PLACE)$(MC_RES) $(RC_DEFINES) $(MC_PC_DIR)/mc.rc
else
MC_RES=
endif # !RSC

1
rosapps/mc/VERSION Normal file
View File

@@ -0,0 +1 @@
#define VERSION "4.1.36"

225
rosapps/mc/about-nls Normal file
View File

@@ -0,0 +1,225 @@
Notes on the Free Translation Project
*************************************
Free software is going international! The Free Translation Project
is a way to get maintainers of free software, translators, and users all
together, so that will gradually become able to speak many languages.
A few packages already provide translations for their messages.
If you found this `ABOUT-NLS' file inside a distribution, you may
assume that the distributed package does use GNU `gettext' internally,
itself available at your nearest GNU archive site. But you do *not*
need to install GNU `gettext' prior to configuring, installing or using
this package with messages translated.
Installers will find here some useful hints. These notes also
explain how users should proceed for getting the programs to use the
available translations. They tell how people wanting to contribute and
work at translations should contact the appropriate team.
When reporting bugs in the `intl/' directory or bugs which may be
related to internationalization, you should tell about the version of
`gettext' which is used. The information can be found in the
`intl/VERSION' file, in internationalized packages.
One advise in advance
=====================
If you want to exploit the full power of internationalization, you
should configure it using
./configure --with-included-gettext
to force usage of internationalizing routines provided within this
package, despite the existence of internationalizing capabilities in the
operating system where this package is being installed. So far, only
the `gettext' implementation in the GNU C library version 2 provides as
many features (such as locale alias or message inheritance) as the
implementation here. It is also not possible to offer this additional
functionality on top of a `catgets' implementation. Future versions of
GNU `gettext' will very likely convey even more functionality. So it
might be a good idea to change to GNU `gettext' as soon as possible.
So you need not provide this option if you are using GNU libc 2 or
you have installed a recent copy of the GNU gettext package with the
included `libintl'.
INSTALL Matters
===============
Some packages are "localizable" when properly installed; the
programs they contain can be made to speak your own native language.
Most such packages use GNU `gettext'. Other packages have their own
ways to internationalization, predating GNU `gettext'.
By default, this package will be installed to allow translation of
messages. It will automatically detect whether the system provides
usable `catgets' (if using this is selected by the installer) or
`gettext' functions. If neither is available, the GNU `gettext' own
library will be used. This library is wholly contained within this
package, usually in the `intl/' subdirectory, so prior installation of
the GNU `gettext' package is *not* required. Installers may use
special options at configuration time for changing the default
behaviour. The commands:
./configure --with-included-gettext
./configure --with-catgets
./configure --disable-nls
will respectively bypass any pre-existing `catgets' or `gettext' to use
the internationalizing routines provided within this package, enable
the use of the `catgets' functions (if found on the locale system), or
else, *totally* disable translation of messages.
When you already have GNU `gettext' installed on your system and run
configure without an option for your new package, `configure' will
probably detect the previously built and installed `libintl.a' file and
will decide to use this. This might be not what is desirable. You
should use the more recent version of the GNU `gettext' library. I.e.
if the file `intl/VERSION' shows that the library which comes with this
package is more recent, you should use
./configure --with-included-gettext
to prevent auto-detection.
By default the configuration process will not test for the `catgets'
function and therefore they will not be used. The reasons are already
given above: the emulation on top of `catgets' cannot provide all the
extensions provided by the GNU `gettext' library. If you nevertheless
want to use the `catgets' functions use
./configure --with-catgets
to enable the test for `catgets' (this causes no harm if `catgets' is
not available on your system). If you really select this option we
would like to hear about the reasons because we cannot think of any
good one ourself.
Internationalized packages have usually many `po/LL.po' files, where
LL gives an ISO 639 two-letter code identifying the language. Unless
translations have been forbidden at `configure' time by using the
`--disable-nls' switch, all available translations are installed
together with the package. However, the environment variable `LINGUAS'
may be set, prior to configuration, to limit the installed set.
`LINGUAS' should then contain a space separated list of two-letter
codes, stating which languages are allowed.
Using This Package
==================
As a user, if your language has been installed for this package, you
only have to set the `LANG' environment variable to the appropriate
ISO 639 `LL' two-letter code prior to using the programs in the
package. For example, let's suppose that you speak German. At the
shell prompt, merely execute `setenv LANG de' (in `csh'),
`export LANG; LANG=de' (in `sh') or `export LANG=de' (in `bash'). This
can be done from your `.login' or `.profile' file, once and for all.
An operating system might already offer message localization for
many of its programs, while other programs have been installed locally
with the full capabilities of GNU `gettext'. Just using `gettext'
extended syntax for `LANG' would break proper localization of already
available operating system programs. In this case, users should set
both `LANGUAGE' and `LANG' variables in their environment, as programs
using GNU `gettext' give preference to `LANGUAGE'. For example, some
Swedish users would rather read translations in German than English for
when Swedish is not available. This is easily accomplished by setting
`LANGUAGE' to `sv:de' while leaving `LANG' to `sv'.
Translating Teams
=================
For the Free Translation Project to be a success, we need interested
people who like their own language and write it well, and who are also
able to synergize with other translators speaking the same language.
Each translation team has its own mailing list, courtesy of Linux
International. You may reach your translation team at the address
`LL@li.org', replacing LL by the two-letter ISO 639 code for your
language. Language codes are *not* the same as the country codes given
in ISO 3166. The following translation teams exist, as of August 1997:
Chinese `zh', Czech `cs', Danish `da', Dutch `nl', English `en',
Esperanto `eo', Finnish `fi', French `fr', German `de', Hungarian
`hu', Irish `ga', Italian `it', Indonesian `id', Japanese `ja',
Korean `ko', Latin `la', Norwegian `no', Persian `fa', Polish
`pl', Portuguese `pt', Russian `ru', Slovenian `sl', Spanish `es',
Swedish `sv', and Turkish `tr'.
For example, you may reach the Chinese translation team by writing to
`zh@li.org'.
If you'd like to volunteer to *work* at translating messages, you
should become a member of the translating team for your own language.
The subscribing address is *not* the same as the list itself, it has
`-request' appended. For example, speakers of Swedish can send a
message to `sv-request@li.org', having this message body:
subscribe
Keep in mind that team members are expected to participate
*actively* in translations, or at solving translational difficulties,
rather than merely lurking around. If your team does not exist yet and
you want to start one, or if you are unsure about what to do or how to
get started, please write to `translation@iro.umontreal.ca' to reach the
coordinator for all translator teams.
The English team is special. It works at improving and uniformizing
the terminology in use. Proven linguistic skill are praised more than
programming skill, here.
Available Packages
==================
Languages are not equally supported in all packages. The following
matrix shows the current state of internationalization, as of August
1997. The matrix shows, in regard of each package, for which languages
PO files have been submitted to translation coordination.
Ready PO files cs da de en es fi fr it ja ko nl no pl pt sl sv
.-------------------------------------------------.
bash | [] [] [] | 3
bison | [] [] [] | 3
clisp | [] [] [] [] | 4
cpio | [] [] [] [] [] | 5
diffutils | [] [] [] [] [] | 5
enscript | [] [] [] [] [] [] | 6
fileutils | [] [] [] [] [] [] [] [] [] [] | 10
findutils | [] [] [] [] [] [] [] [] | 8
flex | [] [] [] [] | 4
gcal | [] [] [] [] [] | 5
gettext | [] [] [] [] [] [] [] [] [] [] | 11
grep | [] [] [] [] [] [] [] [] [] | 9
hello | [] [] [] [] [] [] [] [] [] [] | 10
id-utils | [] [] [] | 3
indent | [] [] [] [] | 4
libc | [] [] [] [] [] [] [] | 7
m4 | [] [] [] [] [] | 5
make | [] [] [] [] [] [] | 6
music | [] [] | 2
ptx | [] [] [] [] [] [] [] [] | 8
recode | [] [] [] [] [] [] [] [] [] | 9
sh-utils | [] [] [] [] [] [] [] | 7
sharutils | [] [] [] [] [] | 5
tar | [] [] [] [] [] [] [] [] [] [] | 10
texinfo | [] | 1
textutils | [] [] [] [] [] [] [] [] [] | 9
wdiff | [] [] [] [] [] [] [] [] | 8
`-------------------------------------------------'
16 languages cs da de en es fi fr it ja ko nl no pl pt sl sv
27 packages 3 2 24 1 17 1 26 2 1 11 20 9 19 7 7 17 167
Some counters in the preceding matrix are higher than the number of
visible blocks let us expect. This is because a few extra PO files are
used for implementing regional variants of languages, or language
dialects.
For a PO file in the matrix above to be effective, the package to
which it applies should also have been internationalized and
distributed as such by its maintainer. There might be an observable
lag between the mere existence a PO file and its wide availability in a
distribution.
If August 1997 seems to be old, you may fetch a more recent copy of
this `ABOUT-NLS' file on most GNU archive sites.

249
rosapps/mc/acconfig.h Normal file
View File

@@ -0,0 +1,249 @@
/* This is the configuration file for the Midnight Commander. It was generated
by autoconf's configure.
Configure for Midnight Commander
Copyright (C) 1994, 1995 Janne Kukonlehto
Copyright (C) 1994, 1995 Miguel de Icaza
Copyright (C) 1995 Jakub Jelinek
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include <VERSION>
@TOP@
#undef PACKAGE
/* Always defined */
#undef D_INO_IN_DIRENT
#undef IS_AIX
#undef MOUNTED_FREAD
#undef MOUNTED_FREAD_FSTYP
#undef MOUNTED_GETFSSTAT
#undef MOUNTED_GETMNT
#undef MOUNTED_GETMNTENT1
#undef MOUNTED_GETMNTENT2
#undef MOUNTED_GETMNTINFO
#undef MOUNTED_VMOUNT
#undef STAT_STATFS2_BSIZE
#undef STAT_STATFS2_FSIZE
#undef STAT_STATFS2_FS_DATA
#undef STAT_STATFS3_OSF1
#undef STAT_STATFS4
#undef STAT_STATVFS
/* Define umode_t if your system does not provide it */
#undef umode_t
/* Define nlink_t if your system does not provide it */
#undef nlink_t
/* Does the file command accepts the -L option */
#undef FILE_L
/* Does the file command work well with - option for stdin? */
#undef FILE_STDIN
/* Does the grep command work well with - option for stdin? */
#undef GREP_STDIN
/* Is the program using the GPM library? */
#undef HAVE_LIBGPM
/* Is the program using the distributed slang library? */
#undef HAVE_SLANG
/* Is the program using a system-installed slang library? */
#undef HAVE_SYSTEM_SLANG
/* Define if the slang.h header file is inside a directory slang
** in the standard directories
*/
#undef SLANG_H_INSIDE_SLANG_DIR
/* Does the program have subshell support? */
#undef HAVE_SUBSHELL_SUPPORT
/* If you don't have gcc, define this */
#undef OLD_TOOLS
/* Are you using other type of curses? */
#undef OTHER_CURSES
/* Is the subshell the default or optional? */
#undef SUBSHELL_OPTIONAL
/* Use SunOS SysV curses? */
#undef SUNOS_CURSES
/* Use old BSD curses? */
#undef USE_BSD_CURSES
/* Use SystemV curses? */
#undef USE_SYSV_CURSES
/* Use Ncurses? */
#undef USE_NCURSES
/* If you Curses does not have color define this one */
#undef NO_COLOR_SUPPORT
/* Support the Midnight Commander Virtual File System? */
#undef USE_VFS
/* Support for the Memory Allocation Debugger */
#undef HAVE_MAD
/* Extra Debugging */
#undef MCDEBUG
/* If the Slang library will be using it's own terminfo instead of termcap */
#undef SLANG_TERMINFO
/* If Slang library should use termcap */
#undef USE_TERMCAP
/* If you have socket and the rest of the net functions use this */
#undef USE_NETCODE
/* If defined, use .netrc for FTP connections */
#undef USE_NETRC
/* If your operating system does not have enough space for a file name
* in a struct dirent, then define this
*/
#undef NEED_EXTRA_DIRENT_BUFFER
/* Define if you want the du -s summary */
#undef HAVE_DUSUM
/* Define if your du does handle -b correctly */
#undef DUSUM_USEB
/* Define to size of chunks du is displaying its information.
* If DUSUM_USEB is defined, this should be 1
*/
#define DUSUM_FACTOR 512
/* Define this one if you want termnet support */
#undef USE_TERMNET
/* Defined if you have the file command */
#undef HAVE_FILECMD
/* Defined if you have libXpm, <X11/xpm.h>, libXext, <X11/extensions/shape.h> */
#undef HAVE_XPM_SHAPE
/* Defined if you have shadow passwords on Linux */
#undef LINUX_SHADOW
/* Defined if you have the crypt prototype in neither unistd.h nor crypt.h */
#undef NEED_CRYPT_PROTOTYPE
/* Defined if your CPP understands ## macro token pasting method */
#undef HAVE_PORTABLE_TOKEN_PASTING
/* Define if you want to turn on SCO-specific code */
#undef SCO_FLAVOR
/* Define if your system has struct linger */
#undef HAVE_STRUCT_LINGER
/* Define if your curses has this one (AIX, OSF/1) */
#undef USE_SETUPTERM
/* Link in ext2fs code for delfs experimental file system */
#undef USE_EXT2FSLIB
/* Define if you have putenv routine */
#undef HAVE_PUTENV
/* Define if you have isascii */
#undef HAVE_ISASCII
/* Define if you want to use the HSC firewall */
#undef HSC_PROXY
/* Define if your system uses PAM for auth stuff */
#undef HAVE_PAM
/* Define if you have the pmap_getmaps function */
#undef HAVE_PMAP_GETMAPS
/* Define if you have the <sys/select.h> header file. */
#undef HAVE_SYS_SELECT_H
/* Define if you have the get_process_stats function and have to use that instead of gettimeofday */
#undef HAVE_GET_PROCESS_STATS
/* Define if you want to call the internal routine edit() for the editor */
#undef USE_INTERNAL_EDIT
/* Define if your system has socketpair */
#undef HAVE_SOCKETPAIR
/* Do we have posix signals? */
#undef HAVE_SIGACTION
#undef HAVE_SIGPROCMASK
#undef HAVE_SIGEMPTYSET
#undef HAVE_SIGADDSET
/* Version of ncurses */
#undef NCURSES_970530
#undef HAVE_STPCPY
#undef ENABLE_NLS
#undef HAVE_CATGETS
#undef HAVE_GETTEXT
#undef HAVE_LC_MESSAGES
@BOTTOM@
#ifdef HAVE_LIBPT
# define HAVE_GRANTPT
#endif
#if defined(HAVE_LIBCRYPT) || defined(HAVE_LIBCRYPT_I)
# define HAVE_CRYPT
#endif
#ifdef HAVE_XVIEW
# include <xvmain.h>
#endif
#if defined(HAVE_SIGADDSET) && defined(HAVE_SIGEMPTYSET)
# if defined(HAVE_SIGACTION) && defined(HAVE_SIGPROCMASK)
# define SLANG_POSIX_SIGNALS
# endif
#endif
#ifdef __os2__
# define OS2_NT 1
# define S_ISFIFO(x) 0
#endif
#ifdef _OS_NT
# define OS2_NT 1
#endif
#ifndef OS2_NT
/* some Unices do not define this, and slang requires it: */
#ifndef unix
# define unix
#endif
#endif

11
rosapps/mc/autogen.sh Normal file
View File

@@ -0,0 +1,11 @@
srcdir=`dirname $0`
test -z "$srcdir" && srcdir=.
(
cd $srcdir
cat macros/gnome.m4 mc-aclocal.m4 gettext.m4 > aclocal.m4
autoheader
autoconf
)
$srcdir/configure $*

179
rosapps/mc/config.cache Normal file
View File

@@ -0,0 +1,179 @@
# This file is a shell script that caches the results of configure
# tests run on this system so they can be shared between configure
# scripts and configure runs. It is not useful on other systems.
# If it contains results you don't want to keep, you may remove or edit it.
#
# By default, configure uses ./config.cache as the cache file,
# creating it if it does not exist already. You can give configure
# the --cache-file=FILE option to use a different cache file; that is
# what configure does when it calls configure scripts in
# subdirectories, so they share the cache.
# Giving --cache-file=/dev/null disables caching, for debugging configure.
# config.status only pays attention to the cache file if you give it the
# --recheck option to rerun configure.
#
ac_cv_header_sys_statfs_h=${ac_cv_header_sys_statfs_h='no'}
ac_cv_header_sys_dustat_h=${ac_cv_header_sys_dustat_h='no'}
ac_cv_type_size_t=${ac_cv_type_size_t='yes'}
ac_cv_path_CHMOD=${ac_cv_path_CHMOD='/usr/bin/chmod'}
ac_cv_prog_cc_works=${ac_cv_prog_cc_works='yes'}
ac_cv_header_sys_statvfs_h=${ac_cv_header_sys_statvfs_h='no'}
ac_cv_header_crypt_h=${ac_cv_header_crypt_h='yes'}
ac_cv_path_XGETTEXT=${ac_cv_path_XGETTEXT='/usr/bin/xgettext'}
ac_cv_func_getcwd=${ac_cv_func_getcwd='yes'}
ac_cv_lib_nsl_t_accept=${ac_cv_lib_nsl_t_accept='no'}
ac_cv_lib_sun_getmntent=${ac_cv_lib_sun_getmntent='no'}
ac_cv_func_tcsetattr=${ac_cv_func_tcsetattr='yes'}
ac_cv_header_grp_h=${ac_cv_header_grp_h='yes'}
ac_cv_lib_ipc_shmat=${ac_cv_lib_ipc_shmat='no'}
ac_cv_func_crypt=${ac_cv_func_crypt='no'}
ac_cv_func_sigaddset=${ac_cv_func_sigaddset='yes'}
ac_cv_func_initgroups=${ac_cv_func_initgroups='yes'}
ac_cv_header_stdlib_h=${ac_cv_header_stdlib_h='yes'}
ac_cv_make_with_percent_rules=${ac_cv_make_with_percent_rules='yes'}
ac_cv_func_sigprocmask=${ac_cv_func_sigprocmask='yes'}
ac_cv_func_memmove=${ac_cv_func_memmove='yes'}
ac_cv_func_strncasecmp=${ac_cv_func_strncasecmp='yes'}
ac_cv_header_sys_filsys_h=${ac_cv_header_sys_filsys_h='no'}
ac_cv_header_nl_types_h=${ac_cv_header_nl_types_h='no'}
ac_cv_prog_cc_g=${ac_cv_prog_cc_g='yes'}
ac_cv_path_install=${ac_cv_path_install='/usr/bin/install -c'}
ac_cv_header_mnttab_h=${ac_cv_header_mnttab_h='no'}
ac_cv_header_dirent_dirent_h=${ac_cv_header_dirent_dirent_h='yes'}
ac_cv_func_setlocale=${ac_cv_func_setlocale='yes'}
ac_cv_lib_ext2fs_ext2fs_close=${ac_cv_lib_ext2fs_ext2fs_close='no'}
ac_cv_func_statlstat=${ac_cv_func_statlstat='no'}
gt_cv_func_gettext_libintl=${gt_cv_func_gettext_libintl='no'}
ac_cv_func_mmap_fixed_mapped=${ac_cv_func_mmap_fixed_mapped='no'}
nls_cv_use_catgets=${nls_cv_use_catgets='no'}
ac_cv_header_sys_wait_h=${ac_cv_header_sys_wait_h='yes'}
ac_cv_prog_RANLIB=${ac_cv_prog_RANLIB='ranlib'}
ac_cv_func_socketpair=${ac_cv_func_socketpair='yes'}
ac_cv_func_pwdauth=${ac_cv_func_pwdauth='no'}
ac_cv_func_strcasecmp=${ac_cv_func_strcasecmp='yes'}
ac_cv_header_minix_config_h=${ac_cv_header_minix_config_h='no'}
ac_cv_mandoc=${ac_cv_mandoc='-mandoc'}
ac_cv_func_socket=${ac_cv_func_socket='yes'}
ac_cv_func_sigaction=${ac_cv_func_sigaction='yes'}
ac_cv_header_fcntl_h=${ac_cv_header_fcntl_h='yes'}
ac_cv_lib_gen_getmntent=${ac_cv_lib_gen_getmntent='no'}
ac_cv_func___argz_count=${ac_cv_func___argz_count='no'}
ac_cv_prog_system=${ac_cv_prog_system='CYGWIN_98-4.10'}
ac_cv_lib_intl_tolower=${ac_cv_lib_intl_tolower='yes'}
ac_cv_func_grantpt=${ac_cv_func_grantpt='yes'}
ac_cv_func_memcpy=${ac_cv_func_memcpy='yes'}
ac_cv_func_memset=${ac_cv_func_memset='yes'}
ac_cv_path_GMSGFMT=${ac_cv_path_GMSGFMT='/usr/bin/msgfmt'}
ac_cv_c_const=${ac_cv_c_const='yes'}
ac_cv_lib_socket_socket=${ac_cv_lib_socket_socket='no'}
ac_cv_header_termios_h=${ac_cv_header_termios_h='yes'}
ac_cv_lib_rpc_pmap_set=${ac_cv_lib_rpc_pmap_set='no'}
ac_cv_prog_CC=${ac_cv_prog_CC='gcc'}
ac_cv_func_pmap_getmaps=${ac_cv_func_pmap_getmaps='no'}
ac_cv_func_remove=${ac_cv_func_remove='yes'}
ac_cv_lib_dnet_stub_dnet_ntoa=${ac_cv_lib_dnet_stub_dnet_ntoa='no'}
ac_cv_type_umode_t=${ac_cv_type_umode_t='no'}
ac_cv_type_mode_t=${ac_cv_type_mode_t='yes'}
ac_cv_func_getmntinfo=${ac_cv_func_getmntinfo='no'}
ac_cv_func_cfgetospeed=${ac_cv_func_cfgetospeed='yes'}
ac_cv_func_munmap=${ac_cv_func_munmap='yes'}
ac_cv_header_values_h=${ac_cv_header_values_h='no'}
ac_cv_header_sys_select_h=${ac_cv_header_sys_select_h='yes'}
ac_cv_path_AR=${ac_cv_path_AR='/usr/bin/ar'}
ac_cv_path_CP=${ac_cv_path_CP='/usr/bin/cp'}
ac_cv_type_nlink_t=${ac_cv_type_nlink_t='yes'}
ac_cv_header_sys_mount_h=${ac_cv_header_sys_mount_h='yes'}
ac_cv_func_sysconf=${ac_cv_func_sysconf='yes'}
ac_cv_func_getwd=${ac_cv_func_getwd='yes'}
gt_cv_func_gettext_libc=${gt_cv_func_gettext_libc='no'}
ac_cv_header_limits_h=${ac_cv_header_limits_h='yes'}
ac_cv_prog_gnu_make=${ac_cv_prog_gnu_make='yes'}
ac_cv_prog_LN_S=${ac_cv_prog_LN_S='ln -s'}
fu_cv_sys_stat_statfs3_osf1=${fu_cv_sys_stat_statfs3_osf1='no'}
ac_cv_struct_st_rdev=${ac_cv_struct_st_rdev='yes'}
ac_cv_func_alloca_works=${ac_cv_func_alloca_works='yes'}
ac_cv_header_alloca_h=${ac_cv_header_alloca_h='no'}
ac_cv_prog_cc_stdc=${ac_cv_prog_cc_stdc=''}
ac_cv_func_shmat=${ac_cv_func_shmat='no'}
ac_cv_have_x=${ac_cv_have_x='have_x=yes ac_x_includes=/usr/X11R6/include ac_x_libraries=/usr/X11R6/lib'}
ac_cv_header_sys_fs_types_h=${ac_cv_header_sys_fs_types_h='no'}
ac_cv_path_MSGFMT=${ac_cv_path_MSGFMT='/usr/bin/msgfmt'}
ac_cv_header_stdc=${ac_cv_header_stdc='yes'}
ac_cv_dusum=${ac_cv_dusum='dusum_useb=yes; dusum_factor=1'}
ac_cv_lib_dnet_dnet_ntoa=${ac_cv_lib_dnet_dnet_ntoa='no'}
ac_cv_header_sys_fstyp_h=${ac_cv_header_sys_fstyp_h='no'}
ac_cv_func___argz_stringify=${ac_cv_func___argz_stringify='no'}
ac_cv_header_mntent_h=${ac_cv_header_mntent_h='yes'}
ac_cv_lib_dir_opendir=${ac_cv_lib_dir_opendir='no'}
ac_cv_header_sys_sysmacros_h=${ac_cv_header_sys_sysmacros_h='yes'}
ac_cv_prog_make_make_set=${ac_cv_prog_make_make_set='yes'}
ac_cv_lib_seq_get_process_stats=${ac_cv_lib_seq_get_process_stats='no'}
ac_cv_func_gethostbyname=${ac_cv_func_gethostbyname='yes'}
ac_cv_func_statfs=${ac_cv_func_statfs='yes'}
nls_cv_header_intl=${nls_cv_header_intl='intl/libintl.h'}
ac_cv_func___argz_next=${ac_cv_func___argz_next='no'}
ac_cv_func_setenv=${ac_cv_func_setenv='yes'}
ac_cv_header_sys_param_h=${ac_cv_header_sys_param_h='yes'}
ac_cv_header_string_h=${ac_cv_header_string_h='yes'}
ac_cv_header_locale_h=${ac_cv_header_locale_h='yes'}
ac_cv_header_unistd_h=${ac_cv_header_unistd_h='yes'}
ac_cv_c_inline=${ac_cv_c_inline='inline'}
ac_cv_func_pmap_set=${ac_cv_func_pmap_set='no'}
ac_cv_func_statvfs=${ac_cv_func_statvfs='no'}
fu_cv_sys_d_ino_in_dirent=${fu_cv_sys_d_ino_in_dirent='yes'}
ac_cv_header_sys_vfs_h=${ac_cv_header_sys_vfs_h='yes'}
ac_cv_func_strchr=${ac_cv_func_strchr='yes'}
ac_cv_header_utime_h=${ac_cv_header_utime_h='yes'}
ac_cv_header_memory_h=${ac_cv_header_memory_h='yes'}
ac_cv_func_keyok=${ac_cv_func_keyok='no'}
ac_cv_filel=${ac_cv_filel='yes'}
ac_cv_func_rresvport=${ac_cv_func_rresvport='yes'}
fu_cv_sys_stat_statfs2_bsize=${fu_cv_sys_stat_statfs2_bsize='yes'}
ac_cv_prog_gcc=${ac_cv_prog_gcc='yes'}
ac_cv_prog_cc_cross=${ac_cv_prog_cc_cross='no'}
ac_cv_lib_curses_setupterm=${ac_cv_lib_curses_setupterm='yes'}
ac_cv_grep_stdin=${ac_cv_grep_stdin='yes'}
ac_cv_prog_HAVE_FILECMD=${ac_cv_prog_HAVE_FILECMD='true'}
ac_cv_prog_HAVE_nroff=${ac_cv_prog_HAVE_nroff='true'}
ac_cv_lib_seq_getmntent=${ac_cv_lib_seq_getmntent='no'}
ac_cv_func_strerror=${ac_cv_func_strerror='yes'}
am_cv_val_LC_MESSAGES=${am_cv_val_LC_MESSAGES='yes'}
ac_cv_type_off_t=${ac_cv_type_off_t='yes'}
ac_cv_func_tcgetattr=${ac_cv_func_tcgetattr='yes'}
nls_cv_force_use_gnu_gettext=${nls_cv_force_use_gnu_gettext='no'}
ac_cv_type_pid_t=${ac_cv_type_pid_t='yes'}
ac_cv_struct_st_blocks=${ac_cv_struct_st_blocks='yes'}
ac_cv_lib_intl_bindtextdomain=${ac_cv_lib_intl_bindtextdomain='yes'}
ac_cv_path_RM=${ac_cv_path_RM='/usr/bin/rm'}
ac_cv_header_sys_mkdev_h=${ac_cv_header_sys_mkdev_h='no'}
ac_cv_header_sys_types_h_makedev=${ac_cv_header_sys_types_h_makedev='no'}
ac_cv_func_connect=${ac_cv_func_connect='yes'}
fu_cv_sys_mounted_getmntent1=${fu_cv_sys_mounted_getmntent1='yes'}
ac_cv_func_sigemptyset=${ac_cv_func_sigemptyset='yes'}
ac_cv_struct_st_blksize=${ac_cv_struct_st_blksize='yes'}
nls_cv_use_gnu_gettext=${nls_cv_use_gnu_gettext='yes'}
ac_cv_header_argz_h=${ac_cv_header_argz_h='no'}
ac_cv_prog_AWK=${ac_cv_prog_AWK='gawk'}
ac_cv_prog_CPP=${ac_cv_prog_CPP='gcc -E'}
ac_cv_func_resizeterm=${ac_cv_func_resizeterm='no'}
fu_cv_sys_mounted_getmntent2=${fu_cv_sys_mounted_getmntent2='no'}
ac_cv_header_malloc_h=${ac_cv_header_malloc_h='yes'}
ac_cv_func_getpagesize=${ac_cv_func_getpagesize='yes'}
ac_cv_nroff_tascii=${ac_cv_nroff_tascii=' -Tascii'}
ac_cv_func_getmntent=${ac_cv_func_getmntent='yes'}
ac_cv_header_libintl_h=${ac_cv_header_libintl_h='yes'}
ac_cv_dnamesize=${ac_cv_dnamesize='yes'}
ac_cv_path_MV=${ac_cv_path_MV='/usr/bin/mv'}
ac_cv_lib_slang_SLang_init_tty=${ac_cv_lib_slang_SLang_init_tty='no'}
ac_cv_type_uid_t=${ac_cv_type_uid_t='yes'}
ac_cv_filestdin=${ac_cv_filestdin='yes'}
ac_cv_lib_crypt_crypt=${ac_cv_lib_crypt_crypt='yes'}
ac_cv_lib_gpm_Gpm_Repeat=${ac_cv_lib_gpm_Gpm_Repeat='no'}
ac_cv_header_rpc_pmap_clnt_h=${ac_cv_header_rpc_pmap_clnt_h='no'}
ac_cv_func_pmap_getport=${ac_cv_func_pmap_getport='no'}
ac_cv_lib_ICE_IceConnectionNumber=${ac_cv_lib_ICE_IceConnectionNumber='yes'}
ac_cv_func_strdup=${ac_cv_func_strdup='yes'}
nls_cv_header_libgt=${nls_cv_header_libgt='intl/libgettext.h'}
ac_cv_func_putenv=${ac_cv_func_putenv='yes'}
ac_cv_func_truncate=${ac_cv_func_truncate='yes'}
ac_cv_func_stpcpy=${ac_cv_func_stpcpy='no'}

575
rosapps/mc/config.h Normal file
View File

@@ -0,0 +1,575 @@
/* config.h. Generated automatically by configure. */
/* config.h.in. Generated automatically from configure.in by autoheader. */
/* This is the configuration file for the Midnight Commander. It was generated
by autoconf's configure.
Configure for Midnight Commander
Copyright (C) 1994, 1995 Janne Kukonlehto
Copyright (C) 1994, 1995 Miguel de Icaza
Copyright (C) 1995 Jakub Jelinek
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include <VERSION>
/* Define if on AIX 3.
System headers sometimes define this.
We just want to avoid a redefinition error message. */
#ifndef _ALL_SOURCE
/* #undef _ALL_SOURCE */
#endif
/* Define if using alloca.c. */
/* #undef C_ALLOCA */
/* Define to empty if the keyword does not work. */
/* #undef const */
/* Define to one of _getb67, GETB67, getb67 for Cray-2 and Cray-YMP systems.
This function is required for alloca.c support on those systems. */
/* #undef CRAY_STACKSEG_END */
/* Define to `int' if <sys/types.h> doesn't define. */
/* #undef gid_t */
/* Define if you have alloca, as a function or macro. */
#define HAVE_ALLOCA 1
/* Define if you have <alloca.h> and it should be used (not on Ultrix). */
/* #undef HAVE_ALLOCA_H */
/* Define if you have the getmntent function. */
#define HAVE_GETMNTENT 1
/* Define if you have a working `mmap' system call. */
/* #undef HAVE_MMAP */
/* Define if your struct stat has st_blksize. */
#define HAVE_ST_BLKSIZE 1
/* Define if your struct stat has st_blocks. */
#define HAVE_ST_BLOCKS 1
/* Define if your struct stat has st_rdev. */
#define HAVE_ST_RDEV 1
/* Define if you have <sys/wait.h> that is POSIX.1 compatible. */
#define HAVE_SYS_WAIT_H 1
/* Define as __inline if that's what the C compiler calls it. */
/* #undef inline */
/* Define if major, minor, and makedev are declared in <mkdev.h>. */
/* #undef MAJOR_IN_MKDEV */
/* Define if major, minor, and makedev are declared in <sysmacros.h>. */
#define MAJOR_IN_SYSMACROS 1
/* Define if on MINIX. */
/* #undef _MINIX */
/* Define to `int' if <sys/types.h> doesn't define. */
/* #undef mode_t */
/* Define to `long' if <sys/types.h> doesn't define. */
/* #undef off_t */
/* Define to `int' if <sys/types.h> doesn't define. */
/* #undef pid_t */
/* Define if the system does not provide POSIX.1 features except
with this defined. */
/* #undef _POSIX_1_SOURCE */
/* Define if you need to in order for stat and other things to work. */
/* #undef _POSIX_SOURCE */
/* Define to `unsigned' if <sys/types.h> doesn't define. */
/* #undef size_t */
/* If using the C implementation of alloca, define if you know the
direction of stack growth for your system; otherwise it will be
automatically deduced at run-time.
STACK_DIRECTION > 0 => grows toward higher addresses
STACK_DIRECTION < 0 => grows toward lower addresses
STACK_DIRECTION = 0 => direction of growth unknown
*/
/* #undef STACK_DIRECTION */
/* Define if you have the ANSI C header files. */
#define STDC_HEADERS 1
/* Define to `int' if <sys/types.h> doesn't define. */
/* #undef uid_t */
/* Define if the X Window System is missing or not being used. */
/* #undef X_DISPLAY_MISSING */
#define PACKAGE "mc"
/* Always defined */
#define D_INO_IN_DIRENT 1
/* #undef IS_AIX */
/* #undef MOUNTED_FREAD */
/* #undef MOUNTED_FREAD_FSTYP */
/* #undef MOUNTED_GETFSSTAT */
/* #undef MOUNTED_GETMNT */
#define MOUNTED_GETMNTENT1 1
/* #undef MOUNTED_GETMNTENT2 */
/* #undef MOUNTED_GETMNTINFO */
/* #undef MOUNTED_VMOUNT */
#define STAT_STATFS2_BSIZE 1
/* #undef STAT_STATFS2_FSIZE */
/* #undef STAT_STATFS2_FS_DATA */
/* #undef STAT_STATFS3_OSF1 */
/* #undef STAT_STATFS4 */
/* #undef STAT_STATVFS */
/* Define umode_t if your system does not provide it */
#define umode_t int
/* Define nlink_t if your system does not provide it */
/* #undef nlink_t */
/* Does the file command accepts the -L option */
#define FILE_L 1
/* Does the file command work well with - option for stdin? */
#define FILE_STDIN 1
/* Does the grep command work well with - option for stdin? */
#define GREP_STDIN 1
/* Is the program using the GPM library? */
/* #undef HAVE_LIBGPM */
/* Is the program using the distributed slang library? */
#define HAVE_SLANG 1
/* Is the program using a system-installed slang library? */
/* #undef HAVE_SYSTEM_SLANG */
/* Define if the slang.h header file is inside a directory slang
** in the standard directories
*/
/* #undef SLANG_H_INSIDE_SLANG_DIR */
/* Does the program have subshell support? */
#define HAVE_SUBSHELL_SUPPORT 1
/* If you don't have gcc, define this */
/* #undef OLD_TOOLS */
/* Is the subshell the default or optional? */
/* #undef SUBSHELL_OPTIONAL */
/* Use SunOS SysV curses? */
/* #undef SUNOS_CURSES */
/* Use SystemV curses? */
/* #undef USE_SYSV_CURSES */
/* Use Ncurses? */
/* #undef USE_NCURSES */
/* If you Curses does not have color define this one */
/* #undef NO_COLOR_SUPPORT */
/* Support the Midnight Commander Virtual File System? */
#define USE_VFS 1
/* Support for the Memory Allocation Debugger */
/* #undef HAVE_MAD */
/* Extra Debugging */
/* #undef MCDEBUG */
/* If the Slang library will be using it's own terminfo instead of termcap */
#define SLANG_TERMINFO 1
/* If Slang library should use termcap */
/* #undef USE_TERMCAP */
/* If you have socket and the rest of the net functions use this */
#define USE_NETCODE 1
/* If defined, use .netrc for FTP connections */
/* #undef USE_NETRC */
/* If your operating system does not have enough space for a file name
* in a struct dirent, then define this
*/
/* #undef NEED_EXTRA_DIRENT_BUFFER */
/* Define if you want the du -s summary */
#define HAVE_DUSUM 1
/* Define if your du does handle -b correctly */
#define DUSUM_USEB 1
/* Define to size of chunks du is displaying its information.
* If DUSUM_USEB is defined, this should be 1
*/
#define DUSUM_FACTOR 1
/* Define this one if you want termnet support */
/* #undef USE_TERMNET */
/* Defined if you have libXpm, <X11/xpm.h>, libXext, <X11/extensions/shape.h> */
/* #undef HAVE_XPM_SHAPE */
/* Defined if you have shadow passwords on Linux */
/* #undef LINUX_SHADOW */
/* Defined if you have the crypt prototype in neither unistd.h nor crypt.h */
#define NEED_CRYPT_PROTOTYPE 1
/* Define if you want to turn on SCO-specific code */
/* #undef SCO_FLAVOR */
/* Define if your system has struct linger */
#define HAVE_STRUCT_LINGER 1
/* Define if your curses has this one (AIX, OSF/1) */
/* #undef USE_SETUPTERM */
/* Link in ext2fs code for delfs experimental file system */
/* #undef USE_EXT2FSLIB */
/* Define if you want to use the HSC firewall */
/* #undef HSC_PROXY */
/* Define if your system uses PAM for auth stuff */
/* #undef HAVE_PAM */
/* Define if you have the get_process_stats function and have to use that instead of gettimeofday */
/* #undef HAVE_GET_PROCESS_STATS */
/* Define if you want to call the internal routine edit() for the editor */
#define USE_INTERNAL_EDIT 1
/* Define if your system has socketpair */
#define HAVE_SOCKETPAIR 1
/* Version of ncurses */
/* #undef NCURSES_970530 */
/* #undef HAVE_STPCPY */
#define ENABLE_NLS 1
/* #undef HAVE_CATGETS */
/* #undef HAVE_GETTEXT */
#define HAVE_LC_MESSAGES 1
/* Define if you have the __argz_count function. */
/* #undef HAVE___ARGZ_COUNT */
/* Define if you have the __argz_next function. */
/* #undef HAVE___ARGZ_NEXT */
/* Define if you have the __argz_stringify function. */
/* #undef HAVE___ARGZ_STRINGIFY */
/* Define if you have the cfgetospeed function. */
#define HAVE_CFGETOSPEED 1
/* Define if you have the crypt function. */
/* #undef HAVE_CRYPT */
/* Define if you have the dcgettext function. */
/* #undef HAVE_DCGETTEXT */
/* Define if you have the getcwd function. */
#define HAVE_GETCWD 1
/* Define if you have the getmntinfo function. */
/* #undef HAVE_GETMNTINFO */
/* Define if you have the getpagesize function. */
#define HAVE_GETPAGESIZE 1
/* Define if you have the getwd function. */
#define HAVE_GETWD 1
/* Define if you have the grantpt function. */
#define HAVE_GRANTPT 1
/* Define if you have the initgroups function. */
#define HAVE_INITGROUPS 1
/* Define if you have the keyok function. */
/* #undef HAVE_KEYOK */
/* Define if you have the memcpy function. */
#define HAVE_MEMCPY 1
/* Define if you have the memmove function. */
#define HAVE_MEMMOVE 1
/* Define if you have the memset function. */
#define HAVE_MEMSET 1
/* Define if you have the munmap function. */
#define HAVE_MUNMAP 1
/* Define if you have the pmap_getmaps function. */
/* #undef HAVE_PMAP_GETMAPS */
/* Define if you have the pmap_getport function. */
/* #undef HAVE_PMAP_GETPORT */
/* Define if you have the pmap_set function. */
/* #undef HAVE_PMAP_SET */
/* Define if you have the putenv function. */
#define HAVE_PUTENV 1
/* Define if you have the pwdauth function. */
/* #undef HAVE_PWDAUTH */
/* Define if you have the resizeterm function. */
/* #undef HAVE_RESIZETERM */
/* Define if you have the rresvport function. */
#define HAVE_RRESVPORT 1
/* Define if you have the setenv function. */
#define HAVE_SETENV 1
/* Define if you have the setlocale function. */
#define HAVE_SETLOCALE 1
/* Define if you have the sigaction function. */
#define HAVE_SIGACTION 1
/* Define if you have the sigaddset function. */
#define HAVE_SIGADDSET 1
/* Define if you have the sigemptyset function. */
#define HAVE_SIGEMPTYSET 1
/* Define if you have the sigprocmask function. */
#define HAVE_SIGPROCMASK 1
/* Define if you have the socket function. */
#define HAVE_SOCKET 1
/* Define if you have the socketpair function. */
#define HAVE_SOCKETPAIR 1
/* Define if you have the statfs function. */
#define HAVE_STATFS 1
/* Define if you have the statlstat function. */
/* #undef HAVE_STATLSTAT */
/* Define if you have the statvfs function. */
/* #undef HAVE_STATVFS */
/* Define if you have the stpcpy function. */
/* #undef HAVE_STPCPY */
/* Define if you have the strcasecmp function. */
#define HAVE_STRCASECMP 1
/* Define if you have the strchr function. */
#define HAVE_STRCHR 1
/* Define if you have the strdup function. */
#define HAVE_STRDUP 1
/* Define if you have the strerror function. */
#define HAVE_STRERROR 1
/* Define if you have the strncasecmp function. */
#define HAVE_STRNCASECMP 1
/* Define if you have the sysconf function. */
#define HAVE_SYSCONF 1
/* Define if you have the tcgetattr function. */
#define HAVE_TCGETATTR 1
/* Define if you have the tcsetattr function. */
#define HAVE_TCSETATTR 1
/* Define if you have the truncate function. */
#define HAVE_TRUNCATE 1
/* Define if you have the <argz.h> header file. */
/* #undef HAVE_ARGZ_H */
/* Define if you have the <crypt.h> header file. */
#define HAVE_CRYPT_H 1
/* Define if you have the <dirent.h> header file. */
#define HAVE_DIRENT_H 1
/* Define if you have the <ext2fs/ext2fs.h> header file. */
/* #undef HAVE_EXT2FS_EXT2FS_H */
/* Define if you have the <fcntl.h> header file. */
#define HAVE_FCNTL_H 1
/* Define if you have the <grp.h> header file. */
#define HAVE_GRP_H 1
/* Define if you have the <limits.h> header file. */
#define HAVE_LIMITS_H 1
/* Define if you have the <linux/ext2_fs.h> header file. */
/* #undef HAVE_LINUX_EXT2_FS_H */
/* Define if you have the <locale.h> header file. */
#define HAVE_LOCALE_H 1
/* Define if you have the <malloc.h> header file. */
#define HAVE_MALLOC_H 1
/* Define if you have the <memory.h> header file. */
#define HAVE_MEMORY_H 1
/* Define if you have the <mntent.h> header file. */
#define HAVE_MNTENT_H 1
/* Define if you have the <mnttab.h> header file. */
/* #undef HAVE_MNTTAB_H */
/* Define if you have the <ndir.h> header file. */
/* #undef HAVE_NDIR_H */
/* Define if you have the <nl_types.h> header file. */
/* #undef HAVE_NL_TYPES_H */
/* Define if you have the <rpc/pmap_clnt.h> header file. */
/* #undef HAVE_RPC_PMAP_CLNT_H */
/* Define if you have the <shadow.h> header file. */
/* #undef HAVE_SHADOW_H */
/* Define if you have the <shadow/shadow.h> header file. */
/* #undef HAVE_SHADOW_SHADOW_H */
/* Define if you have the <slang.h> header file. */
/* #undef HAVE_SLANG_H */
/* Define if you have the <slang/slang.h> header file. */
/* #undef HAVE_SLANG_SLANG_H */
/* Define if you have the <stdlib.h> header file. */
#define HAVE_STDLIB_H 1
/* Define if you have the <string.h> header file. */
#define HAVE_STRING_H 1
/* Define if you have the <sys/dir.h> header file. */
/* #undef HAVE_SYS_DIR_H */
/* Define if you have the <sys/dustat.h> header file. */
/* #undef HAVE_SYS_DUSTAT_H */
/* Define if you have the <sys/filsys.h> header file. */
/* #undef HAVE_SYS_FILSYS_H */
/* Define if you have the <sys/fs_types.h> header file. */
/* #undef HAVE_SYS_FS_TYPES_H */
/* Define if you have the <sys/fstyp.h> header file. */
/* #undef HAVE_SYS_FSTYP_H */
/* Define if you have the <sys/mount.h> header file. */
#define HAVE_SYS_MOUNT_H 1
/* Define if you have the <sys/ndir.h> header file. */
/* #undef HAVE_SYS_NDIR_H */
/* Define if you have the <sys/param.h> header file. */
#define HAVE_SYS_PARAM_H 1
/* Define if you have the <sys/select.h> header file. */
#define HAVE_SYS_SELECT_H 1
/* Define if you have the <sys/statfs.h> header file. */
/* #undef HAVE_SYS_STATFS_H */
/* Define if you have the <sys/statvfs.h> header file. */
/* #undef HAVE_SYS_STATVFS_H */
/* Define if you have the <sys/vfs.h> header file. */
#define HAVE_SYS_VFS_H 1
/* Define if you have the <termios.h> header file. */
#define HAVE_TERMIOS_H 1
/* Define if you have the <unistd.h> header file. */
#define HAVE_UNISTD_H 1
/* Define if you have the <utime.h> header file. */
#define HAVE_UTIME_H 1
/* Define if you have the <values.h> header file. */
/* #undef HAVE_VALUES_H */
/* Define if you have the i library (-li). */
/* #undef HAVE_LIBI */
/* Define if you have the intl library (-lintl). */
#define HAVE_LIBINTL 1
/* Define if you have the nsl library (-lnsl). */
/* #undef HAVE_LIBNSL */
/* Define if you have the pt library (-lpt). */
/* #undef HAVE_LIBPT */
/* Define if you have the socket library (-lsocket). */
/* #undef HAVE_LIBSOCKET */
#ifdef HAVE_LIBPT
# define HAVE_GRANTPT
#endif
#if defined(HAVE_LIBCRYPT) || defined(HAVE_LIBCRYPT_I)
# define HAVE_CRYPT
#endif
#ifdef HAVE_XVIEW
# include <xvmain.h>
#endif
#if defined(HAVE_SIGADDSET) && defined(HAVE_SIGEMPTYSET)
# if defined(HAVE_SIGACTION) && defined(HAVE_SIGPROCMASK)
# define SLANG_POSIX_SIGNALS
# endif
#endif
#ifdef __os2__
# define OS2_NT 1
# define S_ISFIFO(x) 0
#endif
#ifdef _OS_NT
# define OS2_NT 1
#endif
#ifndef OS2_NT
/* some Unices do not define this, and slang requires it: */
#ifndef unix
# define unix
#endif
#endif

574
rosapps/mc/config.h.in Normal file
View File

@@ -0,0 +1,574 @@
/* config.h.in. Generated automatically from configure.in by autoheader. */
/* This is the configuration file for the Midnight Commander. It was generated
by autoconf's configure.
Configure for Midnight Commander
Copyright (C) 1994, 1995 Janne Kukonlehto
Copyright (C) 1994, 1995 Miguel de Icaza
Copyright (C) 1995 Jakub Jelinek
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include <VERSION>
/* Define if on AIX 3.
System headers sometimes define this.
We just want to avoid a redefinition error message. */
#ifndef _ALL_SOURCE
#undef _ALL_SOURCE
#endif
/* Define if using alloca.c. */
#undef C_ALLOCA
/* Define to empty if the keyword does not work. */
#undef const
/* Define to one of _getb67, GETB67, getb67 for Cray-2 and Cray-YMP systems.
This function is required for alloca.c support on those systems. */
#undef CRAY_STACKSEG_END
/* Define to `int' if <sys/types.h> doesn't define. */
#undef gid_t
/* Define if you have alloca, as a function or macro. */
#undef HAVE_ALLOCA
/* Define if you have <alloca.h> and it should be used (not on Ultrix). */
#undef HAVE_ALLOCA_H
/* Define if you have the getmntent function. */
#undef HAVE_GETMNTENT
/* Define if you have a working `mmap' system call. */
#undef HAVE_MMAP
/* Define if your struct stat has st_blksize. */
#undef HAVE_ST_BLKSIZE
/* Define if your struct stat has st_blocks. */
#undef HAVE_ST_BLOCKS
/* Define if your struct stat has st_rdev. */
#undef HAVE_ST_RDEV
/* Define if you have <sys/wait.h> that is POSIX.1 compatible. */
#undef HAVE_SYS_WAIT_H
/* Define as __inline if that's what the C compiler calls it. */
#undef inline
/* Define if major, minor, and makedev are declared in <mkdev.h>. */
#undef MAJOR_IN_MKDEV
/* Define if major, minor, and makedev are declared in <sysmacros.h>. */
#undef MAJOR_IN_SYSMACROS
/* Define if on MINIX. */
#undef _MINIX
/* Define to `int' if <sys/types.h> doesn't define. */
#undef mode_t
/* Define to `long' if <sys/types.h> doesn't define. */
#undef off_t
/* Define to `int' if <sys/types.h> doesn't define. */
#undef pid_t
/* Define if the system does not provide POSIX.1 features except
with this defined. */
#undef _POSIX_1_SOURCE
/* Define if you need to in order for stat and other things to work. */
#undef _POSIX_SOURCE
/* Define to `unsigned' if <sys/types.h> doesn't define. */
#undef size_t
/* If using the C implementation of alloca, define if you know the
direction of stack growth for your system; otherwise it will be
automatically deduced at run-time.
STACK_DIRECTION > 0 => grows toward higher addresses
STACK_DIRECTION < 0 => grows toward lower addresses
STACK_DIRECTION = 0 => direction of growth unknown
*/
#undef STACK_DIRECTION
/* Define if you have the ANSI C header files. */
#undef STDC_HEADERS
/* Define to `int' if <sys/types.h> doesn't define. */
#undef uid_t
/* Define if the X Window System is missing or not being used. */
#undef X_DISPLAY_MISSING
#undef PACKAGE
/* Always defined */
#undef D_INO_IN_DIRENT
#undef IS_AIX
#undef MOUNTED_FREAD
#undef MOUNTED_FREAD_FSTYP
#undef MOUNTED_GETFSSTAT
#undef MOUNTED_GETMNT
#undef MOUNTED_GETMNTENT1
#undef MOUNTED_GETMNTENT2
#undef MOUNTED_GETMNTINFO
#undef MOUNTED_VMOUNT
#undef STAT_STATFS2_BSIZE
#undef STAT_STATFS2_FSIZE
#undef STAT_STATFS2_FS_DATA
#undef STAT_STATFS3_OSF1
#undef STAT_STATFS4
#undef STAT_STATVFS
/* Define umode_t if your system does not provide it */
#undef umode_t
/* Define nlink_t if your system does not provide it */
#undef nlink_t
/* Does the file command accepts the -L option */
#undef FILE_L
/* Does the file command work well with - option for stdin? */
#undef FILE_STDIN
/* Does the grep command work well with - option for stdin? */
#undef GREP_STDIN
/* Is the program using the GPM library? */
#undef HAVE_LIBGPM
/* Is the program using the distributed slang library? */
#undef HAVE_SLANG
/* Is the program using a system-installed slang library? */
#undef HAVE_SYSTEM_SLANG
/* Define if the slang.h header file is inside a directory slang
** in the standard directories
*/
#undef SLANG_H_INSIDE_SLANG_DIR
/* Does the program have subshell support? */
#undef HAVE_SUBSHELL_SUPPORT
/* If you don't have gcc, define this */
#undef OLD_TOOLS
/* Is the subshell the default or optional? */
#undef SUBSHELL_OPTIONAL
/* Use SunOS SysV curses? */
#undef SUNOS_CURSES
/* Use SystemV curses? */
#undef USE_SYSV_CURSES
/* Use Ncurses? */
#undef USE_NCURSES
/* If you Curses does not have color define this one */
#undef NO_COLOR_SUPPORT
/* Support the Midnight Commander Virtual File System? */
#undef USE_VFS
/* Support for the Memory Allocation Debugger */
#undef HAVE_MAD
/* Extra Debugging */
#undef MCDEBUG
/* If the Slang library will be using it's own terminfo instead of termcap */
#undef SLANG_TERMINFO
/* If Slang library should use termcap */
#undef USE_TERMCAP
/* If you have socket and the rest of the net functions use this */
#undef USE_NETCODE
/* If defined, use .netrc for FTP connections */
#undef USE_NETRC
/* If your operating system does not have enough space for a file name
* in a struct dirent, then define this
*/
#undef NEED_EXTRA_DIRENT_BUFFER
/* Define if you want the du -s summary */
#undef HAVE_DUSUM
/* Define if your du does handle -b correctly */
#undef DUSUM_USEB
/* Define to size of chunks du is displaying its information.
* If DUSUM_USEB is defined, this should be 1
*/
#define DUSUM_FACTOR 512
/* Define this one if you want termnet support */
#undef USE_TERMNET
/* Defined if you have libXpm, <X11/xpm.h>, libXext, <X11/extensions/shape.h> */
#undef HAVE_XPM_SHAPE
/* Defined if you have shadow passwords on Linux */
#undef LINUX_SHADOW
/* Defined if you have the crypt prototype in neither unistd.h nor crypt.h */
#undef NEED_CRYPT_PROTOTYPE
/* Define if you want to turn on SCO-specific code */
#undef SCO_FLAVOR
/* Define if your system has struct linger */
#undef HAVE_STRUCT_LINGER
/* Define if your curses has this one (AIX, OSF/1) */
#undef USE_SETUPTERM
/* Link in ext2fs code for delfs experimental file system */
#undef USE_EXT2FSLIB
/* Define if you want to use the HSC firewall */
#undef HSC_PROXY
/* Define if your system uses PAM for auth stuff */
#undef HAVE_PAM
/* Define if you have the get_process_stats function and have to use that instead of gettimeofday */
#undef HAVE_GET_PROCESS_STATS
/* Define if you want to call the internal routine edit() for the editor */
#undef USE_INTERNAL_EDIT
/* Define if your system has socketpair */
#undef HAVE_SOCKETPAIR
/* Version of ncurses */
#undef NCURSES_970530
#undef HAVE_STPCPY
#undef ENABLE_NLS
#undef HAVE_CATGETS
#undef HAVE_GETTEXT
#undef HAVE_LC_MESSAGES
/* Define if you have the __argz_count function. */
#undef HAVE___ARGZ_COUNT
/* Define if you have the __argz_next function. */
#undef HAVE___ARGZ_NEXT
/* Define if you have the __argz_stringify function. */
#undef HAVE___ARGZ_STRINGIFY
/* Define if you have the cfgetospeed function. */
#undef HAVE_CFGETOSPEED
/* Define if you have the crypt function. */
#undef HAVE_CRYPT
/* Define if you have the dcgettext function. */
#undef HAVE_DCGETTEXT
/* Define if you have the getcwd function. */
#undef HAVE_GETCWD
/* Define if you have the getmntinfo function. */
#undef HAVE_GETMNTINFO
/* Define if you have the getpagesize function. */
#undef HAVE_GETPAGESIZE
/* Define if you have the getwd function. */
#undef HAVE_GETWD
/* Define if you have the grantpt function. */
#undef HAVE_GRANTPT
/* Define if you have the initgroups function. */
#undef HAVE_INITGROUPS
/* Define if you have the keyok function. */
#undef HAVE_KEYOK
/* Define if you have the memcpy function. */
#undef HAVE_MEMCPY
/* Define if you have the memmove function. */
#undef HAVE_MEMMOVE
/* Define if you have the memset function. */
#undef HAVE_MEMSET
/* Define if you have the munmap function. */
#undef HAVE_MUNMAP
/* Define if you have the pmap_getmaps function. */
#undef HAVE_PMAP_GETMAPS
/* Define if you have the pmap_getport function. */
#undef HAVE_PMAP_GETPORT
/* Define if you have the pmap_set function. */
#undef HAVE_PMAP_SET
/* Define if you have the putenv function. */
#undef HAVE_PUTENV
/* Define if you have the pwdauth function. */
#undef HAVE_PWDAUTH
/* Define if you have the resizeterm function. */
#undef HAVE_RESIZETERM
/* Define if you have the rresvport function. */
#undef HAVE_RRESVPORT
/* Define if you have the setenv function. */
#undef HAVE_SETENV
/* Define if you have the setlocale function. */
#undef HAVE_SETLOCALE
/* Define if you have the sigaction function. */
#undef HAVE_SIGACTION
/* Define if you have the sigaddset function. */
#undef HAVE_SIGADDSET
/* Define if you have the sigemptyset function. */
#undef HAVE_SIGEMPTYSET
/* Define if you have the sigprocmask function. */
#undef HAVE_SIGPROCMASK
/* Define if you have the socket function. */
#undef HAVE_SOCKET
/* Define if you have the socketpair function. */
#undef HAVE_SOCKETPAIR
/* Define if you have the statfs function. */
#undef HAVE_STATFS
/* Define if you have the statlstat function. */
#undef HAVE_STATLSTAT
/* Define if you have the statvfs function. */
#undef HAVE_STATVFS
/* Define if you have the stpcpy function. */
#undef HAVE_STPCPY
/* Define if you have the strcasecmp function. */
#undef HAVE_STRCASECMP
/* Define if you have the strchr function. */
#undef HAVE_STRCHR
/* Define if you have the strdup function. */
#undef HAVE_STRDUP
/* Define if you have the strerror function. */
#undef HAVE_STRERROR
/* Define if you have the strncasecmp function. */
#undef HAVE_STRNCASECMP
/* Define if you have the sysconf function. */
#undef HAVE_SYSCONF
/* Define if you have the tcgetattr function. */
#undef HAVE_TCGETATTR
/* Define if you have the tcsetattr function. */
#undef HAVE_TCSETATTR
/* Define if you have the truncate function. */
#undef HAVE_TRUNCATE
/* Define if you have the <argz.h> header file. */
#undef HAVE_ARGZ_H
/* Define if you have the <crypt.h> header file. */
#undef HAVE_CRYPT_H
/* Define if you have the <dirent.h> header file. */
#undef HAVE_DIRENT_H
/* Define if you have the <ext2fs/ext2fs.h> header file. */
#undef HAVE_EXT2FS_EXT2FS_H
/* Define if you have the <fcntl.h> header file. */
#undef HAVE_FCNTL_H
/* Define if you have the <grp.h> header file. */
#undef HAVE_GRP_H
/* Define if you have the <limits.h> header file. */
#undef HAVE_LIMITS_H
/* Define if you have the <linux/ext2_fs.h> header file. */
#undef HAVE_LINUX_EXT2_FS_H
/* Define if you have the <locale.h> header file. */
#undef HAVE_LOCALE_H
/* Define if you have the <malloc.h> header file. */
#undef HAVE_MALLOC_H
/* Define if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H
/* Define if you have the <mntent.h> header file. */
#undef HAVE_MNTENT_H
/* Define if you have the <mnttab.h> header file. */
#undef HAVE_MNTTAB_H
/* Define if you have the <ndir.h> header file. */
#undef HAVE_NDIR_H
/* Define if you have the <nl_types.h> header file. */
#undef HAVE_NL_TYPES_H
/* Define if you have the <rpc/pmap_clnt.h> header file. */
#undef HAVE_RPC_PMAP_CLNT_H
/* Define if you have the <shadow.h> header file. */
#undef HAVE_SHADOW_H
/* Define if you have the <shadow/shadow.h> header file. */
#undef HAVE_SHADOW_SHADOW_H
/* Define if you have the <slang.h> header file. */
#undef HAVE_SLANG_H
/* Define if you have the <slang/slang.h> header file. */
#undef HAVE_SLANG_SLANG_H
/* Define if you have the <stdlib.h> header file. */
#undef HAVE_STDLIB_H
/* Define if you have the <string.h> header file. */
#undef HAVE_STRING_H
/* Define if you have the <sys/dir.h> header file. */
#undef HAVE_SYS_DIR_H
/* Define if you have the <sys/dustat.h> header file. */
#undef HAVE_SYS_DUSTAT_H
/* Define if you have the <sys/filsys.h> header file. */
#undef HAVE_SYS_FILSYS_H
/* Define if you have the <sys/fs_types.h> header file. */
#undef HAVE_SYS_FS_TYPES_H
/* Define if you have the <sys/fstyp.h> header file. */
#undef HAVE_SYS_FSTYP_H
/* Define if you have the <sys/mount.h> header file. */
#undef HAVE_SYS_MOUNT_H
/* Define if you have the <sys/ndir.h> header file. */
#undef HAVE_SYS_NDIR_H
/* Define if you have the <sys/param.h> header file. */
#undef HAVE_SYS_PARAM_H
/* Define if you have the <sys/select.h> header file. */
#undef HAVE_SYS_SELECT_H
/* Define if you have the <sys/statfs.h> header file. */
#undef HAVE_SYS_STATFS_H
/* Define if you have the <sys/statvfs.h> header file. */
#undef HAVE_SYS_STATVFS_H
/* Define if you have the <sys/vfs.h> header file. */
#undef HAVE_SYS_VFS_H
/* Define if you have the <termios.h> header file. */
#undef HAVE_TERMIOS_H
/* Define if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
/* Define if you have the <utime.h> header file. */
#undef HAVE_UTIME_H
/* Define if you have the <values.h> header file. */
#undef HAVE_VALUES_H
/* Define if you have the i library (-li). */
#undef HAVE_LIBI
/* Define if you have the intl library (-lintl). */
#undef HAVE_LIBINTL
/* Define if you have the nsl library (-lnsl). */
#undef HAVE_LIBNSL
/* Define if you have the pt library (-lpt). */
#undef HAVE_LIBPT
/* Define if you have the socket library (-lsocket). */
#undef HAVE_LIBSOCKET
#ifdef HAVE_LIBPT
# define HAVE_GRANTPT
#endif
#if defined(HAVE_LIBCRYPT) || defined(HAVE_LIBCRYPT_I)
# define HAVE_CRYPT
#endif
#ifdef HAVE_XVIEW
# include <xvmain.h>
#endif
#if defined(HAVE_SIGADDSET) && defined(HAVE_SIGEMPTYSET)
# if defined(HAVE_SIGACTION) && defined(HAVE_SIGPROCMASK)
# define SLANG_POSIX_SIGNALS
# endif
#endif
#ifdef __os2__
# define OS2_NT 1
# define S_ISFIFO(x) 0
#endif
#ifdef _OS_NT
# define OS2_NT 1
#endif
#ifndef OS2_NT
/* some Unices do not define this, and slang requires it: */
#ifndef unix
# define unix
#endif
#endif

810
rosapps/mc/config.status Normal file
View File

@@ -0,0 +1,810 @@
#! /bin/sh
# Generated automatically by configure.
# Run this file to recreate the current configuration.
# This directory was configured as follows,
# on host ROSBOX:
#
# ./configure --build=mingw32 --host=mingw32 --target=mingw32
#
# Compiler output produced by configure, useful for debugging
# configure, is in ./config.log if it exists.
ac_cs_usage="Usage: ./config.status [--recheck] [--version] [--help]"
for ac_option
do
case "$ac_option" in
-recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
echo "running ${CONFIG_SHELL-/bin/sh} ./configure --build=mingw32 --host=mingw32 --target=mingw32 --no-create --no-recursion"
exec ${CONFIG_SHELL-/bin/sh} ./configure --build=mingw32 --host=mingw32 --target=mingw32 --no-create --no-recursion ;;
-version | --version | --versio | --versi | --vers | --ver | --ve | --v)
echo "./config.status generated by autoconf version 2.12"
exit 0 ;;
-help | --help | --hel | --he | --h)
echo "$ac_cs_usage"; exit 0 ;;
*) echo "$ac_cs_usage"; exit 1 ;;
esac
done
ac_given_srcdir=.
ac_given_INSTALL="/usr/bin/install -c"
trap 'rm -fr
Make.common
Makefile
doc/Makefile
vfs/Makefile
lib/Makefile
tk/Makefile
gnome/Makefile
xv/Makefile
src/Makefile
slang/Makefile
edit/Makefile
icons/Makefile
lib/mc.ext
mcfn_install
vfs/extfs/ftplist vfs/extfs/zip vfs/extfs/zoo vfs/extfs/lslR
vfs/extfs/lha vfs/extfs/cpio vfs/extfs/deb vfs/extfs/rar
doc/mc.1 doc/mcedit.1 doc/mcserv.8
intl/Makefile po/Makefile.in
config.h conftest*; exit 1' 1 2 15
# Protect against being on the right side of a sed subst in config.status.
sed 's/%@/@@/; s/@%/@@/; s/%g$/@g/; /@g$/s/[\\&%]/\\&/g;
s/@@/%@/; s/@@/@%/; s/@g$/%g/' > conftest.subs <<\CEOF
/^[ ]*VPATH[ ]*=[^:]*$/d
s%@CFLAGS@%-g%g
s%@CPPFLAGS@%-I.. -I$(vfsdir) -I$(rootdir) -I$(slangdir)%g
s%@CXXFLAGS@%%g
s%@DEFS@%-DHAVE_CONFIG_H%g
s%@LDFLAGS@%%g
s%@LIBS@%-lintl -lcrypt %g
s%@exec_prefix@%${prefix}%g
s%@prefix@%/usr/local%g
s%@program_transform_name@%s,x,x,%g
s%@bindir@%${exec_prefix}/bin%g
s%@sbindir@%${exec_prefix}/sbin%g
s%@libexecdir@%${exec_prefix}/libexec%g
s%@datadir@%${prefix}/share%g
s%@sysconfdir@%${prefix}/etc%g
s%@sharedstatedir@%${prefix}/com%g
s%@localstatedir@%${prefix}/var%g
s%@libdir@%${exec_prefix}/lib%g
s%@includedir@%${prefix}/include%g
s%@oldincludedir@%/usr/include%g
s%@infodir@%${prefix}/info%g
s%@mandir@%${prefix}/man%g
s%@MC@%%g
s%@SET_MAKE@%%g
s%@CC@%gcc%g
s%@CPP@%gcc -E%g
s%@RANLIB@%ranlib%g
s%@LN_S@%ln -s%g
s%@AWK@%gawk%g
s%@AWK_VAR_OPTION@%-v%g
s%@dep@%fastdep%g
s%@GNU_MAKE@%GNU_MAKE=yes%g
s%@MV@%/usr/bin/mv%g
s%@CP@%/usr/bin/cp%g
s%@RM@%/usr/bin/rm%g
s%@CHMOD@%/usr/bin/chmod%g
s%@AR@%/usr/bin/ar%g
s%@system@%CYGWIN_98-4.10%g
s%@X11_WWW@%lynx%g
s%@ALLOCA@%%g
s%@USE_NLS@%yes%g
s%@MSGFMT@%/usr/bin/msgfmt%g
s%@GMSGFMT@%/usr/bin/msgfmt%g
s%@XGETTEXT@%/usr/bin/xgettext%g
s%@GENCAT@%%g
s%@USE_INCLUDED_LIBINTL@%yes%g
s%@CATALOGS@% es.gmo fr.gmo ru.gmo ko.gmo it.gmo%g
s%@CATOBJEXT@%.gmo%g
s%@DATADIRNAME@%share%g
s%@GMOFILES@% es.gmo fr.gmo ru.gmo ko.gmo it.gmo%g
s%@INSTOBJEXT@%.mo%g
s%@INTLDEPS@%$(top_builddir)/intl/libintl.a%g
s%@INTLLIBS@%$(top_builddir)/intl/libintl.a%g
s%@INTLOBJS@%$(GETTOBJS)%g
s%@POFILES@% es.po fr.po ru.po ko.po it.po%g
s%@POSUB@%po%g
s%@INCLUDE_LOCALE_H@%#include <locale.h>%g
s%@GT_NO@%%g
s%@GT_YES@%#YES#%g
s%@MKINSTALLDIRS@%$(top_srcdir)/mkinstalldirs%g
s%@l@%%g
s%@INSTALL_PROGRAM@%${INSTALL}%g
s%@INSTALL_DATA@%${INSTALL} -m 644%g
s%@REGEX_O@%regex.o%g
s%@LIBOBJS@%%g
s%@SHADOWLIB@%%g
s%@X_CFLAGS@% -I/usr/X11R6/include%g
s%@X_PRE_LIBS@% -lSM -lICE%g
s%@X_LIBS@% -L/usr/X11R6/lib%g
s%@X_EXTRA_LIBS@%%g
s%@XVIEW_CFLAGS@% -DXVIEW_MISSING%g
s%@XVIEW_CPPFLAGS@%%g
s%@XVIEW_LIBS@%%g
s%@HAVE_XVIEW@%no%g
s%@HAVE_XVIEW_PRIVATE_HEADERS@%yes%g
s%@insticons@%%g
s%@mxc@%%g
s%@xvdep@%%g
s%@ac_my_xp@%%g
s%@xv_bindir@%%g
s%@NETFILES@%$(NETFILES)%g
s%@XCURSES@%%g
s%@tkmc@%%g
s%@tkdep@%%g
s%@tk_includes@%%g
s%@tk_libs@%%g
s%@GNOME_LIBS@%%g
s%@GNOMEUI_LIBS@%%g
s%@GTKXMHTML_LIBS@%%g
s%@GNOME_LIBDIR@%%g
s%@GNOME_INCLUDEDIR@%%g
s%@gmc@%%g
s%@gmcdep@%%g
s%@HAVE_nroff@%true%g
s%@MANDOC@%-mandoc%g
s%@TROFFASCII@% -Tascii%g
s%@HAVE_FILECMD@%true%g
s%@INTLSUB@%intl%g
s%@LINTL@%%g
s%@LIBSLANG@%libmcslang.a%g
s%@LSLANG@%-lmcslang%g
s%@fastdepslang@%fastdepslang%g
s%@TERMNET@%%g
s%@LIBVFS@%libvfs.a%g
s%@LVFS@%-lvfs%g
s%@fastdepvfs@%fastdepvfs%g
s%@mcserv@%mcserv%g
s%@LIBEDIT_A@%libedit.a%g
s%@MCEDIT@%mcedit%g
s%@LEDIT@%-ledit%g
s%@undelfs_o@%%g
s%@saver_target@%%g
s%@saver@%%g
s%@vcs@%%g
s%@PAMLIBS@%%g
s%@SEDCMD@%sed 's/-man/-mandoc/'%g
s%@SEDCMD2@%sed 's%@prefix@%$(prefix)%'%g
s%@XPM_LIB@%%g
s%@XEXT_LIB@%%g
s%@PHONY@%.PHONY:%g
s%@WRITEDEP@%:%g
s%@MCFG@%include ../Make.common%g
s%@MCFGR@%include ./Make.common%g
s%@DOTDEPEND@%ifeq (.depend,$(wildcard .depend)) \
include .depend \
endif%g
/@MCF@/r /dev/null
s%@MCF@%%g
s%@PCENTRULE@%%g
s%@builddir@%/cygdrive/c/user/src/local/mc-4.1.36-mingw%g
CEOF
# Split the substitutions into bite-sized pieces for seds with
# small command number limits, like on Digital OSF/1 and HP-UX.
ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script.
ac_file=1 # Number of current file.
ac_beg=1 # First line for current file.
ac_end=$ac_max_sed_cmds # Line after last line for current file.
ac_more_lines=:
ac_sed_cmds=""
while $ac_more_lines; do
if test $ac_beg -gt 1; then
sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file
else
sed "${ac_end}q" conftest.subs > conftest.s$ac_file
fi
if test ! -s conftest.s$ac_file; then
ac_more_lines=false
rm -f conftest.s$ac_file
else
if test -z "$ac_sed_cmds"; then
ac_sed_cmds="sed -f conftest.s$ac_file"
else
ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file"
fi
ac_file=`expr $ac_file + 1`
ac_beg=$ac_end
ac_end=`expr $ac_end + $ac_max_sed_cmds`
fi
done
if test -z "$ac_sed_cmds"; then
ac_sed_cmds=cat
fi
CONFIG_FILES=${CONFIG_FILES-"Make.common
Makefile
doc/Makefile
vfs/Makefile
lib/Makefile
tk/Makefile
gnome/Makefile
xv/Makefile
src/Makefile
slang/Makefile
edit/Makefile
icons/Makefile
lib/mc.ext
mcfn_install
vfs/extfs/ftplist vfs/extfs/zip vfs/extfs/zoo vfs/extfs/lslR
vfs/extfs/lha vfs/extfs/cpio vfs/extfs/deb vfs/extfs/rar
doc/mc.1 doc/mcedit.1 doc/mcserv.8
intl/Makefile po/Makefile.in
"}
for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then
# Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
case "$ac_file" in
*:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'`
ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
*) ac_file_in="${ac_file}.in" ;;
esac
# Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories.
# Remove last slash and all that follows it. Not all systems have dirname.
ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'`
if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then
# The file is in a subdirectory.
test ! -d "$ac_dir" && mkdir "$ac_dir"
ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`"
# A "../" for each directory in $ac_dir_suffix.
ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'`
else
ac_dir_suffix= ac_dots=
fi
case "$ac_given_srcdir" in
.) srcdir=.
if test -z "$ac_dots"; then top_srcdir=.
else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;;
/*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;;
*) # Relative path.
srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix"
top_srcdir="$ac_dots$ac_given_srcdir" ;;
esac
case "$ac_given_INSTALL" in
[/$]*) INSTALL="$ac_given_INSTALL" ;;
*) INSTALL="$ac_dots$ac_given_INSTALL" ;;
esac
echo creating "$ac_file"
rm -f "$ac_file"
configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure."
case "$ac_file" in
*Makefile*) ac_comsub="1i\\
# $configure_input" ;;
*) ac_comsub= ;;
esac
ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"`
sed -e "$ac_comsub
s%@configure_input@%$configure_input%g
s%@srcdir@%$srcdir%g
s%@top_srcdir@%$top_srcdir%g
s%@INSTALL@%$INSTALL%g
" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file
fi; done
rm -f conftest.s*
# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where
# NAME is the cpp macro being defined and VALUE is the value it is being given.
#
# ac_d sets the value in "#define NAME VALUE" lines.
ac_dA='s%^\([ ]*\)#\([ ]*define[ ][ ]*\)'
ac_dB='\([ ][ ]*\)[^ ]*%\1#\2'
ac_dC='\3'
ac_dD='%g'
# ac_u turns "#undef NAME" with trailing blanks into "#define NAME VALUE".
ac_uA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)'
ac_uB='\([ ]\)%\1#\2define\3'
ac_uC=' '
ac_uD='\4%g'
# ac_e turns "#undef NAME" without trailing blanks into "#define NAME VALUE".
ac_eA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)'
ac_eB='$%\1#\2define\3'
ac_eC=' '
ac_eD='%g'
if test "${CONFIG_HEADERS+set}" != set; then
CONFIG_HEADERS="config.h"
fi
for ac_file in .. $CONFIG_HEADERS; do if test "x$ac_file" != x..; then
# Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
case "$ac_file" in
*:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'`
ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
*) ac_file_in="${ac_file}.in" ;;
esac
echo creating $ac_file
rm -f conftest.frag conftest.in conftest.out
ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"`
cat $ac_file_inputs > conftest.in
cat > conftest.frag <<CEOF
${ac_dA}PACKAGE${ac_dB}PACKAGE${ac_dC}"mc"${ac_dD}
${ac_uA}PACKAGE${ac_uB}PACKAGE${ac_uC}"mc"${ac_uD}
${ac_eA}PACKAGE${ac_eB}PACKAGE${ac_eC}"mc"${ac_eD}
${ac_dA}VERSION${ac_dB}VERSION${ac_dC}"dummy"${ac_dD}
${ac_uA}VERSION${ac_uB}VERSION${ac_uC}"dummy"${ac_uD}
${ac_eA}VERSION${ac_eB}VERSION${ac_eC}"dummy"${ac_eD}
${ac_dA}MAJOR_IN_SYSMACROS${ac_dB}MAJOR_IN_SYSMACROS${ac_dC}1${ac_dD}
${ac_uA}MAJOR_IN_SYSMACROS${ac_uB}MAJOR_IN_SYSMACROS${ac_uC}1${ac_uD}
${ac_eA}MAJOR_IN_SYSMACROS${ac_eB}MAJOR_IN_SYSMACROS${ac_eC}1${ac_eD}
${ac_dA}STDC_HEADERS${ac_dB}STDC_HEADERS${ac_dC}1${ac_dD}
${ac_uA}STDC_HEADERS${ac_uB}STDC_HEADERS${ac_uC}1${ac_uD}
${ac_eA}STDC_HEADERS${ac_eB}STDC_HEADERS${ac_eC}1${ac_eD}
CEOF
sed -f conftest.frag conftest.in > conftest.out
rm -f conftest.in
mv conftest.out conftest.in
cat > conftest.frag <<CEOF
${ac_dA}HAVE_ALLOCA${ac_dB}HAVE_ALLOCA${ac_dC}1${ac_dD}
${ac_uA}HAVE_ALLOCA${ac_uB}HAVE_ALLOCA${ac_uC}1${ac_uD}
${ac_eA}HAVE_ALLOCA${ac_eB}HAVE_ALLOCA${ac_eC}1${ac_eD}
${ac_dA}HAVE_UNISTD_H${ac_dB}HAVE_UNISTD_H${ac_dC}1${ac_dD}
${ac_uA}HAVE_UNISTD_H${ac_uB}HAVE_UNISTD_H${ac_uC}1${ac_uD}
${ac_eA}HAVE_UNISTD_H${ac_eB}HAVE_UNISTD_H${ac_eC}1${ac_eD}
${ac_dA}HAVE_GETPAGESIZE${ac_dB}HAVE_GETPAGESIZE${ac_dC}1${ac_dD}
${ac_uA}HAVE_GETPAGESIZE${ac_uB}HAVE_GETPAGESIZE${ac_uC}1${ac_uD}
${ac_eA}HAVE_GETPAGESIZE${ac_eB}HAVE_GETPAGESIZE${ac_eC}1${ac_eD}
${ac_dA}HAVE_LIMITS_H${ac_dB}HAVE_LIMITS_H${ac_dC}1${ac_dD}
${ac_uA}HAVE_LIMITS_H${ac_uB}HAVE_LIMITS_H${ac_uC}1${ac_uD}
${ac_eA}HAVE_LIMITS_H${ac_eB}HAVE_LIMITS_H${ac_eC}1${ac_eD}
CEOF
sed -f conftest.frag conftest.in > conftest.out
rm -f conftest.in
mv conftest.out conftest.in
cat > conftest.frag <<CEOF
${ac_dA}HAVE_LOCALE_H${ac_dB}HAVE_LOCALE_H${ac_dC}1${ac_dD}
${ac_uA}HAVE_LOCALE_H${ac_uB}HAVE_LOCALE_H${ac_uC}1${ac_uD}
${ac_eA}HAVE_LOCALE_H${ac_eB}HAVE_LOCALE_H${ac_eC}1${ac_eD}
${ac_dA}HAVE_MALLOC_H${ac_dB}HAVE_MALLOC_H${ac_dC}1${ac_dD}
${ac_uA}HAVE_MALLOC_H${ac_uB}HAVE_MALLOC_H${ac_uC}1${ac_uD}
${ac_eA}HAVE_MALLOC_H${ac_eB}HAVE_MALLOC_H${ac_eC}1${ac_eD}
${ac_dA}HAVE_STRING_H${ac_dB}HAVE_STRING_H${ac_dC}1${ac_dD}
${ac_uA}HAVE_STRING_H${ac_uB}HAVE_STRING_H${ac_uC}1${ac_uD}
${ac_eA}HAVE_STRING_H${ac_eB}HAVE_STRING_H${ac_eC}1${ac_eD}
${ac_dA}HAVE_UNISTD_H${ac_dB}HAVE_UNISTD_H${ac_dC}1${ac_dD}
${ac_uA}HAVE_UNISTD_H${ac_uB}HAVE_UNISTD_H${ac_uC}1${ac_uD}
${ac_eA}HAVE_UNISTD_H${ac_eB}HAVE_UNISTD_H${ac_eC}1${ac_eD}
CEOF
sed -f conftest.frag conftest.in > conftest.out
rm -f conftest.in
mv conftest.out conftest.in
cat > conftest.frag <<CEOF
${ac_dA}HAVE_SYS_PARAM_H${ac_dB}HAVE_SYS_PARAM_H${ac_dC}1${ac_dD}
${ac_uA}HAVE_SYS_PARAM_H${ac_uB}HAVE_SYS_PARAM_H${ac_uC}1${ac_uD}
${ac_eA}HAVE_SYS_PARAM_H${ac_eB}HAVE_SYS_PARAM_H${ac_eC}1${ac_eD}
${ac_dA}HAVE_GETCWD${ac_dB}HAVE_GETCWD${ac_dC}1${ac_dD}
${ac_uA}HAVE_GETCWD${ac_uB}HAVE_GETCWD${ac_uC}1${ac_uD}
${ac_eA}HAVE_GETCWD${ac_eB}HAVE_GETCWD${ac_eC}1${ac_eD}
${ac_dA}HAVE_MUNMAP${ac_dB}HAVE_MUNMAP${ac_dC}1${ac_dD}
${ac_uA}HAVE_MUNMAP${ac_uB}HAVE_MUNMAP${ac_uC}1${ac_uD}
${ac_eA}HAVE_MUNMAP${ac_eB}HAVE_MUNMAP${ac_eC}1${ac_eD}
${ac_dA}HAVE_PUTENV${ac_dB}HAVE_PUTENV${ac_dC}1${ac_dD}
${ac_uA}HAVE_PUTENV${ac_uB}HAVE_PUTENV${ac_uC}1${ac_uD}
${ac_eA}HAVE_PUTENV${ac_eB}HAVE_PUTENV${ac_eC}1${ac_eD}
CEOF
sed -f conftest.frag conftest.in > conftest.out
rm -f conftest.in
mv conftest.out conftest.in
cat > conftest.frag <<CEOF
${ac_dA}HAVE_SETENV${ac_dB}HAVE_SETENV${ac_dC}1${ac_dD}
${ac_uA}HAVE_SETENV${ac_uB}HAVE_SETENV${ac_uC}1${ac_uD}
${ac_eA}HAVE_SETENV${ac_eB}HAVE_SETENV${ac_eC}1${ac_eD}
${ac_dA}HAVE_SETLOCALE${ac_dB}HAVE_SETLOCALE${ac_dC}1${ac_dD}
${ac_uA}HAVE_SETLOCALE${ac_uB}HAVE_SETLOCALE${ac_uC}1${ac_uD}
${ac_eA}HAVE_SETLOCALE${ac_eB}HAVE_SETLOCALE${ac_eC}1${ac_eD}
${ac_dA}HAVE_STRCHR${ac_dB}HAVE_STRCHR${ac_dC}1${ac_dD}
${ac_uA}HAVE_STRCHR${ac_uB}HAVE_STRCHR${ac_uC}1${ac_uD}
${ac_eA}HAVE_STRCHR${ac_eB}HAVE_STRCHR${ac_eC}1${ac_eD}
${ac_dA}HAVE_STRCASECMP${ac_dB}HAVE_STRCASECMP${ac_dC}1${ac_dD}
${ac_uA}HAVE_STRCASECMP${ac_uB}HAVE_STRCASECMP${ac_uC}1${ac_uD}
${ac_eA}HAVE_STRCASECMP${ac_eB}HAVE_STRCASECMP${ac_eC}1${ac_eD}
CEOF
sed -f conftest.frag conftest.in > conftest.out
rm -f conftest.in
mv conftest.out conftest.in
cat > conftest.frag <<CEOF
${ac_dA}HAVE_LC_MESSAGES${ac_dB}HAVE_LC_MESSAGES${ac_dC}1${ac_dD}
${ac_uA}HAVE_LC_MESSAGES${ac_uB}HAVE_LC_MESSAGES${ac_uC}1${ac_uD}
${ac_eA}HAVE_LC_MESSAGES${ac_eB}HAVE_LC_MESSAGES${ac_eC}1${ac_eD}
${ac_dA}ENABLE_NLS${ac_dB}ENABLE_NLS${ac_dC}1${ac_dD}
${ac_uA}ENABLE_NLS${ac_uB}ENABLE_NLS${ac_uC}1${ac_uD}
${ac_eA}ENABLE_NLS${ac_eB}ENABLE_NLS${ac_eC}1${ac_eD}
${ac_dA}HAVE_UNISTD_H${ac_dB}HAVE_UNISTD_H${ac_dC}1${ac_dD}
${ac_uA}HAVE_UNISTD_H${ac_uB}HAVE_UNISTD_H${ac_uC}1${ac_uD}
${ac_eA}HAVE_UNISTD_H${ac_eB}HAVE_UNISTD_H${ac_eC}1${ac_eD}
${ac_dA}HAVE_STRING_H${ac_dB}HAVE_STRING_H${ac_dC}1${ac_dD}
${ac_uA}HAVE_STRING_H${ac_uB}HAVE_STRING_H${ac_uC}1${ac_uD}
${ac_eA}HAVE_STRING_H${ac_eB}HAVE_STRING_H${ac_eC}1${ac_eD}
CEOF
sed -f conftest.frag conftest.in > conftest.out
rm -f conftest.in
mv conftest.out conftest.in
cat > conftest.frag <<CEOF
${ac_dA}HAVE_MEMORY_H${ac_dB}HAVE_MEMORY_H${ac_dC}1${ac_dD}
${ac_uA}HAVE_MEMORY_H${ac_uB}HAVE_MEMORY_H${ac_uC}1${ac_uD}
${ac_eA}HAVE_MEMORY_H${ac_eB}HAVE_MEMORY_H${ac_eC}1${ac_eD}
${ac_dA}HAVE_CRYPT_H${ac_dB}HAVE_CRYPT_H${ac_dC}1${ac_dD}
${ac_uA}HAVE_CRYPT_H${ac_uB}HAVE_CRYPT_H${ac_uC}1${ac_uD}
${ac_eA}HAVE_CRYPT_H${ac_eB}HAVE_CRYPT_H${ac_eC}1${ac_eD}
${ac_dA}HAVE_GRP_H${ac_dB}HAVE_GRP_H${ac_dC}1${ac_dD}
${ac_uA}HAVE_GRP_H${ac_uB}HAVE_GRP_H${ac_uC}1${ac_uD}
${ac_eA}HAVE_GRP_H${ac_eB}HAVE_GRP_H${ac_eC}1${ac_eD}
${ac_dA}HAVE_LIMITS_H${ac_dB}HAVE_LIMITS_H${ac_dC}1${ac_dD}
${ac_uA}HAVE_LIMITS_H${ac_uB}HAVE_LIMITS_H${ac_uC}1${ac_uD}
${ac_eA}HAVE_LIMITS_H${ac_eB}HAVE_LIMITS_H${ac_eC}1${ac_eD}
CEOF
sed -f conftest.frag conftest.in > conftest.out
rm -f conftest.in
mv conftest.out conftest.in
cat > conftest.frag <<CEOF
${ac_dA}HAVE_MALLOC_H${ac_dB}HAVE_MALLOC_H${ac_dC}1${ac_dD}
${ac_uA}HAVE_MALLOC_H${ac_uB}HAVE_MALLOC_H${ac_uC}1${ac_uD}
${ac_eA}HAVE_MALLOC_H${ac_eB}HAVE_MALLOC_H${ac_eC}1${ac_eD}
${ac_dA}HAVE_STDLIB_H${ac_dB}HAVE_STDLIB_H${ac_dC}1${ac_dD}
${ac_uA}HAVE_STDLIB_H${ac_uB}HAVE_STDLIB_H${ac_uC}1${ac_uD}
${ac_eA}HAVE_STDLIB_H${ac_eB}HAVE_STDLIB_H${ac_eC}1${ac_eD}
${ac_dA}HAVE_TERMIOS_H${ac_dB}HAVE_TERMIOS_H${ac_dC}1${ac_dD}
${ac_uA}HAVE_TERMIOS_H${ac_uB}HAVE_TERMIOS_H${ac_uC}1${ac_uD}
${ac_eA}HAVE_TERMIOS_H${ac_eB}HAVE_TERMIOS_H${ac_eC}1${ac_eD}
${ac_dA}HAVE_SYS_WAIT_H${ac_dB}HAVE_SYS_WAIT_H${ac_dC}1${ac_dD}
${ac_uA}HAVE_SYS_WAIT_H${ac_uB}HAVE_SYS_WAIT_H${ac_uC}1${ac_uD}
${ac_eA}HAVE_SYS_WAIT_H${ac_eB}HAVE_SYS_WAIT_H${ac_eC}1${ac_eD}
CEOF
sed -f conftest.frag conftest.in > conftest.out
rm -f conftest.in
mv conftest.out conftest.in
cat > conftest.frag <<CEOF
${ac_dA}HAVE_DIRENT_H${ac_dB}HAVE_DIRENT_H${ac_dC}1${ac_dD}
${ac_uA}HAVE_DIRENT_H${ac_uB}HAVE_DIRENT_H${ac_uC}1${ac_uD}
${ac_eA}HAVE_DIRENT_H${ac_eB}HAVE_DIRENT_H${ac_eC}1${ac_eD}
${ac_dA}STDC_HEADERS${ac_dB}STDC_HEADERS${ac_dC}1${ac_dD}
${ac_uA}STDC_HEADERS${ac_uB}STDC_HEADERS${ac_uC}1${ac_uD}
${ac_eA}STDC_HEADERS${ac_eB}STDC_HEADERS${ac_eC}1${ac_eD}
${ac_dA}HAVE_ST_BLKSIZE${ac_dB}HAVE_ST_BLKSIZE${ac_dC}1${ac_dD}
${ac_uA}HAVE_ST_BLKSIZE${ac_uB}HAVE_ST_BLKSIZE${ac_uC}1${ac_uD}
${ac_eA}HAVE_ST_BLKSIZE${ac_eB}HAVE_ST_BLKSIZE${ac_eC}1${ac_eD}
${ac_dA}HAVE_ST_BLOCKS${ac_dB}HAVE_ST_BLOCKS${ac_dC}1${ac_dD}
${ac_uA}HAVE_ST_BLOCKS${ac_uB}HAVE_ST_BLOCKS${ac_uC}1${ac_uD}
${ac_eA}HAVE_ST_BLOCKS${ac_eB}HAVE_ST_BLOCKS${ac_eC}1${ac_eD}
CEOF
sed -f conftest.frag conftest.in > conftest.out
rm -f conftest.in
mv conftest.out conftest.in
cat > conftest.frag <<CEOF
${ac_dA}HAVE_ST_RDEV${ac_dB}HAVE_ST_RDEV${ac_dC}1${ac_dD}
${ac_uA}HAVE_ST_RDEV${ac_uB}HAVE_ST_RDEV${ac_uC}1${ac_uD}
${ac_eA}HAVE_ST_RDEV${ac_eB}HAVE_ST_RDEV${ac_eC}1${ac_eD}
${ac_dA}HAVE_STRERROR${ac_dB}HAVE_STRERROR${ac_dC}1${ac_dD}
${ac_uA}HAVE_STRERROR${ac_uB}HAVE_STRERROR${ac_uC}1${ac_uD}
${ac_eA}HAVE_STRERROR${ac_eB}HAVE_STRERROR${ac_eC}1${ac_eD}
${ac_dA}HAVE_STATFS${ac_dB}HAVE_STATFS${ac_dC}1${ac_dD}
${ac_uA}HAVE_STATFS${ac_uB}HAVE_STATFS${ac_uC}1${ac_uD}
${ac_eA}HAVE_STATFS${ac_eB}HAVE_STATFS${ac_eC}1${ac_eD}
${ac_dA}HAVE_GETWD${ac_dB}HAVE_GETWD${ac_dC}1${ac_dD}
${ac_uA}HAVE_GETWD${ac_uB}HAVE_GETWD${ac_uC}1${ac_uD}
${ac_eA}HAVE_GETWD${ac_eB}HAVE_GETWD${ac_eC}1${ac_eD}
CEOF
sed -f conftest.frag conftest.in > conftest.out
rm -f conftest.in
mv conftest.out conftest.in
cat > conftest.frag <<CEOF
${ac_dA}HAVE_STRCASECMP${ac_dB}HAVE_STRCASECMP${ac_dC}1${ac_dD}
${ac_uA}HAVE_STRCASECMP${ac_uB}HAVE_STRCASECMP${ac_uC}1${ac_uD}
${ac_eA}HAVE_STRCASECMP${ac_eB}HAVE_STRCASECMP${ac_eC}1${ac_eD}
${ac_dA}HAVE_STRNCASECMP${ac_dB}HAVE_STRNCASECMP${ac_dC}1${ac_dD}
${ac_uA}HAVE_STRNCASECMP${ac_uB}HAVE_STRNCASECMP${ac_uC}1${ac_uD}
${ac_eA}HAVE_STRNCASECMP${ac_eB}HAVE_STRNCASECMP${ac_eC}1${ac_eD}
${ac_dA}HAVE_STRDUP${ac_dB}HAVE_STRDUP${ac_dC}1${ac_dD}
${ac_uA}HAVE_STRDUP${ac_uB}HAVE_STRDUP${ac_uC}1${ac_uD}
${ac_eA}HAVE_STRDUP${ac_eB}HAVE_STRDUP${ac_eC}1${ac_eD}
${ac_dA}HAVE_MEMMOVE${ac_dB}HAVE_MEMMOVE${ac_dC}1${ac_dD}
${ac_uA}HAVE_MEMMOVE${ac_uB}HAVE_MEMMOVE${ac_uC}1${ac_uD}
${ac_eA}HAVE_MEMMOVE${ac_eB}HAVE_MEMMOVE${ac_eC}1${ac_eD}
CEOF
sed -f conftest.frag conftest.in > conftest.out
rm -f conftest.in
mv conftest.out conftest.in
cat > conftest.frag <<CEOF
${ac_dA}HAVE_TRUNCATE${ac_dB}HAVE_TRUNCATE${ac_dC}1${ac_dD}
${ac_uA}HAVE_TRUNCATE${ac_uB}HAVE_TRUNCATE${ac_uC}1${ac_uD}
${ac_eA}HAVE_TRUNCATE${ac_eB}HAVE_TRUNCATE${ac_eC}1${ac_eD}
${ac_dA}HAVE_INITGROUPS${ac_dB}HAVE_INITGROUPS${ac_dC}1${ac_dD}
${ac_uA}HAVE_INITGROUPS${ac_uB}HAVE_INITGROUPS${ac_uC}1${ac_uD}
${ac_eA}HAVE_INITGROUPS${ac_eB}HAVE_INITGROUPS${ac_eC}1${ac_eD}
${ac_dA}HAVE_PUTENV${ac_dB}HAVE_PUTENV${ac_dC}1${ac_dD}
${ac_uA}HAVE_PUTENV${ac_uB}HAVE_PUTENV${ac_uC}1${ac_uD}
${ac_eA}HAVE_PUTENV${ac_eB}HAVE_PUTENV${ac_eC}1${ac_eD}
${ac_dA}HAVE_MEMSET${ac_dB}HAVE_MEMSET${ac_dC}1${ac_dD}
${ac_uA}HAVE_MEMSET${ac_uB}HAVE_MEMSET${ac_uC}1${ac_uD}
${ac_eA}HAVE_MEMSET${ac_eB}HAVE_MEMSET${ac_eC}1${ac_eD}
CEOF
sed -f conftest.frag conftest.in > conftest.out
rm -f conftest.in
mv conftest.out conftest.in
cat > conftest.frag <<CEOF
${ac_dA}HAVE_MEMCPY${ac_dB}HAVE_MEMCPY${ac_dC}1${ac_dD}
${ac_uA}HAVE_MEMCPY${ac_uB}HAVE_MEMCPY${ac_uC}1${ac_uD}
${ac_eA}HAVE_MEMCPY${ac_eB}HAVE_MEMCPY${ac_eC}1${ac_eD}
${ac_dA}HAVE_TCSETATTR${ac_dB}HAVE_TCSETATTR${ac_dC}1${ac_dD}
${ac_uA}HAVE_TCSETATTR${ac_uB}HAVE_TCSETATTR${ac_uC}1${ac_uD}
${ac_eA}HAVE_TCSETATTR${ac_eB}HAVE_TCSETATTR${ac_eC}1${ac_eD}
${ac_dA}HAVE_TCGETATTR${ac_dB}HAVE_TCGETATTR${ac_dC}1${ac_dD}
${ac_uA}HAVE_TCGETATTR${ac_uB}HAVE_TCGETATTR${ac_uC}1${ac_uD}
${ac_eA}HAVE_TCGETATTR${ac_eB}HAVE_TCGETATTR${ac_eC}1${ac_eD}
${ac_dA}HAVE_CFGETOSPEED${ac_dB}HAVE_CFGETOSPEED${ac_dC}1${ac_dD}
${ac_uA}HAVE_CFGETOSPEED${ac_uB}HAVE_CFGETOSPEED${ac_uC}1${ac_uD}
${ac_eA}HAVE_CFGETOSPEED${ac_eB}HAVE_CFGETOSPEED${ac_eC}1${ac_eD}
CEOF
sed -f conftest.frag conftest.in > conftest.out
rm -f conftest.in
mv conftest.out conftest.in
cat > conftest.frag <<CEOF
${ac_dA}HAVE_SIGACTION${ac_dB}HAVE_SIGACTION${ac_dC}1${ac_dD}
${ac_uA}HAVE_SIGACTION${ac_uB}HAVE_SIGACTION${ac_uC}1${ac_uD}
${ac_eA}HAVE_SIGACTION${ac_eB}HAVE_SIGACTION${ac_eC}1${ac_eD}
${ac_dA}HAVE_SIGEMPTYSET${ac_dB}HAVE_SIGEMPTYSET${ac_dC}1${ac_dD}
${ac_uA}HAVE_SIGEMPTYSET${ac_uB}HAVE_SIGEMPTYSET${ac_uC}1${ac_uD}
${ac_eA}HAVE_SIGEMPTYSET${ac_eB}HAVE_SIGEMPTYSET${ac_eC}1${ac_eD}
${ac_dA}HAVE_SIGPROCMASK${ac_dB}HAVE_SIGPROCMASK${ac_dC}1${ac_dD}
${ac_uA}HAVE_SIGPROCMASK${ac_uB}HAVE_SIGPROCMASK${ac_uC}1${ac_uD}
${ac_eA}HAVE_SIGPROCMASK${ac_eB}HAVE_SIGPROCMASK${ac_eC}1${ac_eD}
${ac_dA}HAVE_SIGADDSET${ac_dB}HAVE_SIGADDSET${ac_dC}1${ac_dD}
${ac_uA}HAVE_SIGADDSET${ac_uB}HAVE_SIGADDSET${ac_uC}1${ac_uD}
${ac_eA}HAVE_SIGADDSET${ac_eB}HAVE_SIGADDSET${ac_eC}1${ac_eD}
CEOF
sed -f conftest.frag conftest.in > conftest.out
rm -f conftest.in
mv conftest.out conftest.in
cat > conftest.frag <<CEOF
${ac_dA}HAVE_SYSCONF${ac_dB}HAVE_SYSCONF${ac_dC}1${ac_dD}
${ac_uA}HAVE_SYSCONF${ac_uB}HAVE_SYSCONF${ac_uC}1${ac_uD}
${ac_eA}HAVE_SYSCONF${ac_eB}HAVE_SYSCONF${ac_eC}1${ac_eD}
${ac_dA}NEED_CRYPT_PROTOTYPE${ac_dB}NEED_CRYPT_PROTOTYPE${ac_dC}1${ac_dD}
${ac_uA}NEED_CRYPT_PROTOTYPE${ac_uB}NEED_CRYPT_PROTOTYPE${ac_uC}1${ac_uD}
${ac_eA}NEED_CRYPT_PROTOTYPE${ac_eB}NEED_CRYPT_PROTOTYPE${ac_eC}1${ac_eD}
${ac_dA}HAVE_SYS_SELECT_H${ac_dB}HAVE_SYS_SELECT_H${ac_dC}1${ac_dD}
${ac_uA}HAVE_SYS_SELECT_H${ac_uB}HAVE_SYS_SELECT_H${ac_uC}1${ac_uD}
${ac_eA}HAVE_SYS_SELECT_H${ac_eB}HAVE_SYS_SELECT_H${ac_eC}1${ac_eD}
${ac_dA}HAVE_GRANTPT${ac_dB}HAVE_GRANTPT${ac_dC}1${ac_dD}
${ac_uA}HAVE_GRANTPT${ac_uB}HAVE_GRANTPT${ac_uC}1${ac_uD}
${ac_eA}HAVE_GRANTPT${ac_eB}HAVE_GRANTPT${ac_eC}1${ac_eD}
CEOF
sed -f conftest.frag conftest.in > conftest.out
rm -f conftest.in
mv conftest.out conftest.in
cat > conftest.frag <<CEOF
${ac_dA}HAVE_LIBINTL${ac_dB}HAVE_LIBINTL${ac_dC}1${ac_dD}
${ac_uA}HAVE_LIBINTL${ac_uB}HAVE_LIBINTL${ac_uC}1${ac_uD}
${ac_eA}HAVE_LIBINTL${ac_eB}HAVE_LIBINTL${ac_eC}1${ac_eD}
${ac_dA}HAVE_FCNTL_H${ac_dB}HAVE_FCNTL_H${ac_dC}1${ac_dD}
${ac_uA}HAVE_FCNTL_H${ac_uB}HAVE_FCNTL_H${ac_uC}1${ac_uD}
${ac_eA}HAVE_FCNTL_H${ac_eB}HAVE_FCNTL_H${ac_eC}1${ac_eD}
${ac_dA}HAVE_SYS_PARAM_H${ac_dB}HAVE_SYS_PARAM_H${ac_dC}1${ac_dD}
${ac_uA}HAVE_SYS_PARAM_H${ac_uB}HAVE_SYS_PARAM_H${ac_uC}1${ac_uD}
${ac_eA}HAVE_SYS_PARAM_H${ac_eB}HAVE_SYS_PARAM_H${ac_eC}1${ac_eD}
${ac_dA}HAVE_MNTENT_H${ac_dB}HAVE_MNTENT_H${ac_dC}1${ac_dD}
${ac_uA}HAVE_MNTENT_H${ac_uB}HAVE_MNTENT_H${ac_uC}1${ac_uD}
${ac_eA}HAVE_MNTENT_H${ac_eB}HAVE_MNTENT_H${ac_eC}1${ac_eD}
CEOF
sed -f conftest.frag conftest.in > conftest.out
rm -f conftest.in
mv conftest.out conftest.in
cat > conftest.frag <<CEOF
${ac_dA}HAVE_UTIME_H${ac_dB}HAVE_UTIME_H${ac_dC}1${ac_dD}
${ac_uA}HAVE_UTIME_H${ac_uB}HAVE_UTIME_H${ac_uC}1${ac_uD}
${ac_eA}HAVE_UTIME_H${ac_eB}HAVE_UTIME_H${ac_eC}1${ac_eD}
${ac_dA}HAVE_SYS_VFS_H${ac_dB}HAVE_SYS_VFS_H${ac_dC}1${ac_dD}
${ac_uA}HAVE_SYS_VFS_H${ac_uB}HAVE_SYS_VFS_H${ac_uC}1${ac_uD}
${ac_eA}HAVE_SYS_VFS_H${ac_eB}HAVE_SYS_VFS_H${ac_eC}1${ac_eD}
${ac_dA}HAVE_SYS_MOUNT_H${ac_dB}HAVE_SYS_MOUNT_H${ac_dC}1${ac_dD}
${ac_uA}HAVE_SYS_MOUNT_H${ac_uB}HAVE_SYS_MOUNT_H${ac_uC}1${ac_uD}
${ac_eA}HAVE_SYS_MOUNT_H${ac_eB}HAVE_SYS_MOUNT_H${ac_eC}1${ac_eD}
${ac_dA}D_INO_IN_DIRENT${ac_dB}D_INO_IN_DIRENT${ac_dC}1${ac_dD}
${ac_uA}D_INO_IN_DIRENT${ac_uB}D_INO_IN_DIRENT${ac_uC}1${ac_uD}
${ac_eA}D_INO_IN_DIRENT${ac_eB}D_INO_IN_DIRENT${ac_eC}1${ac_eD}
CEOF
sed -f conftest.frag conftest.in > conftest.out
rm -f conftest.in
mv conftest.out conftest.in
cat > conftest.frag <<CEOF
${ac_dA}HAVE_GETMNTENT${ac_dB}HAVE_GETMNTENT${ac_dC}1${ac_dD}
${ac_uA}HAVE_GETMNTENT${ac_uB}HAVE_GETMNTENT${ac_uC}1${ac_uD}
${ac_eA}HAVE_GETMNTENT${ac_eB}HAVE_GETMNTENT${ac_eC}1${ac_eD}
${ac_dA}MOUNTED_GETMNTENT1${ac_dB}MOUNTED_GETMNTENT1${ac_dC}1${ac_dD}
${ac_uA}MOUNTED_GETMNTENT1${ac_uB}MOUNTED_GETMNTENT1${ac_uC}1${ac_uD}
${ac_eA}MOUNTED_GETMNTENT1${ac_eB}MOUNTED_GETMNTENT1${ac_eC}1${ac_eD}
${ac_dA}STAT_STATFS2_BSIZE${ac_dB}STAT_STATFS2_BSIZE${ac_dC}1${ac_dD}
${ac_uA}STAT_STATFS2_BSIZE${ac_uB}STAT_STATFS2_BSIZE${ac_uC}1${ac_uD}
${ac_eA}STAT_STATFS2_BSIZE${ac_eB}STAT_STATFS2_BSIZE${ac_eC}1${ac_eD}
${ac_dA}umode_t${ac_dB}umode_t${ac_dC}int${ac_dD}
${ac_uA}umode_t${ac_uB}umode_t${ac_uC}int${ac_uD}
${ac_eA}umode_t${ac_eB}umode_t${ac_eC}int${ac_eD}
CEOF
sed -f conftest.frag conftest.in > conftest.out
rm -f conftest.in
mv conftest.out conftest.in
cat > conftest.frag <<CEOF
${ac_dA}HAVE_UNISTD_H${ac_dB}HAVE_UNISTD_H${ac_dC}1${ac_dD}
${ac_uA}HAVE_UNISTD_H${ac_uB}HAVE_UNISTD_H${ac_uC}1${ac_uD}
${ac_eA}HAVE_UNISTD_H${ac_eB}HAVE_UNISTD_H${ac_eC}1${ac_eD}
${ac_dA}HAVE_GETPAGESIZE${ac_dB}HAVE_GETPAGESIZE${ac_dC}1${ac_dD}
${ac_uA}HAVE_GETPAGESIZE${ac_uB}HAVE_GETPAGESIZE${ac_uC}1${ac_uD}
${ac_eA}HAVE_GETPAGESIZE${ac_eB}HAVE_GETPAGESIZE${ac_eC}1${ac_eD}
${ac_dA}HAVE_ALLOCA${ac_dB}HAVE_ALLOCA${ac_dC}1${ac_dD}
${ac_uA}HAVE_ALLOCA${ac_uB}HAVE_ALLOCA${ac_uC}1${ac_uD}
${ac_eA}HAVE_ALLOCA${ac_eB}HAVE_ALLOCA${ac_eC}1${ac_eD}
${ac_dA}HAVE_SOCKET${ac_dB}HAVE_SOCKET${ac_dC}1${ac_dD}
${ac_uA}HAVE_SOCKET${ac_uB}HAVE_SOCKET${ac_uC}1${ac_uD}
${ac_eA}HAVE_SOCKET${ac_eB}HAVE_SOCKET${ac_eC}1${ac_eD}
CEOF
sed -f conftest.frag conftest.in > conftest.out
rm -f conftest.in
mv conftest.out conftest.in
cat > conftest.frag <<CEOF
${ac_dA}HAVE_SOCKETPAIR${ac_dB}HAVE_SOCKETPAIR${ac_dC}1${ac_dD}
${ac_uA}HAVE_SOCKETPAIR${ac_uB}HAVE_SOCKETPAIR${ac_uC}1${ac_uD}
${ac_eA}HAVE_SOCKETPAIR${ac_eB}HAVE_SOCKETPAIR${ac_eC}1${ac_eD}
${ac_dA}HAVE_STRUCT_LINGER${ac_dB}HAVE_STRUCT_LINGER${ac_dC}1${ac_dD}
${ac_uA}HAVE_STRUCT_LINGER${ac_uB}HAVE_STRUCT_LINGER${ac_uC}1${ac_uD}
${ac_eA}HAVE_STRUCT_LINGER${ac_eB}HAVE_STRUCT_LINGER${ac_eC}1${ac_eD}
${ac_dA}HAVE_RRESVPORT${ac_dB}HAVE_RRESVPORT${ac_dC}1${ac_dD}
${ac_uA}HAVE_RRESVPORT${ac_uB}HAVE_RRESVPORT${ac_uC}1${ac_uD}
${ac_eA}HAVE_RRESVPORT${ac_eB}HAVE_RRESVPORT${ac_eC}1${ac_eD}
${ac_dA}FILE_STDIN${ac_dB}FILE_STDIN${ac_dC}1${ac_dD}
${ac_uA}FILE_STDIN${ac_uB}FILE_STDIN${ac_uC}1${ac_uD}
${ac_eA}FILE_STDIN${ac_eB}FILE_STDIN${ac_eC}1${ac_eD}
CEOF
sed -f conftest.frag conftest.in > conftest.out
rm -f conftest.in
mv conftest.out conftest.in
cat > conftest.frag <<CEOF
${ac_dA}FILE_L${ac_dB}FILE_L${ac_dC}1${ac_dD}
${ac_uA}FILE_L${ac_uB}FILE_L${ac_uC}1${ac_uD}
${ac_eA}FILE_L${ac_eB}FILE_L${ac_eC}1${ac_eD}
${ac_dA}GREP_STDIN${ac_dB}GREP_STDIN${ac_dC}1${ac_dD}
${ac_uA}GREP_STDIN${ac_uB}GREP_STDIN${ac_uC}1${ac_uD}
${ac_eA}GREP_STDIN${ac_eB}GREP_STDIN${ac_eC}1${ac_eD}
${ac_dA}HAVE_DUSUM${ac_dB}HAVE_DUSUM${ac_dC}1${ac_dD}
${ac_uA}HAVE_DUSUM${ac_uB}HAVE_DUSUM${ac_uC}1${ac_uD}
${ac_eA}HAVE_DUSUM${ac_eB}HAVE_DUSUM${ac_eC}1${ac_eD}
${ac_dA}DUSUM_USEB${ac_dB}DUSUM_USEB${ac_dC}1${ac_dD}
${ac_uA}DUSUM_USEB${ac_uB}DUSUM_USEB${ac_uC}1${ac_uD}
${ac_eA}DUSUM_USEB${ac_eB}DUSUM_USEB${ac_eC}1${ac_eD}
CEOF
sed -f conftest.frag conftest.in > conftest.out
rm -f conftest.in
mv conftest.out conftest.in
cat > conftest.frag <<CEOF
${ac_dA}DUSUM_FACTOR${ac_dB}DUSUM_FACTOR${ac_dC}1${ac_dD}
${ac_uA}DUSUM_FACTOR${ac_uB}DUSUM_FACTOR${ac_uC}1${ac_uD}
${ac_eA}DUSUM_FACTOR${ac_eB}DUSUM_FACTOR${ac_eC}1${ac_eD}
${ac_dA}HAVE_SUBSHELL_SUPPORT${ac_dB}HAVE_SUBSHELL_SUPPORT${ac_dC}1${ac_dD}
${ac_uA}HAVE_SUBSHELL_SUPPORT${ac_uB}HAVE_SUBSHELL_SUPPORT${ac_uC}1${ac_uD}
${ac_eA}HAVE_SUBSHELL_SUPPORT${ac_eB}HAVE_SUBSHELL_SUPPORT${ac_eC}1${ac_eD}
${ac_dA}USE_VFS${ac_dB}USE_VFS${ac_dC}1${ac_dD}
${ac_uA}USE_VFS${ac_uB}USE_VFS${ac_uC}1${ac_uD}
${ac_eA}USE_VFS${ac_eB}USE_VFS${ac_eC}1${ac_eD}
${ac_dA}USE_NETCODE${ac_dB}USE_NETCODE${ac_dC}1${ac_dD}
${ac_uA}USE_NETCODE${ac_uB}USE_NETCODE${ac_uC}1${ac_uD}
${ac_eA}USE_NETCODE${ac_eB}USE_NETCODE${ac_eC}1${ac_eD}
CEOF
sed -f conftest.frag conftest.in > conftest.out
rm -f conftest.in
mv conftest.out conftest.in
cat > conftest.frag <<CEOF
${ac_dA}USE_INTERNAL_EDIT${ac_dB}USE_INTERNAL_EDIT${ac_dC}1${ac_dD}
${ac_uA}USE_INTERNAL_EDIT${ac_uB}USE_INTERNAL_EDIT${ac_uC}1${ac_uD}
${ac_eA}USE_INTERNAL_EDIT${ac_eB}USE_INTERNAL_EDIT${ac_eC}1${ac_eD}
${ac_dA}HAVE_SLANG${ac_dB}HAVE_SLANG${ac_dC}1${ac_dD}
${ac_uA}HAVE_SLANG${ac_uB}HAVE_SLANG${ac_uC}1${ac_uD}
${ac_eA}HAVE_SLANG${ac_eB}HAVE_SLANG${ac_eC}1${ac_eD}
${ac_dA}SLANG_TERMINFO${ac_dB}SLANG_TERMINFO${ac_dC}1${ac_dD}
${ac_uA}SLANG_TERMINFO${ac_uB}SLANG_TERMINFO${ac_uC}1${ac_uD}
${ac_eA}SLANG_TERMINFO${ac_eB}SLANG_TERMINFO${ac_eC}1${ac_eD}
s%^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*%/* & */%
CEOF
sed -f conftest.frag conftest.in > conftest.out
rm -f conftest.in
mv conftest.out conftest.in
rm -f conftest.frag conftest.h
echo "/* $ac_file. Generated automatically by configure. */" > conftest.h
cat conftest.in >> conftest.h
rm -f conftest.in
if cmp -s $ac_file conftest.h 2>/dev/null; then
echo "$ac_file is unchanged"
rm -f conftest.h
else
# Remove last slash and all that follows it. Not all systems have dirname.
ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'`
if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then
# The file is in a subdirectory.
test ! -d "$ac_dir" && mkdir "$ac_dir"
fi
rm -f $ac_file
mv conftest.h $ac_file
fi
fi; done
ac_sources="intl/libgettext.h"
ac_dests="intl/libintl.h"
srcdir=$ac_given_srcdir
while test -n "$ac_sources"; do
set $ac_dests; ac_dest=$1; shift; ac_dests=$*
set $ac_sources; ac_source=$1; shift; ac_sources=$*
echo "linking $srcdir/$ac_source to $ac_dest"
if test ! -r $srcdir/$ac_source; then
{ echo "configure: error: $srcdir/$ac_source: File not found" 1>&2; exit 1; }
fi
rm -f $ac_dest
# Make relative symlinks.
# Remove last slash and all that follows it. Not all systems have dirname.
ac_dest_dir=`echo $ac_dest|sed 's%/[^/][^/]*$%%'`
if test "$ac_dest_dir" != "$ac_dest" && test "$ac_dest_dir" != .; then
# The dest file is in a subdirectory.
test ! -d "$ac_dest_dir" && mkdir "$ac_dest_dir"
ac_dest_dir_suffix="/`echo $ac_dest_dir|sed 's%^\./%%'`"
# A "../" for each directory in $ac_dest_dir_suffix.
ac_dots=`echo $ac_dest_dir_suffix|sed 's%/[^/]*%../%g'`
else
ac_dest_dir_suffix= ac_dots=
fi
case "$srcdir" in
[/$]*) ac_rel_source="$srcdir/$ac_source" ;;
*) ac_rel_source="$ac_dots$srcdir/$ac_source" ;;
esac
# Make a symlink if possible; otherwise try a hard link.
if ln -s $ac_rel_source $ac_dest 2>/dev/null ||
ln $srcdir/$ac_source $ac_dest; then :
else
{ echo "configure: error: can not link $ac_dest to $srcdir/$ac_source" 1>&2; exit 1; }
fi
done
sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in > po/Makefile
exit 0

20
rosapps/mc/create_vcs Normal file
View File

@@ -0,0 +1,20 @@
#!/bin/sh
#
# Script by Jakub Jelinek
#
if test -e /dev/vcs0
then
exit
fi
I=0
while [ $I -lt 64 ]
do
mknod /dev/vcs$I c 7 $I
chmod 622 /dev/vcs$I
chown root.tty /dev/vcs$I
mknod /dev/vcsa$I c 7 `expr $I + 128`
chmod 622 /dev/vcsa$I
chown root.tty /dev/vcsa$I
I=`expr $I + 1`
done

0
rosapps/mc/doc/Makefile Normal file
View File

934
rosapps/mc/doc/faq Normal file
View File

@@ -0,0 +1,934 @@
Midnight Commander
Questions and Answers
The newest version of this document is available at
http://mc.blackdown.org/mc/answers0.html
* 1 Getting started
+ 1.1 What is Midnight Commander?
+ 1.2 [UPDATED] Does it run on my machine?
+ 1.3 Does it work with my terminal?
+ 1.4 What else do I need to run MC?
+ 1.5 Is Midnight Commander PD? Copyrighted?
+ 1.6 Where can I get Midnight Commander?
+ 1.7 I don't have FTP access. Where can I get MC?
* 2 Keyboard
+ 2.1 What does documentation mean with the C-?, M-? and F?
keys?
+ 2.2 [UPDATED] Why don't function keys (or some other key)
work?
+ 2.3 How do I use function keys F11 to F20?
+ 2.4 Why does the ESC key behave funny?
+ 2.5 How can I add the plus sign (+) on the command line?
* 3 Mouse
+ 3.1 How do I enable mouse support?
+ 3.2 How do I cut and paste text with mouse?
* 4 Display
+ 4.1 Why do I keep getting "Terminal not powerful enough for
SLang"?
+ 4.2 [UPDATED] Why don't line drawing characters work?
+ 4.3 Can one use latin-1 characters without losing the lines?
+ 4.4 I have problems with entering/viewing national
characters!
+ 4.5 How can I get colors?
+ 4.6 My color_xterm goes completely (or partially) black!
+ 4.7 Where can I get color_xterm?
+ 4.8 I got colors working with MC but the other programs don't
work at all anymore!
+ 4.9 Why are there both terminfo and termcap? Wouldn't one
database be enough?
* 5 Graphical user interface
+ 5.1 Xview and Tk editions?
* 6 Command line problems
+ 6.1 How do I stay in the last directory when I exit Midnight
Commander?
+ 6.2 How can I access command line history?
+ 6.3 How can I complete commands, file names, variable names
and so on?
+ 6.4 [NEW] I am using ksh. Can I use functions defined in the
.kshrc within MC?
+ 6.5 [NEW] Is there any way to include additional options or
hot keys to MC?
* 7 Virtual file systems
+ 7.1 How can I see the contents of a tar archive?
+ 7.2 How do I get out of a tar archive?
+ 7.3 How do I do anonymous ftp with MC?
+ 7.4 How do I do non-anonymous ftp with MC?
+ 7.5 How do I close an ftp connection?
+ 7.6 Why aren't the contents of ftp panel updated?
+ 7.7 [NEW] What kind of proxy server works with Midnight
Commander?
* 8 Other common problems
+ 8.1 [UPDATED] How do I get the internal editor to work?
+ 8.2 Why doesn't "mcedit newfile" work?
+ 8.3 [UPDATED] Is there any way to 'bookmark' favourite ftp-fs
links?
+ 8.4 When copying the directories lose their original date,
uid and gid!
+ 8.5 [UPDATED] Why I keep getting: "There is no disk in the
drive. Please insert a disk into drive D:"?
+ 8.6 [NEW] When I start Midnight Commander, nothing happens!
+ 8.7 [NEW] When I try to view a file MC hangs!
* 9 Development
+ 9.1 Who has written Midnight Commander?
+ 9.2 Do I dare to use a development version?
+ 9.3 How can I report a bug/request for a feature?
+ 9.4 How can I join the development?
* 10 More information
+ 10.1 [UPDATED] This document didn't answer my question. Where
else can I look for an answer?
+ 10.2 What mailing lists are there for Midnight Commander?
+ 10.3 Where should I look on the World Wide Web for MC stuff?
+ 10.4 Are the mailing lists archived anywhere?
* 11 Administrivia
+ 11.1 Authorship
+ 11.2 [UPDATED] File formats
+ 11.3 Feedback is invited
+ 11.4 Disclaimer and copyright
1 Getting started
1.1 What is Midnight Commander?
The Midnight Commander is a user-friendly yet powerful file manager
and visual shell, useful to novice and guru alike. It provides a
clear, user-friendly, and somewhat protected interface to a Unix
system while making many frequent file operations more efficient and
preserving the full power of the command prompt. You will wonder how
you could ever live without it.
For more thorough description take a look at the announcement of
Midnight Commander 4.0.
1.2 [UPDATED] Does it run on my machine?
Yes, Midnight Commander can run on almost any machine, including Unix
clones, Windows 95/NT and OS/2. Midnight Commander does not run on
Macintosh.
Midnight Commander uses GNU autoconfigure which can automatically
configure Midnight Commander for use on almost any (if not every) Unix
clone. Following configurations have been tested:
* i386-*-linux1.x, 2.x
* alpha-linux-linux2
* sparc-linux-linux2.x
* sparc64-linux-linux2.1
* mips-sgi-irix5.x, 6.x
* mips-dec-ultrix4.3
* rs6000-ibm-aix3.2.5
* sparc-sun-sunos4.1
* sparc-sun-solaris2.3, 2.4, 2.5
* sparc-sun-netbsd1.0
* hppa-hp-hpux9
* hppa-hp-hpux7
* m68k-apple-aux
* unixware
* mc88110-aviion-dgux5.4R2.01
* i386-*-sco3.2v4.2
* i386-*-sco3.2v5
* i386-*-windows-nt-3.51, 4.0
* i386-*-windows95
* i386-*-os2
See http://mc.blackdown.org/mc/download.html.
There is also a preliminary Ms-Dos port at
http://mc.blackdown.org/cgi-mc/download/DOS/.html (but no Ms-Dos
binary).
Windows 95/NT port is compiled with Microsoft Visual C++ but it might
be possible to use cygwin32 or djgpp instead.
1.3 Does it work with my terminal?
Yes, it does.
Because Midnight Commander is a full screen program it doesn't run on
dummy terminals but anything more advanced will do (like vt100). If
your terminal works with vi, emacs, elm or pine it will work with
Midnight Commander.
The XView and Tk editions currently under development will require an
X terminal.
1.4 What else do I need to run MC?
You need an Unix compatible operating system or Windows 95/NT or OS/2.
If you want to use mouse on the Linux console you need General Purpose
Mouse server from iride.unipv.it: /pub/gpm/. You need nothing extra to
use mouse on xterm.
To compile the XView edition (currently under development) you need
XView library. Xpm library and X11 non-rectangular shape extensions
are recommended.
To compile the Tk edition (currently under development) you need
Tk-4.0 libraries. Compilation of the Tk version won't be easy. Contact
Miguel for details.
If you do not want to use the slang library you could try using
ncurses (we recommend only version 4.1 and above).
You can get it along with other curses libraries, too, but results may
not be pretty or even usable.
1.5 Is Midnight Commander PD? Copyrighted?
Midnight Commander is under GNU Public License which basically means
that you may freely copy, change and distribute it, but that you may
not impose any restrictions on further distribution, and that you must
make the source code available. This is not the same as Public Domain.
For details, the GNU license is included in the Midnight Commander
source distribution (the COPYING file).
Midnight Commander is nowadays officially a part of GNU project. All
the authors of the Midnight Commander have given all their rights on
the program to the Free Software Foundation.
1.6 Where can I get Midnight Commander?
See http://mc.blackdown.org/mc/download.html. There are about seventy
download sites. Note that the newest files might not be present on all
the download sites yet.
In short: the main site is ftp://ftp.nuclecu.unam.mx/linux/local/ and
the sunsite.unc.edu mirrors have MC in the
/pub/Linux/utils/file/managers/mc directory.
1.7 I don't have FTP access. Where can I get MC?
Most Linux CD-ROMs include Midnight Commander. For example, Slackware,
Yggdrasil, S.U.S.E., Jurix, RedHat, Caldera and Debian.
2 Keyboard
2.1 What does documentation mean with the C-?, M-? and F? keys?
Midnight Commander documentation uses emacs style names for keyboard
keys.
C stands for the Ctrl key. For example, C-f means that you should hold
down the Ctrl key and press the f key.
M stands for the Meta key. Your terminal might call it Alt or Compose
instead of Meta. For example, M-f means that you should hold down the
Meta/Alt/Compose key and press the f key. If your terminal doesn't
have Meta, Alt or Compose or they don't work you can use Esc. For M-f
press the Esc key and then press the f key.
F? stands for a function key. If your terminal doesn't have function
keys or they don't work you can use Esc. For example, for F3 press the
Esc key and then press the 3 key.
2.2 [UPDATED] Why don't function keys (or some other key) work?
Your terminfo or termcap database has missing or incorrect definations
for function keys. Type "mc -V" to see what terminal database is being
used. If the result is "using the S-Lang library with terminfo
database" you should install one of the enhanced terminfo databases
included in the Midnight Commander source distribution. For example,
if you are using xterm type "tic xterm.ti".
If the result is "using the S-Lang library with termcap database" you
should fix your /etc/termcap database.
Best terminfo database is bundled with ncurses 4.2
You can select whether Midnight Commander will use terminfo or termcap
database by giving --with-terminfo or --with-termcap option to the
configure. Default is terminfo if found, otherwise termcap.
If you don't have permissions to edit terminal databases you can use
Learn keys feature of Midnight Commander instead. Press Esc 9 o k and
follow instructions.
If all else fails you can emulate function keys by first pressing the
ESC key and then one of the number keys. For example, if you want to
produce F9, press ESC, then 9. If you don't have a ESC key on your
keyboard you can try alt-9 or meta-9.
2.3 How do I use function keys F11 to F20?
These can mapped to function keys F1 to F10 with Shift held. eg.
function key F13 can be activated by pressing Shift-F3. You can define
the keys this way in the Options menu. The convention for PC keyboards
is that F11-20 always means Shift with F1-10
Note! Windows 95/NT and OS/2 ports use F11 and F12 keys to change the
current disk drive. In this case F11 and F12 mean the real F11 and F12
keys, not shift-F1 and shift-F2.
2.4 Why does the ESC key behave funny?
Midnight Commander uses the ESC key as a prefix for simulating the
Meta and Alt keys (for terminals which don't have Meta or Alt, see the
three previous questions). For example, pressing ESC-a is the same as
pressing Meta-a. In addition most terminals use ESC for internal
representation of arrow keys, function keys and other enhanced keys.
If you want to use ESC to cancel things you have to press it twice i.
e. ESC-ESC. If you find this cumbersome you can generally use F10 to
cancel. Alternatively turn on the old_esc_mode setting in the
~/.mc.ini file. The old_esc_mode setting makes ESC work as a prefix
only if another key is pressed within 0.5 seconds. After 0.5 seconds
the ESC key cancels. There is no way to make ESC cancel immediately
(if we want to be able to use arrows keys and function keys).
X terminals allow more control over keyboard, so these ESC limitations
might not concern the forthcoming XView and Tk editions of the
Midnight Commander.
2.5 How can I add the plus sign (+) on the command line?
Press C-q first, then press the + sign.
The plus key is the hotkey for the select files command. If you want
to add a literal plus on to the command line you must quote it by
pressing C-q first.
Another common key which needs the C-q prefix is backslash "\".
3 Mouse
3.1 How do I enable mouse support?
Invoke mc like this (without quotes): "mc -x". If this doesn't work
upgrade to a terminal which compatible with the Xterm mouse sequences.
Alternatively, on Linux console you can use GPM.
3.2 How do I cut and paste text with mouse?
Hold down shift key while using mouse to cut'n'paste.
4 Display
4.1 Why do I keep getting "Terminal not powerful enough for SLang"?
This means that your terminfo databases do not contain the correct
definitions for your terminal.
You could try using a different terminal setting. If you use csh or
tcsh:
setenv TERM vt100
or if you use sh, bash, ksh or zsh:
export TERM=vt100
If this doesn't help you can recompile MC to use termcap instead of
terminfo:
./configure --with-termcap
make
4.2 [UPDATED] Why don't line drawing characters work?
Since version 4.0.13 there's the commandline option -a to force use of
+, |, - for line drawing (only available when compiled with SLang).
Use this -a option if any of the suggestions below doesn't help.
In general, there are three subcases:
* Lines are shown as ASCII characters like this
+---------+
| |
+---------+
This also happens when you use the -a option. Other than that possible
reason is 1, 2 or 3 (see below).
* Lines are shown as lower case characters like this
lqqqqqqqqqk
x x
mqqqqqqqqqj
Possible reason is 2 or 3 (see below).
* Lines are shown as blanks or missing characters. Possible reason
is 3 or 4 (see below).
The reason for the problem is one of following:
1. Your curses library might not support line drawing characters.
Slang, Ncurses and System V curses do support them, BSD curses
doesn't. MC uses Slang by default so this is not usually a
problem.
2. Your terminal might not support line drawing characters. Vt100
compatible terminals, rxvt, xterm and color_xterm do support them.
3. Your terminfo or termcap database might have missing or incorrect
definations for line drawing characters. Set the acsc variable in
the terminfo database like this:
acsc=a\376k\277l\332m\300j\331n\305w\302v\301u\264t\303q\304x\263h
\2600\333
Don't forget issue 'tic' command. This supposes you are using pc
character set. The octal values might be different for other
character sets. If you are using termcap instead of terminfo, you
should modify above solution appropriately.
4. Your terminal font might not support line drawing characters. Try
changing the font.
Here is Miguel's answer to Torben on this subject.
Torben:
When I load consolefonts/iso01.f16, I get perfectly right national
characters, but the line drawing characters in mc get wrong. Is it
a mc problem, or is it a problem with the font? (I guess it is).
Is there a trick?
Miguel:
First of all, we should determine whether the font has line drawing
characters or not.
If it has line drawing characters, then a new terminfo entry should
be written for this specific case. Let's call this linux-iso01. The
acsc variable should be modified to reflect which characters are
used to do the line drawing.
If it does not have line drawing characters, then we should get rid
of the switch to acsc sequences and make the acsc sequence be just
a mapping to the ugly +, -, |, - characters.
You can get your terminfo definition by running the infocmp
program, making the proper changes and running the tic program to
compile your new terminfo database.
4.3 Can one use latin-1 characters without losing the lines?
Yes, you need a correct font and a correct termcap/terminfo database.
For font, if you use xterm try "xterm -fn fixed".
For termcap/terminfo database, change the acsc capability in the
database.
4.4 I have problems with entering/viewing national characters!
Upgrade to version 4.0.12 or newer.
From the Options - Display Bits dialog select Full 8 bits or ISO
8859-1. In addition, select 8 bit input from the same dialog.
4.5 How can I get colors?
Invoke mc like this (without quotes): "mc -c".
If you get colors, be happy.
If your terminal stays black and white, your terminal doesn't support
color. You might want to upgrade to a terminal which compatible with
the ANSI color sequences.
If your terminal goes compelety black, see the next question.
More detailed answer:
First, check that your terminal supports color. Color_xterm, rxvt and
Linux console do support, most other terminals don't. You can test
color support with following simple C program:
#include <stdio.h>
int main (void){
printf ("\033[32m Hello world! \033[m\n");
return 0;
}
Compile and run it. If you see "Hello world!" text in green your
terminal supports color, otherwise not (however, for color_xterm see
also the next question).
Second, check that you are using Ncurses or the Slang library (type
"mc -V" to find out), in addition some System V curses implementations
do support color, most don't.
With Slang library you can force color support by setting the
environment variable COLORTERM to any value.
Third, if you use ncurses library, check that your terminfo database
supports color. If not you should install one of the enhanced terminfo
databases included in the Midnight Commander source distribution.
Fourth, you might want to set the TERM environment variable so that
you use the correct terminfo database or termcap entry.
If you use color_xterm (or rxvt) the correct value might be
xterm-color, xtermc or simply xterm.
If you use Linux console the correct value for TERM is linux or
console.
4.6 My color_xterm goes completely (or partially) black!
Some color_xterm terminals define all colors as black instead of the
standard ANSI colors. This makes them go completely black when you try
to use Midnight Commander with colors.
You will have to override the defaults. Create a file "color.defaults"
which has the following contents:
color_xterm*color0: Black
color_xterm*color1: Red
color_xterm*color2: Green
color_xterm*color3: Yellow
color_xterm*color4: Blue
color_xterm*color5: Magenta
color_xterm*color6: Cyan
color_xterm*color7: White
color_xterm*background: White
color_xterm*foreground: Black
(replace color_xterm with the name of your color_xterm, color_xterm
mentions its name in its title bar)
Now type:
xrdb -merge color.defaults
Alternatively you can add the suggested contents of the color.defaults
file to your .Xdefaults or .Xresources file (or what ever the name of
your X configuration file is). Or you can replace your non-ANSI
color_xterm with an ANSI color_xterm.
4.7 Where can I get color_xterm?
Try ftp.x.org: /contrib/utilities/colour_xterm.tar.gz.
Alternatively, rxvt is a better choice, see
http://mc.blackdown.org/cgi-mc/download/rxvt/.html
4.8 I got colors working with MC but the other programs don't work at all
anymore!
Midnight Commander uses terminfo database (if available) but many
other programs use termcap database. If you set the TERM environment
variable to a value which has no corresponding entry in termcap
database those programs stop working. You should add the new value of
TERM to the termcap database.
Example: If you have set TERM to xterm-color locate from /etc/termcap
the line which starts:
xterm|vs100|xterm terminal emulator
Change it to start:
xterm|xterm-color|vs100|xterm terminal emulator
4.9 Why are there both terminfo and termcap? Wouldn't one database be enough?
You might want to read the Unix-haters handbook at
http://www.digital.de/people/jmh/Unix_Haters/unix-haters.html. It
lists many more reasons why Unix sucks.
You can configure which terminal database you want to use with the
"--with-termcap" and "--with-terminfo" flags of configure. If you
don't specify them, the configure script will try to use terminfo if
available otherwise it will use termcap.
5 Graphical user interface
5.1 Xview and Tk editions?
Get the newest development version, give the "--with-xview" or
"--with-tk" option to the configure and otherwise compile as usual.
See Download.
Xview and Tk editions are work in progress, they are not as robust as
the text mode edition.
6 Command line problems
6.1 How do I stay in the last directory when I exit Midnight Commander?
See the description of the -P option in the Options section of the
manual.
6.2 How can I access command line history?
You can browse previous commands with M-p and M-n. Alternatively, you
can summon the command history listbox by pressing F9 c h.
6.3 How can I complete commands, file names, variable names and so on?
Just press M-Tab. Press M-Tab again to get a listbox if there are
multiple possible completions.
6.4 [NEW] I am using ksh. Can I use functions defined in the .kshrc within
MC?
Sorry, MC only supports bash, tcsh and zsh functions. Ksh functions
are not supported because ksh lacks the necessary hooks needed for
subshell integration.
Switch to bash or zsh. They are both quite compatible with ksh. Your
ksh functions should work as such or after minimal changes.
6.5 [NEW] Is there any way to include additional options or hot keys to MC?
Yes, F2 invokes an user menu which fully configurable. You can add any
shell commands to the user menu. See
http://mc.blackdown.org/mc/manual-d.html#8 for more info.
Another way to add functionality is the external panelize feature. See
http://mc.blackdown.org/mc/manual-d.html#4 for more info.
And finally, you can code any feature you want yourself. MC source
code is free which means you can change it anyway you want. There are
some limitations to make sure MC stays free. See GNU General Public
License for details.
7 Virtual file systems
Note! Virtual file systems are supported by Unix ports only. The
Windows 95/NT and OS/2 ports do NOT support virtual file systems. This
means you haven't got ftp, zip or tar support on Windows 95/NT and
OS/2.
7.1 How can I see the contents of a tar archive?
If you use keyboard just move the selection bar on the tar file and
press enter.
If you use mouse just doubleclick on the tar file.
If these procedures don't work, your .mc.ext file is faulty. Replace
it with one from the MC source distribution.
You can also enter a tar archive by typing "cd tar:filename.tar.gz"
where filename.tar.gz is the name of the archive.
The recognized suffixes for tar archives are .tar, .tar.gz and .tgz.
If your tar archive uses different suffix you have to rename it.
7.2 How do I get out of a tar archive?
Just press enter on the toplevel ".." file or chdir to a non-tar
directory. Just typing "cd" with no parameters is enough (it will take
you to your home directory).
7.3 How do I do anonymous ftp with MC?
Just type "cd ftp://hostname" where hostname is the name of the host
you want to connect. Alternatively, select FTP link from the Left or
Right menu and type the name of the host you want to connect.
7.4 How do I do non-anonymous ftp with MC?
Non-anonymous ftp works just like the anonymous ftp but you give the
login name with the host name. For example, type "cd
ftp://username@hostname".
7.5 How do I close an ftp connection?
Just chdir to a non-ftp directory. Just typing "cd" with no parameters
is enough (it will take you to your home directory).
Internally Midnight Commander closes ftp connection only after a
timeout. This isn't visible to the end user.
7.6 Why aren't the contents of ftp panel updated?
Update is skipped because there would be a serious performance
penalty. Constantly updating directory panels through a ftp connection
would take too much time.
You can use C-r to force an update.
7.7 [NEW] What kind of proxy server works with Midnight Commander?
Midnight Commander only supports ftp-like ftp proxies. Common WWW
proxies (like Squid) are not supported yet because they make ftp
connections look like http connections.
8 Other common problems
8.1 [UPDATED] How do I get the internal editor to work?
The F4 key defaults to an external editor because thats what most
people are used to. To use the internal editor, select Configuration
from the Options menu and check the 'use internal edit' option.
Alternatively add the line
use_internal_edit=1
under the [Midnight-Commander] section in your .mc.ini file (which is
in your home directory).
To make the editor work all the time, go to the default/* section in
the file lib/mc/mc.ext file and remove the line
Edit=%var{EDITOR:vi} %f
The internal editor will now be invoked for anything not specified
elsewhere in the mc.ext file.
Make sure that you edit the correct mc.ext file. The Midnight
Commander first checks the existance of $HOME/.mc.ext. If this file is
missing MC will use $prefix/lib/mc/mc.ext instead ($prefix can be
changed with configure before compilation and it defaults to
/usr/local).
When you run `F9/Command/Extension file edit' for the very first time
Midnight Commander copies the system-wide mc.ext from $prefix/lib/mc
into your home directory because you need write access in order to
change it.
And please don't forget that "make install" overwrites
$prefix/lib/mc/mc.ext.
8.2 Why doesn't "mcedit newfile" work?
This is a known bug.
If the newfile doesn't exist, mcedit fails.
Start mcedit with no parameters, this will create a blank file. Then
save the file with whatever name you like.
8.3 [UPDATED] Is there any way to 'bookmark' favourite ftp-fs links?
Use the directory hotlist. Just press control-backslash. If your
national keyboard layout doesn't have backslash key, just press the
control key with the key which is the backslash key in the English
keyboard layout.
8.4 When copying the directories lose their original date, uid and gid!
This is a known bug. At moment only files preserve their original
settings when copying, not directories.
Uid and gid is fixed since 4.0.1. "Preserve UIDs/GIDs" in the copy
dialog needs to be checked and you must be root.
Date problem is supposed to be fixed with 4.0.13.
8.5 [UPDATED] Why I keep getting: "There is no disk in the drive. Please
insert a disk into drive D:"?
This is a known bug of the Windows 95/NT and OS/2 ports. MC looks its
configuration files from the D:\MC directory and if the D: drive is a
removable drive (like a CD ROM drive) and there is no disk in drive
you get this message everytime you try to do anything.
Since version 4.0.6 you can specify the actual location of the
Midnight Commander configuration files with the MCHOME environment
variable.
8.6 [NEW] When I start Midnight Commander, nothing happens!
First, invoke MC without subshell support: "mc -u". If this helps
check the shell you are using. Subshell support works best with bash
although tcsh and zsh are also supported. You might want to upgrade
your shell to a newer version. If you use something else than bash,
tcsh or zsh, subshell support is disabled automatically.
If disabling subshell doesn't help, try to reconfigure MC with
"--with-our-slang" and "--with-termcap" options and recompile. If this
helps, there is something wrong with your terminfo database or shared
slang library. For better terminfo databases see chapter 4. For a
better slang library, upgrade to a newer version or keep using the
"--with-our-slang" option.
8.7 [NEW] When I try to view a file MC hangs!
This is known bug. A quick fix is "chmod 666 /dev/tty". For a more
complete fix, see http://mc.blackdown.org/mc/maillist/97-10/98.html.
This bug will probably be fixed in 4.1.6.
9 Development
9.1 Who has written Midnight Commander?
Midnight Commander was started by Miguel de Icaza and he is the
maintainer of the package. Other authors have joined the project
later:
* Mauricio Plaza (early releases, retired)
* Janne Kukonlehto (joined Sep 27 1994, retired Mar 8 1995, nowadays
Janne is the webmaster of the Midnight Commander web site)
* Radek Doulik (joined Oct 30 1994)
* Fred Leeflang (joined Nov 2 1994)
* Dugan Porter (joined Dec 1 1994)
* Jakub Jelinek (joined Feb 8 1995)
* Ching Hui (joined Jun 27 1995)
* Andrej Borsenkow (joined Jul 1996)
* Paul Sheer (joined Nov 1 1996)
* Norbert Warmuth
* Alex I. Tkachenko
Alessandro Rubini has been specially helpful with debugging and
enhancing of the mouse support. John Davis has made his S-Lang library
available to us and answered many questions about it.
The photographs of the authors are available as:
http://mc.blackdown.org/mc/about.html
Many people have contributed bug reports, feature suggestions and
small code bits (alphabetical order):
* Thomasz Cholewo
* Juan Jose Ciarlante
* Alexander Dong (OS/2 port, NT port updates)
* Erwin van Eijk
* Torben Fjerdingstad
* Massimo Fontanelli
* Juan Grigera (NT port)
* Gerd Knorr
* Sergey Ya. Korshunoff
* Jean-Daniel Luiset
* Wim Osterholt
* Antonio Palama (old DOS port)
* Thomas Pundt
* Marcelo Roccasalva
* Ilya Rybkin
* Vadim Sinolits
* Jon Stevens
* Adam Tla/lka
9.2 Do I dare to use a development version?
I am afraid you have to answer to this question yourself. Development
versions seldom cause data loss but they have usually got many bugs.
It's up to you to judge whether new features outweight the bugs.
9.3 How can I report a bug/request for a feature?
You might first want to get the newest development version to see if
the bug is fixed or the feature is added already.
Send your report/request to mc-devel@roxanne.nuclecu.unam.mx or
mc@roxanne.nuclecu.unam.mx. These mailing lists are the most certain
way to contact the developers. Remember to mention if you are not on
the mailing list to make sure that you will receive a copy of replies.
Give as much details as possible. A too long message is a lot better
than a too short message.
For segmentation faults a stack backtrace is appreciated. You can
produce stack backtrace as follows:
* If segmentation fault produced a core file:
1. Load the core file by typing "gdb mc core" or "dbx mc core".
2. Type "where".
3. Cut and paste the results to your message.
* If segmentation fault didn't produce a core file:
1. Load mc by typing "gdb mc" or "dbx mc".
2. Start mc by typing "run".
3. Try to reproduce the segmentation fault by doing whatever you
did last time when the segmentation fault occurred.
4. Type "where".
5. Cut and paste the results to your message.
6. For the future you might want to check out what is the
command in your shell to allow producing of the core files.
Usually it is "limit coredumpsize unlimited" or "ulimit
coredumpsize" or "ulimit -c unlimited".
9.4 How can I join the development?
To join the development just code the feature you want to add and send
your patch for inclusion. Email address is mc-devel@nuclecu.unam.mx.
Before you start coding check the latest development version. It might
be that your feature has already been implemented.
Note that the authors of the Midnight Commander have given all their
rights on the program to the Free Software Foundation. You will have
to do the same if you contribute non-trivial patches. Otherwise we
have to reject your patches in order to avoid copyright problems.
10 More information
10.1 [UPDATED] This document didn't answer my question. Where else can I look
for an answer?
Read messages from the Discussion (mailing list archive), search the
web site or read the Manual.
Upgrade to a newer version of Midnight Commander. Many problems are
fixed in the new versions.
If you still can't find an answer, post your question to the Midnight
Commander mailing list. Its address is mc@nuclecu.unam.mx.
10.2 What mailing lists are there for Midnight Commander?
Following mailing lists discuss about Midnight Commander:
mc
General discussion of the Midnight Commander
mc-digest
The mc list, in digest format
mc-announce
Major announcements about the Commander
mc-patch
The latest Commander patches
mc-devel
Technical development discussion
mc-chat
Non-MC related chatting by the developers (contact Miguel to
subscribe)
To subscribe, send e-mail to majordomo@roxanne.nuclecu.unam.mx with
the following line in the body of the message:
subscribe <list-name> [optional-address]
Replace <list-name> with the name of the list you want to subscribe
and [optional-address] with your email address.
10.3 Where should I look on the World Wide Web for MC stuff?
There is a WWW page for Midnight Commander. The URL is:
http://mc.blackdown.org/mc/
The WWW page features MC screen shots, photographs of the authors,
mailing list archive and a few other things.
10.4 Are the mailing lists archived anywhere?
The mc and mc-devel lists are archived on the World Wide Web page (see
the previous question). Other lists are not currently archived though
Miguel keeps a private archive. Contact him if you want copies of past
messages.
11 Administrivia
11.1 Authorship
Questions and Answers is written by Janne Kukonlehto. Parts of it
originate from Ian Jackson, Miguel de Icaza, Dugan Porter, Norbert
Warmuth and Paul Sheer.
11.2 [UPDATED] File formats
This document is available in HTML, postscript and PDF formats at
http://mc.blackdown.org/mc/answers0.html.
This document is available in ASCII format in the Midnight Commander
source package.
11.3 Feedback is invited
Send your comments about this document to janne@mc.blackdown.org
Send your comments about the Midnight Commander to mc@nuclecu.unam.mx
11.4 Disclaimer and copyright
Note that this document is provided as is. The information in it is
not warranted to be correct; you use it at your own risk.
You can use Questions and Answers according to GNU Public License (see
the COPYING file in the Midnight Commander source distribution).
Questions and Answers is not public domain.
__________________________________________________________________
This document is maintained by Janne Kukonlehto
<janne@mc.blackdown.org>.

529
rosapps/mc/doc/install Normal file
View File

@@ -0,0 +1,529 @@
-*-text-*-
This file contains:
- Installation instructions and notes for the Midnight Commander
- Where to get more information on the Midnight Commander
- Common problems
- Information on porting the program
- Obtaining the missing pieces of the Midnight Commander
Installation instructions for the Midnight Commander
----------------------------------------------------
The `configure' shell script attempts to guess correct values for
various system-dependent variables used during compilation, and creates
the Makefile. It also creates a file `config.status' that you can run
in the future to recreate the current configuration.
(Nextstep users, make sure you read the "Compiling under Nextstep"
section)
To compile this package:
1. Configure the package for your system.
Normally, you just `cd' to the directory containing the package's
source code and type `./configure'. If you're using `csh' on an old
version of System V, you might need to type `sh configure' instead to
prevent `csh' from trying to execute `configure' itself (under AIX,
you may need to use ksh instead of sh).
Running `configure' takes a while. While it is running, it
prints some messages that tell what it is doing. If you don't want to
see any messages, run `configure' with its standard output redirected
to `/dev/null'; for example, `./configure >/dev/null'.
To compile the package in a different directory from the one
containing the source code, you must use a version of `make' that
supports the `VPATH' variable, such as GNU `make'. `cd' to the
directory where you want the object files and executables to go and run
the `configure' script. `configure' automatically checks for the
source code in the directory that `configure' is in and in `..'. If
for some reason `configure' is not in the source code directory that
you are configuring, then it will report that it can't find the source
code. In that case, run `configure' with the option `--srcdir=DIR',
where DIR is the directory that contains the source code.
By default, `make install' will install the package's files in
`/usr/local/bin', `/usr/local/man', etc. You can specify an
installation prefix other than `/usr/local' by giving `configure' the
option `--prefix=PATH'. Alternately, you can do so by consistently
giving a value for the `prefix' variable when you run `make', e.g.,
make prefix=/usr/gnu
make prefix=/usr/gnu install
You can specify separate installation prefixes for
architecture-specific files and architecture-independent files. If
you give `configure' the option `--exec-prefix=PATH' or set the `make'
variable `exec_prefix' to PATH, the package will use PATH as the
prefix for installing programs and libraries. Data files and
documentation will still use the regular prefix. Normally, all files
are installed using the same prefix.
The program detects if you have the gpm library installed. If you
installed the gpm mouse library in a non-standard place, you will need
to use the --with-gpm-mouse flag with the directory base where you
installed the gpm package.
`configure' also recognizes the following options:
`--help'
Print a summary of the options to `configure', and exit.
`--quiet'
`--silent'
Do not print messages saying which checks are being made.
`--verbose'
Print the results of the checks.
`--version'
Print the version of Autoconf used to generate the `configure'
script, and exit.
`--with-debug'
Enables the built-in memory allocation debugger and forces
compilation with -Wall. This is an option intended to be used by
the program developers.
`--without-edit'
Configures the program to be compiled without the built-in file
editor. The built-in editor is compiled in by default.
`--with-ext2undel[=PATH]'
On systems that use the Extended 2 file system and have the
libext2fs.a library available, this compiles into the Midnight
Commander the support code for recovering deleted files (the
undel virtual file system).
Use =PATH if libext2fs.a is installed in a non-standard place.
The configure will append `lib' and `include' to find the ext2fs
libraries and include files respectively.
`--with-gpm-mouse[=PATH]'
Use this flag if your GPM mouse package cannot be detected by the
configure. Use =PATH if it is installed in a non-standard place.
The configure will append `lib' and `include' to find the libgpm.a
and gpm.h files respectively.
`--without-gpm-mouse'
Use this flag to disable GPM mouse support (e.g. if you want to
use mouse only on X terminals).
`--with-hsc'
Compiles support into the ftp virtual file system to support the
HSC firewall.
`--with-mmap'
Needed when compiling under AIX if you want the fast viewer.
`--with-sco'
This option is used to compile on SCO: it turns on SCO-specific
code, i.e. disables the terminal resizing mechanism, uses the
BSD-like pseudoterminal handling, adds screen-saving capabilities
on console, etc.
`--with-subshell[=optional]', `--without-subshell'
The subshell support is by default turned on, you can disable
this by using the --without-subshell option. If you pass the
=optional parameter, then the subshell support is turned off by
default, to turn it on, you have to specify the `-U' flag when
running the program.
`--with-termnet'
Enables the network support with the Term package.
`--with-tk' [WARNING: X code is not released]
This option enables including the Tcl/Tk version.
`--with-tk-includes=DIR' [WARNING: X code is not released]
Lets you specify the place where you have your Tcl/Tk headers installed.
It should be a directory containing tcl.h and tk.h.
`--with-tk-libraries=DIR' [WARNING: X code is not released]
Lets you specify the place where you have your Tcl/Tk libraries -
libtcl and libtk.
`--with-xview' [WARNING: X code is not released]
This option enables including the XView version.
`--with-xview-includes=DIR' [WARNING: X code is not released]
Lets you specify the place where you have your xview headers installed.
It should be the directory, which has subdirectories xview and
hopefuly xview_private.
`--with-xview-libraries=DIR' [WARNING: X code is not released]
Lets you specify the place where you have your xview libraries -
libolgx and libxview.
`--with-xv-bindir=DIR' [WARNING: X code is not released]
Lets you specify the place where program mxc will be installed.
Default is somewhere in your XView binaries directory,
$OPENWINHOME/bin.
`--without-dusum'
This option disables a feature of the Midnight Commander, which is
forking the du command with the -s option when you want to calculate
directory sizes.
`--without-vfs'
This option disables the Virtual File System switch code in the
Midnight Commander and uses the standard file system calls for
file access. If you specify this option you will not get the
transparent tar File system manipulation as well nor the
networked Midnight Commander file system.
You may also tell configure which display manager you want to use with
the Midnight Commander. The configure script will use SLang as default,
but you can override this by using any of the following flags (please
note that slang is included as part of the distribution),
`--with-slang' (default)
This is used to configure the program to use the SLang screen
manager. This is included as part of the Midnight Commander,
you don't need it installed on your system. If SLang is installed
on your system it will be used if possible. You can force usage of
the included SLang with the `--with-included-slang' option.
Slang is the only library that will let you resize the Midnight
Commander window on an xterm.
This option will usually try to use the terminfo database if it
is available, otherwise it will use the termcap database. At
compile time, you may force the use the terminal database with
the `--with-termcap' and `--with-terminfo' options (both options
automaticly turn `--with-included-slang' on).
`--with-ncurses[=directory]'
Use this flag (either with or without the =directory part), if
you want to compile with ncurses instead of the default SLang.
Use the =directory part if your ncurses is not installed in any of the
places configure will check (/usr/include, /usr/include/ncurses,
/usr/local/include and /usr/local/include/ncurses).
The argument to this flag is the base directory where the ncurses
files are located. The configure will append lib and include to
find the libncurses.a and ncurses.h file respectively. For
example, if you have installed ncurses under /gnu/lib and
/gnu/include, you specify: --with-ncurses=/gnu
You will need the ncurses package only if your system does not
provide a compatible curses. If after compiling, the program
says that it can't resolve the has_colors function, then you need
the ncurses package or you may always go back to the included SLang
screen manager.
`--with-vcurses[=directory]'
Use this flag to force the Midnight Commander to use a SystemV
type ncurses, the optional directory specifies where should
the C compiler find the include files.
`--with-sunos-curses'
You use this flag on SunOS machines if you want to use SunOS 4.x
curses instead of ncurses. You don't need this flag if you don't
have ncurses installed: it's only needed to force the usage of
SunOS curses over ncurses.
`configure' also accepts and ignores some other options.
On systems that require unusual options for compilation or linking
that the package's `configure' script does not know about, you can give
`configure' initial values for variables by setting them in the
environment. In Bourne-compatible shells, you can do that on the
command line like this:
CC='gcc -traditional' LIBS=-lposix ./configure
On systems that have the `env' program, you can do it like this:
env CC='gcc -traditional' LIBS=-lposix ./configure
Here are the `make' variables that you might want to override with
environment variables when running `configure'.
For these variables, any value given in the environment overrides the
value that `configure' would choose:
- Variable: CC
C compiler program. The default is `cc'.
- Variable: CFLAGS
The default flags used to build the program.
- Variable: INSTALL
Program to use to install files. The default is `install' if you
have it, `cp' otherwise.
For these variables, any value given in the environment is added to
the value that `configure' chooses:
- Variable: LIBS
Libraries to link with, in the form `-lfoo -lbar...'.
If you need to do unusual things to compile the package, we encourage
you to figure out how `configure' could check whether to do them, and
mail diffs or instructions to the address given in the README so we
can include them in the next release.
2. Type `make' to compile the package.
3. If the package comes with self-tests and you want to run them,
type `make check'. If you're not sure whether there are any, try it;
if `make' responds with something like
make: *** No way to make target `check'. Stop.
then the package does not come with self-tests.
4. Type `make install' to install programs, data files, and
documentation.
If your system is Linux, then install installs the Linux console screen
saver as well.
5. You can remove the program binaries and object files from the
source directory by typing `make clean'. To also remove the
Makefile(s), the header file containing system-dependent definitions
(if the package uses one), and `config.status' (all the files that
`configure' created), type `make realclean'. If you want to clean the source
tree completely, so that it contains only those files that should be
packaged in the archive, issue `make distclean'. If you've run configure in
a different directory than the source tree, distclean won't remove your *.o
and linked programs in that directory.
6. The Midnight Commander allows you to be kept on the directory you
were when you quit the program, this is done with a shell function,
the man page has more information about this. If you want to let the
install program make the change to your /etc/profile or your
~/.profile or ~/.bashrc, then type: `make mcfninstall'.
The file `configure.in' is used to create `configure' by a program
called `autoconf'. You only need it if you want to regenerate
`configure' using a newer version of `autoconf'.
Compiling under NeXTStep
------------------------
These instructions were provided by Gregor Hoffleit
<flight@mathi.uni-heidelberg.DE>, he recommends configuring the
program like this:
export CC="cc -posix"
configure --without-subshell --with-termcap
Edie config.h and make sure you have #undef HAVE_GETWD
make
- Where to get more information on the Midnight Commander
---------------------------------------------------------
Janne Kukonlehto set up a WWW page, here is the URL:
http://mc.blackdown.org/mc/
We also a set of mailing lists for the program:
mc-announce: Announcements of new version of the Midnight Commander.
mc-digest: Digest version of the mc list.
mc-patches: Patches by mail (also on the ftp site).
mc: Discussion on the Midnight Commander file manager.
mc-devel: For discussion between the developers of the program.
to subscribe to the mailing lists, send a message to:
majordomo@roxanne.nuclecu.unam.mx
with the following text in the body of the message:
subscribe <list-name> [address]
The address is optional and list-name is one of the above list names
(mc, mc-announce, mc-patches or mc-digest).
Notes about the Midnight Commander installation
------------------------------------------------
The Midnight Commander has been run in the following configurations:
i386-*-linux
sparc-*-linux
alpha-*-linux
mips-dec-ultrix4.3
mips-dec-{open,net}bsd1.0
mips-sgi-irix5.2
mips-sgi-irix5.3
rs6000-ibm-aix3.2.5
sparc-sun-sunos4.1
sparc-sun-netbsd1.0
sparc-sun-solaris2.3
hppa-hp-hpux9
hppa-hp-hpux7
m68k-apple-aux
mc88110-aviion-dgux5.4
i386-*-{bsdi2,freebsd}
Since the Midnight Commander is configured via the GNU autoconf
program, it's not difficult to run it in other operating systems.
If you're using AIX, with the cc6000 compiler, you have to specify the
`--with-mmap' command line option.
You will need GNU C (or an ANSI C Compiler) and optionally a color
curses library (ncurses is a good choice). The Midnight Commander now
comes with the Slang screen manager, a fast screen manager, so ncurses
is not required anymore unless you want to use it.
Many Linux systems ship with ncurses version 1.9.9e, however, we recommend
ncurses 4.1 or above, since the former version does not support resizing
of the xterm window.
Since version 0.9 the Midnight Commander comes with mouse support on
xterms and in the Linux console. In order to take advantage of the
mouse support on the Linux console you will need the gpm mouse server
(see the section "Obtaining the Missing Pieces" in this file).
Once you get the Mouse Server, compile it and install it, then you
will have to specify the `--with-gpm-mouse' flag to the configure
program if you installed it in a non-standard directory. If you
installed the gpm package under /usr or /usr/local, you don't need to
specify this flag; configure will find gpm for you. The support for
mice on xterms is always compiled in.
We are working on further enhancements to the program, but we're not
sure which ones must go first. If you would like to point us in the
Right Direction we will be glad to hear from you (you could check the
file TODO included with this distribution for the current projects).
If you happen to find an undocumented feature that doesn't do what you
expected, please drop us a note telling us as much as you can about
the problem you're experiencing (to miguel@roxanne.nuclecu.unam.mx).
Porting the program
-------------------
Random notes on porting to other architectures.
The Midnight Commander uses now by default the Slang library for
handling the display. If you can't port Slang (which should be a
pretty trivial job), you may want to attempt using ncurses (the
Midnight Commander can use ncurses as well as the display engine).
If you don't want to install ncurses and your OS is a SystemV Release
4 variant, maybe the curses supplied with your system will do the
work. If you experience display problems, then it means that we are
dealing with a buggy implementation of curses. You have two options:
one, download ncurses and recompile with ncurses or recompile all your
source code with the symbol BUGGY_CURSES defined. But you can always
switch to the default SLang screen manager.
The fast way to do this is to:
make clean; make XINC=-DBUGGY_CURSES
Obtaining the missing pieces of the Midnight Commander
------------------------------------------------------
The Midnight Commander will build without requiring you to get any
other software packages, however, you may be interested in enhancing
the Midnight Commander environment with some of these:
o Terminal database
There are many incomplete terminal databases out there, however, a
complete terminfo is bundled with ncurses. (It is simple to generate
the termcap database using the infocmp utility in ncurses).
Some terminfo data are included with the mc distribution (lib/*.ti).
Particularly linux, xterm and vt100. Use e.g. ''tic linux.ti'' to
use them.
If you want to run mc on xterm/color_xterm/ansi_xterm (not rxvt), then
you might read lib/README.xterm for further information.
o In the past the Midnight Commander required the NCurses library to
build, now it's optional. You can get Ncurses from
ftp.gnu.org:/pub/gnu
ftp.clark.net:/pub/dickey/ncurses
o The GPM Mouse Server is available at:
iride.unipv.it:/pub/gpm
o The X Windows System libraries are only used if you are going to
build the X11 versions of the program. Please note that this code
is not finished, so it's only useful if you want to look at what we
are doing or want to help in one of the two X11 versions.
o The XView library can be obtained from (currently the newest is
XView3.2p1-X11R6.tar.gz):
ftp.nuclecu.unam.mx:/Midnight/devel/XView.libs
ftp.x.org:/contrib/libraries
ftp.cvut.cz:/pub/x11/contrib/libraries
- Linux/ELF shared binaries:
sunsite.unc.edu:/pub/Linux/libs/X/xview
ftp.cvut.cz:/pub/linux/sunsite/libs/X/xview
o The Tcl/Tk libraries can be obtained from:
ftp.smli.com:/pub/tcl
ftp.aud.alcatel.com:/tcl/ftp.smli.com
ftp.cvut.cz:/pub/tcl/ftp.smli.com
- Linux/ELF shared binaries:
ftp.ods.com:/pub/linux
ftp.cvut.cz:/pub/linux/ods
o The Xpm library (used by the XView version) can be obtained from
(currently xpm-3.4f.tar.gz):
koala.inria.fr:/pub/xpm
ftp.x.org:/contrib/libraries
ftp.cvut.cz:/pub/x11/contrib/libraries
- Linux/ELF shared binaries:
ftp.ctd.comsat.com:/pub/linux/ELF
ftp.cvut.cz:/pub/linux/comsat
To get the mouse support working on the Linux console:
If you're using Linux version >= 1.1.34, then you will have to choose yes
to selection when you compile your kernel. If your Linux version is
older than this one, you may try to apply one of the patches included in
the gpm package.
And the GNU C Compiler may be obtained from the following sites:
ASIA: ftp.cs.titech.ac.jp, utsun.s.u-tokyo.ac.jp:/ftpsync/prep,
cair.kaist.ac.kr:/pub/gnu
AUSTRALIA: archie.au:/gnu (archie.oz or archie.oz.au for ACSnet)
AFRICA: ftp.sun.ac.za:/pub/gnu
MIDDLE-EAST: ftp.technion.ac.il:/pub/unsupported/gnu
EUROPE: ftp.cvut.cz:/pub/gnu, irisa.irisa.fr:/pub/gnu,
ftp.univ-lyon1.fr:pub/gnu, ftp.mcc.ac.uk,
unix.hensa.ac.uk:/pub/uunet/systems/gnu,
src.doc.ic.ac.uk:/gnu, ftp.win.tue.nl, ugle.unit.no,
ftp.denet.dk, ftp.informatik.rwth-aachen.de:/pub/gnu,
ftp.informatik.tu-muenchen.de, ftp.eunet.ch,
nic.switch.ch:/mirror/gnu, nic.funet.fi:/pub/gnu, isy.liu.se,
ftp.stacken.kth.se, ftp.luth.se:/pub/unix/gnu, archive.eu.net
CANADA: ftp.cs.ubc.ca:/mirror2/gnu
USA: wuarchive.wustl.edu:/mirrors/gnu, labrea.stanford.edu,
ftp.kpc.com:/pub/mirror/gnu, ftp.cs.widener.edu, uxc.cso.uiuc.edu,
col.hp.com:/mirrors/gnu, ftp.cs.columbia.edu:/archives/gnu/prep,
gatekeeper.dec.com:/pub/GNU, ftp.uu.net:/systems/gnu
Unsupported options to configure:
---------------------------------
`--with-bsd-curses'
If you don't want to use ncurses and are using an Ultrix box, you
can use this switch. Be aware that ncurses is a better option
than the curses included in Ultrix.

View File

@@ -0,0 +1,70 @@
-*-text-*-
Read the INSTALL file for the complete instructions.
The Midnight Commander by default will use the Slang screen
manager, if something fails with the Slang screen manager, you may
compile the program with your system curses (You will need a SysV
compatible curses, in case you don't have such, read the README file
for directions on getting the ncurses package, a freely available
replacement for SysV curses).
1. Configure the package for your system.
Normally, you just `cd' to the package main directory and type
`./configure'.
The most often needed options to configure are following:
`--prefix=PATH'
By default, `make install' will install the package's files in
`/usr/local/bin', `/usr/local/man', etc. or to `/usr/bin',
`/usr/man', etc. depending on the location of an old mc binary.
If you have none in your system, default will be `/usr/local'.
You can specify an installation prefix other than default by giving
`configure' the option `--prefix=PATH'.
`--with-slang' (default)
The easy way to get the Commander running: Slang is part of
the distribution. This is the default screen manager, if you run
configure without any --with-*curses parameter.
`--with-ncurses[=PATH]'
Use the flag without =PATH if you want to compile with ncurses
(default is in version 3.0 the SLang screen manager included
in the distribution).
Use this flag with =PATH part, if you want to compile with ncurses
and your ncurses is not installed in any of the
places configure checks (/usr/include, /usr/include/ncurses,
/usr/local/include and /usr/local/include/ncurses). The
configure script will append `lib' and `include' to find the
libncurses.a and ncurses.h files respectively.
`--with-gpm-mouse[=PATH]'
Use this flag if your GPM mouse package cannot be detected by the
configure. Use =PATH if it is installed in a non-standard place.
The configure will append `lib' and `include' to find the libgpm.a
and gpm.h files respectively.
`--with-sco'
If you are compiling on a SCO machine.
You may also want to specify CFLAGS for the compiler, even if it finds
itself some defaults by typing e.g.
`CFLAGS=-O2 ./configure'
2. Type `make' to compile the package.
3. Type `make install' (as root) to install programs, data files, and
documentation. If you're on a Linux system, this will install the
`cons.saver' utility, which allows the Midnight Commander to save and
restore the screen contents. If you're making a mc binary distribution for
other people and want to tar the whole binary later, you may want to specify
`make install DESTDIR=PATH', which will make PATH the root for installation
(but in the installed stuff will be still stored only --prefix).
3a. Type `make mcfninstall' to get an interactive program check if you
want to define an useful alias for the Midnight Commander.
4. Type `mc' and enjoy!

0
rosapps/mc/doc/mc.1 Normal file
View File

0
rosapps/mc/doc/mcedit.1 Normal file
View File

0
rosapps/mc/doc/mcserv.8 Normal file
View File

516
rosapps/mc/doc/news Normal file
View File

@@ -0,0 +1,516 @@
Version 3.5
- New hotlist code.
- The bookmark code has been completely revamped and now it supports
folders. New format for the hot list file.
- It is possible to copy a selected path name into the input line
(C-Enter).
- Tk enhancements.
- New built in GUI designer to help developers modify the look
of the program at run time (no penaly for users).
- Many dialog boxes now work.
- Right button now pops up a context sensitive action menu.
- Added many visual enhancements.
- The Tk edition is not yet finished though.
- File management.
- Now we do background copy and move operations.
(you can ftp your files in the background now, for example).
- Built in text editor
- This is an easy to use text editor with pull-down menus.
The features it presently supports are: Block copy, move,
delete, cut, paste; key for key undo; file insertion; macro
definition; regular expression search and replace (and our
own scanf-printf search and replace); shift-arrow MSW-MAC
text highlighting (for the linux console only);
insert-overwrite toggle; and an option to pipe text blocks
through shell commands like indent.
Comes with Emacs keybindings as well.
mcedit is a link to mc which bring it up in editor mode.
- FTP File system
- Many fixes and enhacements, better support for proxy
machines.
- Now we support both active and passive opens.
- Estimated time of arrival for ftp transfers.
- stalled detection.
- Much better support for proxies.
- ftp URL's now allow a password to be provided.
- ext2fs Undelete File system
- Minor enhancements.
- TAR File system
- Now we flush the tarfs if the tar file has been modified
- External File systems:
- Speeded up RPM file system.
- New LHA file system.
- New ARC file system.
- New DEB file system (for those users of Debian).
- New RAR file system.
- Fixed problems with different zipfs.
- MC file system:
- We get can use a mc file system by using either mc: or mc:// prefixes.
- Viewer changes:
- Now we include a program that preprocesses mail if you view it
so, you get colored mails in the viewer.
- A simple ruler has been implemented (press Alt-r to enable it).
- New hex editor
- Now you can do hex editions in your files with a single keystroke.
(invoke it by using the hex-viewer and then clicking on edit).
- Find file command:
- Now we can search inside files using a piped grep (particularly
interesting to search inside virtual file system: tar files,
tar files on remote ftp sites, or searching information on an
ftp site)
- Widgets:
- Input lines now support control-left, control-right movement on the
Linux console.
- Extension file:
- We now support extra entries in a given rule with the Include=
tag.
- Ports:
- Windows NT, Windows 95 by Juan Grigera
- OS/2 by Alexander Dong.
- Many many many bug fixes and memory leaks have been fixed.
Version 3.2
- External File system:
- Mtools file system works.
- New Cpio file system.
- New RPM file system.
- FTP file system:
- support for HSC firewall
- Lots of subshell fixes
- Regexp-extension:
- Editing of non-local files works now.
- Bunch of bug fixes.
- Panelize now works properly.
- Can work on Nextstep now.
- Windows NT port by Juan Grigera.
- Midnight Commander file system server:
- Fixed errno handling in the server.
- Fixed time handling in the server.
- Better caching.
- Works with PAM if supported on the system.
Version 3.1
This has been finished:
- Enhanced ftpfs:
- Displays progress bars.
- Supports netware and windows nt servers
- Better support for symlinked files.
- Handles those warez sites file names.
- Increase the directory cache timeout.
- Cache flushing (C-r)
- If you append a /~ to the directory, you will log into your home
directory (this is done by default if you use the menus to connect).
- More robust.
- Subshell fixes (it should not hang any longer).
- Fixes prompt handling for zsh and tcsh users.
- Fixes variable expansion for tcsh (now you may edit files).
- Rewrote the sync code between the parend and child, should not hang
any longer.
- Better command completion.
- Keypad handling enhanced:
- Special key treatment for +, -, \ and now may be configure to
only take place if you do not have a command typed in.
- Now the + and \ bindings when ran on the Linux console work
may use the keypad and M-+ and M-\ and leave the + and \ keys
free.
- Better handling of the line drawing chars on OSF/1 and AIX.
- Enhanced tar/compressed tar file systems.
- Global kill ring.
- Added undelete feature for Linux systems: now you may recover deleted files
on ext2 file systems with the Undelete file system.
- Symlink commands (for symlink lovers).
see the docs on C-x C-r, C-x C-l, C-x C-s keystrokes.
- New macros:
%b and %B return the basename of the selected filename
%var{ENV-VAR} expands to the contents of ENV-VAR variable.
- MC may be invoked as a viewer (mc -f flag).
- Added Unicode support on the Linux console (run with mc -N)
- Tons of bug fixes, the code is cleaner and hopefully
- Allow a vfs pathname to be passed as a startup directory.
This is a list of people that put their effort into making the 3.1
release:
Adam Tla/lka, Antonio Palama, Carl Thompson, Ching Hui, Dugan Porter, Gerd
Knorr, Ilya Rybkin, Jakub Jelinek, Janne Kikonlehto, Juan Grigera, Juan Jose
Ciarlante, John Davis, Marcelo Fabian Roccasalva, Perry Francis Nguyen,
Sergey Ya Korshunoff Steven Hirsch, Thanh Ma and Torben Fjerdingstad.
Version 3.0
This has been finished:
- Virtual File System: You now can browse tar, compressed tar and
file systems over the network as if they were local subdirectories;
- Slang support, you don't need ncurses anymore (but you can still compile
with ncurses, if you want).
- New mc.ext format, for details see the sample mc.ext file provided.
- Append option if you try to copy/move a file onto already existing one.
- Internal cd command uses CDPATH variable if set (like in BASH).
- Find file command is much faster.
- External panelize command - finding files using unlimited number of
criteria - actually spawns an external command and it can be find, awk,
grep -l or anything else.
- Learn keys makes setting up of mc on terminals with broken
terminfo/termcap databases easier. It just asks you to press keys which
are not working.
- Advanced chown command.
- C-PgUp and C-PgDn takes you to the previous and currently selected
directory respectively on the Linux console.
- You can choose between 7 data bits, iso-latin-1 (0-127+160-255) or
other (0-255).
- Confirmation for overwriting, deleting and exiting added.
- Viewer has growing buffers.
- Filename, username, hostname and variable completion (M-Tab) on all
input lines plus command completion on appropriate places of command
line.
- Following of symlinks at changing directory.
- Viewer now supports bold faces and underlines, and it fits the
information on the screen better. Now you can also specify the starting
mode for the viewer depending on the contents of the viewed file.
- Mask rename and copy.
- Colors now let you specify the intensity of the colors you want.
This is being worked on:
- Virtual File System: FTP file system.
- Tcl/Tk and XView versions of the program (preliminary versions are
up and running).
Version 2.0
Now users are able to define their own display
- User defined display formats.
Now you can configure the file display to suit your needs.
For example, you can say which information you want to see displayed
instead of our defaults.
- User definable program layout.
Panels could be shown vertically or horizontally;
panels could be different sizes, you can hide or show most
program windows (command line, keybar or menubar).
- Output window.
Now, it's possible to see part of the last program output on the Linux
console without having to switch screens via an option in the layout
menu.
- New View modes:
Quick view: as you browse your files, each one is displayed on
the other panel on the idle time.
Tree view: let's you browse your directories by traveling a tree.
We have two traveling modes available. And the tree does
not take your precious time: it's build on the fly, as you
browse your disk (you can always loose your time if you
want to :-).
Info view: Gives you information on the currently select file and
the current file system as you move.
User view: Let's you define a directory listing and the format you
want to use.
- New subshell support (concurrent shell execution)
The Midnight Commander will now spawn one copy of the shell, so you
get better performance and you can use shell functions, define variables
and execute complete shell commands. Supported shells: bash, zsh and
tcsh. If your shell is not supported, then the old mode is still
available.
- Dialog box manager
Almost all the new configuration options are configured with this
new dialog manager, easy to use if you are familiar with dialog boxes
in DOS and Windows.
Available widgets: check buttons, buttons, radio buttons,
input lines and list boxes (So you can take our code and use it on
your applications).
- New option configuration.
Now the program options are configured with a dialog box.
- Chmod and Chown commands:
For changing permissions as well as ownership of files and
directories, uses our new dialog manager.
- Color customization support
Now you can change the default color of the program with any of
these:
environment variable, Colors section in the init file (colors per
terminal type) and command line.
- User menu and extension enhancements:
Execution understand the %t macro (tagged files).
User menu also has a new macro to let the user specify options.
You can hide and show entries in the user menus by using conditions.
Auto detect best match depending on a regexp.
- Viewer:
Goto line command,
horizontal scrolling,
on the fly uncompression (and we don't eat unneeded cycles of CPU),
allow non gunzip operation.
- Internal move command:
Now, we don't rely anymore on system commands in /bin, so the
program is more robust and is much faster. Bunchs of code come
from the GNU fileutils.
- The Tree view and normal views allows wrapped incremental searchs of
file names.
- Mask rename:
Now it's possible to do things like rename *.pas in *.bak
- Compare directories command
- Allow panels to be in Long mode without forcing the user to a single panel.
(You can even have two long panels).
- F10, C-g cancels as well as ESC ESC.
- Improved help system.
We updated and spelled the help system and added a lots of links.
The Web page is constructed with the same tools.
- Allows tagging of directories:
Now you can copy, rename, move and delete complete directories. You
are not limited anymore to files.
- View output (screen save/restore) on Linux console.
On old Linux systems, only b&w is supported, on newer Linux systems
(1.1.67 and newer), we also support color screen save/restore and
cursos positions.
- 8 bit clean support.
- Visual feedback while i-searching files.
- Much more intuitive, you have to use it.
- It's better than aspirin.
- New memory allocation debugger.
During testing time, we used a powerfull memory allocation debugger,
so the program will not eat all your memory, and will make a good use of
your memory.
- Now it also runs on hppa-hp-hpux9, hppa-hp-hpux7, m68k-apple-aux and
sparc-sun-netbsd1.0. The best platform to run it is Linux, of course,
since that's where most of us develop it.
- Inode sort option.
- Nice progress status indicator.
We have two of them: a moving dash indicator and a progress bar
indicator for file operations.
Version 0.15
- Uses GNU autoconf.
Currently, it has been ported to this configurations:
i386-*-linux1.0
i386-*-linux1.1
mips-sgi-irix5.2
mips-dec-ultrix4.3
rs6000-ibm-aix3.2.5
sparc-sun-sunos4.1
sparc-sun-solaris2.3
- Improvements to the internal file viewer:
Wrap/Unwrap mode.
Hex mode.
Hex searches.
Now you can view compressed files (gzip, compress, zip, pack and lzh).
Performance enhancements, now it's much faster.
Works on systems without mmap.
- Mouse Support now also works on xterms.
If you run in the Linux console, you will still need the gpm mouse server
to use the mouse support, but if you use xterms, then you're lucky
and can use the mouse support when using xterms.
- Help system and man page.
Both were updated and has many more hypertext links inside, the
help system can also be used with a mouse.
- If running on xterms, now you can see the output of the last program
you ran by using the C-o key combination.
- Switch panels command (C-u)
- With filter command per panel.
- With auto mounting/umounting on chdir feature.
- cd now expands tildes (~, ~user).
- Much more portable.
- Many bugs were fixed.
Version 0.14
- Now can handle directories with an unlimited number of files.
- New link and symlink commands (C-x l, C-x s).
- New insert tagged files or selection command (C-x t).
Version 0.13
- Behave more like the Norton Commander.
- Added menu file edit.
- If there is no permission to load a directory, now it loads a dummy
directory.
- When a panel is re-sorted, keep the selected file selected.
- forward_word and backward_word command on the input line now skip
over letters and numbers.
- Fixed backward scrolling in the internal viewer.
- The internal viewer now computes the percentage in a more natural
way.
- Added handling of the Home and End keys to the internal viewer
- Bug fixes.
Version 0.12
- Preliminary support for System V compilation.
- Bug fix: didn't call closedir in all cases.
- bug fixes.
Version 0.11
- Support cd -.
- Corrected Makefile.
Version 0.10
- Added new Alt-G, Alt-H, Alt-J to select the top file, middle file
and bottom file in the current panel.
- Now it's allowed to select option in query boxes by the first initial
- Fixed mouse repeat rate.
- Fixed a bug that prevent copying individual files to another file.
- Some minor bug fixes.
Version 0.9
- Mouse Support.
- Internal Copy command (it no longer uses cp).
- Verbose Copying of files.
- Confirmation on Overwrite and on Delete.
- Support reverse sorting.
- Many visual enhancements.
- Per panel options are saved and restored.
- New truncation of names in the panels.
- History in Input Lines (M-p and M-n).
- Input line enhancements.
- Dialog boxes are nicer than before.
- Cache in gid and uid translators.
- More keybindings for the Input lines.
- Better kill management in Input Lines.
- Bug fixes.
Version 0.8
- The online help now comes with the complete man page.
- Input lines now support M-b and M-f for movement by word.
- Unlimited input lines (command line).
- Filename searches now must be started with C-s or M-s.
- Many bug fixes.
Version 0.7
- The stat() reloading optimization is now a configuration option.
- Many bug fixes went to the find file command.
- New history in the hypertext viewer.
- ESC-Tab will copy the name of the other-panel selected file to the
input line.
- Now it's possible to display files and directories mixed together or
separated (like the Norton Commander).
- Many bug fixes, see the ChangeLog for details.
Version 0.6
- Extension dependent execution implemented (now you can execute
things like tar tzvf over compressed tar files, just a tap in the
Enter key).
- Added simple expansion of useful variables in the user menu.
- Avoid unnecessary reloading of subdirectories using stat (suggested
by Torben Fjerdingstad <tfj@olivia.ping.dk>).
- Added options to disable colors and display version number.
- Allow start up directory specification (ex: mc /usr/local/bin /tmp).
- Fixed bug that operated on the selection instead of the tagged file
(when only one file was tagged).
- Some cosmetic changes.
- Bug fixes.
Version 0.5
- Fixed bug in the help browser that crashed the program.
- New internal viewer.
- New long directory listing format.
- some bug fixes.
Version 0.4
- User Menus (F2 key).
- Quick search of files in a panel (Alt-filename takes you to that file).
- Char quoting (C-q).
- exec() enhancements.
- now you can suspend the program (C-z).
- The find file command now seems to be very stable.
- misc bug fixes.
Version 0.3
- Setup loading/saving.
- Support for any size screen.
- Many, many bug fixes.

191
rosapps/mc/doc/readme Normal file
View File

@@ -0,0 +1,191 @@
-*-Text-*-
Contents:
---------
Intro text
Midnight Commander editions
Where to get more information
The Midnight Commander
Mini-docs
Obtaining the Midnight Commander
Reporting problems.
This is version 4 of the Midnight Commander, a free Norton Commander
Clone with many useful features. The Midnight Commander comes with
mouse support on xterms and optionally on the Linux console.
The Midnight Commander is a directory browsing tool which bears a
certain remote resemblance to John Socha's Norton Commander for DOS.
It is feature packed:
o Built in Virtual File System: manipulate remote files
systems through the ftp protocol or Midnight Commander's own
mcfs protocol. Browse tar, compressed tar files, rpm, zip,
cpio, lha and rar files with a single click.
o All of the Midnight Commander operations work with the virtual
file system, enabling you to do complex tasks.
o Mouse support on the Linux console and under X11's xterms.
o Learn Keys: The Midnight Commander may be configured at run
time to support any kind of input keys for a given terminal,
making its operation even on the most wierd terminals a
breeze.
o Text and hex editors are available for you to use.
o Hotlist allows you to keep a list of common visited
locations (including ftp sites).
o Command completion: By pressing Alt-Tab in any place where a
filename or an executable are expected, the Midnight Commander
will complete for you the name. If you quickly press Alt-Tab
twice you can get a listbox with the possible completions
available.
o Subshell support: Run your commands by a real shell
interpreter. The Midnight Commander interacts with bash, tcsh
and zsh to provide you with all of the facilities available in
your shell.
o Find file command can now search inside the contents of
files.
o Background operations allows you to copy or move files from
any virtual file system while you do other tasks (ie, you can
do background ftp copies).
o Proxy support with our ftpfs.
o Linux file recovery: If you are using Linux system, you can
recover deleted files from an ext2fs partition with the
undelete file system. This is a low level file recovery
function that will recover files deleted by any program in
Linux.
Please note that the undelete file system can only recover
12 file system blocks if the file was deleted with a kernel
in the 2.0.x series. The 2.1.x series have fixed this and you
can recover all of the file contents there.
o External panelization: You can run any arbitrary external
command and the Midnight Commander will display the output
generated as a file listing that can be manipulated as a
regular directory.
o Emacs like key bindings in all of our widgets.
o Powerfull context dependant actions are available.
o Powerfull built-in file viewer: The file viewer, together
with the context dependant actions is used to format man pages
on the fly, coloring mail messages and more.
Midnight Commander editions:
----------------------------
The Midnight Commander may be compiled into three different editions:
the text mode edition, the Tk edition and the XView edition. Please
note that currently the only supported edition is the text mode
edition. The Tk and XView editions are included with the tar file but
are not finished and thus not supported.
Where to get more information:
------------------------------
There is a mailing list for discussion on enhancing the program, future
directions and announcements; if you want to subscribe, send mail to:
majordomo@roxanne.nuclecu.unam.mx
There is a WWW page for the Midnight Commander with the URL:
<http://mc.blackdown.org/mc/>.
The Midnight Commander:
-----------------------
The Midnight Commander is released under the GNU General Public License
version 2.0 or any later version. A copy of the file is included with
this distribution package.
If you have comments, you can send them to me:
miguel@roxanne.nuclecu.unam.mx
or if it would benefit more people, to the mailing list:
mc@roxanne.nuclecu.unam.mx
Help develop and enhance free software.
Mini-documentation:
-------------------
o Use the F-Keys for invoking the commands in the function key bar.
If your terminal doesn't support F-keys, you can use the <ESC digit>
sequence to invoke the corresponding F-digit key.
o Tab changes the current panel.
o All input lines have emacs-like key-bindings (command history is
accessed through the M-p and M-n keys).
o The panels accept C-n, C-p for browsing the panel (like in emacs).
o M-Enter copies the currently selected file name to the input line.
o M-Tab completes the current word (or tries to).
o The Virtual File System is a cute addition to the project, you may
browse in tar and compressed tar files as well as browsing remote
machines with the mcfs file system.
o Please read the manual page.
o Read the file src/TODO for the current projects.
You can access the whole documentation online with the F1 key,
although it's not as nice as the groff printed manual page :-)
Where you may obtain the Midnight Commander
-------------------------------------------
The software should be available by anonymous ftp at sunsite.unc.edu
in the directory /pub/Linux/utils/file and at ftp.nuclecu.unam.mx
in the directory /linux/local.
The last alpha versions are available at ftp.nuclecu.unam.mx in the
directory /linux/local/devel.
European mirrors of both version 3.1 and alpha versions are available
at sunsite.mff.cuni.cz in the directory /GNU/mc and at ftp.teuto.de
in the directory /lmb/mc.
Reporting problems
------------------
Please, send a detailed description of your problem to the
mc-bugs@roxanne.nuclecu.unam.mx address.
Include the version of the program, the operating system that you are
using, the compiler and compiler flags used to compile the program (if
you know them), what kind of distribution you are using (if a
GNU/Linux system).
If the program crashed and produces a core dump, please provide a
stack trace of the program.
You can do this by running dbx or gdb like this:
gdb mc core
(gdb) where

126
rosapps/mc/doc/readme.nt Normal file
View File

@@ -0,0 +1,126 @@
Midnight Commander for Windows NT and Windows '95
-------------------------------------------------
0. Hello
1. Compiling
2. Changes made
0. Hello
--------
Hello, this is the Midnight Commander port to Win32. It has many bugs, but is
quite stable now. Maybe you can help as an beta tester or as a programmer. In
either case you would like subscribe to mc-devel list
(see readme files in main doc on how to do this) and contact us.
1. Compiling
------------
1.1. Compiler
----------------
Microsoft Visual C++ for Windows NT (all versions, including 4.x) are supported.
In nt/makefile you can find an external makefile, and in nt/makefile.vc1.nt, vc4.nt
projects for the visual IDE. Two makefiles are add since the version 3.5.39. They
are produced from MS VC 4.x and are named as ntaxp.mak (for Windows NT AXP)
and ntint.mak (for Windows NT Intel). If you want to use them, you will have to
change the path coded in these two files.
Other compilers such as Watcom, or Borland tools should be quite
straightforward, but has not been tested.
Under Cygnus tools, apparently everything works just fine.
1.2. General issues
--------------------
Preprocessor
Define:
LIBDIR
_OS_NT - OS flag
OS2_NT - Flag for OS/2 and NT
HAVE_CONFIG_H - config.h flag
Includes:
So as to avoid chaos in include files, I decided to create some
fake includes for UNIX counterparts. The empty files you need to create are:
pwd.h grp.h
sys/param.h sys/time.h
1.3 Windowing Library
--------------------------------
Currently only support for S-lang windowing library is given. I know no curses
public library ported to Win32 consoles, and I think it is useless to port
it now. You may want to download the complete distribution it from
ftp://space.mit.edu/pub/davis.
2. Changes made
---------------
2.1. Changes to main code
-------------------------
They are enclosed in #ifdef _OS_NT or OS2_NT blocks.
Wrote something similar to statfs in UTIL.C
Wrote truncate.
Changed (almost) all references to "/" path slash with PATH_CHAR and strPATH_CHAR.
Changed name of CONTROL_FILE.
Changed name of shell and call to shell.
In some cases we supressed code. This is temporal (so that mc can compile). In
the future we will provide fake or true interfaces for these features.
- Links: creation and information on links are not supported in NT. We
should provide a fake interface for the local filesystem and
a true one for networked.
- GID/UID queries (get_user, owner, preserve UID/GID on copy, ...).
- TERMinals: all the code directly done with terminals must be supressed.
- Signals: deleted. Should support the native ones.
- pipes: had some trouble in ext.c and with error_pipes but soon will be fixed.
- Chown command: Not supported yet.
2.2. Files rewritten
--------------------
There are 3 files with so many changes that they have been moved to independent
archives (or OS dependent).
- Chmod.nt.c: this command will query and change attributes (hidden, system,
archive,...). Maybe we should write a real chmod (and also a
chown). It is not finished, but works almost fine. Look that
the stat st_mode member is filled with attributes, not modes.
- Cons.handler.nt.c: Supports same API as linux cons.handler.c. It allocates
a new console buffer and switches between the two when doing a
shell. The new allocated one is the used by Midnight commander.
(look that to make this we should also redirect standard handles)
- Key.nt.c: a static table maps Virtual Key codes to Curses-like Key codes.
Also mouse events are supported.
still preliminar.
- utilnt.c: Contains utilunix.c functions, with Win32 implementation
2.3. New files
--------------
- drive.nt.c: A Change Drive command has been implemented. Two lines
in main.c were included (in the left/right panel menus).
The funcs drive_cmd_a/b are implemented in this new file.
It will build a dialog with available drives as buttons.
bug: too many drives are not supported (think just 7). have
to rewrite to support more than one line.
- util.debug.c: developers-only utilities to trace Win32 API call error codes
- util.WinNT.c: Windows NT specific functions:
getuid(): Will check your priviledges and return 0 (root)
if you have Administrator priviledges.
- util.Win32.c: Windows NT & 95 utilities: (specific to Win32, no UNIX counterpart)
getEXEtype(): check if executable is CUI or GUI.
2.4. Changes made from me (Alexander Dong, ado@software-ag.de)
--------------------
I have hacked some codes for Windows NT AXP and NT Intel.
Drive.nt.c was rewritten for a beautiful Drive_Change dialog window.
All main source changed from me are marked with the comment /* .ado */.
I have also included two own Makefiles:
ntaxp.mak (for Windows NT Alpha) and
ntint.mak (for Windows 95/NT Intel).
You will have to change the path in these files before use them. They
are both for Microsoft Visual C++ 4.x.

86
rosapps/mc/edit/Makefile Normal file
View File

@@ -0,0 +1,86 @@
# Generated automatically from Makefile.in by configure.
srcdir = .
rootdir = $(srcdir)/..
include ../Make.common
CFLAGS = $(XCFLAGS)
CPPFLAGS = $(XCPPFLAGS)
LDFLAGS = $(XLDFLAGS)
DEFS = $(XDEFS)
LIBS = $(XLIBS) $(XLIB)
INSTALL = /usr/bin/install -c
INSTALL_PROGRAM = ${INSTALL}
INSTALL_DATA = ${INSTALL} -m 644
AR = /usr/bin/ar
#
# Distribution variables
#
EDITSRC = edit.c editcmd.c editwidget.c edit_key_translator.c editdraw.c \
edit.h editmenu.c editcmddef.h wordproc.c syntax.c editoptions.c
EDITOBJS = edit.o editcmd.o editwidget.o editdraw.o editmenu.o wordproc.o \
syntax.o editoptions.o
DIST = Makefile.in README.edit $(EDITSRC)
all: libedit.a
.c.o:
$(CC) -c $(CPPFLAGS) $(DEFS) $(CFLAGS) -DMIDNIGHT $<
check:
@echo no tests are supplied.
libedit.a: $(EDITOBJS)
$(RMF) $@
$(AR) cr $@ $(EDITOBJS)
-$(RANLIB) $@
mcedit:
-$(RMF) $(DESTDIR)$(bindir)/$(binprefix)mcedit
$(LN_S) mc $(DESTDIR)$(bindir)/$(binprefix)mcedit
showlibdep:
@echo 'OBJS="$(EDITOBJS)"'
cross:
$(MAKE) CC=gcc-linux CPP="gcc-linux -E" \
CPPFLAGS="$(CPPFLAGS) -I/usr/local/lib/gcc-lib/i386-linux-linux/include/ncurses "
TAGS: $(EDITSRC)
etags $(EDITSRC)
clean:
$(RMF) *.o core a.out libedit.a
realclean: clean
$(RMF) .depend
$(RMF) TAGS
$(RMF) *~
distclean:
-$(RMF) $(srcdir)/*~ $(srcdir)/*.o $(srcdir)/a.out
-$(RMF) $(srcdir)/core $(srcdir)/libedit.a
-if test $(srcdir) = .; then $(MAKE) realclean; fi
-$(RMF) $(srcdir)/Makefile
install: mcedit
uninstall:
-$(RMF) $(DESTDIR)$(bindir)/$(binprefix)mcedit
distcopy:
$(CP) $(DIST) ../../mc-$(VERSION)/edit
depend dep: mcdep
fastdeploc:
# ***Dependencies***Do not edit***
ifeq (.depend,$(wildcard .depend))
include .depend
endif
# ***End of dependencies***

2279
rosapps/mc/edit/edit.c Normal file

File diff suppressed because it is too large Load Diff

633
rosapps/mc/edit/edit.h Normal file
View File

@@ -0,0 +1,633 @@
#ifndef __EDIT_H
#define __EDIT_H
#ifdef MIDNIGHT
#ifdef HAVE_SLANG
#define HAVE_SYNTAXH 1
#endif
# include <stdio.h>
# include <stdarg.h>
# include <sys/types.h>
# ifdef HAVE_UNISTD_H
# include <unistd.h>
# endif
# include <string.h>
# include "../src/tty.h"
# include <sys/stat.h>
# include <errno.h>
# ifdef HAVE_FCNTL_H
# include <fcntl.h>
# endif
# include <stdlib.h>
# include <malloc.h>
#else /* ! MIDNIGHT */
# include "global.h"
# include <stdio.h>
# include <stdarg.h>
# include <sys/types.h>
# ifdef HAVE_UNISTD_H
# include <unistd.h>
# endif
# include <my_string.h>
# include <sys/stat.h>
# ifdef HAVE_FCNTL_H
# include <fcntl.h>
# endif
# include <stdlib.h>
# include <stdarg.h>
# if TIME_WITH_SYS_TIME
# include <sys/time.h>
# include <time.h>
# else
# if HAVE_SYS_TIME_H
# include <sys/time.h>
# else
# include <time.h>
# endif
# endif
# include "regex.h"
#endif
#ifndef MIDNIGHT
# include <signal.h>
# include <X11/Xlib.h>
# include <X11/Xutil.h>
# include <X11/Xresource.h>
# include "lkeysym.h"
# include "coolwidget.h"
# include "app_glob.c"
# include "coollocal.h"
# include "stringtools.h"
#else
# include "../src/main.h" /* for char *shell */
# include "../src/mad.h"
# include "../src/dlg.h"
# include "../src/widget.h"
# include "../src/color.h"
# include "../src/dialog.h"
# include "../src/mouse.h"
# include "../src/global.h"
# include "../src/help.h"
# include "../src/key.h"
# include "../src/wtools.h" /* for QuickWidgets */
# include "../src/win.h"
# include "../vfs/vfs.h"
# include "../src/menu.h"
# include "../src/regex.h"
# define WANT_WIDGETS
# define WIDGET_COMMAND (WIDGET_USER + 10)
# define N_menus 5
#endif
#define SEARCH_DIALOG_OPTION_NO_SCANF 1
#define SEARCH_DIALOG_OPTION_NO_REGEX 2
#define SEARCH_DIALOG_OPTION_NO_CASE 4
#define SEARCH_DIALOG_OPTION_BACKWARDS 8
#define SYNTAX_FILE "/.cedit/syntax"
#define CLIP_FILE "/.cedit/cooledit.clip"
#define MACRO_FILE "/.cedit/cooledit.macros"
#define BLOCK_FILE "/.cedit/cooledit.block"
#define ERROR_FILE "/.cedit/cooledit.error"
#define TEMP_FILE "/.cedit/cooledit.temp"
#define SCRIPT_FILE "/.cedit/cooledit.script"
#define EDIT_DIR "/.cedit"
#define EDIT_KEY_EMULATION_NORMAL 0
#define EDIT_KEY_EMULATION_EMACS 1
#define REDRAW_LINE (1 << 0)
#define REDRAW_LINE_ABOVE (1 << 1)
#define REDRAW_LINE_BELOW (1 << 2)
#define REDRAW_AFTER_CURSOR (1 << 3)
#define REDRAW_BEFORE_CURSOR (1 << 4)
#define REDRAW_PAGE (1 << 5)
#define REDRAW_IN_BOUNDS (1 << 6)
#define REDRAW_CHAR_ONLY (1 << 7)
#define REDRAW_COMPLETELY (1 << 8)
#define MOD_ABNORMAL (1 << 0)
#define MOD_UNDERLINED (1 << 1)
#define MOD_BOLD (1 << 2)
#define MOD_HIGHLIGHTED (1 << 3)
#define MOD_MARKED (1 << 4)
#define MOD_ITALIC (1 << 5)
#define MOD_CURSOR (1 << 6)
#define MOD_INVERSE (1 << 7)
#ifndef MIDNIGHT
# define EDIT_TEXT_HORIZONTAL_OFFSET 4
# define EDIT_TEXT_VERTICAL_OFFSET 3
#else
# define EDIT_TEXT_HORIZONTAL_OFFSET 0
# define EDIT_TEXT_VERTICAL_OFFSET 1
# define FONT_OFFSET_X 0
# define FONT_OFFSET_Y 0
#endif
#define EDIT_RIGHT_EXTREME option_edit_right_extreme
#define EDIT_LEFT_EXTREME option_edit_left_extreme
#define EDIT_TOP_EXTREME option_edit_top_extreme
#define EDIT_BOTTOM_EXTREME option_edit_bottom_extreme
#define MAX_MACRO_LENGTH 1024
/*there are a maximum of ... */
#define MAXBUFF 1024
/*... edit buffers, each of which is ... */
#define EDIT_BUF_SIZE 16384
/* ...bytes in size. */
/*x / EDIT_BUF_SIZE equals x >> ... */
#define S_EDIT_BUF_SIZE 14
/* x % EDIT_BUF_SIZE is equal to x && ... */
#define M_EDIT_BUF_SIZE 16383
#define SIZE_LIMIT (EDIT_BUF_SIZE * (MAXBUFF - 2))
/* Note a 16k stack is 64k of data and enough to hold (usually) around 10
pages of undo info. */
/* undo stack */
#define START_STACK_SIZE 32
/*some codes that may be pushed onto or returned from the undo stack: */
#define CURS_LEFT 601
#define CURS_RIGHT 602
#define DELETE 603
#define BACKSPACE 604
#define STACK_BOTTOM 605
#define CURS_LEFT_LOTS 606
#define CURS_RIGHT_LOTS 607
#define MARK_1 1000
#define MARK_2 700000000
#define KEY_PRESS 1400000000
/*Tabs spaces: (sofar only HALF_TAB_SIZE is used: */
#define TAB_SIZE option_tab_spacing
#define HALF_TAB_SIZE ((int) option_tab_spacing / 2)
struct macro {
short command;
short ch;
};
struct selection {
unsigned char * text;
int len;
};
#define RULE_CONTEXT 0x00FFF000UL
#define RULE_CONTEXT_SHIFT 12
#define RULE_WORD 0x00000FFFUL
#define RULE_WORD_SHIFT 0
#define RULE_ON_LEFT_BORDER 0x02000000UL
#define RULE_ON_RIGHT_BORDER 0x01000000UL
struct key_word {
char *keyword;
char first;
char last;
char *whole_word_chars_left;
char *whole_word_chars_right;
#define NO_COLOR ((unsigned long) -1);
int line_start;
int bg;
int fg;
};
struct context_rule {
int rule_number;
char *left;
char first_left;
char last_left;
char line_start_left;
char *right;
char first_right;
char last_right;
char line_start_right;
int single_char;
int between_delimiters;
char *whole_word_chars_left;
char *whole_word_chars_right;
unsigned char *conflicts;
char *keyword_first_chars;
char *keyword_last_chars;
/* first word is word[1] */
struct key_word **keyword;
};
struct editor_widget {
#ifdef MIDNIGHT
Widget widget;
#else
struct cool_widget *widget;
#endif
#define from_here num_widget_lines
int num_widget_lines;
int num_widget_columns;
#ifdef MIDNIGHT
int have_frame;
#else
int stopped;
#endif
char *filename; /* Name of the file */
char *dir; /* current directory */
/* dynamic buffers and curser position for editor: */
long curs1; /*position of the cursor from the beginning of the file. */
long curs2; /*position from the end of the file */
unsigned char *buffers1[MAXBUFF + 1]; /*all data up to curs1 */
unsigned char *buffers2[MAXBUFF + 1]; /*all data from end of file down to curs2 */
/* search variables */
long search_start; /* First character to start searching from */
int found_len; /* Length of found string or 0 if none was found */
long found_start; /* the found word from a search - start position */
/* display information */
long last_byte; /* Last byte of file */
long start_display; /* First char displayed */
long start_col; /* First displayed column, negative */
long max_column; /* The maximum cursor position ever reached used to calc hori scroll bar */
long curs_row; /*row position of curser on the screen */
long curs_col; /*column position on screen */
int force; /* how much of the screen do we redraw? */
unsigned char overwrite;
unsigned char modified; /*has the file been changed?: 1 if char inserted or
deleted at all since last load or save */
#ifdef MIDNIGHT
int delete_file; /* has the file been created in edit_load_file? Delete
it at end of editing when it hasn't been modified
or saved */
#endif
unsigned char highlight;
long prev_col; /*recent column position of the curser - used when moving
up or down past lines that are shorter than the current line */
long curs_line; /*line number of the cursor. */
long start_line; /*line nummber of the top of the page */
/* file info */
long total_lines; /*total lines in the file */
long mark1; /*position of highlight start */
long mark2; /*position of highlight end */
int column1; /*position of column highlight start */
int column2; /*position of column highlight end */
long bracket; /*position of a matching bracket */
/* undo stack and pointers */
unsigned long stack_pointer;
long *undo_stack;
unsigned long stack_size;
unsigned long stack_size_mask;
unsigned long stack_bottom;
struct stat stat;
/* syntax higlighting */
struct context_rule **rules;
long last_get_rule;
unsigned long rule;
char *syntax_type; /* description of syntax highlighting type being used */
int explicit_syntax; /* have we forced the syntax hi. type in spite of the filename? */
int to_here; /* dummy marker */
/* macro stuff */
int macro_i; /* -1 if not recording index to macro[] otherwise */
struct macro macro[MAX_MACRO_LENGTH];
};
typedef struct editor_widget WEdit;
#ifndef MIDNIGHT
void edit_render_expose (WEdit * edit, XExposeEvent * xexpose);
void edit_render_tidbits (struct cool_widget *w);
int eh_editor (CWidget * w, XEvent * xevent, CEvent * cwevent);
void edit_draw_menus (Window parent, int x, int y);
void edit_run_make (void);
void edit_change_directory (void);
int edit_man_page_cmd (WEdit * edit);
void edit_search_replace_dialog (Window parent, int x, int y, char **search_text, char **replace_text, char **arg_order, char *heading, int option);
void edit_search_dialog (WEdit * edit, char **search_text);
long edit_find (long search_start, unsigned char *exp, int *len, long last_byte, int (*get_byte) (void *, long), void *data);
void edit_set_foreground_colors (unsigned long normal, unsigned long bold, unsigned long italic);
void edit_set_background_colors (unsigned long normal, unsigned long abnormal, unsigned long marked, unsigned long marked_abnormal, unsigned long highlighted);
void edit_set_cursor_color (unsigned long c);
void draw_options_dialog (Window parent, int x, int y);
void CRefreshEditor (WEdit * edit);
void edit_set_user_command (void (*func) (WEdit *, int));
void edit_draw_this_line_proportional (WEdit * edit, long b, int curs_row, int start_column, int end_column);
unsigned char get_international_character (unsigned char key_press);
void edit_set_user_key_function (int (*user_def_key_func) (unsigned int, unsigned int, KeySym keysym));
#else
int edit_drop_hotkey_menu (WEdit * e, int key);
void edit_menu_cmd (WEdit * e);
void edit_init_menu_emacs (void);
void edit_init_menu_normal (void);
void edit_done_menu (void);
int edit_raw_key_query (char *heading, char *query, int cancel);
char *strcasechr (const unsigned char *s, int c);
int edit (const char *_file, int line);
int edit_translate_key (WEdit * edit, unsigned int x_keycode, long x_key, int x_state, int *cmd, int *ch);
#endif
int edit_get_byte (WEdit * edit, long byte_index);
char *edit_get_buffer_as_text (WEdit * edit);
int edit_load_file (WEdit * edit, const char *filename, const char *text, unsigned long text_size);
int edit_count_lines (WEdit * edit, long current, int upto);
long edit_move_forward (WEdit * edit, long current, int lines, long upto);
long edit_move_forward3 (WEdit * edit, long current, int cols, long upto);
long edit_move_backward (WEdit * edit, long current, int lines);
void edit_scroll_screen_over_cursor (WEdit * edit);
void edit_render_keypress (WEdit * edit);
void edit_scroll_upward (WEdit * edit, unsigned long i);
void edit_scroll_downward (WEdit * edit, int i);
void edit_scroll_right (WEdit * edit, int i);
void edit_scroll_left (WEdit * edit, int i);
int edit_get_col (WEdit * edit);
long edit_bol (WEdit * edit, long current);
long edit_eol (WEdit * edit, long current);
void edit_update_curs_row (WEdit * edit);
void edit_update_curs_col (WEdit * edit);
void edit_block_copy_cmd (WEdit * edit);
void edit_block_move_cmd (WEdit * edit);
int edit_block_delete_cmd (WEdit * edit);
int edit_delete (WEdit * edit);
void edit_insert (WEdit * edit, int c);
int edit_cursor_move (WEdit * edit, long increment);
void edit_push_action (WEdit * edit, long c,...);
void edit_push_key_press (WEdit * edit);
void edit_insert_ahead (WEdit * edit, int c);
int edit_save_file (WEdit * edit, const char *filename);
int edit_save_cmd (WEdit * edit);
int edit_save_confirm_cmd (WEdit * edit);
int edit_save_as_cmd (WEdit * edit);
WEdit *edit_init (WEdit * edit, int lines, int columns, const char *filename, const char *text, const char *dir, unsigned long text_size);
int edit_clean (WEdit * edit);
int edit_renew (WEdit * edit);
int edit_new_cmd (WEdit * edit);
int edit_reload (WEdit * edit, const char *filename, const char *text, const char *dir, unsigned long text_size);
int edit_load_cmd (WEdit * edit);
void edit_mark_cmd (WEdit * edit, int unmark);
void edit_set_markers (WEdit * edit, long m1, long m2, int c1, int c2);
void edit_push_markers (WEdit * edit);
void edit_quit_cmd (WEdit * edit);
void edit_replace_cmd (WEdit * edit, int again);
void edit_search_cmd (WEdit * edit, int again);
int edit_save_block_cmd (WEdit * edit);
int edit_insert_file_cmd (WEdit * edit);
int edit_insert_file (WEdit * edit, const char *filename);
void edit_block_process_cmd (WEdit * edit, const char *shell_cmd, int block);
char *catstrs (const char *first,...);
void edit_refresh_cmd (WEdit * edit);
void edit_date_cmd (WEdit * edit);
void edit_goto_cmd (WEdit * edit);
int eval_marks (WEdit * edit, long *start_mark, long *end_mark);
void edit_status (WEdit * edit);
int edit_execute_command (WEdit * edit, int command, int char_for_insertion);
int edit_execute_key_command (WEdit * edit, int command, int char_for_insertion);
void edit_update_screen (WEdit * edit);
int edit_printf (WEdit * e, const char *fmt,...);
int edit_print_string (WEdit * e, const char *s);
void edit_move_to_line (WEdit * e, long line);
void edit_move_display (WEdit * e, long line);
void edit_word_wrap (WEdit * edit);
unsigned char *edit_get_block (WEdit * edit, long start, long finish, int *l);
int edit_sort_cmd (WEdit * edit);
void edit_help_cmd (WEdit * edit);
void edit_left_word_move (WEdit * edit);
void edit_right_word_move (WEdit * edit);
void edit_get_selection (WEdit * edit);
int edit_save_macro_cmd (WEdit * edit, struct macro macro[], int n);
int edit_load_macro_cmd (WEdit * edit, struct macro macro[], int *n, int k);
void edit_delete_macro_cmd (WEdit * edit);
int edit_copy_to_X_buf_cmd (WEdit * edit);
int edit_cut_to_X_buf_cmd (WEdit * edit);
void edit_paste_from_X_buf_cmd (WEdit * edit);
void edit_paste_from_history (WEdit *edit);
void edit_split_filename (WEdit * edit, char *name);
#ifdef MIDNIGHT
#define CWidget Widget
#endif
void edit_set_syntax_change_callback (void (*callback) (CWidget *));
void edit_load_syntax (WEdit * edit, char **names, char *type);
void edit_free_syntax_rules (WEdit * edit);
void edit_get_syntax_color (WEdit * edit, long byte_index, int *fg, int *bg);
#ifdef MIDNIGHT
/* put OS2/NT/WIN95 defines here */
# ifdef OS2_NT
# define MY_O_TEXT O_TEXT
# else
# define MY_O_TEXT 0
# endif
# define FONT_PIX_PER_LINE 1
# define FONT_MEAN_WIDTH 1
# define get_sys_error(s) (s)
# define open mc_open
# define close(f) mc_close(f)
# define read(f,b,c) mc_read(f,b,c)
# define write(f,b,c) mc_write(f,b,c)
# define stat(f,s) mc_stat(f,s)
# define mkdir(s,m) mc_mkdir(s,m)
# define itoa MY_itoa
# define edit_get_load_file(d,f,h) input_dialog (h, _(" Enter file name: "), f)
# define edit_get_save_file(d,f,h) input_dialog (h, _(" Enter file name: "), f)
# define CMalloc(x) malloc(x)
# define set_error_msg(s) edit_init_error_msg = strdup(s)
# ifdef _EDIT_C
# define edit_error_dialog(h,s) set_error_msg(s)
char *edit_init_error_msg = NULL;
# else /* ! _EDIT_C */
# define edit_error_dialog(h,s) query_dialog (h, s, 0, 1, _("&Dismiss"))
# define edit_message_dialog(h,s) query_dialog (h, s, 0, 1, _("&Ok"))
extern char *edit_init_error_msg;
# endif /* ! _EDIT_C */
# define get_error_msg(s) edit_init_error_msg
# define edit_query_dialog2(h,t,a,b) query_dialog(h,t,0,2,a,b)
# define edit_query_dialog3(h,t,a,b,c) query_dialog(h,t,0,3,a,b,c)
# define edit_query_dialog4(h,t,a,b,c,d) query_dialog(h,t,0,4,a,b,c,d)
#else /* ! MIDNIGHT */
# define MY_O_TEXT 0
# define WIN_MESSAGES edit->widget->mainid, 20, 20
# define edit_get_load_file(d,f,h) CGetLoadFile(WIN_MESSAGES,d,f,h)
# define edit_get_save_file(d,f,h) CGetSaveFile(WIN_MESSAGES,d,f,h)
# define edit_error_dialog(h,t) CErrorDialog(WIN_MESSAGES,h,"%s",t)
# define edit_message_dialog(h,t) CMessageDialog(WIN_MESSAGES,0,h,"%s",t)
# define edit_query_dialog2(h,t,a,b) CQueryDialog(WIN_MESSAGES,h,t,a,b,0)
# define edit_query_dialog3(h,t,a,b,c) CQueryDialog(WIN_MESSAGES,h,t,a,b,c,0)
# define edit_query_dialog4(h,t,a,b,c,d) CQueryDialog(WIN_MESSAGES,h,t,a,b,c,d,0)
#endif /* ! MIDNIGHT */
extern char *home_dir;
#define NUM_SELECTION_HISTORY 32
#ifdef _EDIT_C
struct selection selection =
{0, 0};
int current_selection = 0;
/* Note: selection.text = selection_history[current_selection].text */
struct selection selection_history[NUM_SELECTION_HISTORY] =
{
{0, 0},
{0, 0},
{0, 0},
{0, 0},
{0, 0},
{0, 0},
{0, 0},
{0, 0},
{0, 0},
{0, 0},
};
#ifdef MIDNIGHT
/*
what editor are we going to emulate? one of EDIT_KEY_EMULATION_NORMAL
or EDIT_KEY_EMULATION_EMACS
*/
int edit_key_emulation = EDIT_KEY_EMULATION_NORMAL;
#endif /* ! MIDNIGHT */
int option_word_wrap_line_length = 72;
int option_typewriter_wrap = 0;
int option_auto_para_formatting = 0;
int option_international_characters = 0;
int option_tab_spacing = 8;
int option_fill_tabs_with_spaces = 0;
int option_return_does_auto_indent = 1;
int option_backspace_through_tabs = 0;
int option_fake_half_tabs = 1;
int option_save_mode = 0;
int option_backup_ext_int = -1;
int option_find_bracket = 1;
int option_max_undo = 8192;
int option_editor_fg_normal = 26;
int option_editor_fg_bold = 8;
int option_editor_fg_italic = 10;
int option_edit_right_extreme = 0;
int option_edit_left_extreme = 0;
int option_edit_top_extreme = 0;
int option_edit_bottom_extreme = 0;
int option_editor_bg_normal = 1;
int option_editor_bg_abnormal = 0;
int option_editor_bg_marked = 2;
int option_editor_bg_marked_abnormal = 9;
int option_editor_bg_highlighted = 12;
int option_editor_fg_cursor = 18;
char *option_whole_chars_search = "0123456789abcdefghijklmnopqrstuvwxyz_";
char *option_whole_chars_move = "0123456789abcdefghijklmnopqrstuvwxyz_; ,[](){}";
char *option_backup_ext = "~";
#else /* ! _EDIT_C */
extern struct selection selection;
extern struct selection selection_history[];
extern int current_selection;
#ifdef MIDNIGHT
/*
what editor are we going to emulate? one of EDIT_KEY_EMULATION_NORMAL
or EDIT_KEY_EMULATION_EMACS
*/
extern int edit_key_emulation;
#endif /* ! MIDNIGHT */
extern int option_word_wrap_line_length;
extern int option_typewriter_wrap;
extern int option_auto_para_formatting;
extern int option_international_characters;
extern int option_tab_spacing;
extern int option_fill_tabs_with_spaces;
extern int option_return_does_auto_indent;
extern int option_backspace_through_tabs;
extern int option_fake_half_tabs;
extern int option_save_mode;
extern int option_backup_ext_int;
extern int option_find_bracket;
extern int option_max_undo;
extern int option_editor_fg_normal;
extern int option_editor_fg_bold;
extern int option_editor_fg_italic;
extern int option_edit_right_extreme;
extern int option_edit_left_extreme;
extern int option_edit_top_extreme;
extern int option_edit_bottom_extreme;
extern int option_editor_bg_normal;
extern int option_editor_bg_abnormal;
extern int option_editor_bg_marked;
extern int option_editor_bg_marked_abnormal;
extern int option_editor_bg_highlighted;
extern int option_editor_fg_cursor;
extern char *option_whole_chars_search;
extern char *option_whole_chars_move;
extern char *option_backup_ext;
extern int edit_confirm_save;
#endif /* ! _EDIT_C */
#endif /* __EDIT_H */

View File

@@ -0,0 +1,294 @@
/*
these #defines are probably the ones most people will be interested in.
You can use these two #defines to hard code the key mappings --- just
uncomment the one you want. But only if you have trouble with learn
keys (which is unlikely).
*/
/* KEY_BACKSPACE is the key learned in the learn keys menu : */
#define OUR_BACKSPACE_KEY KEY_BACKSPACE
/* ...otherwise ctrl-h : */
/* #define OUR_BACKSPACE_KEY XCTRL ('h') */
/* ...otherwise 127 or DEL in ascii : */
/* #define OUR_BACKSPACE_KEY 0177 */
/* KEY_DC is the key learned in the learn keys menu */
#define OUR_DELETE_KEY KEY_DC
/* ...otherwise ctrl-d : */
/* #define OUR_DELETE_KEY XCTRL ('d') */
/* ...otherwise 127 or DEL in ascii : */
/* #define OUR_DELETE_KEY 0177 */
/*
This is #include'd into the function edit_translate_key in edit.c.
This sequence of code takes 'x_state' and 'x_key' and translates them
into either 'command' or 'char_for_insertion'. 'x_key' holds one of
KEY_NPAGE, KEY_HOME etc., and 'x_state' holds a bitwise inclusive OR of
CONTROL_PRESSED, ALT_PRESSED or SHIFT_PRESSED, although none may
be supported.
'command' is one of the editor commands editcmddef.h.
Almost any C code can go into this file. The code below is an example
that may by appended or modified by the user.
*/
/* look in this file for the list of commands : */
#include "editcmddef.h"
#define KEY_NUMLOCK ???
/* ordinary translations. (Some of this may be redundant.) Note that keys listed
first take priority when a key is assigned to more than one command */
static long *key_map;
static long cooledit_key_map[] =
{OUR_BACKSPACE_KEY, CK_BackSpace, OUR_DELETE_KEY, CK_Delete,
XCTRL ('d'), CK_Delete, '\n', CK_Enter,
KEY_PPAGE, CK_Page_Up, KEY_NPAGE, CK_Page_Down, KEY_LEFT, CK_Left,
KEY_RIGHT, CK_Right, KEY_UP, CK_Up, KEY_DOWN, CK_Down, ALT ('\t'), CK_Return, ALT ('\n'), CK_Return,
KEY_HOME, CK_Home, KEY_END, CK_End, '\t', CK_Tab, XCTRL ('u'), CK_Undo, KEY_IC, CK_Toggle_Insert,
XCTRL ('o'), CK_Load, KEY_F (3), CK_Mark, KEY_F (5), CK_Copy,
KEY_F (6), CK_Move, KEY_F (8), CK_Remove, KEY_F (12), CK_Save_As,
KEY_F (2), CK_Save, XCTRL ('n'), CK_New,
XCTRL ('l'), CK_Refresh, ESC_CHAR, CK_Exit, KEY_F (10), CK_Exit,
KEY_F (19), /*C formatter */ CK_Pipe_Block (0),
XCTRL ('p'), /*spell check */ CK_Pipe_Block (1),
KEY_F (15), CK_Insert_File,
XCTRL ('f'), CK_Save_Block, KEY_F (1), CK_Help,
ALT ('t'), CK_Sort, ALT ('m'), CK_Mail,
XCTRL ('z'), CK_Word_Left, XCTRL ('x'), CK_Word_Right,
KEY_F (4), CK_Replace, KEY_F (7), CK_Find, KEY_F (14), CK_Replace_Again,
XCTRL ('h'), CK_BackSpace, ALT ('l'), CK_Goto, ALT ('L'), CK_Goto, XCTRL ('y'), CK_Delete_Line,
KEY_F (17), CK_Find_Again, ALT ('p'), CK_Paragraph_Format, 0};
static long emacs_key_map[] =
{OUR_BACKSPACE_KEY, CK_BackSpace, OUR_DELETE_KEY, CK_Delete, '\n', CK_Enter,
KEY_PPAGE, CK_Page_Up, KEY_NPAGE, CK_Page_Down, KEY_LEFT, CK_Left,
KEY_RIGHT, CK_Right, KEY_UP, CK_Up, KEY_DOWN, CK_Down, ALT ('\t'), CK_Return, ALT ('\n'), CK_Return,
KEY_HOME, CK_Home, KEY_END, CK_End, '\t', CK_Tab, XCTRL ('u'), CK_Undo, KEY_IC, CK_Toggle_Insert,
XCTRL ('o'), CK_Load, KEY_F (3), CK_Mark, KEY_F (5), CK_Copy,
KEY_F (6), CK_Move, KEY_F (8), CK_Remove, KEY_F (12), CK_Save_As,
KEY_F (2), CK_Save, ALT ('p'), CK_Paragraph_Format,
ALT ('t'), CK_Sort,
XCTRL ('a'), CK_Home, XCTRL ('e'), CK_End,
XCTRL ('b'), CK_Left, XCTRL ('f'), CK_Right,
XCTRL ('n'), CK_Down, XCTRL ('p'), CK_Up,
XCTRL ('d'), CK_Delete,
XCTRL ('v'), CK_Page_Down, ALT ('v'), CK_Page_Up,
XCTRL ('@'), CK_Mark,
XCTRL ('k'), CK_Delete_To_Line_End,
XCTRL ('s'), CK_Find,
ALT ('b'), CK_Word_Left, ALT ('f'), CK_Word_Right,
XCTRL ('w'), CK_XCut,
XCTRL ('y'), CK_XPaste,
ALT ('w'), CK_XStore,
XCTRL ('l'), CK_Refresh, ESC_CHAR, CK_Exit, KEY_F (10), CK_Exit,
KEY_F (19), /*C formatter */ CK_Pipe_Block (0),
ALT ('$'), /*spell check */ CK_Pipe_Block (1),
KEY_F (15), CK_Insert_File,
KEY_F (1), CK_Help,
KEY_F (4), CK_Replace, KEY_F (7), CK_Find, KEY_F (14), CK_Replace_Again,
XCTRL ('h'), CK_BackSpace, ALT ('l'), CK_Goto, ALT ('L'), CK_Goto,
KEY_F (17), CK_Find_Again,
ALT ('<'), CK_Beginning_Of_Text,
ALT ('>'), CK_End_Of_Text,
0, 0};
static long key_pad_map[10] =
{XCTRL ('o'), KEY_END, KEY_DOWN, KEY_NPAGE, KEY_LEFT,
KEY_DOWN, KEY_RIGHT, KEY_HOME, KEY_UP, KEY_PPAGE};
#define DEFAULT_NUM_LOCK 0
static int num_lock = DEFAULT_NUM_LOCK;
int i = 0;
switch (edit_key_emulation) {
case EDIT_KEY_EMULATION_NORMAL:
key_map = cooledit_key_map;
break;
case EDIT_KEY_EMULATION_EMACS:
key_map = emacs_key_map;
if (x_key == XCTRL ('x')) {
int ext_key;
ext_key = edit_raw_key_query (" Ctrl-X ", _(" Emacs key: "), 0);
switch (ext_key) {
case 's':
command = CK_Save;
goto fin;
case 'x':
command = CK_Exit;
goto fin;
case 'k':
command = CK_New;
goto fin;
case 'e':
command = CK_Macro (edit_raw_key_query (_(" Execute Macro "), _(" Press macro hotkey: "), 1));
if (command == CK_Macro (0))
command = -1;
goto fin;
}
goto fin;
}
break;
}
if (x_key == XCTRL ('q')) {
char_for_insertion = edit_raw_key_query (_(" Insert Literal "), _(" Press any key: "), 0);
goto fin;
}
if (x_key == XCTRL ('a') && edit_key_emulation != EDIT_KEY_EMULATION_EMACS) {
command = CK_Macro (edit_raw_key_query (" Execute Macro ", " Press macro hotkey: ", 1));
if (command == CK_Macro (0))
command = -1;
goto fin;
}
/* edit is a pointer to the widget */
if (edit)
if (x_key == XCTRL ('r')) {
command = edit->macro_i < 0 ? CK_Begin_Record_Macro : CK_End_Record_Macro;
goto fin;
}
/* if (x_key == KEY_NUMLOCK) {
num_lock = 1 - num_lock;
return 1;
}
*/
/* first translate the key-pad */
if (num_lock) {
if (x_key >= '0' && x_key <= '9') {
x_key = key_pad_map[x_key - '0'];
}
if (x_key == '.') {
x_key = KEY_DC;
}
}
if ((x_state & SHIFT_PRESSED) && (x_state & CONTROL_PRESSED)) {
switch (x_key) {
case KEY_PPAGE:
command = CK_Beginning_Of_Text_Highlight;
goto fin;
case KEY_NPAGE:
command = CK_End_Of_Text_Highlight;
goto fin;
case KEY_LEFT:
command = CK_Word_Left_Highlight;
goto fin;
case KEY_RIGHT:
command = CK_Word_Right_Highlight;
goto fin;
}
}
if ((x_state & SHIFT_PRESSED) && !(x_state & CONTROL_PRESSED)) {
switch (x_key) {
case KEY_PPAGE:
command = CK_Page_Up_Highlight;
goto fin;
case KEY_NPAGE:
command = CK_Page_Down_Highlight;
goto fin;
case KEY_LEFT:
command = CK_Left_Highlight;
goto fin;
case KEY_RIGHT:
command = CK_Right_Highlight;
goto fin;
case KEY_UP:
command = CK_Up_Highlight;
goto fin;
case KEY_DOWN:
command = CK_Down_Highlight;
goto fin;
case KEY_HOME:
command = CK_Home_Highlight;
goto fin;
case KEY_END:
command = CK_End_Highlight;
goto fin;
case KEY_IC:
command = CK_XPaste;
goto fin;
case KEY_DC:
command = CK_XCut;
goto fin;
}
}
/* things that need a control key */
if (x_state & CONTROL_PRESSED) {
switch (x_key) {
case KEY_F (2):
command = CK_Save_As;
goto fin;
case KEY_F (4):
command = CK_Replace_Again;
goto fin;
case KEY_F (7):
command = CK_Find_Again;
goto fin;
case KEY_BACKSPACE:
command = CK_Undo;
goto fin;
case KEY_PPAGE:
command = CK_Beginning_Of_Text;
goto fin;
case KEY_NPAGE:
command = CK_End_Of_Text;
goto fin;
case KEY_UP:
command = CK_Scroll_Up;
goto fin;
case KEY_DOWN:
command = CK_Scroll_Down;
goto fin;
case KEY_LEFT:
command = CK_Word_Left;
goto fin;
case KEY_RIGHT:
command = CK_Word_Right;
goto fin;
case KEY_IC:
command = CK_XStore;
goto fin;
case KEY_DC:
command = CK_Remove;
goto fin;
}
}
/* an ordinary insertable character */
if (x_key < 256 && is_printable (x_key)) {
char_for_insertion = x_key;
goto fin;
}
/* other commands */
i = 0;
while (key_map[i] != x_key && (key_map[i] || key_map[i + 1]))
i += 2;
command = key_map[i + 1];
if (command)
goto fin;
/* Function still not found for this key, so try macro's */
/* This allows the same macro to be
enabled by either eg "ALT('f')" or "XCTRL('f')" or "XCTRL('a'), 'f'" */
/* key.h: #define ALT(x) (0x200 | (x)) */
if (x_key & ALT (0)) { /* is an alt key ? */
command = CK_Macro (x_key - ALT (0));
goto fin;
}
/* key.h: #define XCTRL(x) ((x) & 31) */
if (x_key < ' ') { /* is a ctrl key ? */
command = CK_Macro (x_key);
goto fin;
}
fin:

2541
rosapps/mc/edit/editcmd.c Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,138 @@
#ifndef __EDIT_CMD_DEF_H
#define __EDIT_CMD_DEF_H
/* in the distant future, keyboards will be invented with a
seperate key for each one of these commands *sigh* */
/* cursor movements */
#define CK_No_Command -1
#define CK_BackSpace 1
#define CK_Delete 2
#define CK_Enter 3
#define CK_Page_Up 4
#define CK_Page_Down 5
#define CK_Left 6
#define CK_Right 7
#define CK_Word_Left 8
#define CK_Word_Right 9
#define CK_Up 10
#define CK_Down 11
#define CK_Home 12
#define CK_End 13
#define CK_Tab 14
#define CK_Undo 15
#define CK_Beginning_Of_Text 16
#define CK_End_Of_Text 17
#define CK_Scroll_Up 18
#define CK_Scroll_Down 19
#define CK_Return 20
#define CK_Begin_Page 21
#define CK_End_Page 22
#define CK_Delete_Word_Left 23
#define CK_Delete_Word_Right 24
#define CK_Paragraph_Up 25
#define CK_Paragraph_Down 26
/* file commands */
#define CK_Save 101
#define CK_Load 102
#define CK_New 103
#define CK_Save_As 104
/* block commands */
#define CK_Mark 201
#define CK_Copy 202
#define CK_Move 203
#define CK_Remove 204
#define CK_Unmark 206
#define CK_Save_Block 207
/* search and replace */
#define CK_Find 301
#define CK_Find_Again 302
#define CK_Replace 303
#define CK_Replace_Again 304
/* misc */
#define CK_Insert_File 401
#define CK_Exit 402
#define CK_Toggle_Insert 403
#define CK_Help 404
#define CK_Date 405
#define CK_Refresh 406
#define CK_Goto 407
#define CK_Delete_Line 408
#define CK_Delete_To_Line_End 409
#define CK_Delete_To_Line_Begin 410
#define CK_Man_Page 411
#define CK_Sort 412
#define CK_Mail 413
#define CK_Cancel 414
#define CK_Complete 415
#define CK_Paragraph_Format 416
/* application control */
#define CK_Save_Desktop 451
#define CK_New_Window 452
#define CK_Cycle 453
#define CK_Menu 454
#define CK_Save_And_Quit 455
#define CK_Run_Another 456
#define CK_Check_Save_And_Quit 457
/* macro */
#define CK_Begin_Record_Macro 501
#define CK_End_Record_Macro 502
#define CK_Delete_Macro 503
/* highlight commands */
#define CK_Page_Up_Highlight 604
#define CK_Page_Down_Highlight 605
#define CK_Left_Highlight 606
#define CK_Right_Highlight 607
#define CK_Word_Left_Highlight 608
#define CK_Word_Right_Highlight 609
#define CK_Up_Highlight 610
#define CK_Down_Highlight 611
#define CK_Home_Highlight 612
#define CK_End_Highlight 613
#define CK_Beginning_Of_Text_Highlight 614
#define CK_End_Of_Text_Highlight 615
#define CK_Begin_Page_Highlight 616
#define CK_End_Page_Highlight 617
#define CK_Scroll_Up_Highlight 618
#define CK_Scroll_Down_Highlight 619
#define CK_Paragraph_Up_Highlight 620
#define CK_Paragraph_Down_Highlight 621
/* X clipboard operations */
#define CK_XStore 701
#define CK_XCut 702
#define CK_XPaste 703
#define CK_Selection_History 704
#ifdef MIDNIGHT /* cooledit now has its own full-featured script editor and executor */
/*
Process a block through a shell command: CK_Pipe_Block(i) executes shell_cmd[i].
shell_cmd[i] must process the file ~/cooledit.block and output ~/cooledit.block
which is then inserted into the text in place of the original block. shell_cmd[i] must
also produce a file homedir/cooledit.error . If this file is not empty an error will
have been assumed to have occured, and the block will not be replaced.
TODO: bring up a viewer to display the error message instead of inserting
it into the text, which is annoying.
*/
#define CK_Pipe_Block(i) (1000+(i))
#define SHELL_COMMANDS_i {"/.cedit/edit.indent.rc", "/.cedit/edit.spell.rc", /* and so on */ 0};
#else
#define CK_User_Command(i) (1000+(i))
#endif
/* execute a macro */
#define CK_Macro(i) (2000+(i))
#define CK_Last_Macro CK_Macro(0x7FFF)
#endif

648
rosapps/mc/edit/editdraw.c Normal file
View File

@@ -0,0 +1,648 @@
/* editor text drawing.
Copyright (C) 1996, 1997 the Free Software Foundation
Authors: 1996, 1997 Paul Sheer
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include <config.h>
#include "edit.h"
#define MAX_LINE_LEN 1024
#ifndef MIDNIGHT
#include "app_glob.c"
#include "coollocal.h"
#else
#include "../src/mad.h"
#endif
static void status_string (WEdit * edit, char *s, int w, int fill, int font_width)
{
int i;
char t[160]; /* 160 just to be sure */
/* The field lengths just prevents the status line from shortening to much */
sprintf (t, "[%c%c%c%c] %2ld:%3ld+%2ld=%3ld/%3ld - *%-4ld/%4ldb=%3d",
edit->mark1 != edit->mark2 ? 'B' : '-',
edit->modified ? 'M' : '-', edit->macro_i < 0 ? '-' : 'R',
edit->overwrite == 0 ? '-' : 'O',
edit->curs_col / font_width, edit->start_line + 1, edit->curs_row,
edit->curs_line + 1, edit->total_lines + 1, edit->curs1,
edit->last_byte, edit->curs1 < edit->last_byte
? edit_get_byte (edit, edit->curs1) : -1);
sprintf (s, "%.*s", w + 1, t);
i = strlen (s);
s[i] = ' ';
i = w;
do {
if (strchr (" +-*=/:b", s[i])) /* chop off the last word/number */
break;
s[i] = fill;
} while (i--);
s[i] = fill;
s[w] = 0;
}
#ifdef MIDNIGHT
/* how to get as much onto the status line as is numerically possible :) */
void edit_status (WEdit * edit)
{
int w, i, t;
char *s;
w = edit->widget.cols - (edit->have_frame * 2);
s = malloc (w + 15);
if (w < 4)
w = 4;
memset (s, ' ', w);
attrset (SELECTED_COLOR);
if (w > 4) {
widget_move (edit, edit->have_frame, edit->have_frame);
i = w > 24 ? 18 : w - 6;
i = i < 13 ? 13 : i;
sprintf (s, "%s", name_trunc (edit->filename ? edit->filename : "", i));
i += strlen (s);
s[strlen (s)] = ' ';
t = w - 20;
if (t < 0)
t = 0;
status_string (edit, s + 20, t, ' ', 1);
} else {
s[w] = 0;
}
printw ("%.*s", w, s);
attrset (NORMAL_COLOR);
free (s);
}
#else
extern int fixed_font;
void rerender_text (CWidget * wdt);
void edit_status (WEdit * edit)
{
if ((edit->widget->options & EDITOR_NO_TEXT)) {
return;
} else {
int w, i, t;
CWidget *wdt;
char id[33];
char s[160];
w = edit->num_widget_columns - 1;
if (w > 150)
w = 150;
if (w < 0)
w = 0;
memset (s, 0, w);
if (w > 1) {
i = w > 24 ? 18 : w - 6;
i = i < 13 ? 13 : i;
sprintf (s, "%s", name_trunc (edit->filename ? edit->filename : "", i));
i = strlen (s);
s[i] = ' ';
s[i+1] = ' ';
t = w - i - 2;
if (t < 0)
t = 0;
status_string (edit, s + i + 2, t, 0, FONT_MEAN_WIDTH);
}
s[w] = 0;
strcpy (id, edit->widget->ident);
strcat (id, ".text");
wdt = CIdent (id);
free (wdt->text);
wdt->text = strdup (s);
CSetWidgetSize (id, edit->widget->width, wdt->height);
rerender_text (wdt);
}
}
#endif
/* boolean */
int cursor_in_screen (WEdit * edit, long row)
{
if (row < 0 || row >= edit->num_widget_lines)
return 0;
else
return 1;
}
/* returns rows from the first displayed line to the cursor */
int cursor_from_display_top (WEdit * edit)
{
if (edit->curs1 < edit->start_display)
return -edit_move_forward (edit, edit->curs1, 0, edit->start_display);
else
return edit_move_forward (edit, edit->start_display, 0, edit->curs1);
}
/* returns how far the cursor is out of the screen */
int cursor_out_of_screen (WEdit * edit)
{
int row = cursor_from_display_top (edit);
if (row >= edit->num_widget_lines)
return row - edit->num_widget_lines + 1;
if (row < 0)
return row;
return 0;
}
#ifndef MIDNIGHT
extern unsigned char per_char[256];
int edit_width_of_long_printable (int c);
#endif
/* this scrolls the text so that cursor is on the screen */
void edit_scroll_screen_over_cursor (WEdit * edit)
{
int p, l;
int outby;
p = edit_get_col (edit);
edit_update_curs_row (edit);
#ifdef MIDNIGHT
outby = p + edit->start_col - edit->num_widget_columns + 1 + (EDIT_RIGHT_EXTREME + edit->found_len);
#else
outby = p + edit->start_col - edit->widget->width + 7 + (EDIT_RIGHT_EXTREME + edit->found_len) * FONT_MEAN_WIDTH + edit_width_of_long_printable (edit_get_byte (edit, edit->curs1));
#endif
if (outby > 0)
edit_scroll_right (edit, outby);
#ifdef MIDNIGHT
outby = EDIT_LEFT_EXTREME - p - edit->start_col;
#else
outby = EDIT_LEFT_EXTREME * FONT_MEAN_WIDTH - p - edit->start_col;
#endif
if (outby > 0)
edit_scroll_left (edit, outby);
p = edit->curs_row;
l = 0;
if (edit->found_len != 0)
l = edit->num_widget_lines / 5;
outby = p - edit->num_widget_lines + 1 + EDIT_BOTTOM_EXTREME + l;
if (outby > 0)
edit_scroll_downward (edit, outby);
outby = EDIT_TOP_EXTREME - p + l;
if (outby > 0)
edit_scroll_upward (edit, outby);
edit_update_curs_row (edit);
}
#ifndef MIDNIGHT
#define CACHE_WIDTH 256
#define CACHE_HEIGHT 128
int EditExposeRedraw = 0;
int EditClear = 0;
/* background colors: marked is refers to mouse highlighting, highlighted refers to a found string. */
unsigned long edit_abnormal_color, edit_marked_abnormal_color;
unsigned long edit_highlighted_color, edit_marked_color;
unsigned long edit_normal_background_color;
/* foreground colors */
unsigned long edit_normal_foreground_color, edit_bold_color;
unsigned long edit_italic_color;
/* cursor color */
unsigned long edit_cursor_color;
void edit_set_foreground_colors (unsigned long normal, unsigned long bold, unsigned long italic)
{
edit_normal_foreground_color = normal;
edit_bold_color = bold;
edit_italic_color = italic;
}
void edit_set_background_colors (unsigned long normal, unsigned long abnormal, unsigned long marked, unsigned long marked_abnormal, unsigned long highlighted)
{
edit_abnormal_color = abnormal;
edit_marked_abnormal_color = marked_abnormal;
edit_marked_color = marked;
edit_highlighted_color = highlighted;
edit_normal_background_color = normal;
}
void edit_set_cursor_color (unsigned long c)
{
edit_cursor_color = c;
}
#else
#define BOLD_COLOR MARKED_COLOR
#define UNDERLINE_COLOR VIEW_UNDERLINED_COLOR
#define MARK_COLOR SELECTED_COLOR
#define DEF_COLOR NORMAL_COLOR
static void set_color (int font)
{
attrset (font);
}
#define edit_move(x,y) widget_move(edit, y, x);
static void print_to_widget (WEdit * edit, long row, int start_col, float start_col_real, long end_col, unsigned int line[])
{
int x = (float) start_col_real + EDIT_TEXT_HORIZONTAL_OFFSET;
int x1 = start_col + EDIT_TEXT_HORIZONTAL_OFFSET;
int y = row + EDIT_TEXT_VERTICAL_OFFSET;
set_color (DEF_COLOR);
edit_move (x1, y);
hline (' ', end_col + 1 - EDIT_TEXT_HORIZONTAL_OFFSET - x1);
edit_move (x + FONT_OFFSET_X, y + FONT_OFFSET_Y);
{
unsigned int *p = line;
int textchar = ' ';
long style;
while (*p) {
style = *p >> 8;
textchar = *p & 0xFF;
#ifdef HAVE_SYNTAXH
if (!(style & (0xFF - MOD_ABNORMAL - MOD_CURSOR)))
SLsmg_set_color ((*p & 0x007F0000) >> 16);
#endif
if (style & MOD_ABNORMAL)
textchar = '.';
if (style & MOD_HIGHLIGHTED) {
set_color (BOLD_COLOR);
} else if (style & MOD_MARKED) {
set_color (MARK_COLOR);
}
if (style & MOD_UNDERLINED) {
set_color (UNDERLINE_COLOR);
}
if (style & MOD_BOLD) {
set_color (BOLD_COLOR);
}
addch (textchar);
p++;
}
}
}
/* b pointer to begining of line */
static void edit_draw_this_line (WEdit * edit, long b, long row, long start_col, long end_col)
{
static unsigned int line[MAX_LINE_LEN];
unsigned int *p = line;
long m1 = 0, m2 = 0, q;
int col, start_col_real;
unsigned int c;
int fg, bg;
int i;
edit_get_syntax_color (edit, b - 1, &fg, &bg);
q = edit_move_forward3 (edit, b, start_col - edit->start_col, 0);
start_col_real = (col = (int) edit_move_forward3 (edit, b, 0, q)) + edit->start_col;
if (col + 16 > -edit->start_col) {
eval_marks (edit, &m1, &m2);
if (row <= edit->total_lines - edit->start_line) {
while (col <= end_col - edit->start_col) {
*p = 0;
if (q == edit->curs1)
*p |= MOD_CURSOR * 256;
if (q >= m1 && q < m2)
*p |= MOD_MARKED * 256;
if (q == edit->bracket)
*p |= MOD_BOLD * 256;
if (q >= edit->found_start && q < edit->found_start + edit->found_len)
*p |= MOD_HIGHLIGHTED * 256;
c = edit_get_byte (edit, q);
edit_get_syntax_color (edit, q, &fg, &bg);
/* we don't use bg for mc - fg contains both */
*p |= fg << 16;
q++;
switch (c) {
case '\n':
col = end_col - edit->start_col + 1; /* quit */
*(p++) |= ' ';
break;
case '\t':
i = TAB_SIZE - ((int) col % TAB_SIZE);
*p |= ' ';
c = *(p++) & (0xFFFFFFFF - MOD_CURSOR * 256);
col += i;
while (--i)
*(p++) = c;
break;
case '\r':
break;
default:
if (is_printable (c)) {
*(p++) |= c;
} else {
*(p++) = '.';
*p |= (256 * MOD_ABNORMAL);
}
col++;
break;
}
}
}
} else {
start_col_real = start_col = 0;
}
*p = 0;
print_to_widget (edit, row, start_col, start_col_real, end_col, line);
}
#endif
#ifdef MIDNIGHT
#define key_pending(x) (!is_idle())
#else
int edit_mouse_pending (Window win);
#define edit_draw_this_line edit_draw_this_line_proportional
static int key_pending (WEdit * edit)
{
if (!(edit->force & REDRAW_COMPLETELY) && !EditExposeRedraw)
return CKeyPending ();
return 0;
}
#endif
/* b for pointer to begining of line */
static void edit_draw_this_char (WEdit * edit, long curs, long row)
{
int b = edit_bol (edit, curs);
#ifdef MIDNIGHT
edit_draw_this_line (edit, b, row, 0, edit->num_widget_columns - 1);
#else
edit_draw_this_line (edit, b, row, 0, edit->widget->width);
#endif
}
/* cursor must be in screen for other than REDRAW_PAGE passed in force */
void render_edit_text (WEdit * edit, long start_row, long start_column, long end_row, long end_column)
{
long row = 0, curs_row;
static int prev_curs_row = 0;
static long prev_start_display = 0;
static int prev_start_col = 0;
static long prev_curs = 0;
#ifndef MIDNIGHT
static Window prev_win = 0;
#endif
int fg, bg;
int force = edit->force;
long b;
/*
if the position of the page has not moved then we can draw the cursor character only.
This will prevent line flicker when using arrow keys.
*/
if ((!(force & REDRAW_CHAR_ONLY)) || (force & REDRAW_PAGE)
#ifndef MIDNIGHT
|| prev_win != edit->widget->winid
#endif
) {
if (!(force & REDRAW_IN_BOUNDS)) { /* !REDRAW_IN_BOUNDS means to ignore bounds and redraw whole rows */
start_row = 0;
end_row = edit->num_widget_lines - 1;
start_column = 0;
#ifdef MIDNIGHT
end_column = edit->num_widget_columns - 1;
#else
end_column = edit->widget->width;
#endif
}
if (force & REDRAW_PAGE) {
row = start_row;
b = edit_move_forward (edit, edit->start_display, start_row, 0);
while (row <= end_row) {
if (key_pending (edit))
goto exit_render;
edit_draw_this_line (edit, b, row, start_column, end_column);
b = edit_move_forward (edit, b, 1, 0);
row++;
}
} else {
curs_row = edit->curs_row;
if (force & REDRAW_BEFORE_CURSOR) {
if (start_row < curs_row) {
long upto = curs_row - 1 <= end_row ? curs_row - 1 : end_row;
row = start_row;
b = edit->start_display;
while (row <= upto) {
if (key_pending (edit))
goto exit_render;
edit_draw_this_line (edit, b, row, start_column, end_column);
b = edit_move_forward (edit, b, 1, 0);
}
}
}
/* if (force & REDRAW_LINE) { ---> default */
b = edit_bol (edit, edit->curs1);
if (curs_row >= start_row && curs_row <= end_row) {
if (key_pending (edit))
goto exit_render;
edit_draw_this_line (edit, b, curs_row, start_column, end_column);
}
if (force & REDRAW_AFTER_CURSOR) {
if (end_row > curs_row) {
row = curs_row + 1 < start_row ? start_row : curs_row + 1;
b = edit_move_forward (edit, b, 1, 0);
while (row <= end_row) {
if (key_pending (edit))
goto exit_render;
edit_draw_this_line (edit, b, row, start_column, end_column);
b = edit_move_forward (edit, b, 1, 0);
row++;
}
}
}
if (force & REDRAW_LINE_ABOVE && curs_row >= 1) {
row = curs_row - 1;
b = edit_move_backward (edit, edit_bol (edit, edit->curs1), 1);
if (row >= start_row && row <= end_row) {
if (key_pending (edit))
goto exit_render;
edit_draw_this_line (edit, b, row, start_column, end_column);
}
}
if (force & REDRAW_LINE_BELOW && row < edit->num_widget_lines - 1) {
row = curs_row + 1;
b = edit_bol (edit, edit->curs1);
b = edit_move_forward (edit, b, 1, 0);
if (row >= start_row && row <= end_row) {
if (key_pending (edit))
goto exit_render;
edit_draw_this_line (edit, b, row, start_column, end_column);
}
}
}
} else {
if (prev_curs_row < edit->curs_row) { /* with the new text highlighting, we must draw from the top down */
edit_draw_this_char (edit, prev_curs, prev_curs_row);
edit_draw_this_char (edit, edit->curs1, edit->curs_row);
} else {
edit_draw_this_char (edit, edit->curs1, edit->curs_row);
edit_draw_this_char (edit, prev_curs, prev_curs_row);
}
}
edit->force = 0;
prev_curs_row = edit->curs_row;
prev_curs = edit->curs1;
prev_start_display = edit->start_display;
prev_start_col = edit->start_col;
#ifndef MIDNIGHT
prev_win = edit->widget->winid;
#endif
exit_render:
edit_get_syntax_color (edit, edit->start_display - 1, &fg, &bg);
}
#ifndef MIDNIGHT
void edit_convert_expose_to_area (XExposeEvent * xexpose, int *row1, int *col1, int *row2, int *col2)
{
*col1 = xexpose->x - EDIT_TEXT_HORIZONTAL_OFFSET;
*row1 = (xexpose->y - EDIT_TEXT_VERTICAL_OFFSET) / FONT_PIX_PER_LINE;
*col2 = xexpose->x + xexpose->width + EDIT_TEXT_HORIZONTAL_OFFSET + 3;
*row2 = (xexpose->y + xexpose->height - EDIT_TEXT_VERTICAL_OFFSET) / FONT_PIX_PER_LINE;
}
void edit_render_tidbits (CWidget * wdt)
{
int isfocussed;
int w = wdt->width, h = wdt->height;
Window win;
win = wdt->winid;
isfocussed = (win == CGetFocus ());
CSetColor (COLOR_FLAT);
if (isfocussed) {
render_bevel (win, 0, 0, w - 1, h - 1, 3, 1); /*most outer border bevel */
} else {
render_bevel (win, 2, 2, w - 3, h - 3, 1, 1); /*border bevel */
render_bevel (win, 0, 0, w - 1, h - 1, 2, 0); /*most outer border bevel */
}
}
void edit_set_space_width (int s);
extern int option_long_whitespace;
#endif
void edit_render (WEdit * edit, int page, int row_start, int col_start, int row_end, int col_end)
{
int f = 0;
if (page) /* if it was an expose event, 'page' would be set */
edit->force |= REDRAW_PAGE | REDRAW_IN_BOUNDS;
f = edit->force & (REDRAW_PAGE | REDRAW_COMPLETELY);
#ifdef MIDNIGHT
if (edit->force & REDRAW_COMPLETELY)
redraw_labels (edit->widget.parent, (Widget *) edit);
#else
if (option_long_whitespace)
edit_set_space_width (per_char[' '] * 2);
else
edit_set_space_width (per_char[' ']);
edit_set_foreground_colors (
color_palette (option_editor_fg_normal),
color_palette (option_editor_fg_bold),
color_palette (option_editor_fg_italic)
);
edit_set_background_colors (
color_palette (option_editor_bg_normal),
color_palette (option_editor_bg_abnormal),
color_palette (option_editor_bg_marked),
color_palette (option_editor_bg_marked_abnormal),
color_palette (option_editor_bg_highlighted)
);
edit_set_cursor_color (
color_palette (option_editor_fg_cursor)
);
if (!EditExposeRedraw)
set_cursor_position (0, 0, 0, 0, 0, 0, 0, 0, 0);
#endif
render_edit_text (edit, row_start, col_start, row_end, col_end);
if (edit->force) /* edit->force != 0 means a key was pending and the redraw
was halted, so next time we must redraw everything in case stuff
was left undrawn from a previous key press */
edit->force |= REDRAW_PAGE;
#ifndef MIDNIGHT
if (f) {
edit_render_tidbits (edit->widget);
CSetColor (edit_normal_background_color);
CLine (edit->widget->winid, 3, 3, 3, edit->widget->height - 4);
}
#endif
}
#ifndef MIDNIGHT
void edit_render_expose (WEdit * edit, XExposeEvent * xexpose)
{
int row_start, col_start, row_end, col_end;
EditExposeRedraw = 1;
edit->num_widget_lines = (edit->widget->height - 6) / FONT_PIX_PER_LINE;
edit->num_widget_columns = (edit->widget->width - 7) / FONT_MEAN_WIDTH;
if (edit->force & (REDRAW_PAGE | REDRAW_COMPLETELY)) {
edit->force |= REDRAW_PAGE | REDRAW_COMPLETELY;
edit_render_keypress (edit);
} else {
edit_convert_expose_to_area (xexpose, &row_start, &col_start, &row_end, &col_end);
edit_render (edit, 1, row_start, col_start, row_end, col_end);
}
EditExposeRedraw = 0;
}
void edit_render_keypress (WEdit * edit)
{
edit_render (edit, 0, 0, 0, 0, 0);
}
#else
void edit_render_keypress (WEdit * edit)
{
edit_render (edit, 0, 0, 0, 0, 0);
}
#endif

455
rosapps/mc/edit/editmenu.c Normal file
View File

@@ -0,0 +1,455 @@
/* editor menu definitions and initialisation
Copyright (C) 1996 the Free Software Foundation
Authors: 1996, 1997 Paul Sheer
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include <config.h>
#include "edit.h"
#include "editcmddef.h"
#ifdef MIDNIGHT
#include "../src/mad.h"
extern int edit_key_emulation;
extern WEdit *wedit;
extern WButtonBar *edit_bar;
extern Dlg_head *edit_dlg;
extern WMenu *edit_menubar;
#undef edit_message_dialog
#define edit_message_dialog(w,x,y,h,s) query_dialog (h, s, 0, 1, "&Ok")
#define CFocus(x)
static void menu_cmd (int i)
{
send_message (wedit->widget.parent, (Widget *) wedit, WIDGET_COMMAND, i);
}
static void menu_key (int i)
{
send_message (wedit->widget.parent, (Widget *) wedit, WIDGET_KEY, i);
}
void edit_wrap_cmd ()
{
char *f;
char s[12];
sprintf (s, "%d", option_word_wrap_line_length);
f = input_dialog (_(" Word wrap "),
/* Not essential to translate */
_(" Enter line length, 0 for off: "), s);
if (f) {
if (*f) {
option_word_wrap_line_length = atoi (f);
free (f);
}
}
}
void edit_about_cmd ()
{
edit_message_dialog (wedit->mainid, 20, 20, " About ",
"\n"
" Cooledit v2.1\n"
"\n"
" Copyright (C) 1996 the Free Software Foundation\n"
"\n"
" A user friendly text editor written\n"
" for the Midnight Commander.\n"
);
}
void menu_mail_cmd (void) { menu_cmd (CK_Mail); }
void menu_load_cmd (void) { menu_cmd (CK_Load); }
void menu_new_cmd (void) { menu_cmd (CK_New); }
void menu_save_cmd (void) { menu_cmd (CK_Save); }
void menu_save_as_cmd (void) { menu_cmd (CK_Save_As); }
void menu_insert_file_cmd (void) { menu_cmd (CK_Insert_File); }
void menu_quit_cmd (void) { menu_cmd (CK_Exit); }
void menu_mark_cmd (void) { menu_cmd (CK_Mark); }
void menu_ins_cmd (void) { menu_cmd (CK_Toggle_Insert); }
void menu_copy_cmd (void) { menu_cmd (CK_Copy); }
void menu_move_cmd (void) { menu_cmd (CK_Move); }
void menu_delete_cmd (void) { menu_cmd (CK_Remove); }
void menu_cut_cmd (void) { menu_cmd (CK_Save_Block); }
void menu_search_cmd (void) { menu_cmd (CK_Find); }
void menu_search_again_cmd (void) { menu_cmd (CK_Find_Again); }
void menu_replace_cmd (void) { menu_cmd (CK_Replace); }
void menu_begin_record_cmd (void) { menu_cmd (CK_Begin_Record_Macro); }
void menu_end_record_cmd (void) { menu_cmd (CK_End_Record_Macro); }
void menu_wrap_cmd (void) { edit_wrap_cmd (); }
void menu_exec_macro_cmd (void) { menu_key (XCTRL ('a')); }
void menu_exec_macro_delete_cmd (void) { menu_cmd (CK_Delete_Macro); }
void menu_c_form_cmd (void) { menu_key (KEY_F (19)); }
void menu_ispell_cmd (void) { menu_cmd (CK_Pipe_Block (1)); }
void menu_sort_cmd (void) { menu_cmd (CK_Sort); }
void menu_date_cmd (void) { menu_cmd (CK_Date); }
void menu_undo_cmd (void) { menu_cmd (CK_Undo); }
void menu_beginning_cmd (void) { menu_cmd (CK_Beginning_Of_Text); }
void menu_end_cmd (void) { menu_cmd (CK_End_Of_Text); }
void menu_refresh_cmd (void) { menu_cmd (CK_Refresh); }
void menu_goto_line (void) { menu_cmd (CK_Goto); }
void menu_lit_cmd (void) { menu_key (XCTRL ('q')); }
void menu_format_paragraph (void) { menu_cmd (CK_Paragraph_Format); }
void edit_options_dialog (void);
void menu_options (void) { edit_options_dialog (); }
static menu_entry FileMenu[] =
{
{' ', N_("&Open/load... C-o"), 'O', menu_load_cmd},
{' ', N_("&New C-n"), 'N', menu_new_cmd},
{' ', "", ' ', 0},
{' ', N_("&Save F2"), 'S', menu_save_cmd},
{' ', N_("save &As... F12"), 'A', menu_save_as_cmd},
{' ', "", ' ', 0},
{' ', N_("&Insert file... F15"), 'I', menu_insert_file_cmd},
{' ', N_("copy to &File... C-f"), 'F', menu_cut_cmd},
{' ', "", ' ', 0},
{' ', N_("a&Bout... "), 'B', edit_about_cmd},
{' ', "", ' ', 0},
{' ', N_("&Quit F10"), 'Q', menu_quit_cmd}
};
static menu_entry FileMenuEmacs[] =
{
{' ', N_("&Open/load... C-o"), 'O', menu_load_cmd},
{' ', N_("&New C-x k"), 'N', menu_new_cmd},
{' ', "", ' ', 0},
{' ', N_("&Save F2"), 'S', menu_save_cmd},
{' ', N_("save &As... F12"), 'A', menu_save_as_cmd},
{' ', "", ' ', 0},
{' ', N_("&Insert file... F15"), 'I', menu_insert_file_cmd},
{' ', N_("copy to &File... "), 'F', menu_cut_cmd},
{' ', "", ' ', 0},
{' ', N_("a&Bout... "), 'B', edit_about_cmd},
{' ', "", ' ', 0},
{' ', N_("&Quit F10"), 'Q', menu_quit_cmd}
};
static menu_entry EditMenu[] =
{
{' ', N_("&Toggle Mark F3"), 'T', menu_mark_cmd},
{' ', "", ' ', 0},
{' ', N_("toggle &Ins/overw Ins"), 'I', menu_ins_cmd},
{' ', "", ' ', 0},
{' ', N_("&Copy F5"), 'C', menu_copy_cmd},
{' ', N_("&Move F6"), 'M', menu_move_cmd},
{' ', N_("&Delete F8"), 'D', menu_delete_cmd},
{' ', "", ' ', 0},
{' ', N_("&Undo C-u"), 'U', menu_undo_cmd},
{' ', "", ' ', 0},
{' ', N_("&Beginning C-PgUp"), 'B', menu_beginning_cmd},
{' ', N_("&End C-PgDn"), 'E', menu_end_cmd}
};
static menu_entry EditMenuEmacs[] =
{
{' ', N_("&Toggle Mark F3"), 'T', menu_mark_cmd},
{' ', "", ' ', 0},
{' ', N_("toggle &Ins/overw Ins"), 'I', menu_ins_cmd},
{' ', "", ' ', 0},
{' ', N_("&Copy F5"), 'C', menu_copy_cmd},
{' ', N_("&Move F6"), 'M', menu_move_cmd},
{' ', N_("&Delete F8"), 'D', menu_delete_cmd},
{' ', "", ' ', 0},
{' ', N_("&Undo C-u"), 'U', menu_undo_cmd},
{' ', "", ' ', 0},
{' ', N_("&Beginning C-PgUp"), 'B', menu_beginning_cmd},
{' ', N_("&End C-PgDn"), 'E', menu_end_cmd}
};
static menu_entry SearReplMenu[] =
{
{' ', N_("&Search... F7"), 'S', menu_search_cmd},
{' ', N_("search &Again F17"), 'A', menu_search_again_cmd},
{' ', N_("&Replace... F4"), 'R', menu_replace_cmd}
};
static menu_entry SearReplMenuEmacs[] =
{
{' ', N_("&Search... F7"), 'S', menu_search_cmd},
{' ', N_("search &Again F17"), 'A', menu_search_again_cmd},
{' ', N_("&Replace... F4"), 'R', menu_replace_cmd}
};
static menu_entry CmdMenu[] =
{
{' ', N_("&Goto line... M-l"), 'G', menu_goto_line},
{' ', "", ' ', 0},
{' ', N_("insert &Literal... C-q"), 'L', menu_lit_cmd},
{' ', "", ' ', 0},
{' ', N_("&Refresh screen C-l"), 'R', menu_refresh_cmd},
{' ', "", ' ', 0},
{' ', N_("&Start record macro C-r"), 'S', menu_begin_record_cmd},
{' ', N_("&Finish record macro... C-r"), 'F', menu_end_record_cmd},
{' ', N_("&Execute macro... C-a, KEY"), 'E', menu_exec_macro_cmd},
{' ', N_("delete macr&O... "), 'O', menu_exec_macro_delete_cmd},
{' ', "", ' ', 0},
{' ', N_("insert &Date/time "), 'D', menu_date_cmd},
{' ', "", ' ', 0},
{' ', N_("format p&Aragraph M-p"), 'A', menu_format_paragraph},
{' ', N_("'ispell' s&Pell check C-p"), 'P', menu_ispell_cmd},
{' ', N_("sor&T... M-t"), 'T', menu_sort_cmd},
{' ', N_("'indent' &C Formatter F19"), 'C', menu_c_form_cmd},
{' ', N_("&Mail... "), 'M', menu_mail_cmd}
};
static menu_entry CmdMenuEmacs[] =
{
{' ', N_("&Goto line... M-l"), 'G', menu_goto_line},
{' ', "", ' ', 0},
{' ', N_("insert &Literal... C-q"), 'L', menu_lit_cmd},
{' ', "", ' ', 0},
{' ', N_("&Refresh screen C-l"), 'R', menu_refresh_cmd},
{' ', "", ' ', 0},
{' ', N_("&Start record macro C-r"), 'S', menu_begin_record_cmd},
{' ', N_("&Finish record macro... C-r"), 'F', menu_end_record_cmd},
{' ', N_("&Execute macro... C-x e, KEY"), 'E', menu_exec_macro_cmd},
{' ', N_("delete macr&O... "), 'o', menu_exec_macro_delete_cmd},
{' ', "", ' ', 0},
{' ', N_("insert &Date/time "), 'D', menu_date_cmd},
{' ', "", ' ', 0},
{' ', N_("format p&Aragraph M-p"), 'a', menu_format_paragraph},
{' ', N_("'ispell' s&Pell check M-$"), 'P', menu_ispell_cmd},
{' ', N_("sor&T... M-t"), 'T', menu_sort_cmd},
{' ', N_("'indent' &C Formatter F19"), 'C', menu_c_form_cmd}
};
extern void menu_save_mode_cmd (void);
static menu_entry OptMenu[] =
{
{' ', N_("&General... "), 'G', menu_options},
{' ', N_("&Save mode..."), 'S', menu_save_mode_cmd}
#if 0
{' ', N_("&Layout..."), 'L', menu_layout_cmd}
#endif
};
static menu_entry OptMenuEmacs[] =
{
{' ', N_("&General... "), 'G', menu_options},
{' ', N_("&Save mode..."), 'S', menu_save_mode_cmd}
#if 0
{' ', N_("&Layout..."), 'L', menu_layout_cmd}
#endif
};
#define menu_entries(x) sizeof(x)/sizeof(menu_entry)
Menu EditMenuBar[N_menus];
void edit_init_menu_normal (void)
{
EditMenuBar[0] = create_menu (_(" File "), FileMenu, menu_entries (FileMenu));
EditMenuBar[1] = create_menu (_(" Edit "), EditMenu, menu_entries (EditMenu));
EditMenuBar[2] = create_menu (_(" Sear/Repl "), SearReplMenu, menu_entries (SearReplMenu));
EditMenuBar[3] = create_menu (_(" Command "), CmdMenu, menu_entries (CmdMenu));
EditMenuBar[4] = create_menu (_(" Options "), OptMenu, menu_entries (OptMenu));
}
void edit_init_menu_emacs (void)
{
EditMenuBar[0] = create_menu (_(" File "), FileMenuEmacs, menu_entries (FileMenuEmacs));
EditMenuBar[1] = create_menu (_(" Edit "), EditMenuEmacs, menu_entries (EditMenuEmacs));
EditMenuBar[2] = create_menu (_(" Sear/Repl "), SearReplMenuEmacs, menu_entries (SearReplMenuEmacs));
EditMenuBar[3] = create_menu (_(" Command "), CmdMenuEmacs, menu_entries (CmdMenuEmacs));
EditMenuBar[4] = create_menu (_(" Options "), OptMenuEmacs, menu_entries (OptMenuEmacs));
}
void edit_done_menu (void)
{
int i;
for (i = 0; i < N_menus; i++)
destroy_menu (EditMenuBar[i]);
}
void edit_drop_menu_cmd (WEdit * e, int which)
{
if (edit_menubar->active)
return;
edit_menubar->active = 1;
edit_menubar->dropped = drop_menus;
edit_menubar->previous_selection = which >= 0 ? which : dlg_item_number (edit_dlg);
if (which >= 0)
edit_menubar->selected = which;
dlg_select_widget (edit_dlg, edit_menubar);
}
void edit_menu_cmd (WEdit * e)
{
edit_drop_menu_cmd (e, -1);
}
int edit_drop_hotkey_menu (WEdit * e, int key)
{
int m = 0;
switch (key) {
case ALT ('f'):
if (edit_key_emulation == EDIT_KEY_EMULATION_EMACS)
return 0;
m = 0;
break;
case ALT ('e'):
m = 1;
break;
case ALT ('s'):
m = 2;
break;
case ALT ('c'):
m = 3;
break;
case ALT ('o'):
m = 4;
break;
default:
return 0;
}
edit_drop_menu_cmd (e, m);
return 1;
}
#else /* !MIDNIGHT */
extern CWidget *wedit;
void CSetEditMenu (const char *ident)
{
wedit = CIdent (ident);
}
CWidget *CGetEditMenu (void)
{
return wedit;
}
static void menu_cmd (unsigned long i)
{
XEvent e;
if (wedit) {
memset (&e, 0, sizeof (XEvent));
e.type = EditorCommand;
e.xkey.keycode = i;
e.xkey.window = wedit->winid;
CFocus (wedit);
CSendEvent (&e);
}
}
void CEditMenuCommand (int i)
{
menu_cmd ((unsigned long) i);
}
static void menu_key (KeySym i, int state)
{
int cmd, ch;
if (edit_translate_key (0, i, state, &cmd, &ch)) {
if (cmd > 0)
menu_cmd (cmd);
}
}
static void menu_ctrl_key (unsigned long i)
{
menu_key ((KeySym) i, ControlMask);
}
void CDrawEditMenuButtons (const char *ident, Window parent, Window focus_return, int x, int y)
{
int d;
CDrawMenuButton (catstrs (ident, ".filemenu", 0), parent, focus_return, x, y, AUTO_WIDTH, AUTO_HEIGHT, 8,
/* The following are menu options. Do not change the key bindings (eg. C-o) and preserve '\t' */
_(" File "),
_("Open...\tC-o"), '~', menu_cmd, CK_Load,
_("New\tC-n"), '~', menu_cmd, CK_New,
"", ' ', 0, 0,
_("Save\tF2"), '~', menu_cmd, CK_Save,
_("Save as...\tF12"), '~', menu_cmd, CK_Save_As,
"", ' ', 0, 0,
_("Insert file...\tF15"), '~', menu_cmd, CK_Insert_File,
_("Copy to file...\tC-f"), '~', menu_cmd, CK_Save_Block
);
/* Tool hint */
CSetToolHint (catstrs (ident, ".filemenu", 0), _("Disk operations"));
CGetHintPos (&x, &d);
CDrawMenuButton (catstrs (ident, ".editmenu", 0), parent, focus_return, x, y, AUTO_WIDTH, AUTO_HEIGHT, 14,
_(" Edit "),
_("Toggle mark\tF3"), '~', menu_cmd, CK_Mark,
"", ' ', 0, 0,
_("Toggle insert/overwrite\tIns"), '~', menu_cmd, CK_Toggle_Insert,
"", ' ', 0, 0,
_("Copy block to cursor\tF5"), '~', menu_cmd, CK_Copy,
_("Move block to cursor\tF6"), '~', menu_cmd, CK_Move,
_("Delete block\tF8/C-Del"), '~', menu_cmd, CK_Remove,
"", ' ', 0, 0,
_("Copy block to clipbrd\tC-Ins"), '~', menu_cmd, CK_XStore,
_("Cut block to clipbrd\tS-Del"), '~', menu_cmd, CK_XCut,
_("Paste block from clipbrd\tS-Ins"), '~', menu_cmd, CK_XPaste,
_("Selection history\tM-Ins"), '~', menu_cmd, CK_Selection_History,
"", ' ', 0, 0,
_("Undo\tC-BackSpace"), '~', menu_cmd, CK_Undo
);
/* Tool hint */
CSetToolHint (catstrs (ident, ".editmenu", 0), _("Manipulating blocks of text"));
CGetHintPos (&x, &d);
CDrawMenuButton (catstrs (ident, ".searchmenu", 0), parent, focus_return, x, y, AUTO_WIDTH, AUTO_HEIGHT, 4,
_(" Srch/Replce "),
_("Search...\tF7"), '~', menu_cmd, CK_Find,
_("Search again\tF17"), '~', menu_cmd, CK_Find_Again,
_("Replace...\tF4"), '~', menu_cmd, CK_Replace,
_("Replace again\tF14"), '~', menu_cmd, CK_Replace_Again
);
/* Tool hint */
CSetToolHint (catstrs (ident, ".searchmenu", 0), _("Search for and replace text"));
CGetHintPos (&x, &d);
CDrawMenuButton (catstrs (ident, ".commandmenu", 0), parent, focus_return, x, y, AUTO_WIDTH, AUTO_HEIGHT, 9,
_(" Command "),
_("Goto line...\tM-l"), '~', menu_cmd, CK_Goto,
"", ' ', 0, 0,
_("Start record macro\tC-r"), '~', menu_cmd, CK_Begin_Record_Macro,
_("Finish record macro...\tC-r"), '~', menu_cmd, CK_End_Record_Macro,
_("Execute macro...\tC-a, KEY"), '~', menu_ctrl_key, XK_a,
_("Delete macro...\t"), '~', menu_cmd, CK_Delete_Macro,
"", ' ', 0, 0,
_("Insert date/time\tC-d"), '~', menu_cmd, CK_Date,
_("Format paragraph\tM-p"), '~', menu_cmd, CK_Paragraph_Format
);
/* Tool hint */
CSetToolHint (catstrs (ident, ".commandmenu", 0), _("Macros and internal commands"));
}
#endif /* !MIDNIGHT */

View File

@@ -0,0 +1,182 @@
/* editor options dialog box
Copyright (C) 1996, 1997 the Free Software Foundation
Authors: 1996, 1997 Paul Sheer
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include <config.h>
#include "edit.h"
#define OPT_DLG_H 15
#define OPT_DLG_W 72
#ifndef USE_INTERNAL_EDIT
#define USE_INTERNAL_EDIT 1
#endif
#include "../src/main.h" /* extern int option_this_and_that ... */
char *key_emu_str[] =
{"Intuitive", "Emacs"};
char *wrap_str[] =
{N_("None"), N_("Dynamic paragraphing"), N_("Type writer wrap")};
extern int option_syntax_highlighting;
void edit_options_dialog (void)
{
char wrap_length[32], tab_spacing[32], *p, *q;
int wrap_mode = 0;
int tedit_key_emulation = edit_key_emulation;
int toption_fill_tabs_with_spaces = option_fill_tabs_with_spaces;
int tedit_confirm_save = edit_confirm_save;
int tedit_syntax_highlighting = option_syntax_highlighting;
int toption_return_does_auto_indent = option_return_does_auto_indent;
int toption_backspace_through_tabs = option_backspace_through_tabs;
int toption_fake_half_tabs = option_fake_half_tabs;
QuickWidget quick_widgets[] =
{
/*0 */
{quick_button, 6, 10, OPT_DLG_H - 3, OPT_DLG_H, "&Cancel", 0, B_CANCEL, 0,
0, XV_WLAY_DONTCARE, NULL},
/*1 */
{quick_button, 2, 10, OPT_DLG_H - 3, OPT_DLG_H, "&Ok", 0, B_ENTER, 0,
0, XV_WLAY_DONTCARE, NULL},
/*2 */
{quick_label, OPT_DLG_W / 2, OPT_DLG_W, OPT_DLG_H - 4, OPT_DLG_H, "Word wrap line length : ", 0, 0,
0, 0, XV_WLAY_DONTCARE, NULL},
/*3 */
{quick_input, OPT_DLG_W / 2 + 24, OPT_DLG_W, OPT_DLG_H - 4, OPT_DLG_H, "", OPT_DLG_W / 2 - 4 - 24, 0,
0, 0, XV_WLAY_DONTCARE, "i"},
/*4 */
{quick_label, OPT_DLG_W / 2, OPT_DLG_W, OPT_DLG_H - 5, OPT_DLG_H, "Tab spacing : ", 0, 0,
0, 0, XV_WLAY_DONTCARE, NULL},
/*5 */
{quick_input, OPT_DLG_W / 2 + 24, OPT_DLG_W, OPT_DLG_H - 5, OPT_DLG_H, "", OPT_DLG_W / 2 - 4 - 24, 0,
0, 0, XV_WLAY_DONTCARE, "i"},
/*6 */
#if !defined(MIDNIGHT) || defined(HAVE_SYNTAXH)
#define OA 1
{quick_checkbox, OPT_DLG_W / 2 + 1, OPT_DLG_W, OPT_DLG_H - 7, OPT_DLG_H, "syntax h&Ighlighting", 8, 0,
0, 0, XV_WLAY_DONTCARE, NULL},
#else
#define OA 0
#endif
/*7 */
{quick_checkbox, OPT_DLG_W / 2 + 1, OPT_DLG_W, OPT_DLG_H - 8, OPT_DLG_H, "confir&M before saving", 6, 0,
0, 0, XV_WLAY_DONTCARE, NULL},
/*8 */
{quick_checkbox, OPT_DLG_W / 2 + 1, OPT_DLG_W, OPT_DLG_H - 9, OPT_DLG_H, "&Fill tabs with spaces", 0, 0,
0, 0, XV_WLAY_DONTCARE, NULL},
/*9 */
{quick_checkbox, OPT_DLG_W / 2 + 1, OPT_DLG_W, OPT_DLG_H - 10, OPT_DLG_H, "&Return does auto indent", 0, 0,
0, 0, XV_WLAY_DONTCARE, NULL},
/*10 */
{quick_checkbox, OPT_DLG_W / 2 + 1, OPT_DLG_W, OPT_DLG_H - 11, OPT_DLG_H, "&Backspace through tabs", 0, 0,
0, 0, XV_WLAY_DONTCARE, NULL},
/*11 */
{quick_checkbox, OPT_DLG_W / 2 + 1, OPT_DLG_W, OPT_DLG_H - 12, OPT_DLG_H, "&Fake half tabs", 0, 0,
0, 0, XV_WLAY_DONTCARE, NULL},
/*12 */
{quick_radio, 5, OPT_DLG_W, OPT_DLG_H - 6, OPT_DLG_H, "", 3, 0,
0, wrap_str, XV_WLAY_DONTCARE, "wrapm"},
/*13 */
{quick_label, 4, OPT_DLG_W, OPT_DLG_H - 7, OPT_DLG_H, N_("Wrap mode"), 0, 0,
0, 0, XV_WLAY_DONTCARE, NULL},
/*14 */
{quick_radio, 5, OPT_DLG_W, OPT_DLG_H - 11, OPT_DLG_H, "", 2, 0,
0, key_emu_str, XV_WLAY_DONTCARE, "keyemu"},
/*15 */
{quick_label, 4, OPT_DLG_W, OPT_DLG_H - 12, OPT_DLG_H, N_("Key emulation"), 0, 0,
0, 0, XV_WLAY_DONTCARE, NULL},
{0}};
sprintf (wrap_length, "%d", option_word_wrap_line_length);
sprintf (tab_spacing, "%d", option_tab_spacing);
quick_widgets[3].text = wrap_length;
quick_widgets[3].str_result = &p;
quick_widgets[5].text = tab_spacing;
quick_widgets[5].str_result = &q;
quick_widgets[5 + OA].result = &tedit_syntax_highlighting;
quick_widgets[6 + OA].result = &tedit_confirm_save;
quick_widgets[7 + OA].result = &toption_fill_tabs_with_spaces;
quick_widgets[8 + OA].result = &toption_return_does_auto_indent;
quick_widgets[9 + OA].result = &toption_backspace_through_tabs;
quick_widgets[10 + OA].result = &toption_fake_half_tabs;
if (option_auto_para_formatting)
wrap_mode = 1;
else if (option_typewriter_wrap)
wrap_mode = 2;
else
wrap_mode = 0;
quick_widgets[11 + OA].result = &wrap_mode;
quick_widgets[11 + OA].value = wrap_mode;
quick_widgets[13 + OA].result = &tedit_key_emulation;
quick_widgets[13 + OA].value = tedit_key_emulation;
{
QuickDialog Quick_options =
{OPT_DLG_W, OPT_DLG_H, -1, 0, " Editor Options ",
"", "quick_input", 0};
Quick_options.widgets = quick_widgets;
if (quick_dialog (&Quick_options) != B_CANCEL) {
if (p) {
option_word_wrap_line_length = atoi (p);
free (p);
}
if (q) {
option_tab_spacing = atoi (q);
if (option_tab_spacing < 0)
option_tab_spacing = 2;
option_tab_spacing += option_tab_spacing & 1;
free (q);
}
option_syntax_highlighting = *quick_widgets[5 + OA].result;
edit_confirm_save = *quick_widgets[6 + OA].result;
option_fill_tabs_with_spaces = *quick_widgets[7 + OA].result;
option_return_does_auto_indent = *quick_widgets[8 + OA].result;
option_backspace_through_tabs = *quick_widgets[9 + OA].result;
option_fake_half_tabs = *quick_widgets[10 + OA].result;
if (*quick_widgets[11 + OA].result == 1) {
option_auto_para_formatting = 1;
option_typewriter_wrap = 0;
} else if (*quick_widgets[11 + OA].result == 2) {
option_auto_para_formatting = 0;
option_typewriter_wrap = 1;
} else {
option_auto_para_formatting = 0;
option_typewriter_wrap = 0;
}
edit_key_emulation = *quick_widgets[13 + OA].result;
return;
} else {
return;
}
}
}

1082
rosapps/mc/edit/editwidget.c Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,84 @@
srcdir = @srcdir@
VPATH = @srcdir@
rootdir = $(srcdir)/..
@MCFG@@MCF@
CFLAGS = $(XCFLAGS)
CPPFLAGS = $(XCPPFLAGS)
LDFLAGS = $(XLDFLAGS)
DEFS = $(XDEFS)
LIBS = @SHADOWLIB@ $(XLIBS) @TERMNET@ @PAMLIBS@ $(XLIB)
INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_DATA = @INSTALL_DATA@
AR = @AR@
#
# Distribution variables
#
EDITSRC = edit.c editcmd.c editwidget.c edit_key_translator.c editdraw.c \
edit.h editmenu.c editcmddef.h wordproc.c syntax.c editoptions.c
EDITOBJS = edit.o editcmd.o editwidget.o editdraw.o editmenu.o wordproc.o \
syntax.o editoptions.o
DIST = Makefile.in README.edit $(EDITSRC)
all: @LIBEDIT_A@
.c.o:
$(CC) -c $(CPPFLAGS) $(DEFS) $(CFLAGS) -DMIDNIGHT $<
check:
@echo no tests are supplied.
libedit.a: $(EDITOBJS)
$(RMF) $@
$(AR) cr $@ $(EDITOBJS)
-$(RANLIB) $@
mcedit:
-$(RMF) $(DESTDIR)$(bindir)/$(binprefix)mcedit
$(LN_S) mc $(DESTDIR)$(bindir)/$(binprefix)mcedit
showlibdep:
@echo 'OBJS="$(EDITOBJS)"'
cross:
$(MAKE) CC=gcc-linux CPP="gcc-linux -E" \
CPPFLAGS="$(CPPFLAGS) -I/usr/local/lib/gcc-lib/i386-linux-linux/include/ncurses "
TAGS: $(EDITSRC)
etags $(EDITSRC)
clean:
$(RMF) *.o core a.out libedit.a
realclean: clean
$(RMF) .depend
$(RMF) TAGS
$(RMF) *~
distclean:
-$(RMF) $(srcdir)/*~ $(srcdir)/*.o $(srcdir)/a.out
-$(RMF) $(srcdir)/core $(srcdir)/libedit.a
-if test $(srcdir) = .; then $(MAKE) realclean; fi
-$(RMF) $(srcdir)/Makefile
install: @MCEDIT@
uninstall:
-$(RMF) $(DESTDIR)$(bindir)/$(binprefix)mcedit
distcopy:
$(CP) $(DIST) ../../mc-$(VERSION)/edit
depend dep: mcdep
fastdeploc:
# ***Dependencies***Do not edit***
@DOTDEPEND@
# ***End of dependencies***

View File

@@ -0,0 +1 @@

1712
rosapps/mc/edit/syntax.c Normal file

File diff suppressed because it is too large Load Diff

350
rosapps/mc/edit/wordproc.c Normal file
View File

@@ -0,0 +1,350 @@
/* wordproc.c - word-processor mode for the editor: does dynamic
paragraph formatting.
Copyright (C) 1996 Paul Sheer
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <config.h>
#include "edit.h"
#ifdef MIDNIGHT
#define tab_width option_tab_spacing
#endif
int line_is_blank (WEdit * edit, long line);
#define NO_FORMAT_CHARS_START "-+*\\,.;:&>"
static long line_start (WEdit * edit, long line)
{
static long p = -1, l = 0;
int c;
if (p == -1 || abs (l - line) > abs (edit->curs_line - line)) {
l = edit->curs_line;
p = edit->curs1;
}
if (line < l)
p = edit_move_backward (edit, p, l - line);
else if (line > l)
p = edit_move_forward (edit, p, line - l, 0);
l = line;
p = edit_bol (edit, p);
while (strchr ("\t ", c = edit_get_byte (edit, p)))
p++;
return p;
}
static int bad_line_start (WEdit * edit, long p)
{
int c;
c = edit_get_byte (edit, p);
if (c == '.') { /* `...' is acceptable */
if (edit_get_byte (edit, p + 1) == '.')
if (edit_get_byte (edit, p + 2) == '.')
return 0;
return 1;
}
if (c == '-') {
if (edit_get_byte (edit, p + 1) == '-')
if (edit_get_byte (edit, p + 2) == '-')
return 0; /* `---' is acceptable */
return 1;
}
if (strchr (NO_FORMAT_CHARS_START, c))
return 1;
return 0;
}
static long begin_paragraph (WEdit * edit, long p, int force)
{
int i;
for (i = edit->curs_line - 1; i > 0; i--) {
if (line_is_blank (edit, i)) {
i++;
break;
}
if (force) {
if (bad_line_start (edit, line_start (edit, i))) {
i++;
break;
}
}
}
return edit_move_backward (edit, edit_bol (edit, edit->curs1), edit->curs_line - i);
}
static long end_paragraph (WEdit * edit, long p, int force)
{
int i;
for (i = edit->curs_line + 1; i < edit->total_lines; i++) {
if (line_is_blank (edit, i)) {
i--;
break;
}
if (force)
if (bad_line_start (edit, line_start (edit, i))) {
i--;
break;
}
}
return edit_eol (edit, edit_move_forward (edit, edit_bol (edit, edit->curs1), i - edit->curs_line, 0));
}
static char *get_paragraph (WEdit * edit, long p, long q, int indent, int *size)
{
char *s, *t;
t = malloc ((q - p) + 2 * (q - p) / option_word_wrap_line_length + 10);
if (!t)
return 0;
for (s = t; p < q; p++, s++) {
if (indent)
if (edit_get_byte (edit, p - 1) == '\n')
while (strchr ("\t ", edit_get_byte (edit, p)))
p++;
*s = edit_get_byte (edit, p);
}
*size = (unsigned long) s - (unsigned long) t;
t[*size] = '\n';
return t;
}
static void strip_newlines (char *t, int size)
{
char *p = t;
while (size--) {
*p = *p == '\n' ? ' ' : *p;
p++;
}
}
#ifndef MIDNIGHT
int edit_width_of_long_printable (int c);
#endif
/*
This is a copy of the function
int calc_text_pos (WEdit * edit, long b, long *q, int l)
in propfont.c :(
It calculates the number of chars in a line specified to length l in pixels
*/
extern int tab_width;
static inline int next_tab_pos (int x)
{
return x += tab_width - x % tab_width;
}
static int line_pixel_length (char *t, long b, int l)
{
int x = 0, c, xn = 0;
for (;;) {
c = t[b];
switch (c) {
case '\n':
return b;
case '\t':
xn = next_tab_pos (x);
break;
default:
#ifdef MIDNIGHT
xn = x + 1;
#else
xn = x + edit_width_of_long_printable (c);
#endif
break;
}
if (xn > l)
break;
x = xn;
b++;
}
return b;
}
/* find the start of a word */
static int next_word_start (char *t, int q, int size)
{
int i;
for (i = q;; i++) {
switch (t[i]) {
case '\n':
return -1;
case '\t':
case ' ':
for (;; i++) {
if (t[i] == '\n')
return -1;
if (t[i] != ' ' && t[i] != '\t')
return i;
}
break;
}
}
}
/* find the start of a word */
static int word_start (char *t, int q, int size)
{
int i = q;
if (t[q] == ' ' || t[q] == '\t')
return next_word_start (t, q, size);
for (;;) {
int c;
if (!i)
return -1;
c = t[i - 1];
if (c == '\n')
return -1;
if (c == ' ' || c == '\t')
return i;
i--;
}
}
/* replaces ' ' with '\n' to properly format a paragraph */
static void format_this (char *t, int size, int indent)
{
int q = 0, ww;
strip_newlines (t, size);
ww = option_word_wrap_line_length * FONT_MEAN_WIDTH - indent;
if (ww < FONT_MEAN_WIDTH * 2)
ww = FONT_MEAN_WIDTH * 2;
for (;;) {
int p;
q = line_pixel_length (t, q, ww);
if (q > size)
break;
if (t[q] == '\n')
break;
p = word_start (t, q, size);
if (p == -1)
q = next_word_start (t, q, size); /* Return the end of the word if the beginning
of the word is at the beginning of a line
(i.e. a very long word) */
else
q = p;
if (q == -1) /* end of paragraph */
break;
if (q)
t[q - 1] = '\n';
}
}
static void replace_at (WEdit * edit, long q, int c)
{
edit_cursor_move (edit, q - edit->curs1);
edit_delete (edit);
edit_insert_ahead (edit, c);
}
void edit_insert_indent (WEdit * edit, int indent);
/* replaces a block of text */
static void put_paragraph (WEdit * edit, char *t, long p, long q, int indent, int size)
{
long cursor;
int i, c = 0;
cursor = edit->curs1;
if (indent)
while (strchr ("\t ", edit_get_byte (edit, p)))
p++;
for (i = 0; i < size; i++, p++) {
if (i && indent) {
if (t[i - 1] == '\n' && c == '\n') {
while (strchr ("\t ", edit_get_byte (edit, p)))
p++;
} else if (t[i - 1] == '\n') {
long curs;
edit_cursor_move (edit, p - edit->curs1);
curs = edit->curs1;
edit_insert_indent (edit, indent);
if (cursor >= curs)
cursor += edit->curs1 - p;
p = edit->curs1;
} else if (c == '\n') {
edit_cursor_move (edit, p - edit->curs1);
while (strchr ("\t ", edit_get_byte (edit, p))) {
edit_delete (edit);
if (cursor > edit->curs1)
cursor--;
}
p = edit->curs1;
}
}
c = edit_get_byte (edit, p);
if (c != t[i])
replace_at (edit, p, t[i]);
}
edit_cursor_move (edit, cursor - edit->curs1); /* restore cursor position */
}
int edit_indent_width (WEdit * edit, long p);
static int test_indent (WEdit * edit, long p, long q)
{
int indent;
indent = edit_indent_width (edit, p++);
if (!indent)
return 0;
for (; p < q; p++)
if (edit_get_byte (edit, p - 1) == '\n')
if (indent != edit_indent_width (edit, p))
return 0;
return indent;
}
void format_paragraph (WEdit * edit, int force)
{
long p, q;
int size;
char *t;
int indent = 0;
if (option_word_wrap_line_length < 2)
return;
if (line_is_blank (edit, edit->curs_line))
return;
p = begin_paragraph (edit, edit->curs1, force);
q = end_paragraph (edit, edit->curs1, force);
indent = test_indent (edit, p, q);
t = get_paragraph (edit, p, q, indent, &size);
if (!t)
return;
if (!force) {
int i;
if (strchr (NO_FORMAT_CHARS_START, *t)) {
free (t);
return;
}
for (i = 0; i < size - 1; i++) {
if (t[i] == '\n') {
if (strchr (NO_FORMAT_CHARS_START "\t ", t[i + 1])) {
free (t);
return;
}
}
}
}
format_this (t, q - p, indent);
put_paragraph (edit, t, p, q, indent, size);
free (t);
}

119
rosapps/mc/install-sh Normal file
View File

@@ -0,0 +1,119 @@
#!/bin/sh
#
# install - install a program, script, or datafile
# This comes from X11R5; it is not part of GNU.
#
# $XConsortium: install.sh,v 1.2 89/12/18 14:47:22 jim Exp $
#
# This script is compatible with the BSD install script, but was written
# from scratch.
#
# set DOITPROG to echo to test this script
# Don't use :- since 4.3BSD and earlier shells don't like it.
doit="${DOITPROG-}"
# put in absolute paths if you don't have them in your path; or use env. vars.
mvprog="${MVPROG-mv}"
cpprog="${CPPROG-cp}"
chmodprog="${CHMODPROG-chmod}"
chownprog="${CHOWNPROG-chown}"
chgrpprog="${CHGRPPROG-chgrp}"
stripprog="${STRIPPROG-strip}"
rmprog="${RMPROG-rm}"
instcmd="$mvprog"
chmodcmd=""
chowncmd=""
chgrpcmd=""
stripcmd=""
rmcmd="$rmprog -f"
mvcmd="$mvprog"
src=""
dst=""
while [ x"$1" != x ]; do
case $1 in
-c) instcmd="$cpprog"
shift
continue;;
-m) chmodcmd="$chmodprog $2"
shift
shift
continue;;
-o) chowncmd="$chownprog $2"
shift
shift
continue;;
-g) chgrpcmd="$chgrpprog $2"
shift
shift
continue;;
-s) stripcmd="$stripprog"
shift
continue;;
*) if [ x"$src" = x ]
then
src=$1
else
dst=$1
fi
shift
continue;;
esac
done
if [ x"$src" = x ]
then
echo "install: no input file specified"
exit 1
fi
if [ x"$dst" = x ]
then
echo "install: no destination specified"
exit 1
fi
# If destination is a directory, append the input filename; if your system
# does not like double slashes in filenames, you may need to add some logic
if [ -d $dst ]
then
dst="$dst"/`basename $src`
fi
# Make a temp file name in the proper directory.
dstdir=`dirname $dst`
dsttmp=$dstdir/#inst.$$#
# Move or copy the file name to the temp name
$doit $instcmd $src $dsttmp
# and set any options; do chmod last to preserve setuid bits
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; fi
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; fi
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; fi
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; fi
# Now rename the file to the real destination.
$doit $rmcmd $dst
$doit $mvcmd $dsttmp $dst
exit 0

105
rosapps/mc/make.common.in Normal file
View File

@@ -0,0 +1,105 @@
VERSION=4.1.36
SHELL = /bin/sh
# This variable makes it possible to move the installation root to another
# directory. This is useful when you're creating a binary distribution of mc.
# If empty, normal root will be used.
# You can run e.g. 'make install DESTDIR=/packages/mc/3.0' to accomplish
# that.
# DESTDIR = /opt/apps/mc/$(VERSION)
# Installation target directories & other installation stuff
prefix = @prefix@
exec_prefix = $(prefix)
binprefix =
manprefix =
builddir = @builddir@
bindir = $(exec_prefix)/bin
libdir = $(exec_prefix)/lib/mc
suppbindir = $(libdir)/bin
tidir = $(libdir)/term
extfsdir = $(libdir)/extfs
icondir = $(prefix)/share/icons/mc
mandir = $(prefix)/man/man1
datadir = $(prefix)/share
localedir = $(datadir)/locale
manext = 1
man8dir = $(prefix)/man/man8
man8ext = 8
xv_bindir = @xv_bindir@
# Tools & program stuff
SEDCMD = @SEDCMD@
SEDCMD2 = @SEDCMD2@
STRIP = @STRIP@
@SET_MAKE@
CC = @CC@
CPP = @CPP@
AR = @AR@
RANLIB = @RANLIB@
RM = @RM@
RMF = @RM@ -f
MV = @MV@
CP = @CP@
LN_S = @LN_S@
AWK = @AWK@
AWK_VAR_OPTION = @AWK_VAR_OPTION@
# Flags & libs
# No way, to make make happy (except GNU), we cannot use := to append
# something to these, so that's why there is a leading _
XCFLAGS = @CFLAGS@
XCPPFLAGS = @CPPFLAGS@ -I.. -DBINDIR=\""$(bindir)/"\" -DLIBDIR=\""$(libdir)/"\" -DICONDIR=\""$(icondir)/"\" $(XINC) -DLOCALEDIR=\""$(localedir)/"\"
XLDFLAGS = @LDFLAGS@
XDEFS = @DEFS@
XLIBS = @LIBS@
# Where do we have the sources?
# You shouldn't have to edit this :)
mcsrcdir = $(rootdir)/src
docdir = $(rootdir)/doc
mclibdir = $(rootdir)/lib
slangdir = $(rootdir)/slang
vfsdir = $(rootdir)/vfs
xvdir = $(rootdir)/xv
tkdir = $(rootdir)/tk
gnomedir = $(rootdir)/gnome
icodir = $(rootdir)/icons
hpath = -I$(mcsrcdir) -I$(slangdir) -I$(vfsdir) -I$(xvdir) -I$(xvdir)/support/xview_private -I$(tkdir)
# Rules
first_rule: all
@PHONY@ all check cross TAGS clean install uninstall distcopy depend dep
@PHONY@ fastdep fastdepslang fastdepvfs fastdeploc slowdep
@PCENTRULE@../slang/%.o : ../slang/%.c
@PCENTRULE@ cd ../slang; $(MAKE) libmcslang.a
@PCENTRULE@../vfs/%.o : ../vfs/%.c
@PCENTRULE@ cd ../vfs; $(MAKE) libvfs.a
fastdep: dummy
if test x"`echo $(srcdir)/*.[ch]`" != x'$(srcdir)/*.[ch]'; then { cd $(srcdir); $(AWK) -f $(mcsrcdir)/depend.awk $(AWK_VAR_OPTION) hpath="$(hpath)" $(AWK_VAR_OPTION) srcdir="$(srcdir)" *.[ch];} > .depend; fi
-$(MAKE) fastdeploc
@WRITEDEP@
fastdepslang:
@PCENTRULE@ { { { cd ../slang; $(MAKE) showlibdep;} | grep OBJS; cat .depend;} | { cd $(slangdir); $(AWK) -f $(mcsrcdir)/depend.awk $(AWK_VAR_OPTION) dolib="../slang libmcslang.a" $(AWK_VAR_OPTION) hpath="$(hpath)" $(AWK_VAR_OPTION) srcdir="$(slangdir)";};} >> .depend
fastdepvfs:
@PCENTRULE@ { { { cd ../vfs; $(MAKE) showlibdep;} | grep OBJS; cat .depend;} | { cd $(vfsdir); $(AWK) -f $(mcsrcdir)/depend.awk $(AWK_VAR_OPTION) dolib="../vfs libvfs.a" $(AWK_VAR_OPTION) hpath="$(hpath)" $(AWK_VAR_OPTION) srcdir="$(vfsdir)";};} >> .depend
slowdep: dummy
if test x"`echo $(srcdir)/*.[ch]`" != x'$(srcdir)/*.[ch]'; then \
$(CPP) -M $(CPPFLAGS) $(DEFS) $(CFLAGS) $(srcdir)/*.c > .depend; fi
@WRITEDEP@
mcdep: @dep@
dummy:
# End of Make.common

60
rosapps/mc/mc.rc Normal file
View File

@@ -0,0 +1,60 @@
#include "VERSION"
#ifndef WINDRES
# include "windows.h"
// # include "winver.h"
#endif
/* English (U.S.) resources */
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
#ifndef WINDRES
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#endif
#pragma code_page(1252)
#endif /* _WIN32 */
/* Version */
VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,0,0,1
PRODUCTVERSION 3,0,0,1
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x40000L
FILETYPE 0x1L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904E4"
BEGIN
VALUE "CompanyName", "Free Software Foundation"
VALUE "FileDescription", "GNU Midnight Commander"
VALUE "FileVersion", VERSION
VALUE "InternalName", "MC"
VALUE "LegalCopyright", "(c) Free Software Foundation"
VALUE "LegalTrademarks", "see GNU General Public License"
VALUE "OriginalFilename", "MC.EXE"
VALUE "ProductName", "GNU Midnight Commander"
VALUE "ProductVersion", VERSION
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1252
END
END
/* Icon */
// 0 ICON DISCARDABLE "mc_nt.ico"
// 1 ICON DISCARDABLE "bez03.ico"
#endif /* English (U.S.) resources */

67
rosapps/mc/mcfn_install Normal file
View File

@@ -0,0 +1,67 @@
#/bin/sh
#
prefix=/usr/local
if test -n `echo $prefix | grep prefix`; then
prefix=/usr/local
fi
if test x$BASH = x; then
BASHRC=
else
BASHRC=~/.bashrc
fi
if test "x$EUID" = x0; then
PROFILE=/etc/profile
else
PROFILE=~/.profile
fi
if test -f $PROFILE; then
A=`grep "mc ()" $PROFILE`
B=
if test -n "$BASHRC"; then
if test -f $BASHRC; then
B=`grep "mc ()" $BASHRC`
fi
fi
if test -n "$A"; then
:
else
if test -n "$B"; then
:
else
A=`typeset -f | grep "mc ()" 2>/dev/null`
if test ! -n "$A"; then
echo "mc () installation."
if test -n "$BASHRC"; then
echo "While examining your $PROFILE and $BASHRC,"
else
echo "While examining your $PROFILE,"
fi
echo "I've found that you have no mc () function defined there."
echo "This function enables a feature of mc(1) that when you leave mc(1),"
echo "you return to a directory where you were in mc just before exiting"
echo "and not to the directory you've started mc from."
echo "Would you like to append"
echo 'mc () { MC=`'$prefix'/bin/mc -P "$@"`; [ -n "$MC" ] && cd "$MC"; unset MC };'
if test -n "$BASHRC"; then
echo "function to your (p) $PROFILE (mc function will be active in your login shells)"
echo -n "or to your (b) $BASHRC (in every bash instance) or (n) no? [p|b|n] "
else
echo -n "function to your $PROFILE? [y|n] "
fi
read rep
if test -n "$BASHRC"; then
INITFILE=$BASHRC
else
INITFILE=$PROFILE
fi
case $rep in
[Nn]*) exit ;;
[Pp]*) INITFILE=$PROFILE ;;
esac
echo >>$INITFILE
echo 'mc () { MC=`'$prefix'/bin/mc -P "$@"`; [ -n "$MC" ] && cd "$MC"; unset MC };' >>$INITFILE
echo "mc () function appended to your $INITFILE"
fi
fi
fi
fi

View File

@@ -0,0 +1,67 @@
#/bin/sh
#
prefix=@prefix@
if test -n `echo $prefix | grep prefix`; then
prefix=/usr/local
fi
if test x$BASH = x; then
BASHRC=
else
BASHRC=~/.bashrc
fi
if test "x$EUID" = x0; then
PROFILE=/etc/profile
else
PROFILE=~/.profile
fi
if test -f $PROFILE; then
A=`grep "mc ()" $PROFILE`
B=
if test -n "$BASHRC"; then
if test -f $BASHRC; then
B=`grep "mc ()" $BASHRC`
fi
fi
if test -n "$A"; then
:
else
if test -n "$B"; then
:
else
A=`typeset -f | grep "mc ()" 2>/dev/null`
if test ! -n "$A"; then
echo "mc () installation."
if test -n "$BASHRC"; then
echo "While examining your $PROFILE and $BASHRC,"
else
echo "While examining your $PROFILE,"
fi
echo "I've found that you have no mc () function defined there."
echo "This function enables a feature of mc(1) that when you leave mc(1),"
echo "you return to a directory where you were in mc just before exiting"
echo "and not to the directory you've started mc from."
echo "Would you like to append"
echo 'mc () { MC=`'$prefix'/bin/mc -P "$@"`; [ -n "$MC" ] && cd "$MC"; unset MC };'
if test -n "$BASHRC"; then
echo "function to your (p) $PROFILE (mc function will be active in your login shells)"
echo -n "or to your (b) $BASHRC (in every bash instance) or (n) no? [p|b|n] "
else
echo -n "function to your $PROFILE? [y|n] "
fi
read rep
if test -n "$BASHRC"; then
INITFILE=$BASHRC
else
INITFILE=$PROFILE
fi
case $rep in
[Nn]*) exit ;;
[Pp]*) INITFILE=$PROFILE ;;
esac
echo >>$INITFILE
echo 'mc () { MC=`'$prefix'/bin/mc -P "$@"`; [ -n "$MC" ] && cd "$MC"; unset MC };' >>$INITFILE
echo "mc () function appended to your $INITFILE"
fi
fi
fi
fi

40
rosapps/mc/mkinstalldirs Normal file
View File

@@ -0,0 +1,40 @@
#! /bin/sh
# mkinstalldirs --- make directory hierarchy
# Author: Noah Friedman <friedman@prep.ai.mit.edu>
# Created: 1993-05-16
# Public domain
# $Id: mkinstalldirs,v 1.1 2001/12/30 09:49:36 sedwards Exp $
errstatus=0
for file
do
set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`
shift
pathcomp=
for d
do
pathcomp="$pathcomp$d"
case "$pathcomp" in
-* ) pathcomp=./$pathcomp ;;
esac
if test ! -d "$pathcomp"; then
echo "mkdir $pathcomp" 1>&2
mkdir "$pathcomp" || lasterr=$?
if test ! -d "$pathcomp"; then
errstatus=$lasterr
fi
fi
pathcomp="$pathcomp/"
done
done
exit $errstatus
# mkinstalldirs ends here

28
rosapps/mc/pc/Makefile Normal file
View File

@@ -0,0 +1,28 @@
TARGET_OS=NT
CC=gcc
LINK=gcc -s
OBJ_SUFFIX=o
OBJ_PLACE=-o
EXE_PLACE=-o
# ---- Compiler-specific optional stuff
MC_MISC_CFLAGS=
OBJS_DIR=release
EXTRA_MC_SRCS=
SPECIFIC_DEFINES=
SPECIFIC_MC_CFLAGS=-O2 $(MC_MISC_CFLAGS)
SPECIFIC_MC_LFLAGS_EXTRA=
SPECIFIC_SLANG_CFLAGS=$(SPECIFIC_MC_CFLAGS)
SPECIFIC_MCEDIT_CFLAGS=$(SPECIFIC_MC_CFLAGS)
# ---- Compiler independent defines
include Makefile.PC
# ---- Linkers are very compiler-specific
SPECIFIC_MC_LFLAGS=$(SPECIFIC_MC_LFLAGS_EXTRA)
MC_LIBS= # -lintl
$(MC_EXE): $(OBJS) $(MCEDIT_OBJS) $(SLANG_OBJS)
$(LINK) $(EXE_PLACE) $(MC_EXE) $(SPECIFIC_MC_LFLAGS) $+ $(MC_LIBS)

178
rosapps/mc/pc/Makefile.PC Normal file
View File

@@ -0,0 +1,178 @@
# Makefile.PC
#
# This is the Makefile for Midnight Commander under OS/2 and Windows NT
#
# Written by Dan Nicolaescu
# 970423 hacked by Juan f. Grigera
# 970525 hacked again by jfg to add internal editor
# 971127 hacked by Pavel Roskin to make it work with mc-4.1.11
# 980206 hacked by Pavel Roskin to make it work with GNU make
# 980329 changed by Pavel Roskin to make it common for OS/2 and NT
#
# Supported Compilers:
#
# For Windows NT:
# Makefile.VC4: Microsoft Visual C++ 4.0 and above
# Makefile.BC5: Borland C++ 5.x
# Makefile.MIN: MinGW
# Makefile.RSX: RSX
# For OS/2:
# Makefile.EMX: EMX/GCC
# Makefile.BC2: Borland C++ 2.x
# Makefile.IBM: IBM CSet or Visual Age C++
# ...
# ---- Directories
MC_PC_DIR=.
MC_SRC_DIR=../src
VFS_DIR=../vfs
MCEDIT_SRC_DIR=../edit
MCEDIT_OBJS_DIR=$(OBJS_DIR)/edit
SLANG_SRC_DIR=../slang
SLANG_OBJS_DIR=$(OBJS_DIR)/slang
MC_EXE=$(OBJS_DIR)/mc.exe
# --- Midnight Defines
COMMON_DEFINES=-DMC_$(TARGET_OS) $(SPECIFIC_DEFINES)
MC_DEFINES=$(COMMON_DEFINES) -DHAVE_CONFIG_H
MC_INCLUDES=-I$(MC_PC_DIR) -I$(SLANG_SRC_DIR)
SLANG_DEFINES=$(COMMON_DEFINES)
SLANG_INCLUDES=-I$(MC_PC_DIR) -I$(SLANG_SRC_DIR)
MCEDIT_DEFINES=$(COMMON_DEFINES) -DHAVE_CONFIG_H
MCEDIT_INCLUDES=-I$(MC_PC_DIR) -I$(SLANG_SRC_DIR)
CFLAGS=$(SPECIFIC_MC_CFLAGS) $(MC_INCLUDES) $(MC_DEFINES) -c
SLANG_CFLAGS=$(SPECIFIC_SLANG_CFLAGS) $(SLANG_INCLUDES) $(SLANG_DEFINES) -c
MCEDIT_CFLAGS=$(SPECIFIC_MCEDIT_CFLAGS) $(MCEDIT_INCLUDES) $(MCEDIT_DEFINES) -c
all: object-dirs mc
object-dirs: $(OBJS_DIR) $(SLANG_OBJS_DIR) $(MCEDIT_OBJS_DIR)
mc: $(MC_EXE)
clean:
deltree -y "$(SLANG_OBJS_DIR)"
deltree -y "$(MCEDIT_OBJS_DIR)"
deltree -y "$(OBJS_DIR)"
$(OBJS_DIR):
mkdir "$@"
$(SLANG_OBJS_DIR):
mkdir "$@"
$(MCEDIT_OBJS_DIR):
mkdir "$@"
$(OBJS_DIR)/%.$(OBJ_SUFFIX): $(MC_PC_DIR)/%.c
$(CC) $(CFLAGS) $(OBJ_PLACE)$@ $<
$(OBJS_DIR)/%.$(OBJ_SUFFIX): $(MC_SRC_DIR)/%.c
$(CC) $(CFLAGS) $(OBJ_PLACE)$@ $<
$(SLANG_OBJS_DIR)/%.$(OBJ_SUFFIX): $(SLANG_SRC_DIR)/%.c
$(CC) $(SLANG_CFLAGS) $(OBJ_PLACE)$@ $<
$(MCEDIT_OBJS_DIR)/%.$(OBJ_SUFFIX): $(MCEDIT_SRC_DIR)/%.c
$(CC) $(MCEDIT_CFLAGS) $(OBJ_PLACE)$@ $<
MC_SRCS= \
terms.c \
user.c \
file.c \
listmode.c \
cmd.c \
command.c \
help.c \
menu.c \
view.c \
dir.c \
info.c \
widget.c \
option.c \
dlg.c \
panelize.c \
profile.c \
util.c \
dialog.c \
ext.c \
color.c \
layout.c \
setup.c \
regex.c \
hotlist.c \
tree.c \
win.c \
complete.c \
find.c \
wtools.c \
boxes.c \
background.c \
main.c \
popt.c \
text.c \
screen.c
PC_SRCS= \
slint_pc.c \
chmod.c \
drive.c
NT_SRCS= \
cons_nt.c \
dirent_nt.c \
key_nt.c \
util_win32.c \
util_winnt.c \
util_nt.c
OS2_SRCS= \
cons_os2.c \
dirent_os2.c \
key_os2.c \
util_os2.c
SLANG_NT=slw32tty.c
SLANG_OS2=slos2tty.c
SLANG_SRCS= \
slerr.c \
slgetkey.c \
slsmg.c \
slvideo.c \
$(SLANG_$(TARGET_OS))
MCEDIT_SRCS= \
edit.c \
editcmd.c \
editdraw.c \
editmenu.c \
editoptions.c \
editwidget.c \
syntax.c \
wordproc.c
SRCS=$(MC_SRCS) $(PC_SRCS) $($(TARGET_OS)_SRCS) $(EXTRA_MC_SRCS)
OBJS=$(addprefix $(OBJS_DIR)/, \
$(patsubst %.c,%.$(OBJ_SUFFIX),$(SRCS)))
SLANG_OBJS=$(addprefix $(SLANG_OBJS_DIR)/, \
$(patsubst %.c,%.$(OBJ_SUFFIX),$(SLANG_SRCS)))
MCEDIT_OBJS=$(addprefix $(MCEDIT_OBJS_DIR)/, \
$(patsubst %.c,%.$(OBJ_SUFFIX),$(MCEDIT_SRCS)))
ifdef RSC
ifndef RES_SUFFIX
RES_SUFFIX=res
endif # RES_SUFFIX
MC_RES=$(OBJS_DIR)/mc.$(RES_SUFFIX)
$(MC_RES): $(MC_PC_DIR)/mc.rc $(MC_PC_DIR)/mc_nt.ico $(MC_PC_DIR)/config.h ../VERSION
$(RSC) $(RES_PLACE)$(MC_RES) $(RC_DEFINES) $(MC_PC_DIR)/mc.rc
else
MC_RES=
endif # !RSC

15
rosapps/mc/pc/bugs Normal file
View File

@@ -0,0 +1,15 @@
BUGS OF PC port
- Troubles with keys (Ctrl-Tab, Gray +,-,*, Alt-Shift-A etc)
- Filtered view hangs in close_pipe() because error is set, but nothing
is available on stderr
- Windows '95 will not delete directory if not empty. (as it does
not return ENOTEMPTY but ENOACCESS)! Already fixed?
- Windows '95 will not allow "''" in root drives
- OS/2 port uses always screen size 80x25. Do we need newer SLang?
- IBM C++ has some problems with O_TEXT -> troubles with editor
- OS/2 port causes access violation while copying files.
- getcwd from EMX returns a UNIX-like path -> drive change fails.
-please report!

23
rosapps/mc/pc/changelog Normal file
View File

@@ -0,0 +1,23 @@
Tue May 12 17:16:43 1998 Pavel Roskin <pavel.roskin@ecsoft.co.uk>
* Makefile.RSX, mc.rc: Resources support for RSX
* Makefile.PC, *.c: Some includes corrected for MinGW
compatability (dir.h exists both in mc and MinGW)
Fri May 8 10:49:21 1998 Pavel Roskin <pavel.roskin@ecsoft.co.uk>
* Makefile.PC, Makefile.MIN: support for custom extension
for compiled resourses
* key_nt.c: Minor changes for MinGW
* mc.rc: WindRes support
* slint_pc.c: support for syntax highlighting
Fri May 1 17:33:11 1998 Pavel Roskin <pavel.roskin@ecsoft.co.uk>
* chmod.c: Updated call to update_panels()
* config.h, Makefile.MIN: Support for MinGW added

495
rosapps/mc/pc/chmod.c Normal file
View File

@@ -0,0 +1,495 @@
/* Chmod command for Windows NT and OS/2
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <config.h>
#ifdef __os2__
#define INCL_DOSFILEMGR
#include <os2.h>
#endif
#ifdef _OS_NT
#include <windows.h>
#endif
#include <string.h>
#include <stdio.h>
/* for chmod and stat */
#include <io.h>
#include <sys/types.h>
#include <sys/stat.h>
#include "../src/tty.h"
#include "../src/mad.h"
#include "../src/util.h"
#include "../src/win.h"
#include "../src/color.h"
#include "../src/dlg.h"
#include "../src/widget.h"
#include "../src/dialog.h" /* For do_refresh() */
#include "../src/dir.h"
#include "../src/panel.h" /* Needed for the externs */
#include "../src/file.h"
#include "../src/main.h"
#include "../src/chmod.h"
#include "../src/achown.h"
#include "../src/chown.h"
#ifdef _OS_NT
#define FILE_ARCHIVED FILE_ATTRIBUTE_ARCHIVE
#define FILE_DIRECTORY FILE_ATTRIBUTE_DIRECTORY
#define FILE_HIDDEN FILE_ATTRIBUTE_HIDDEN
#define FILE_READONLY FILE_ATTRIBUTE_READONLY
#define FILE_SYSTEM FILE_ATTRIBUTE_SYSTEM
#define mk_chmod(fname,st) SetFileAttributes(fname,st)
#endif
static int single_set;
struct Dlg_head *ch_dlg;
#define PX 5
#define PY 2
#define FX 40
#define FY 2
#define BX 6
#define BY 17
#define TX 40
#define TY 12
#define PERMISSIONS 4
#define BUTTONS 6
#define B_MARKED B_USER
#define B_ALL B_USER+1
#define B_SETMRK B_USER+2
#define B_CLRMRK B_USER+3
int mode_change, need_update;
int c_file, end_chmod;
umode_t and_mask, or_mask, c_stat;
char *c_fname, *c_fown, *c_fgrp, *c_fperm;
int c_fsize;
static WLabel *statl;
static int normal_color;
static int title_color;
static int selection_color;
/* bsedos.h */
struct {
mode_t mode;
char *text;
int selected;
WCheck *check;
} check_perm[PERMISSIONS] = {
{
FILE_ARCHIVED, N_("Archive"), 0, 0,
},
{
FILE_READONLY, N_("Read Only"), 0, 0,
},
{
FILE_HIDDEN, N_("Hidden"), 0, 0,
},
{
FILE_SYSTEM, N_("System"), 0, 0,
},
};
struct {
int ret_cmd, flags, y, x;
char *text;
} chmod_but[BUTTONS] = {
{
B_CANCEL, NORMAL_BUTTON, 2, 33, N_("&Cancel"),
},
{
B_ENTER, DEFPUSH_BUTTON, 2, 17, N_("&Set"),
},
{
B_CLRMRK, NORMAL_BUTTON, 0, 42, N_("C&lear marked"),
},
{
B_SETMRK, NORMAL_BUTTON, 0, 27, N_("S&et marked"),
},
{
B_MARKED, NORMAL_BUTTON, 0, 12, N_("&Marked all"),
},
{
B_ALL, NORMAL_BUTTON, 0, 0, N_("Set &all"),
},
};
static void chmod_toggle_select (void)
{
int Id = ch_dlg->current->dlg_id - BUTTONS + single_set * 2;
attrset (normal_color);
check_perm[Id].selected ^= 1;
dlg_move (ch_dlg, PY + PERMISSIONS - Id, PX + 1);
addch ((check_perm[Id].selected) ? '*' : ' ');
dlg_move (ch_dlg, PY + PERMISSIONS - Id, PX + 3);
}
static void chmod_refresh (void)
{
attrset (normal_color);
dlg_erase (ch_dlg);
draw_box (ch_dlg, 1, 2, 20 - single_set, 66);
draw_box (ch_dlg, PY, PX, PERMISSIONS + 2, 33);
draw_box (ch_dlg, FY, FX, 10, 25);
dlg_move (ch_dlg, FY + 1, FX + 2);
addstr (_("Name"));
dlg_move (ch_dlg, FY + 3, FX + 2);
addstr (_("Permissions (Octal)"));
dlg_move (ch_dlg, FY + 5, FX + 2);
addstr (_("Owner name"));
dlg_move (ch_dlg, FY + 7, FX + 2);
addstr (_("Group name"));
attrset (title_color);
dlg_move (ch_dlg, 1, 28);
addstr (_(" Chmod command "));
dlg_move (ch_dlg, PY, PX + 1);
addstr (_(" Permission "));
dlg_move (ch_dlg, FY, FX + 1);
addstr (_(" File "));
attrset (selection_color);
dlg_move (ch_dlg, TY, TX);
addstr (_("Use SPACE to change"));
dlg_move (ch_dlg, TY + 1, TX);
addstr (_("an option, ARROW KEYS"));
dlg_move (ch_dlg, TY + 2, TX);
addstr (_("to move between options"));
dlg_move (ch_dlg, TY + 3, TX);
addstr (_("and T or INS to mark"));
}
static int chmod_callback (Dlg_head *h, int Par, int Msg)
{
char buffer [10];
switch (Msg) {
case DLG_ACTION:
if (Par >= BUTTONS - single_set * 2){
c_stat ^= check_perm[Par - BUTTONS + single_set * 2].mode;
sprintf (buffer, "%o", c_stat);
label_set_text (statl, buffer);
chmod_toggle_select ();
mode_change = 1;
}
break;
case DLG_KEY:
if ((Par == 'T' || Par == 't' || Par == KEY_IC) &&
ch_dlg->current->dlg_id >= BUTTONS - single_set * 2) {
chmod_toggle_select ();
if (Par == KEY_IC)
dlg_one_down (ch_dlg);
return 1;
}
break;
#ifndef HAVE_X
case DLG_DRAW:
chmod_refresh ();
break;
#endif
}
return 0;
}
static void init_chmod (void)
{
int i;
do_refresh ();
end_chmod = c_file = need_update = 0;
single_set = (cpanel->marked < 2) ? 2 : 0;
if (use_colors){
normal_color = COLOR_NORMAL;
title_color = COLOR_HOT_NORMAL;
selection_color = COLOR_NORMAL;
} else {
normal_color = NORMAL_COLOR;
title_color = SELECTED_COLOR;
selection_color = SELECTED_COLOR;
}
ch_dlg = create_dlg (0, 0, 22 - single_set, 70, dialog_colors,
chmod_callback, _("[Chmod]"), _("chmod"), DLG_CENTER);
x_set_dialog_title (ch_dlg, _("Chmod command"));
#define XTRACT(i) BY+chmod_but[i].y-single_set, BX+chmod_but[i].x, \
chmod_but[i].ret_cmd, chmod_but[i].flags, chmod_but[i].text, 0, 0, NULL
tk_new_frame (ch_dlg, "b.");
for (i = 0; i < BUTTONS; i++) {
if (i == 2 && single_set)
break;
else
add_widgetl (ch_dlg, button_new (XTRACT (i)), XV_WLAY_RIGHTOF);
}
#define XTRACT2(i) 0, check_perm [i].text, NULL
tk_new_frame (ch_dlg, "c.");
for (i = 0; i < PERMISSIONS; i++) {
check_perm[i].check = check_new (PY + (PERMISSIONS - i), PX + 2,
XTRACT2 (i));
add_widget (ch_dlg, check_perm[i].check);
}
}
int pc_stat_file (char *filename)
{
mode_t st;
#ifdef _OS_NT
st = GetFileAttributes (filename);
#endif /* _OS_NT */
#ifdef __os2__
HFILE fHandle = 0L;
ULONG fInfoLevel = 1; /* 1st Level Info: Standard attributs */
FILESTATUS3 fInfoBuf;
ULONG fInfoBufSize;
ULONG fAction = 0;
APIRET rc;
fInfoBufSize = sizeof(FILESTATUS3);
rc = DosOpen((PSZ) filename,
&fHandle,
&fAction,
(ULONG) 0,
FILE_NORMAL,
OPEN_ACTION_OPEN_IF_EXISTS,
(OPEN_ACCESS_READONLY | OPEN_SHARE_DENYNONE),
(PEAOP2) NULL);
if (rc != 0) {
return -1;
}
rc = DosQueryFileInfo(fHandle, fInfoLevel, &fInfoBuf, fInfoBufSize);
DosClose(fHandle);
if (rc != 0) {
return -1; /* error ! */
} else {
st = fInfoBuf.attrFile;
}
#endif /* __os2__ */
if (st & FILE_DIRECTORY)
st = -1;
return st;
}
static void chmod_done (void)
{
if (need_update)
update_panels (UP_OPTIMIZE, UP_KEEPSEL);
repaint_screen ();
}
char *next_file (void)
{
while (!cpanel->dir.list[c_file].f.marked)
c_file++;
return cpanel->dir.list[c_file].fname;
}
#ifdef __os2__
static int mk_chmod (char *filename, ULONG st)
{
HFILE fHandle = 0L;
ULONG fInfoLevel = 1; /* 1st Level Info: Standard attributs */
FILESTATUS3 fInfoBuf;
ULONG fInfoBufSize;
ULONG fAction = 0L;
APIRET rc;
if (!(st & FILE_READONLY))
chmod(filename, (S_IWRITE | S_IREAD));
fInfoBufSize = sizeof(FILESTATUS3);
rc = DosOpen((PSZ) filename,
&fHandle,
&fAction,
(ULONG) 0,
FILE_NORMAL,
OPEN_ACTION_OPEN_IF_EXISTS,
(OPEN_ACCESS_READWRITE | OPEN_SHARE_DENYNONE),
0L);
if (rc != 0) {
return rc;
}
rc = DosQueryFileInfo(fHandle, fInfoLevel, &fInfoBuf, fInfoBufSize);
if (rc!=0) {
DosClose(fHandle);
return rc;
}
fInfoBuf.attrFile = st;
rc = DosSetFileInfo(fHandle, fInfoLevel, &fInfoBuf, fInfoBufSize);
rc = DosClose(fHandle);
return rc;
}
#endif /* __os2__ */
static void do_chmod (mode_t sf)
{
sf &= and_mask;
sf |= or_mask;
mk_chmod(cpanel->dir.list[c_file].fname, sf);
do_file_mark (cpanel, c_file, 0);
}
static void apply_mask (mode_t sf)
{
char *fname;
mode_t sf_stat;
need_update = end_chmod = 1;
do_chmod (sf);
do {
fname = next_file ();
if ((sf_stat = pc_stat_file (fname)) < 0)
break;
c_stat = sf_stat;
do_chmod (c_stat);
} while (cpanel->marked);
}
void chmod_cmd (void)
{
char buffer [10];
char *fname;
int i;
mode_t sf_stat;
do { /* do while any files remaining */
init_chmod ();
if (cpanel->marked)
fname = next_file (); /* next marked file */
else
fname = selection (cpanel)->fname; /* single file */
if ((sf_stat = pc_stat_file (fname)) < 0) /* get status of file */
break;
c_stat = sf_stat;
mode_change = 0; /* clear changes flag */
/* set check buttons */
for (i = 0; i < PERMISSIONS; i++){
check_perm[i].check->state = (c_stat & check_perm[i].mode) ? 1 : 0;
check_perm[i].selected = 0;
}
tk_new_frame (ch_dlg, "l.");
/* Set the labels */
c_fname = name_trunc (fname, 21);
add_widget (ch_dlg, label_new (FY+2, FX+2, c_fname, NULL));
c_fown = _("unknown");
add_widget (ch_dlg, label_new (FY+6, FX+2, c_fown, NULL));
c_fgrp = _("unknown");
add_widget (ch_dlg, label_new (FY+8, FX+2, c_fgrp, NULL));
sprintf (buffer, "%o", c_stat);
statl = label_new (FY+4, FX+2, buffer, NULL);
add_widget (ch_dlg, statl);
tk_end_frame ();
run_dlg (ch_dlg); /* retrieve an action */
/* do action */
switch (ch_dlg->ret_value){
case B_ENTER:
if (mode_change)
mk_chmod (fname, c_stat); /*.ado */
need_update = 1;
break;
case B_CANCEL:
end_chmod = 1;
break;
case B_ALL:
case B_MARKED:
and_mask = or_mask = 0;
and_mask = ~and_mask;
for (i = 0; i < PERMISSIONS; i++) {
if (check_perm[i].selected || ch_dlg->ret_value == B_ALL)
if (check_perm[i].check->state & C_BOOL)
or_mask |= check_perm[i].mode;
else
and_mask &= ~check_perm[i].mode;
}
apply_mask (sf_stat);
break;
case B_SETMRK:
and_mask = or_mask = 0;
and_mask = ~and_mask;
for (i = 0; i < PERMISSIONS; i++) {
if (check_perm[i].selected)
or_mask |= check_perm[i].mode;
}
apply_mask (sf_stat);
break;
case B_CLRMRK:
and_mask = or_mask = 0;
and_mask = ~and_mask;
for (i = 0; i < PERMISSIONS; i++) {
if (check_perm[i].selected)
and_mask &= ~check_perm[i].mode;
}
apply_mask (sf_stat);
break;
}
if (cpanel->marked && ch_dlg->ret_value!=B_CANCEL) {
do_file_mark (cpanel, c_file, 0);
need_update = 1;
}
destroy_dlg (ch_dlg);
} while (cpanel->marked && !end_chmod);
chmod_done ();
}

248
rosapps/mc/pc/config.h Normal file
View File

@@ -0,0 +1,248 @@
/****************************************************************************
CONFIG.H - Midnight Commander Configuration for Win32 and OS/2
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
----------------------------------------------------------------------------
Changes:
- Created 951204/jfg
- Changed from Alexander Dong (ado) for OS/2
- Changed 980329 by Pavel Roskin for both OS/2 and NT
----------------------------------------------------------------------------
Contents:
- Headers flags
- Library flags
- Typedefs
- etc.
****************************************************************************/
#ifndef __CONFIG_H
#define __CONFIG_H
#define OS2_NT
#ifdef MC_NT
# ifndef WIN32
# define WIN32
# endif
# ifndef __WIN32__
# define __WIN32__
# endif
# ifndef MSWINDOWS
# define MSWINDOWS
# endif
# ifndef _OS_NT
# define _OS_NT
# endif
#endif /* MC_NT */
#ifdef MC_OS2
# ifndef OS2
# define OS2
# endif
# ifndef __os2__
# define __os2__
# endif
#endif /* MC_OS2 */
#include "../VERSION"
#ifndef pc_system
# define pc_system
#endif
#ifndef HAVE_SLANG
# define HAVE_SLANG
#endif
#ifndef _CONSOLE
# define _CONSOLE
#endif
#define FLOAT_TYPE
#define MIDNIGHT
#define USE_INTERNAL_EDIT
#define STDC_HEADERS
#define HAVE_STDLIB_H
#define HAVE_STRING_H
#define HAVE_DIRENT_H
#define HAVE_LIMITS_H
#define HAVE_FCNTL_H
#define HAVE_UTIME_H
#define HAVE_MEMSET
#define HAVE_MEMCHR
#define HAVE_MEMCPY
#define HAVE_MEMCMP
#define HAVE_MEMMOVE
#define HAVE_STRDUP
#define HAVE_STRERROR
#define HAVE_TRUNCATE
#define REGEX_MALLOC
#define NO_INFOMOUNT
typedef unsigned int umode_t;
#define S_IFLNK 0
#define S_ISLNK(x) 0
#ifdef __EMX__
#define S_IFBLK 0
#define S_ISBLK(x) 0
#endif /* __EMX__ */
#ifdef __MINGW32__
#define S_IRGRP 0000040
#define S_IWGRP 0000020
#define S_IXGRP 0000010
#define S_IROTH 0000004
#define S_IWOTH 0000002
#define S_IXOTH 0000001
#define ENABLE_NLS
#define pipe(p) _pipe(p, 4096, 0x8000 /* O_BINARY */)
/*typedef int mode_t;*/
typedef unsigned int nlink_t;
typedef int gid_t;
typedef int uid_t;
/*typedef int pid_t;*/
#endif /* __MINGW32__ */
#ifdef _MSC_VER
#pragma include_alias(<utime.h>, <sys/utime.h>)
#define INLINE
#define inline
#define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR)
#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
#define S_ISFIFO(m) 0
#define S_ISBLK(x) 0
#define S_IRWXU 0000700
#define S_IRUSR 0000400
#define S_IWUSR 0000200
#define S_IXUSR 0000100
#define S_IRWXG 0000070
#define S_IRGRP 0000040
#define S_IWGRP 0000020
#define S_IXGRP 0000010
#define S_IRWXO 0000007
#define S_IROTH 0000004
#define S_IWOTH 0000002
#define S_IXOTH 0000001
/* FIXME: is this definition correct? */
#define R_OK 4
#define pipe(p) _pipe(p, 4096, 0x8000 /* O_BINARY */)
#define popen _popen
#define pclose _pclose
typedef int mode_t;
typedef unsigned int nlink_t;
typedef int gid_t;
typedef int uid_t;
typedef int pid_t;
#endif /* _MSC_VER */
#ifdef __BORLANDC__
#define INLINE
#define inline
#define S_IRWXG 0000070
#define S_IRGRP 0000040
#define S_IWGRP 0000020
#define S_IXGRP 0000010
#define S_IRWXO 0000007
#define S_IROTH 0000004
#define S_IWOTH 0000002
#define S_IXOTH 0000001
/* FIXME: is this definition correct? */
#define R_OK 4
#define pipe(p) _pipe(p, 4096, 0x8000 /* O_BINARY */)
#define popen _popen
#define pclose _pclose
#define sleep _sleep
typedef int pid_t;
#endif /* __BORLANDC__ */
#ifdef __IBMC__
#define INLINE
#define inline
#define S_ISFIFO(m) 0
#define S_ISBLK(x) 0
#define S_ISCHR(m) (((m) & S_IFCHR) != 0)
#define S_ISDIR(m) (((m) & S_IFDIR) != 0)
#define S_ISREG(m) (((m) & S_IFREG) != 0)
#define S_IRWXU 0000700
#define S_IRUSR 0000400
#define S_IWUSR 0000200
#define S_IXUSR 0000100
#define S_IRWXG 0000070
#define S_IRGRP 0000040
#define S_IWGRP 0000020
#define S_IXGRP 0000010
#define S_IRWXO 0000007
#define S_IROTH 0000004
#define S_IWOTH 0000002
#define S_IXOTH 0000001
#define ENOTDIR ENOENT
/* FIXME: is this definition correct? */
#define R_OK 4
#pragma map( chdir , "_chdir" )
#pragma map( getcwd, "_getcwd" )
#pragma map( mkdir , "_mkdir" )
#pragma map( rmdir , "_rmdir" )
#define popen DosCreatePipe
#define pclose DosClose
#define sleep DosSleep
typedef unsigned int nlink_t;
typedef int mode_t;
typedef int gid_t;
typedef int uid_t;
typedef int pid_t;
#endif /* __IBMC__ */
#endif /* __CONFIG_H */

112
rosapps/mc/pc/cons_nt.c Normal file
View File

@@ -0,0 +1,112 @@
/* Client interface for General purpose Win32 console save/restore server
Having the same interface as its Linux counterpart:
Copyright (C) 1994 Janne Kukonlehto <jtklehto@stekt.oulu.fi>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
Note:
show_console_contents doesn't know how to write to its window
the rest works fine.
*/
#include <config.h>
#include <windows.h>
#include "trace_nt.h"
int cons_saver_pid = 1;
#include "../src/tty.h"
#include "../src/util.h"
#include "../src/win.h"
#include "../src/cons.saver.h"
signed char console_flag = 1;
static HANDLE hSaved, hNew;
void show_console_contents (int starty, unsigned char begin_line,
unsigned char end_line)
{
COORD c0 = { 0, 0 };
COORD csize;
SMALL_RECT rect;
CHAR_INFO *pchar;
csize.X = COLS;
csize.Y = end_line-begin_line;
rect.Left = 0;
rect.Top = begin_line;
rect.Right = COLS;
rect.Bottom = end_line;
/* -- This code reads characters and attributes */
pchar = malloc (sizeof(CHAR_INFO) * (end_line-begin_line) * COLS);
/* Copy from one console to the curses virtual screen */
win32APICALL(ReadConsoleOutput (hSaved, pchar, csize, c0, &rect));
/* FIXME: this should've work,
but refresh() is called after this write :-( */
win32APICALL(WriteConsoleOutput (hNew, pchar, csize, c0, &rect));
free (pchar);
}
void handle_console (unsigned char action)
{
static SECURITY_ATTRIBUTES sa;
CONSOLE_SCREEN_BUFFER_INFO csbi;
switch (action){
case CONSOLE_INIT:
/* Save Standard handle */
hSaved = GetStdHandle (STD_OUTPUT_HANDLE);
sa.nLength = sizeof(SECURITY_ATTRIBUTES);
sa.lpSecurityDescriptor = NULL;
/* Create a new console buffer */
sa.bInheritHandle = TRUE;
win32APICALL_HANDLE(hNew,
CreateConsoleScreenBuffer (GENERIC_WRITE | GENERIC_READ,
FILE_SHARE_READ | FILE_SHARE_WRITE, &sa,
CONSOLE_TEXTMODE_BUFFER, NULL));
win32APICALL(GetConsoleScreenBufferInfo(hSaved, &csbi));
csbi.dwSize.X=csbi.srWindow.Right-csbi.srWindow.Left;
csbi.dwSize.Y=csbi.srWindow.Bottom-csbi.srWindow.Right;
win32APICALL(SetConsoleScreenBufferSize(hNew, csbi.dwSize));
/* that becomes standard handle */
win32APICALL(SetConsoleActiveScreenBuffer(hNew));
win32APICALL(SetConsoleMode(hNew, ENABLE_PROCESSED_INPUT));
win32APICALL(SetStdHandle(STD_OUTPUT_HANDLE, hNew));
break;
case CONSOLE_DONE:
win32APICALL(CloseHandle (hNew));
break;
case CONSOLE_SAVE:
/* Current = our standard handle */
win32APICALL(SetConsoleActiveScreenBuffer (hNew));
win32APICALL(SetStdHandle (STD_OUTPUT_HANDLE, hNew));
break;
case CONSOLE_RESTORE:
/* Put saved (shell) screen buffer */
win32APICALL(SetConsoleActiveScreenBuffer (hSaved));
win32APICALL(SetStdHandle (STD_OUTPUT_HANDLE, hSaved));
break;
default:
win32Trace(("Invalid action code %d sent to handle_console", action));
}
}

110
rosapps/mc/pc/cons_os2.c Normal file
View File

@@ -0,0 +1,110 @@
/* Client interface for General purpose OS/2 console save/restore server.
1997 Alexander Dong <ado@software-ag.de>
Having the same interface as its Linux counterpart:
Copyright (C) 1994 Janne Kukonlehto <jtklehto@stekt.oulu.fi>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <config.h>
#ifdef __os2__
#define INCL_BASE
#define INCL_NOPM
#define INCL_VIO
#define INCL_KBD
#define INCL_DOS
#define INCL_SUB
#define INCL_DOSERRORS
#include <os2.h>
#endif
#include "../src/tty.h"
#include "../src/util.h"
#include "../src/win.h"
#include "../src/cons.saver.h"
signed char console_flag = 1;
static unsigned char *scr_buffer;
static unsigned char *pointer;
static int GetScrRows();
static int GetScrCols();
static int GetScrRows()
{
VIOMODEINFO pvMode = {80};
unsigned int hVio = 0;
VioGetMode(&pvMode, hVio);
return (pvMode.row ? pvMode.row: 25);
}
static int GetScrCols()
{
VIOMODEINFO pvMode = {80};
unsigned int hVio = 0;
VioGetMode(&pvMode, hVio);
return (pvMode.col ? pvMode.col: 80);
}
void show_console_contents (int starty, unsigned char begin_line, unsigned char end_line)
{
int col = GetScrCols();
int row = GetScrRows();
int n;
register int z;
pointer = scr_buffer;
for (z=0; z<(begin_line * col); z++) {
pointer++; pointer++;
}
n = (end_line - begin_line + 1) * col;
VioWrtCellStr((PCH) pointer, (USHORT) n, begin_line, 0, 0);
return;
}
void handle_console (unsigned char action)
{
static int col;
static int row;
int n;
switch (action) {
case CONSOLE_INIT: /* Initialize */
col = GetScrCols();
row = GetScrRows();
scr_buffer = (unsigned char *) malloc(col * row * 2); /* short values */
n = col * row * 2;
VioReadCellStr((PCH) scr_buffer, (USHORT *) &n, 0, 0, 0); /* Just save it */
break;
case CONSOLE_DONE:
free(scr_buffer);
break;
case CONSOLE_SAVE: /* Save the screen */
n = col * row * 2;
VioReadCellStr((PCH) scr_buffer, (USHORT *) &n, 0, 0, 0);
break;
case CONSOLE_RESTORE:
n = col * row * 2;
VioWrtCellStr ((PCH) scr_buffer, (USHORT) n, 0, 0, 0); /* Write it back */
break;
default:
/* This is not possible, but if we are here, just save the screen */
handle_console(CONSOLE_SAVE);
break;
}
return;
}

35
rosapps/mc/pc/dirent.h Normal file
View File

@@ -0,0 +1,35 @@
/*
* direct.h Defines the types and structures used by the directory routines
*
*/
#ifndef _DIRENT_H_incl
#define _DIRENT_H_incl
#ifdef __cplupplus
extern "C" {
#endif
#include <sys/types.h>
#define NAME_MAX 255 /* maximum filename for HPFS or NTFS */
typedef struct dirent {
unsigned long* d_handle;
unsigned d_attr; /* file's attribute */
unsigned short int d_time; /* file's time */
unsigned short int d_date; /* file's date */
long d_size; /* file's size */
char d_name[ NAME_MAX + 1 ]; /* file's name */
unsigned short d_ino; /* serial number (not used) */
char d_first; /* flag for 1st time */
} DIR;
extern int closedir( DIR * );
extern DIR *opendir( const char * );
extern struct dirent *readdir( DIR * );
#ifdef __cplusplus
};
#endif
#endif /* _DIRENT_H_incl */

92
rosapps/mc/pc/dirent_nt.c Normal file
View File

@@ -0,0 +1,92 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <windows.h>
#include <errno.h>
#include "dirent.h"
DIR *opendir (const char * a_dir)
{
int err;
WIN32_FIND_DATA wfd;
DIR* dd_dir = (DIR*) malloc (sizeof(DIR));
char *c_dir = malloc (strlen(a_dir) + 4);
strcpy (c_dir, a_dir);
strcat (c_dir, "\\*");
dd_dir->d_handle = FindFirstFile (c_dir, &wfd);
if (dd_dir->d_handle == INVALID_HANDLE_VALUE) {
err = GetLastError();
switch (err) {
case ERROR_NO_MORE_FILES:
case ERROR_FILE_NOT_FOUND:
case ERROR_PATH_NOT_FOUND:
errno = ENOENT;
break;
case ERROR_NOT_ENOUGH_MEMORY:
errno = ENOMEM;
break;
default:
errno = EINVAL;
break;
}
free(dd_dir);
return NULL;
}
dd_dir->d_attr = (wfd.dwFileAttributes == FILE_ATTRIBUTE_NORMAL)
? 0 : wfd.dwFileAttributes;
dd_dir->d_time = dd_dir->d_date = 10;
dd_dir->d_size = wfd.nFileSizeLow;
strcpy (dd_dir->d_name, wfd.cFileName);
dd_dir->d_first = 1;
free (c_dir);
return dd_dir;
}
DIR *readdir( DIR * dd_dir)
{
int err;
WIN32_FIND_DATA wfd;
if (dd_dir->d_first) {
dd_dir->d_first = 0;
return dd_dir;
}
if(!FindNextFile (dd_dir->d_handle, &wfd)) {
err = GetLastError();
switch (err) {
case ERROR_NO_MORE_FILES:
case ERROR_FILE_NOT_FOUND:
case ERROR_PATH_NOT_FOUND:
errno = ENOENT;
break;
case ERROR_NOT_ENOUGH_MEMORY:
errno = ENOMEM;
break;
default:
errno = EINVAL;
break;
}
return NULL;
}
dd_dir->d_attr = (wfd.dwFileAttributes == FILE_ATTRIBUTE_NORMAL)
? 0 : wfd.dwFileAttributes;
dd_dir->d_time = dd_dir->d_date = 10;
dd_dir->d_size = wfd.nFileSizeLow;
strcpy (dd_dir->d_name, wfd.cFileName);
return dd_dir;
}
int closedir (DIR *dd_dir)
{
FindClose(dd_dir->d_handle);
free (dd_dir);
return 1;
}

110
rosapps/mc/pc/dirent_os2.c Normal file
View File

@@ -0,0 +1,110 @@
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#define INCL_DOSFILEMGR
#define INCL_DOSERRORS
#include <os2.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include "dirent.h"
DIR *opendir (const char * a_dir)
{
APIRET rc;
FILEFINDBUF3 FindBuffer = {0};
ULONG FileCount = 1;
DIR *dd_dir = (DIR*) malloc (sizeof(DIR));
char *c_dir = (char*) malloc (strlen(a_dir) + 5);
strcpy (c_dir, a_dir);
strcat (c_dir, "\\*.*");
dd_dir->d_handle = (unsigned long*) HDIR_CREATE;
rc = DosFindFirst(c_dir,
(PHDIR) &dd_dir->d_handle,
FILE_SYSTEM | FILE_HIDDEN | FILE_DIRECTORY,
(PVOID) &FindBuffer,
sizeof(FILEFINDBUF3),
&FileCount,
FIL_STANDARD);
if (rc) {
switch (rc) {
case ERROR_NO_MORE_FILES:
case ERROR_FILE_NOT_FOUND:
case ERROR_PATH_NOT_FOUND:
errno = ENOENT;
break;
case ERROR_BUFFER_OVERFLOW:
errno = ENOMEM;
break;
default:
errno = EINVAL;
break;
}
free(dd_dir);
return NULL;
}
dd_dir->d_attr = FindBuffer.attrFile;
dd_dir->d_time = dd_dir->d_date = 10;
dd_dir->d_size = FindBuffer.cbFile;
strcpy (dd_dir->d_name, FindBuffer.achName);
dd_dir->d_first = 1;
free (c_dir);
return dd_dir;
}
DIR *readdir( DIR * dd_dir)
{
APIRET rc;
FILEFINDBUF3 FindBuffer = {0};
ULONG FileCount = 1;
DIR *ret_dir = (DIR*) malloc (sizeof(DIR));
if (dd_dir->d_first) {
dd_dir->d_first = 0;
return dd_dir;
}
rc = DosFindNext((HDIR) dd_dir->d_handle,
(PVOID) &FindBuffer,
sizeof(FILEFINDBUF3),
&FileCount);
if (rc) {
switch (rc) {
case ERROR_NO_MORE_FILES:
case ERROR_FILE_NOT_FOUND:
case ERROR_PATH_NOT_FOUND:
errno = ENOENT;
break;
case ERROR_BUFFER_OVERFLOW:
errno = ENOMEM;
break;
default:
errno = EINVAL;
break;
}
return NULL;
}
ret_dir->d_attr = FindBuffer.attrFile;
ret_dir->d_time = ret_dir->d_date = 10;
ret_dir->d_size = FindBuffer.cbFile;
strcpy (ret_dir->d_name, FindBuffer.achName);
return ret_dir;
}
int closedir (DIR *dd_dir)
{
if (dd_dir->d_handle != (unsigned long*) HDIR_CREATE) {
DosFindClose((HDIR) dd_dir->d_handle);
}
free (dd_dir);
return 1;
}

226
rosapps/mc/pc/drive.c Normal file
View File

@@ -0,0 +1,226 @@
/* Ch-Drive command for Windows NT and OS/2
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
Bug:
the code will not work if you have more drives than those that
can fit in a panel.
*/
#include <config.h>
#ifdef _OS_NT
#include <windows.h>
#include "util_win32.h"
#endif
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include "../src/tty.h"
#include "../src/mad.h"
#include "../src/util.h"
#include "../src/win.h"
#include "../src/color.h"
#include "../src/dlg.h"
#include "../src/widget.h"
#include "../src/dialog.h"
#include "../src/dir.h"
#include "../src/panel.h"
#include "../src/main.h"
#include "../src/cmd.h"
struct Dlg_head *drive_dlg;
WPanel *this_panel;
static int drive_dlg_callback (Dlg_head *h, int Par, int Msg);
static void drive_dlg_refresh (void);
static void drive_cmd(void);
#define B_DRIVE_BASE 100
#define MAX_LGH 13 /* Length for drives */
static void drive_cmd()
{
int i, nNewDrive, nDrivesAvail;
char szTempBuf[7], szDrivesAvail[27*4], *p;
/* Dialogbox position */
int x_pos;
int y_pos = (LINES-6)/2-3;
int y_height;
int x_width;
int m_drv;
/* Get drives name and count */
#ifdef _OS_NT
GetLogicalDriveStrings (255, szDrivesAvail);
for (nDrivesAvail = 0, p = szDrivesAvail; *p; nDrivesAvail++)
p+=4;
#else
unsigned long uDriveNum, uDriveMap;
nDrivesAvail = 0;
p = szDrivesAvail;
DosQueryCurrentDisk(&uDriveNum, &uDriveMap);
for (i = 0; i < 26; i++) {
if ( uDriveMap & (1 << i) ) {
*p = 'A' + i;
p += 4;
nDrivesAvail++;
}
}
*p = 0;
#endif
/* Create Dialog */
do_refresh ();
m_drv = ((nDrivesAvail > MAX_LGH) ? MAX_LGH: nDrivesAvail);
/* Center on x, relative to panel */
x_pos = this_panel->widget.x + (this_panel->widget.cols - m_drv*3)/2 + 2;
if (nDrivesAvail > MAX_LGH) {
y_height = 8;
x_width = 33;
} else {
y_height = 6;
x_width = (nDrivesAvail - 1) * 2 + 9;
}
drive_dlg = create_dlg (y_pos, x_pos, y_height, x_width, dialog_colors,
drive_dlg_callback, _("[ChDrive]"),_("drive"), DLG_NONE);
x_set_dialog_title (drive_dlg, _("Change Drive") );
if (nDrivesAvail>MAX_LGH) {
for (i = 0; i < nDrivesAvail - MAX_LGH; i++) {
p -= 4;
sprintf(szTempBuf, "&%c", *p);
add_widgetl(drive_dlg,
button_new (5,
(m_drv-i-1)*2+4 - (MAX_LGH*2 - nDrivesAvail) * 2,
B_DRIVE_BASE + nDrivesAvail - i - 1,
HIDDEN_BUTTON,
szTempBuf, 0, NULL, NULL),
XV_WLAY_RIGHTOF);
}
}
/* Add a button for each drive */
for (i = 0; i < m_drv; i++) {
p -= 4;
sprintf (szTempBuf, "&%c", *p);
add_widgetl(drive_dlg,
button_new (3, (m_drv-i-1)*2+4, B_DRIVE_BASE+m_drv-i-1,
HIDDEN_BUTTON, szTempBuf, 0, NULL, NULL),
XV_WLAY_RIGHTOF);
}
run_dlg(drive_dlg);
/* do action */
if (drive_dlg->ret_value != B_CANCEL) {
int errocc = 0; /* no error */
int rtn;
char drvLetter;
/* Set the Panel to Directory listing mode first */
int is_right=(this_panel==right_panel);
set_display_type (is_right?1:0, view_listing);
this_panel=is_right?right_panel:left_panel;
/* */
nNewDrive = drive_dlg->ret_value - B_DRIVE_BASE;
drvLetter = (char) *(szDrivesAvail + (nNewDrive*4));
#ifdef _OS_NT
if (win32_GetPlatform() == OS_WinNT) { /* Windows NT */
rtn = _chdrive(drvLetter - 'A' + 1);
} else { /* Windows 95 */
rtn = 1;
SetCurrentDirectory(szDrivesAvail+(nNewDrive*4));
}
#else
rtn = DosSetDefaultDisk(nNewDrive + 1);
#endif
if (rtn == -1)
errocc = 1;
else {
getcwd (this_panel->cwd, sizeof (this_panel->cwd)-2);
if (toupper(drvLetter) == toupper(*(this_panel->cwd))) {
clean_dir (&this_panel->dir, this_panel->count);
this_panel->count = do_load_dir(&this_panel->dir,
this_panel->sort_type,
this_panel->reverse,
this_panel->case_sensitive,
this_panel->filter);
this_panel->top_file = 0;
this_panel->selected = 0;
this_panel->marked = 0;
this_panel->total = 0;
show_dir(this_panel);
reread_cmd();
} else
errocc = 1;
}
if (errocc)
message (1, _(" Error "), _(" Can't access drive %c: "),
*(szDrivesAvail+(nNewDrive*4)) );
}
destroy_dlg (drive_dlg);
repaint_screen ();
}
void drive_cmd_a()
{
this_panel = left_panel;
drive_cmd();
}
void drive_cmd_b()
{
this_panel = right_panel;
drive_cmd();
}
void drive_chg(WPanel *panel)
{
this_panel = panel;
drive_cmd();
}
static int drive_dlg_callback (Dlg_head *h, int Par, int Msg)
{
switch (Msg) {
#ifndef HAVE_X
case DLG_DRAW:
drive_dlg_refresh ();
break;
#endif
}
return 0;
}
static void drive_dlg_refresh (void)
{
attrset (dialog_colors[0]);
dlg_erase (drive_dlg);
draw_box (drive_dlg, 1, 1, drive_dlg->lines-2, drive_dlg->cols-2);
attrset (dialog_colors[2]);
dlg_move (drive_dlg, 1, drive_dlg->cols/2 - 7);
addstr (_(" Change Drive "));
}

4
rosapps/mc/pc/drive.h Normal file
View File

@@ -0,0 +1,4 @@
void drive_cmd_a(WPanel *);
void drive_cmd_b(WPanel *);
void drive_chg(WPanel *panel);

325
rosapps/mc/pc/key_nt.c Normal file
View File

@@ -0,0 +1,325 @@
/* Keyboard support routines.
for Windows NT system.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
Bugs:
Have trouble with non-US keyboards, "Alt-gr"+keys (API tells CTRL-ALT is pressed)
*/
#include <config.h>
#ifndef _OS_NT
#error This file is for Win32 systems.
#else
#include <windows.h>
#include <stdio.h>
#include "../src/mouse.h"
#include "../src/global.h"
#include "../src/main.h"
#include "../src/key.h"
#include "../vfs/vfs.h"
#include "../src/tty.h"
#include "trace_nt.h"
/* Global variables */
int old_esc_mode = 0;
HANDLE hConsoleInput;
DWORD dwSaved_ControlState;
Gpm_Event evSaved_Event;
/* Unused variables */
int double_click_speed; /* they are here to keep linker happy */
int mou_auto_repeat;
int use_8th_bit_as_meta = 0;
/* Static Tables */
struct {
int key_code;
int vkcode;
} key_table [] = {
{ KEY_F(1), VK_F1 },
{ KEY_F(2), VK_F2 },
{ KEY_F(3), VK_F3 },
{ KEY_F(4), VK_F4 },
{ KEY_F(5), VK_F5 },
{ KEY_F(6), VK_F6 },
{ KEY_F(7), VK_F7 },
{ KEY_F(8), VK_F8 },
{ KEY_F(9), VK_F9 },
{ KEY_F(10), VK_F10 },
{ KEY_F(11), VK_F11 },
{ KEY_F(12), VK_F12 },
{ KEY_F(13), VK_F13 },
{ KEY_F(14), VK_F14 },
{ KEY_F(15), VK_F15 },
{ KEY_F(16), VK_F16 },
{ KEY_F(17), VK_F17 },
{ KEY_F(18), VK_F18 },
{ KEY_F(19), VK_F19 },
{ KEY_F(20), VK_F20 },
{ KEY_IC, VK_INSERT },
{ KEY_DC, VK_DELETE },
{ KEY_BACKSPACE, VK_BACK },
{ KEY_PPAGE, VK_PRIOR },
{ KEY_NPAGE, VK_NEXT },
{ KEY_LEFT, VK_LEFT },
{ KEY_RIGHT, VK_RIGHT },
{ KEY_UP, VK_UP },
{ KEY_DOWN, VK_DOWN },
{ KEY_HOME, VK_HOME },
{ KEY_END, VK_END },
{ ALT('*'), VK_MULTIPLY },
{ ALT('+'), VK_ADD },
{ ALT('-'), VK_SUBTRACT },
{ ALT('\t'), VK_PAUSE }, /* Added to make Complete work press Pause */
{ ESC_CHAR, VK_ESCAPE },
{ 0, 0}
};
/* init_key - Called in main.c to initialize ourselves
Get handle to console input
*/
void init_key (void)
{
win32APICALL_HANDLE (hConsoleInput, GetStdHandle (STD_INPUT_HANDLE));
}
int ctrl_pressed ()
{
if(dwSaved_ControlState & RIGHT_ALT_PRESSED) return 0;
/* The line above fixes the BUG with the AltGr Keys*/
return dwSaved_ControlState & (RIGHT_CTRL_PRESSED | LEFT_CTRL_PRESSED);
}
int shift_pressed ()
{
if(dwSaved_ControlState & RIGHT_ALT_PRESSED) return 0;
/* The line above fixes the BUG with the AltGr Keys*/
return dwSaved_ControlState & SHIFT_PRESSED;
}
int alt_pressed ()
{
return dwSaved_ControlState & (/* RIGHT_ALT_PRESSED | */ LEFT_ALT_PRESSED);
}
static int VKtoCurses (int a_vkc)
{
int i;
for (i = 0; key_table[i].vkcode != 0; i++)
if (a_vkc == key_table[i].vkcode) {
return key_table[i].key_code;
}
return 0;
}
static int translate_key_code(int asc, int scan)
{
int c;
switch(scan){
case 106: /* KP_MULT*/
return ALT('*');
case 107: /* KP_PLUS*/
return ALT('+');
case 109: /* KP_MINUS*/
return ALT('-');
}
c = VKtoCurses (scan);
if (!asc && !c)
return 0;
if (asc && c)
return c;
if (!asc || asc=='\t' )
{
if (shift_pressed() && (c >= KEY_F(1)) && (c <= KEY_F(10)))
c += 10;
if (alt_pressed() && (c >= KEY_F(1)) && (c <= KEY_F(2)))
c += 10;
if (alt_pressed() && (c == KEY_F(7)))
c = ALT('?');
if (asc == '\t'){
if(ctrl_pressed())c = ALT('\t');
else c=asc;
}
return c;
}
if (ctrl_pressed())
return XCTRL(asc);
if (alt_pressed())
return ALT(asc);
if (asc == 13)
return 10;
return asc;
}
int get_key_code (int no_delay)
{
INPUT_RECORD ir; /* Input record */
DWORD dw; /* number of records actually read */
int ch, vkcode, j;
if (no_delay) {
/* Check if any input pending, otherwise return */
nodelay (stdscr, TRUE);
win32APICALL(PeekConsoleInput(hConsoleInput, &ir, 1, &dw));
if (!dw)
return 0;
}
do {
win32APICALL(ReadConsoleInput(hConsoleInput, &ir, 1, &dw));
switch (ir.EventType) {
case KEY_EVENT:
if (!ir.Event.KeyEvent.bKeyDown) /* Process key just once: when pressed */
break;
vkcode = ir.Event.KeyEvent.wVirtualKeyCode;
//#ifndef __MINGW32__
ch = ir.Event.KeyEvent.uChar.AsciiChar;
//#else
// ch = ir.Event.KeyEvent.AsciiChar;
//#endif
dwSaved_ControlState = ir.Event.KeyEvent.dwControlKeyState;
j = translate_key_code (ch, vkcode);
if (j)
return j;
break;
case MOUSE_EVENT:
/* Save event as a GPM-like event */
evSaved_Event.x = ir.Event.MouseEvent.dwMousePosition.X;
evSaved_Event.y = ir.Event.MouseEvent.dwMousePosition.Y+1;
evSaved_Event.buttons = ir.Event.MouseEvent.dwButtonState;
switch (ir.Event.MouseEvent.dwEventFlags) {
case 0:
evSaved_Event.type = GPM_DOWN | GPM_SINGLE;
break;
case MOUSE_MOVED:
evSaved_Event.type = GPM_MOVE;
break;
case DOUBLE_CLICK:
evSaved_Event.type = GPM_DOWN | GPM_DOUBLE;
break;
};
return 0;
}
} while (!no_delay);
return 0;
}
static int getch_with_delay (void)
{
int c;
while (1) {
/* Try to get a character */
c = get_key_code (0);
if (c != ERR)
break;
}
/* Success -> return the character */
return c;
}
/* Returns a character read from stdin with appropriate interpretation */
int get_event (Gpm_Event *event, int redo_event, int block)
{
int c;
static int flag; /* Return value from select */
static int dirty = 3;
if ((dirty == 1) || is_idle ()){
refresh ();
doupdate ();
dirty = 1;
} else
dirty++;
vfs_timeout_handler ();
c = block ? getch_with_delay () : get_key_code (1);
if (!c) {
/* Code is 0, so this is a Control key or mouse event */
return EV_NONE; /* FIXME: mouse not supported */
}
return c;
}
/* Returns a key press, mouse events are discarded */
int mi_getch ()
{
Gpm_Event ev;
int key;
while ((key = get_event (&ev, 0, 1)) == 0)
;
return key;
}
/*
is_idle - A function to check if we're idle.
It checks for any waiting event (that can be a Key, Mouse event,
and other internal events like focus or menu)
*/
int is_idle (void)
{
DWORD dw;
if (GetNumberOfConsoleInputEvents (hConsoleInput, &dw))
if (dw > 15)
return 0;
return 1;
}
/* get_modifier */
int get_modifier()
{
int retval = 0;
if (dwSaved_ControlState & LEFT_ALT_PRESSED) /* code is not clean, because we return Linux-like bitcodes*/
retval |= ALTL_PRESSED;
if (dwSaved_ControlState & RIGHT_ALT_PRESSED)
retval |= ALTR_PRESSED;
if (dwSaved_ControlState & RIGHT_CTRL_PRESSED ||
dwSaved_ControlState & LEFT_CTRL_PRESSED)
retval |= CONTROL_PRESSED;
if (dwSaved_ControlState & SHIFT_PRESSED)
retval |= SHIFT_PRESSED;
return retval;
}
/* void functions for UNIX compatibility */
void define_sequence (int code, char* vkcode, int action) {}
void channels_up() {}
void channels_down() {}
void init_key_input_fd (void) {}
void numeric_keypad_mode (void) {}
void application_keypad_mode (void) {}
/* mouse is not yet supported, sorry */
void init_mouse (void) {}
void shut_mouse (void) {}
#endif /* _OS_NT */

408
rosapps/mc/pc/key_os2.c Normal file
View File

@@ -0,0 +1,408 @@
/* Keyboard support routines.
for OS/2 system.
20. April 97: Alexander Dong (ado)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <config.h>
#ifndef __os2__
#error This file is for OS/2 systems.
#else
#define INCL_BASE
#define INCL_NOPM
#define INCL_VIO
#define INCL_KBD
#define INCL_DOS
#define INCL_DOSERRORS
#define INCL_WININPUT
#include <os2.h>
#include <stdio.h>
#include "../src/mouse.h"
#include "../src/global.h"
#include "../src/main.h"
#include "../src/key.h"
#include "../vfs/vfs.h"
#include "../src/tty.h"
/* Code to read keystrokes in a separate thread */
typedef struct kbdcodes {
UCHAR ascii;
UCHAR scan;
USHORT shift; /* .ado: change for mc */
} KBDCODES;
/* Global variables */
int old_esc_mode = 0;
/* HANDLE hConsoleInput;
DWORD dwSaved_ControlState; */
Gpm_Event evSaved_Event;
/* Unused variables */
int double_click_speed; /* they are here to keep linker happy */
int mou_auto_repeat;
int use_8th_bit_as_meta = 0;
static int VKtoCurses (int vkcode);
/* -------------------------------------------------------------- */
/* DEFINITIONS:
Return from SLANG: KeyCode: 0xaaaabbcc
where: aaaa = Flags
bb = Scan code
cc = ASCII-code (if available)
if no flags (CTRL and ALT) is set, cc will be returned.
If CTRL is pressed, cc is already the XCTRL(code).
case cc is:
0xE0: The scan code will be used for the following keys:
Insert: 0x52, DEL: 0x53,
Page_Up: 0x49, Page_Down: 0x51,
Pos1: 0x47, Ende: 0x4F,
Up: 0x48, Down: 0x50,
Left: 0x4B, Right: 0x4D,
0x00: The function keys are defined as:
F1: 3b00, F2: 3c00 ... F10: 4400, F11: 8500, F12: 8600.
With ALT-bit set:
ALT(F1): 6800, 6900,... ALT(F10): 7100, ALT(F11): 8b00
ALT(F12): 8c00
Mapping for ALT(key_code):
For Mapping with normal keys, only the scan code can be
used. (see struct ALT_table)
Special keys:
ENTER (number block): 0xaaaaE00D
+ (number block): 0xaaaa4E2B Normal: 1B2B
- (number block): 0xaaaa4A2D Normal: 352D
* (number block): 0xaaaa372A Normal: 1B2A
/ (number block): 0xaaaaE02F
*/
/* -------------------------------------------------------------- */
#define RIGHT_SHIFT_PRESSED 1
#define LEFT_SHIFT_PRESSED 2
#define CTRL_PRESSED 4
#define ALT_PRESSED 8
#define SCROLL_LOCK_MODE 16
#define NUM_LOCK_MODE 32
#define CAPS_LOCK_MODE 64
#define INSERT_MODE 128
#define LEFT_CTRL_PRESSED 256
#define LEFT_ALT_PRESSED 512
#define RIGHT_CTRL_PRESSED 1024
#define RIGHT_ALT_PRESSED 2048
#define SCROLL_LOCK_PRESSED 4096
#define NUM_LOCK_PRESSED 8192
#define CAPS_LOCK_PRESSED 16384
#define SYSREQ 32768
/* -------------------------------------------------------------- */
/* Static Tables */
struct {
int key_code;
int vkcode;
} fkt_table [] = {
{ KEY_F(1), 0x3B },
{ KEY_F(2), 0x3C },
{ KEY_F(3), 0x3D },
{ KEY_F(4), 0x3E },
{ KEY_F(5), 0x3F },
{ KEY_F(6), 0x40 },
{ KEY_F(7), 0x41 },
{ KEY_F(8), 0x42 },
{ KEY_F(9), 0x43 },
{ KEY_F(10), 0x44 },
{ KEY_F(11), 0x85 },
{ KEY_F(12), 0x86 },
{ 0, 0}
};
struct {
int key_code;
int vkcode;
} ALT_table [] = {
{ ALT('a'), 0x1E },
{ ALT('b'), 0x30 },
{ ALT('c'), 0x2E },
{ ALT('d'), 0x20 },
{ ALT('e'), 0x12 },
{ ALT('f'), 0x21 },
{ ALT('g'), 0x22 },
{ ALT('h'), 0x23 },
{ ALT('i'), 0x17 },
{ ALT('j'), 0x24 },
{ ALT('k'), 0x25 },
{ ALT('l'), 0x26 },
{ ALT('m'), 0x32 },
{ ALT('n'), 0x31 },
{ ALT('o'), 0x18 },
{ ALT('p'), 0x19 },
{ ALT('q'), 0x10 },
{ ALT('r'), 0x13 },
{ ALT('s'), 0x1F },
{ ALT('t'), 0x14 },
{ ALT('u'), 0x16 },
{ ALT('v'), 0x2F },
{ ALT('w'), 0x11 },
{ ALT('x'), 0x2D },
{ ALT('y'), 0x15 },
{ ALT('z'), 0x2C },
{ ALT('\n'), 0x1c },
{ ALT('\n'), 0xA6 },
{ ALT(KEY_F(1)), 0x68 },
{ ALT(KEY_F(2)), 0x69 },
{ ALT(KEY_F(3)), 0x6A },
{ ALT(KEY_F(4)), 0x6B },
{ ALT(KEY_F(5)), 0x6C },
{ ALT(KEY_F(6)), 0x6D },
{ ALT(KEY_F(7)), 0x6E },
{ ALT(KEY_F(8)), 0x6F },
{ ALT(KEY_F(9)), 0x70 },
{ ALT(KEY_F(10)), 0x71 },
{ ALT(KEY_F(11)), 0x8B },
{ ALT(KEY_F(12)), 0x8C },
{ 0, 0}
};
struct {
int key_code;
int vkcode;
} movement [] = {
{ KEY_IC, 0x52 },
{ KEY_DC, 0x53 },
{ KEY_PPAGE, 0x49 },
{ KEY_NPAGE, 0x51 },
{ KEY_LEFT, 0x4B },
{ KEY_RIGHT, 0x4D },
{ KEY_UP, 0x48 },
{ KEY_DOWN, 0x50 },
{ KEY_HOME, 0x47 },
{ KEY_END, 0x4F },
{ 0, 0}
};
/* init_key -- to make linker happy */
void init_key (void)
{
return;
}
/* The maximum sequence length (32 + null terminator) */
static int seq_buffer[33];
static int *seq_append = 0;
static int push_char (int c)
{
if (!seq_append)
seq_append = seq_buffer;
if (seq_append == &(seq_buffer [sizeof (seq_buffer)-2]))
return 0;
*(seq_append++) = c;
*seq_append = 0;
return 1;
}
int get_key_code (int no_delay)
{
unsigned int inp_ch;
if (no_delay) {
/* Check if any input pending, otherwise return */
nodelay (stdscr, TRUE);
inp_ch = SLang_input_pending(0);
if (inp_ch == 0) {
return 0;
}
}
if (no_delay) {
return (VKtoCurses(inp_ch));
}
do {
inp_ch = SLang_getkey();
if (!inp_ch)
inp_ch = (SLang_getkey() << 8);
if (inp_ch) return (VKtoCurses(inp_ch));
} while (!no_delay);
return 0;
}
static int VKtoCurses (int a_vkc)
{
int ctrlState = 0;
int altState = 0;
int fsState;
char scanCode;
char asciiCode;
register int i;
int rtnCode = 0;
fsState = (a_vkc & 0xFFFF0000) >> 16;
fsState &= (~INSERT_MODE); /* Ignore Insertion mode */
scanCode = (char) ((a_vkc & 0x0000FFFF) >> 8);
asciiCode = (char) (a_vkc & 0x000000FF);
ctrlState = (fsState & CTRL_PRESSED);
altState = (fsState & ALT_PRESSED);
rtnCode = asciiCode;
if (ctrlState) {
/* CTRL pressed */
rtnCode = XCTRL(asciiCode);
}
if (altState) {
/* ALT pressed
* rtnCode = ALT(asciiCode);
*
* With German keyboards, the Values between 7B -> 7D
* and 5b, 5d, 40, fd, fc and e6 are only reachable with the AltGr
* key. If such a combination is used, asciiCode will not be zero.
* With the normal ALT key, the asciiCode will always be zero.
*/
if (asciiCode) {
return asciiCode;
}
}
/* Scan Movement codes */
if (asciiCode == 0) {
/* Replace key code with that in table */
for (i=0; movement[i].vkcode != 0 || movement[i].key_code != 0; i++)
if (scanCode == movement[i].vkcode)
return (movement[i].key_code);
}
if (asciiCode == 0) {
/* Function-key detected */
for (i=0; fkt_table[i].vkcode != 0 || fkt_table[i].key_code != 0; i++)
if (scanCode == fkt_table[i].vkcode)
return (fkt_table[i].key_code);
/* ALT - KEY */
/* if (altState) */ {
for (i=0; ALT_table[i].vkcode != 0 || ALT_table[i].key_code != 0; i++)
if (scanCode == ALT_table[i].vkcode)
return (ALT_table[i].key_code);
}
}
if (asciiCode == 0x0d) {
return '\n';
}
return rtnCode;
}
static int getch_with_delay (void)
{
int c;
while (1) {
/* Try to get a character */
c = get_key_code (0);
if (c != ERR)
break;
}
/* Success -> return the character */
return c;
}
int get_event (Gpm_Event *event, int redo_event, int block)
{
int c;
static int dirty = 3;
if ((dirty == 1) || is_idle ()){
refresh ();
doupdate ();
dirty = 1;
} else
dirty++;
vfs_timeout_handler ();
c = block ? getch_with_delay () : get_key_code (1);
if (!c) {
/* Code is 0, so this is a Control key or mouse event */
*event = evSaved_Event;
return EV_NONE; /* FIXME: when should we return EV_MOUSE ? */
}
return c;
}
/* Returns a key press, mouse events are discarded */
int mi_getch ()
{
Gpm_Event ev;
int key;
while ((key = get_event (&ev, 0, 1)) == 0)
;
return key;
}
/*
is_idle - A function to check if we're idle.
It checks for any waiting event (that can be a Key, Mouse event,
and other internal events like focus or menu)
*/
int is_idle (void)
{
return 1;
}
/* get_modifier */
int get_modifier()
{
return 0;
}
int ctrl_pressed ()
{
return 0;
}
/* void functions for UNIX copatibility */
void define_sequence (int code, char* vkcode, int action) {}
void channels_up() {}
void channels_down() {}
void init_key_input_fd (void) {}
void numeric_keypad_mode (void) {}
void application_keypad_mode (void) {}
/* mouse is not yet supported, sorry */
void init_mouse (void) {}
void shut_mouse (void) {}
#endif /* __os2__ */

60
rosapps/mc/pc/mc.rc Normal file
View File

@@ -0,0 +1,60 @@
#include "../VERSION"
#ifndef WINDRES
# include "windows.h"
# include "winver.h"
#endif
/* English (U.S.) resources */
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
#ifndef WINDRES
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#endif
#pragma code_page(1252)
#endif /* _WIN32 */
/* Version */
VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,0,0,1
PRODUCTVERSION 3,0,0,1
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x40000L
FILETYPE 0x1L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904E4"
BEGIN
VALUE "CompanyName", "Free Software Foundation"
VALUE "FileDescription", "GNU Midnight Commander"
VALUE "FileVersion", VERSION
VALUE "InternalName", "MC"
VALUE "LegalCopyright", "(c) Free Software Foundation"
VALUE "LegalTrademarks", "see GNU General Public License"
VALUE "OriginalFilename", "MC.EXE"
VALUE "ProductName", "GNU Midnight Commander"
VALUE "ProductVersion", VERSION
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1252
END
END
/* Icon */
// 0 ICON DISCARDABLE "mc_nt.ico"
// 1 ICON DISCARDABLE "bez03.ico"
#endif /* English (U.S.) resources */

41
rosapps/mc/pc/readme Normal file
View File

@@ -0,0 +1,41 @@
This is the port of Midnight Commander for OS/2, Windows 95 and Windows NT.
This port is based on the port for Windows NT by
Juan Grigera <grigera@isis.unlp.edu.ar>
and the port for OS/2 by
Alexander Dong <ado@software-ag.de>
and is currently maintained by
Pavel Roskin <pavel.roskin@ecsoft.co.uk>
This port of the Midnight Commander is released under the GNU General
Public License version 2.0 or any later version. See file COPYING for
details.
Following compilers are supported:
For Windows NT:
Makefile.VC4: Microsoft Visual C++ 4.0 and above
Makefile.BC5: Borland C++ 5.x
For OS/2:
Makefile.EMX: EMX/GCC
Makefile.BC2: Borland C++ 2.x
Makefile.IBM: IBM CSet or Visual Age C++
You need GNU make in order to compile mc. Other implementation of
make will not work! Run
gmake -f Makefile.xxx [RELEASE=1]
where gmake is name of GNU make and Makefile.xxx is the makefile for
your compiler. You may want to add RELEASE=1 if you want to compile an
optimized version without debug information.
Please note, that not all compilers are equal. You may need to create
dummy include files or change something in order to be able to compile
mc. BUT PLEASE DON'T TRY TO INCORPORATE SUCH QUICK HACKS INTO THE
MC DISTRIBUTION! Try to make your changes work with all other compilers.
If you add a file, don't forget to add it into FILES statement of
Makefile in this directory. Otherwise this file will not be copied to
the distribution.
This port is not very stable now. See files BUGS and TODO in this
directory.
Pavel Roskin <pavel.roskin@ecsoft.co.uk>

269
rosapps/mc/pc/slint_pc.c Normal file
View File

@@ -0,0 +1,269 @@
/* Slang interface to the Midnight Commander for Windows NT and OS/2
This emulates some features of ncurses on top of slang
S-lang is not fully consistent between its Unix and non-Unix versions.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include <config.h>
#include <stdio.h>
#include "../src/tty.h"
#include "../src/mad.h"
#include "../src/color.h"
#include "../src/util.h"
#include "../src/mouse.h" /* Gpm_Event is required in key.h */
#include "../src/key.h" /* define_sequence */
#include "../src/main.h" /* extern: force_colors */
#include "../src/win.h" /* do_exit_ca_mode */
#ifdef HAVE_SLANG
static void slang_sigterm ()
{
SLsmg_reset_smg ();
}
static int slinterrupt;
void enable_interrupt_key(void)
{
SLang_set_abort_signal(NULL);
slinterrupt = 1;
}
void disable_interrupt_key(void)
{
slinterrupt = 0;
}
int got_interrupt ()
{
int t;
int SLKeyboard_Quit=0; /* FIXME!! */
t = slinterrupt ? SLKeyboard_Quit : 0;
/* SLKeyboard_Quit = 0; */
return t;
}
/* Only done the first time */
void slang_init (void)
{
SLtt_get_terminfo ();
SLang_init_tty (XCTRL('c'), 1, 0);
slang_prog_mode ();
load_terminfo_keys ();
}
/* Done each time we come back from done mode */
void slang_prog_mode (void)
{
SLsmg_init_smg ();
SLsmg_touch_lines (0, LINES);
}
/* Called each time we want to shutdown slang screen manager */
void slang_shell_mode (void)
{
}
void slang_shutdown ()
{
slang_shell_mode ();
do_exit_ca_mode ();
SLang_reset_tty ();
/* reset the colors to those that were
* active when the program was started up
(not written)
*/
}
/* keypad routines */
void slang_keypad (int set)
{
/* enable keypad strings */
}
static int no_slang_delay;
void set_slang_delay (int v)
{
no_slang_delay = v;
}
void hline (int ch, int len)
{
int last_x, last_y;
last_x = SLsmg_get_column ();
last_y = SLsmg_get_row ();
if (ch == 0)
ch = ACS_HLINE;
if (ch == ACS_HLINE){
SLsmg_draw_hline (len);
} else {
while (len--)
addch (ch);
}
move (last_y, last_x);
}
void vline (int character, int len)
{
if (!slow_terminal){
SLsmg_draw_vline (len);
} else {
int last_x, last_y, pos = 0;
last_x = SLsmg_get_column ();
last_y = SLsmg_get_row ();
while (len--){
move (last_y + pos++, last_x);
addch (' ');
}
move (last_x, last_y);
}
}
int has_colors ()
{
/* No terminals on NT, make default color */
if (!disable_colors)
SLtt_Use_Ansi_Colors = 1;
/* Setup emulated colors */
if (SLtt_Use_Ansi_Colors){
/* DO NOT TRANSLATE WITH gettext SYNTAX coloring will be broken */
init_pair (A_REVERSE, "black", "white");
} else {
/* SLtt_set_mono (A_BOLD, NULL, SLTT_BOLD_MASK);
SLtt_set_mono (A_REVERSE, NULL, SLTT_REV_MASK);
SLtt_set_mono (A_BOLD|A_REVERSE, NULL, SLTT_BOLD_MASK | SLTT_REV_MASK);
*/ }
return SLtt_Use_Ansi_Colors;
}
void attrset (int color)
{
if (!SLtt_Use_Ansi_Colors){
SLsmg_set_color (color);
return;
}
if (color & A_BOLD){
if (color == A_BOLD)
SLsmg_set_color (A_BOLD);
else
SLsmg_set_color ((color & (~A_BOLD)) + 8);
return;
}
if (color == A_REVERSE)
SLsmg_set_color (A_REVERSE);
else
SLsmg_set_color (color);
}
void load_terminfo_keys ()
{
}
int getch ()
{
if (no_slang_delay)
if (SLang_input_pending (0) == 0)
return -1;
return SLang_getkey ();
}
extern int slow_terminal;
#else
/* Non slang builds do not understand got_interrupt */
int got_interrupt ()
{
return 0;
}
#endif /* HAVE_SLANG */
void mc_refresh (void)
{
/* if (!we_are_background) (no background mode yet) */
refresh ();
}
void slang_set_raw_mode (void)
{
return;
}
int max_index = 0;
void
init_pair (int index, char *foreground, char *background)
{
SLtt_set_color (index, "", foreground, background);
if (index > max_index)
max_index = index;
}
int
alloc_color_pair (char *foreground, char *background)
{
init_pair (++max_index, foreground, background);
return max_index;
}
int
try_alloc_color_pair (char *fg, char *bg)
{
static struct colors_avail {
struct colors_avail *next;
char *fg, *bg;
int index;
} *p, c =
{
0, 0, 0, 0
};
c.index = NORMAL_COLOR;
p = &c;
for (;;) {
if (((fg && p->fg) ? !strcmp (fg, p->fg) : fg == p->fg) != 0
&& ((bg && p->bg) ? !strcmp (bg, p->bg) : bg == p->bg) != 0)
return p->index;
if (!p->next)
break;
p = p->next;
}
p->next = malloc (sizeof (c));
p = p->next;
p->next = 0;
p->fg = fg ? strdup (fg) : 0;
p->bg = bg ? strdup (bg) : 0;
/* DO NOT TRANSLATE WITH gettext SYNTAX coloring will be broken */
if (!fg)
fg = "white";
if (!bg)
bg = "blue";
p->index = alloc_color_pair (fg, bg);
return p->index;
}

View File

@@ -0,0 +1,7 @@
/* Systems having sys/param.h should not include this file */
#ifdef HAVE_PARAM_H
#error Remove this file if you have real sys/param.h
#else
/* FIXME: We should warn, that this file should not be included */
#endif

View File

@@ -0,0 +1,16 @@
#ifndef _SYS_TIME_H
#define _SYS_TIME_H
#ifndef _WINSOCKAPI_ /* winsock.h defines struct timeval */
struct timeval {
long tv_sec;
long tv_usec;
};
#endif
int gettimeofday (struct timeval*, void *);
#endif

12
rosapps/mc/pc/todo Normal file
View File

@@ -0,0 +1,12 @@
TODO
- Make most files common for OS/2 and NT
- Move settings from mc.ini to the registry for Windows NT/95 (optionally?)
- Fix opendir/readdir d_date and d_time packing (they return 10).
- Fix gettimeofday()
- Write a better stat function than the one RTL gives us. We can provide
user ID (on NT) and rwx permissions.
- Optionally use vfsapi.lib for ext2 filesystems on OS/2
- Write the VFS
- Write a better documentation
- Write a better canonify_pathname()

186
rosapps/mc/pc/trace_nt.c Normal file
View File

@@ -0,0 +1,186 @@
/* trace_nt.c - Debugging routines
for Midnight Commander, under Win32
Written 951215 by Juan Grigera <grigera@isis.unlp.edu.ar>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <config.h>
#ifdef HAVE_TRACE
#include <stdio.h>
#ifdef _OS_NT
#include <windows.h>
#endif
#include <errno.h>
#include "trace_nt.h"
/* Global variables */
int __win32_tracing_enabled = 1;
static int _win32_tracing_started = 0;
static FILE *__win32_trace_f = NULL;
/* Definitions */
#define TRACE_FILE "mcTrace.out"
/* Prototypes - static funcs */
static void _win32InitTrace (void);
static void _win32EndTrace (void);
static const char* GetLastErrorText(void);
static char *visbuf(const char *buf);
/*
void _win32InitTrace()
This func will open file TRACE_FILE for output and add _win32EndTrace to onexit
list of funcs.
*/
static void _win32InitTrace()
{
if (!_win32_tracing_started) {
_win32_tracing_started = 1;
__win32_trace_f = fopen(TRACE_FILE, "wt");
if (__win32_trace_f == NULL) {
printf("Midnight Commander[DEBUG]: Can't open trace file '" TRACE_FILE "': %s \n", strerror(errno));
}
atexit (&_win32EndTrace);
}
}
/*
void _win32EndTrace()
This func closes file TRACE_FILE if opened.
*/
static void _win32EndTrace()
{
if (_win32_tracing_started) {
_win32_tracing_started = 0;
if (__win32_trace_f)
fclose (__win32_trace_f);
}
}
/*
void _win32Trace (char *fmt, ...)
Format and output debug strings. They are written to TRACE_FILE.
Debug Output is controlled by SetTrace (see below).
Win32: Output is sent to Debug Output also.
*/
void _win32Trace (const char *fmt, ...)
{
va_list ap;
char buffer[256];
char *vp;
if (!_win32_tracing_started)
_win32InitTrace();
va_start(ap, fmt);
vsprintf(buffer, fmt, ap);
vp = buffer;
#ifdef _OS_NT /* Write Output to Debug monitor also */
OutputDebugString (vp);
#if (_MSC_VER > 800) /* Don't write newline in MSVC++ 1.0, has a dammed bug in Debug Output screen */
OutputDebugString ("\n");
#endif
#endif
if(__win32_trace_f)
fprintf (__win32_trace_f, "%s\n", vp);
}
/*
void SetTrace (int trace)
Control debug output. Turn it of or on.
trace: 0 = off, 1 = on.
*/
void _win32SetTrace (int trace)
{
/* Prototypes - interlan funcs */
__win32_tracing_enabled = trace;
}
void _win32TraceOn ()
{
__win32_tracing_enabled = 1;
}
void _win32TraceOff()
{
__win32_tracing_enabled = 0;
}
#ifdef _OS_NT
/*
void DebugFailedWin32APICall (const char* name, int line, const char* file)
Report a System call failure.
name - text containing the source code that called the offending API func
line, file - place of "name" in code
See Also: definition of win32APICALL macro.
*/
void _win32DebugFailedWin32APICall (const char* name, int line, const char* file)
{
_win32Trace ("%s(%d): Call to Win32 API Failed. \"%s\".", file, line, name);
_win32Trace (" System Error (%d): %s. ", GetLastError(), GetLastErrorText());
}
#endif
/*
void DebugAssertionFailed (const char* name, int line, const char* file)
Report a logical condition failure. (e.g. a bad argument to a func)
name - text containing the logical condition
line, file - place of "name" in code
See Also: definition of ASSERT macro.
*/
void _win32DebugAssertionFailed (const char* name, int line, const char* file)
{
_win32Trace ("%s(%d): Assertion failed! \"%s\".", file, line, name);
}
/* const char* GetLastErrorText()
Retrieves the text associated with the last system error.
Returns pointer to static buffer. Contents valid till next call
*/
static const char* GetLastErrorText()
{
#define MAX_MSG_SIZE 256
static char szMsgBuf[MAX_MSG_SIZE];
DWORD dwError, dwRes;
dwError = GetLastError ();
dwRes = FormatMessage (
FORMAT_MESSAGE_FROM_SYSTEM,
NULL,
dwError,
MAKELANGID (LANG_ENGLISH, SUBLANG_ENGLISH_US),
szMsgBuf,
MAX_MSG_SIZE,
NULL);
if (0 == dwRes) {
sprintf (szMsgBuf, "FormatMessage failed with %d", GetLastError());
}
return szMsgBuf;
}
#endif /*HAVE_TRACE*/

72
rosapps/mc/pc/trace_nt.h Normal file
View File

@@ -0,0 +1,72 @@
/* trace_nt.h - Debugging routines
Written by Juan Grigera<grigera@isis.unlp.edu.ar>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* ------------------------------------------------------------------------------------------ *
TRACER FUNCTIONS
* ------------------------------------------------------------------------------------------ */
#ifdef HAVE_TRACE
/************************/
/* Debug version */
/************************/
/* Macros
------
win32Trace(x) - Trace macro. Use double in parenthesis for x. Same args as printf.
win32ASSERT(x) - assert macro, but will not abort program and output sent to trace routine.
win32APICALL(x) - Use to enclose a Win32 system call that should return TRUE.
win32APICALL_HANDLE(h,api) - Use to enclose a Win32 system call that should return a handle.
*/
#define win32Trace(x) if (__win32_tracing_enabled) _win32Trace x
#define win32ASSERT(x) if (!(x)) _win32DebugAssertionFailed (#x, __LINE__, __FILE__)
#define win32APICALL(x) if (!(x)) _win32DebugFailedWin32APICall (#x, __LINE__, __FILE__)
#define win32APICALL_HANDLE(h,api) h=api; if (h==INVALID_HANDLE_VALUE) _win32DebugFailedWin32APICall (#h" = "#api, __LINE__, __FILE__)
/* Prototypes */
void _win32Trace (const char *, ...);
void _win32DebugFailedWin32APICall (const char *name, int line, const char *file);
void _win32DebugAssertionFailed (const char *name, int line, const char *file);
void _win32SetTrace (int trace);
void _win32TraceOn (void);
void _win32TraceOff (void);
#define SetTrace _win32SetTrace
#define TraceOn _win32TraceOn
#define TraceOff _win32TraceOff
/* Global variables */
extern int __win32_tracing_enabled;
#else
/************************/
/* Non-debug version */
/************************/
/* Wipe-out these macros */
#define win32Trace(x)
#define win32ASSERT(x)
#define win32APICALL(x) x
#define win32APICALL_HANDLE(h,api) h=api;
/* Wipe-out these funcs */
#define SetTrace(x)
#define TraceOn()
#define TraceOff()
#endif

749
rosapps/mc/pc/util_nt.c Normal file
View File

@@ -0,0 +1,749 @@
/* Various utilities - NT versions
Copyright (C) 1994, 1995, 1996 the Free Software Foundation.
Written 1994, 1995, 1996 by:
Juan Grigera, Miguel de Icaza, Janne Kukonlehto, Dugan Porter,
Jakub Jelinek, Mauricio Plaza.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include <config.h>
#include <sys/types.h>
#include <stdio.h>
#include <stdlib.h>
#include <windows.h>
#include <io.h>
#include <fcntl.h>
#include <signal.h> /* my_system */
#include <limits.h> /* INT_MAX */
#include <errno.h>
#if defined(_MSC_VER)
#include <sys/time.h___> /* select: timeout */
#else
#include <sys/time.h> /* select: timeout */
#endif
#include <sys/param.h>
#include <sys/stat.h>
#include <stdarg.h>
#include <process.h>
#include "../src/fs.h"
#include "../src/util.h"
#include "util_win32.h"
#ifdef __BORLANDC__
#define ENOTEMPTY ERROR_DIR_NOT_EMPTY
#endif
char *get_owner (int uid)
{
return "none";
}
char *get_group (int gid)
{
return "none";
}
/* Pipes are guaranteed to be able to hold at least 4096 bytes */
/* More than that would be unportable */
#define MAX_PIPE_SIZE 4096
static int error_pipe[2]; /* File descriptors of error pipe */
static int old_error; /* File descriptor of old standard error */
/* Creates a pipe to hold standard error for a later analysis. */
/* The pipe can hold 4096 bytes. Make sure no more is written */
/* or a deadlock might occur. */
void open_error_pipe (void)
{
if (pipe (error_pipe) < 0){
message (0, _(" Warning "), _(" Pipe failed ") );
}
old_error = dup (2);
if(old_error < 0 || close(2) || dup (error_pipe[1]) != 2){
message (0, _(" Warning "), _(" Dup failed ") );
close (error_pipe[0]);
close (error_pipe[1]);
}
close (error_pipe[1]);
}
void close_error_pipe (int error, char *text)
{
char *title;
char msg[MAX_PIPE_SIZE];
int len = 0;
if (error)
title = _(" Error ");
else
title = _(" Warning ");
if (old_error >= 0){
close (2);
dup (old_error);
close (old_error);
len = read (error_pipe[0], msg, MAX_PIPE_SIZE);
if (len >= 0)
msg[len] = 0;
close (error_pipe[0]);
}
if (error < 0)
return; /* Just ignore error message */
if (text == NULL){
if (len == 0) return; /* Nothing to show */
/* Show message from pipe */
message (error, title, msg);
} else {
/* Show given text and possible message from pipe */
message (error, title, " %s \n %s ", text, msg);
}
}
void check_error_pipe (void)
{
char error[MAX_PIPE_SIZE];
int len = 0;
if (old_error >= 0){
while (len < MAX_PIPE_SIZE)
{
int rvalue;
rvalue = -1; // read (error_pipe[0], error + len, 1);
if (rvalue <= 0)
break;
len ++;
}
error[len] = 0;
close (error_pipe[0]);
}
if (len > 0)
message (0, _(" Warning "), error);
}
int my_system (int as_shell_command, const char *shell, const char *command)
{
int status = 0;
#if 0
/* .ado: temp. turn out */
if (as_shell_command) {
/* It is only the shell, /c will not work */
if (command)
spawnlp (P_WAIT, shell, shell, "/c", command, (char *) 0);
else
spawnlp (P_WAIT, shell, (char *) 0);
} else
spawnl (P_WAIT, shell, shell, command, (char *) 0);
if (win32_GetPlatform() == OS_Win95) {
SetConsoleTitle ("GNU Midnight Commander"); /* title is gone after spawn... */
}
#endif
if (as_shell_command) {
if (!access(command, 0)) {
switch(win32_GetEXEType (shell)) {
case EXE_win16: /* Windows 3.x archive or OS/2 */
case EXE_win32GUI: /* NT or Chicago GUI API */
spawnlp (P_NOWAIT, shell, shell, "/c", command, (char *) 0); /* don't wait for GUI programs to end */
break;
case EXE_otherCUI: /* DOS COM, MZ, ZM, Phar Lap */
case EXE_win32CUI: /* NT or Chicago Console API, also OS/2 */
case EXE_Unknown:
default:
spawnlp (P_WAIT, shell, shell, "/c", command, (char *) 0);
break;
}
}
else
spawnlp (P_WAIT, shell, shell, "/c", command, (char *) 0);
}
else
spawnl (P_WAIT, shell, shell, command, (char *) 0);
if (win32_GetPlatform() == OS_Win95) {
SetConsoleTitle ("GNU Midnight Commander"); /* title is gone after spawn... */
}
return status;
}
/* get_default_shell
Get the default shell for the current hardware platform
*/
char* get_default_shell()
{
if (win32_GetPlatform() == OS_WinNT)
return "cmd.exe";
else
return "command.com";
}
char *tilde_expand (char *directory)
{
return strdup (directory);
}
/* sleep: Call Windows API.
Can't do simple define. That would need <windows.h> in every source
*/
#ifndef __EMX__
void sleep(unsigned long dwMiliSecs)
{
Sleep(dwMiliSecs);
}
#endif
/* Canonicalize path, and return a new path. Do everything in situ.
The new path differs from path in:
Multiple `/'s are collapsed to a single `/'.
Leading `./'s and trailing `/.'s are removed.
Trailing `/'s are removed.
Non-leading `../'s and trailing `..'s are handled by removing
portions of the path. */
char *canonicalize_pathname (char *path)
{
int i, start;
char stub_char;
stub_char = (*path == PATH_SEP) ? PATH_SEP : '.';
/* Walk along path looking for things to compact. */
i = 0;
for (;;) {
if (!path[i])
break;
while (path[i] && path[i] != PATH_SEP)
i++;
start = i++;
/* If we didn't find any slashes, then there is nothing left to do. */
if (!path[start])
break;
/* Handle multiple `/'s in a row. */
while (path[i] == PATH_SEP)
i++;
if ((start + 1) != i) {
strcpy (path + start + 1, path + i);
i = start + 1;
}
/* Handle backquoted `/'. */
if (start > 0 && path[start - 1] == '\\')
continue;
/* Check for trailing `/'. */
if (start && !path[i]) {
zero_last:
path[--i] = '\0';
break;
}
/* Check for `../', `./' or trailing `.' by itself. */
if (path[i] == '.') {
/* Handle trailing `.' by itself. */
if (!path[i + 1])
goto zero_last;
/* Handle `./'. */
if (path[i + 1] == PATH_SEP) {
strcpy (path + i, path + i + 1);
i = start;
continue;
}
/* Handle `../' or trailing `..' by itself.
Remove the previous ?/ part with the exception of
../, which we should leave intact. */
if (path[i + 1] == '.' && (path[i + 2] == PATH_SEP || !path[i + 2])) {
while (--start > -1 && path[start] != PATH_SEP);
if (!strncmp (path + start + 1, "../", 3))
continue;
strcpy (path + start + 1, path + i + 2);
i = start;
continue;
}
}
}
if (!*path) {
*path = stub_char;
path[1] = '\0';
}
return path;
}
#ifndef USE_VFS
/*
int mc_rmdir (char *path);
Fix for Win95 UGLY BUG in rmdir: it will return ENOACCESS instead
of ENOTEMPTY.
*/
int mc_rmdir (char *path)
{
if (win32_GetPlatform() == OS_Win95) {
if (rmdir(path)) {
SetLastError (ERROR_DIR_NOT_EMPTY);
#ifndef __EMX__
/* FIXME: We are always saying the same thing! */
_doserrno = ERROR_DIR_NOT_EMPTY;
#endif
errno = ENOTEMPTY;
return -1;
} else
return 0;
}
else
return rmdir(path); /* No trouble in Windows NT */
}
static int conv_nt_unx_rc(int rc)
{
int errCode;
switch (rc) {
case ERROR_FILE_NOT_FOUND:
case ERROR_PATH_NOT_FOUND:
case ERROR_TOO_MANY_OPEN_FILES:
errCode = ENOENT;
break;
case ERROR_INVALID_HANDLE:
case ERROR_ARENA_TRASHED:
case ERROR_ACCESS_DENIED:
case ERROR_INVALID_ACCESS:
case ERROR_WRITE_PROTECT:
case ERROR_WRITE_FAULT:
case ERROR_READ_FAULT:
case ERROR_SHARING_VIOLATION:
errCode = EACCES;
break;
case ERROR_NOT_ENOUGH_MEMORY:
errCode = ENOMEM;
break;
case ERROR_INVALID_BLOCK:
case ERROR_INVALID_FUNCTION:
case ERROR_INVALID_DRIVE:
errCode = ENODEV;
break;
case ERROR_CURRENT_DIRECTORY:
errCode = ENOTDIR;
break;
case ERROR_NOT_READY:
errCode = EINVAL;
break;
default:
errCode = EINVAL;
break;
} /* endswitch */
return errCode;
}
/*
int mc_unlink (char *pathName)
For Windows 95 and NT, files should be able to be deleted even
if they don't have write-protection. We should build a question box
like: Delete anyway? Yes <No> All
*/
int mc_unlink (char *pathName)
{
char *fileName;
char *trunced_name;
static int erase_all = 0;
BOOL rc;
DWORD returnError;
rc = DeleteFile(pathName);
returnError = GetLastError();
if ((rc == FALSE) && (returnError == ERROR_ACCESS_DENIED)) {
int result;
if (!erase_all) {
errno = conv_nt_unx_rc(returnError);
trunced_name = name_trunc(pathName, 30);
fileName = (char *) malloc(strlen(trunced_name) + 16);
strcpy(fileName, _("File "));
strcat(fileName, trunced_name);
strcat(fileName, _(" protected"));
result = query_dialog(fileName, _("Delete anyway?"), 3, 3, _(" No "), _(" Yes "), _(" All in the future!"));
free(fileName);
switch (result) {
case 0:
do_refresh ();
return -1;
case 1:
do_refresh ();
break;
case 2:
do_refresh ();
erase_all = 1;
break;
default:
do_refresh ();
return -1;
break;
}
}
chmod(pathName, S_IWRITE); /* make it writable */
rc = DeleteFile(pathName);
returnError = GetLastError();
if (rc == FALSE) {
errno = conv_nt_unx_rc(returnError);
return -1;
}
}
if (rc == TRUE) return 0;
else
return -1;
}
#endif /*USE_VFS*/
void my_statfs (struct my_statfs *myfs_stats, char *path)
{
int len = 0;
DWORD lpSectorsPerCluster, lpBytesPerSector, lpFreeClusters, lpClusters;
DWORD lpMaximumComponentLength, lpFileSystemFlags;
static char lpVolumeNameBuffer[256], lpFileSystemNameBuffer[30];
GetDiskFreeSpace(NULL, &lpSectorsPerCluster, &lpBytesPerSector,
&lpFreeClusters, &lpClusters);
/* KBytes available */
myfs_stats->avail = (unsigned int)( ((double)lpSectorsPerCluster * lpBytesPerSector * lpFreeClusters) / 1024 );
/* KBytes total */
myfs_stats->total = (unsigned int)( ((double)lpSectorsPerCluster * lpBytesPerSector * lpClusters) / 1024 );
myfs_stats->nfree = lpFreeClusters;
myfs_stats->nodes = lpClusters;
GetVolumeInformation(NULL, lpVolumeNameBuffer, 255, NULL,
&lpMaximumComponentLength, &lpFileSystemFlags,
lpFileSystemNameBuffer, 30);
myfs_stats->mpoint = lpFileSystemNameBuffer;
myfs_stats->device = lpVolumeNameBuffer;
myfs_stats->type = GetDriveType(NULL);
switch (myfs_stats->type) {
/*
* mmm. DeviceIoControl may fail if you are not root case
* F5_1Pt2_512, 5.25", 1.2MB, 512 bytes/sector
* myfs_stats->typename = "5.25\" 1.2MB"; break; case
* F3_1Pt44_512, 3.5", 1.44MB, 512 bytes/sector
* myfs_stats->typename = "3.5\" 1.44MB"; break; case
* F3_2Pt88_512, 3.5", 2.88MB, 512 bytes/sector
* myfs_stats->typename = "3.5\" 2.88MB"; break; case
* F3_20Pt8_512, 3.5", 20.8MB, 512 bytes/sector
* myfs_stats->typename = "3.5\" 20.8MB"; break; case
* F3_720_512, 3.5", 720KB, 512 bytes/sector
* myfs_stats->typename = "3.5\" 720MB"; break; case
* F5_360_512, 5.25", 360KB, 512 bytes/sector
* myfs_stats->typename = "5.25\" 360KB"; break; case
* F5_320_512, 5.25", 320KB, 512 bytes/sector
* case F5_320_1024, 5.25", 320KB, 1024
* bytes/sector myfs_stats->typename = "5.25\" 320KB"; break;
* case F5_180_512, 5.25", 180KB, 512
* bytes/sector myfs_stats->typename = "5.25\" 180KB"; break;
* case F5_160_512, 5.25", 160KB, 512
* bytes/sector myfs_stats->typename = "5.25\" 160KB"; break;
* case RemovableMedia, Removable media other than
* floppy myfs_stats->typename = "Removable"; break; case
* FixedMedia Fixed hard disk media
* myfs_stats->typename = "Hard Disk"; break; case Unknown:
* Format is unknown
*/
case DRIVE_REMOVABLE:
myfs_stats->typename = _("Removable");
break;
case DRIVE_FIXED:
myfs_stats->typename = _("Hard Disk");
break;
case DRIVE_REMOTE:
myfs_stats->typename = _("Networked");
break;
case DRIVE_CDROM:
myfs_stats->typename = _("CD-ROM");
break;
case DRIVE_RAMDISK:
myfs_stats->typename = _("RAM disk");
break;
default:
myfs_stats->typename = _("unknown");
break;
};
}
int gettimeofday (struct timeval* tvp, void *p)
{
if (p != NULL)
return 0;
/* Since MC only calls this func from get_random_hint we return
some value, not exactly the "correct" one */
tvp->tv_sec = GetTickCount()/1000; /* Number of milliseconds since Windows //started*/
tvp->tv_usec = GetTickCount();
}
/* FAKE functions */
int
look_for_exe(const char* pathname)
{
int j;
char *p;
int lgh = strlen(pathname);
if (lgh < 4) {
return 0;
} else {
p = (char *) pathname;
for (j=0; j<lgh-4; j++) {
p++;
} /* endfor */
if (!stricmp(p, ".exe") ||
!stricmp(p, ".bat") ||
!stricmp(p, ".com") ||
!stricmp(p, ".cmd")) {
return 1;
}
}
return 0;
}
int
lstat (const char* pathname, struct stat *buffer)
{
int rc = stat (pathname, buffer);
#ifdef __BORLANDC__
if (rc == 0) {
if (!(buffer->st_mode & S_IFDIR)) {
if (!look_for_exe(pathname)) {
buffer->st_mode &= !S_IXUSR & !S_IXGRP & !S_IXOTH;
}
}
}
#endif
return rc;
}
int getuid ()
{
/* SID sid;
LookupAccountName (NULL, &sid...
return 0;
*/
return 0;
}
int getgid ()
{
return 0;
}
int readlink (char* path, char* buf, int size)
{
return -1;
}
int symlink (char *n1, char *n2)
{
return -1;
}
int link (char *p1, char *p2)
{
return -1;
}
int chown (char *path, int owner, int group)
{
return -1;
}
int mknod (char *path, int mode, int dev)
{
return -1;
}
void init_uid_gid_cache (void)
{
return;
}
/* INHANDLE is a result of some mc_open call to any vfs, this function
returns a normal handle (to be used with read) of a pipe for reading
of the output of COMMAND with arguments ... (must include argv[0] as
well) which gets as its input at most INLEN bytes from the INHANDLE
using mc_read. You have to call mc_doublepclose to close the returned
handle afterwards. If INLEN is -1, we read as much as we can :) */
int mc_doublepopen (int inhandle, int inlen, pid_t *the_pid, char *command, ...)
{
int pipe0 [2], pipe1 [2], std_sav [2];
#define MAXARGS 16
int argno;
char *args[MAXARGS];
char buffer [8192];
int i;
va_list ap;
pid_t pid;
// Create the pipes
if(_pipe(pipe0, 8192, O_BINARY | O_NOINHERIT) == -1)
exit (1);
if(_pipe(pipe1, 8192, O_BINARY | O_NOINHERIT) == -1)
exit (1);
// Duplicate stdin/stdout handles (next line will close original)
std_sav[0] = _dup(_fileno(stdin));
std_sav[1] = _dup(_fileno(stdout));
// Duplicate read end of pipe0 to stdin handle
if(_dup2(pipe0[0], _fileno(stdin)) != 0)
exit (1);
// Duplicate write end of pipe1 to stdout handle
if(_dup2(pipe1[1], _fileno(stdout)) != 0)
exit (1);
// Close original read end of pipe0
close(pipe0[0]);
// Close original write end of pipe1
close(pipe1[1]);
va_start (ap, command);
argno = 0;
while ((args[argno++] = va_arg(ap, char *)) != NULL)
if (argno == (MAXARGS - 1)) {
args[argno] = NULL;
break;
}
va_end (ap);
// Spawn process
pid = spawnvp(P_NOWAIT,command, args);// argv[1], (const char* const*)&argv[1]);
if(!pid)
exit (1);
// Duplicate copy of original stdin back into stdin
if(_dup2(std_sav[0], _fileno(stdin)) != 0)
exit (1);
// Duplicate copy of original stdout back into stdout
if(_dup2(std_sav[1], _fileno(stdout)) != 0)
exit (1);
// Close duplicate copy of original stdout and stdin
close(std_sav[0]);
close(std_sav[1]);
while ((i = _read (inhandle, buffer,
(inlen == -1 || inlen > 8192)
? 8192 : inlen)) > 0) {
write (pipe0 [1], buffer, i);
if (inlen != -1) {
inlen -= i;
if (!inlen)
break;
}
}
close (pipe0 [1]);
*the_pid = pid;
return pipe1 [0];
}
int mc_doublepclose (int pipe, pid_t pid)
{
int status = 0;
close (pipe);
_cwait ( &status, pid, 0);
return status;
}
/*hacks to get it compile, remove these after vfs works */
/*hacks to get it compile, remove these after vfs works */
#ifndef USE_VFS
char *vfs_get_current_dir (void)
{
return NULL;
}
int vfs_current_is_extfs (void)
{
return 0;
}
int vfs_file_is_ftp (char *filename)
{
return 0;
}
int mc_utime (char *path, void *times)
{
return 0;
}
void extfs_run (char *file)
{
return;
}
#endif
char *
get_default_editor (void)
{
return "notepad.exe";
}
int
errno_dir_not_empty (int err)
{
if (err == ENOTEMPTY || err == EEXIST || err == EACCES)
return 1;
return 0;
}
/* The MC library directory is by default the directory where mc.exe
is situated. It is possible to specify this directory via MCHOME
environment variable */
char *
get_mc_lib_dir ()
{
char *cur;
char *mchome = getenv("MCHOME");
if (mchome && *mchome)
return mchome;
mchome = malloc(MC_MAXPATHLEN);
GetModuleFileName(NULL, mchome, MC_MAXPATHLEN);
for (cur = mchome + strlen(mchome); \
(cur > mchome) && (*cur != PATH_SEP); cur--);
*cur = 0;
cur = strdup(mchome);
free(mchome);
if (!cur || !*cur) {
free(cur);
return "C:\\MC";
}
return cur;
}
int get_user_rights (struct stat *buf)
{
return 2;
}
void init_groups (void)
{
}
void delete_groups (void)
{
}

854
rosapps/mc/pc/util_os2.c Normal file
View File

@@ -0,0 +1,854 @@
/* Various utilities - OS/2 versions
Copyright (C) 1994, 1995, 1996 the Free Software Foundation.
Written 1994, 1995, 1996 by:
Juan Grigera, Miguel de Icaza, Janne Kukonlehto, Dugan Porter,
Jakub Jelinek, Mauricio Plaza.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include <config.h>
#define INCL_DOS
#define INCL_PM
#define INCL_DOSPROCESS
#define INCL_DOSFILEMGR
#define INCL_DOSDEVICES /* Device values */
#define INCL_DOSDATETIME
#define INCL_DOSERRORS
#include <os2.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <ctype.h>
#include <sys/stat.h>
#include <errno.h>
#include <io.h>
#include <fcntl.h>
#include <signal.h> /* my_system */
#include <limits.h> /* INT_MAX */
#include <sys/time.h> /* select: timeout */
#include <sys/param.h>
#include <sys/stat.h>
#include <stdarg.h>
#include <process.h>
#include "../src/fs.h"
#include "../src/util.h"
#include "../src/dialog.h"
#ifndef ENOTEMPTY
#define ENOTEMPTY ERROR_DIR_NOT_EMPTY
#endif
char *
get_owner (int uid)
{
return "none";
}
char *
get_group (int gid)
{
return "none";
}
/* Pipes are guaranteed to be able to hold at least 4096 bytes */
/* More than that would be unportable */
#define MAX_PIPE_SIZE 4096
static int error_pipe[2]; /* File descriptors of error pipe */
static int old_error; /* File descriptor of old standard error */
/* Creates a pipe to hold standard error for a later analysis. */
/* The pipe can hold 4096 bytes. Make sure no more is written */
/* or a deadlock might occur. */
void
open_error_pipe (void)
{
return;
}
void
close_error_pipe (int error, char *text)
{
return;
}
void
check_error_pipe (void)
{
char error[MAX_PIPE_SIZE];
int len = 0;
if (old_error >= 0){
while (len < MAX_PIPE_SIZE)
{
int rvalue;
rvalue = read (error_pipe[0], error + len, 1);
len ++;
if (rvalue <= 0)
break;
}
error[len] = 0;
close (error_pipe[0]);
}
if (len > 0)
message (0, " Warning ", error);
}
static int
StartWindowsProg (char *name, SHORT type)
{
#if 0 /* FIXME: PM DDL's should be loaded (or not loaded) at run time */
PROGDETAILS pDetails;
memset(&pDetails, 0, sizeof(PROGDETAILS)) ;
pDetails.Length = sizeof(pDetails);
pDetails.pszExecutable = name; /* program name */
pDetails.pszStartupDir = NULL; /* default directory for new app. */
pDetails.pszParameters = NULL; /* command line */
pDetails.progt.fbVisible = SHE_VISIBLE ;
pDetails.pszEnvironment = NULL;
switch (type) {
case 0:
/* Win Standard */
pDetails.progt.progc = PROG_31_ENHSEAMLESSCOMMON ;
break;
case 1:
/* Win 3.1 Protect */
pDetails.progt.progc = PROG_31_ENHSEAMLESSCOMMON ;
break;
case 2:
/* Win 3.1 Enh. Protect */
pDetails.progt.progc = PROG_31_ENHSEAMLESSCOMMON ;
break;
default:
pDetails.progt.progc = PROG_31_ENHSEAMLESSCOMMON ;
break;
}
WinStartApp(NULLHANDLE,
&pDetails,
NULL,
NULL,
SAF_INSTALLEDCMDLINE|SAF_STARTCHILDAPP) ;
#endif
return 0;
}
static int
os2_system (int as_shell_command, const char *shell, const char *command, char *parm);
/*
as_shell_command = 1: If a program is started during input line, CTRL-O
or RETURN
= 0: F3, F4
*/
int
my_system (int as_shell_command, const char *shell, const char *command)
{
char *sh; /* This is the shell -- always! */
char *cmd; /* This is the command (only the command) */
char *parm; /* This is the parameter (can be more than one) */
register int length, i;
char temp[4096]; /* That's enough! */
sh = get_default_shell();
if (strcmp(sh, shell)) {
/*
Not equal -- That means: shell is the program and command is the
parameter
*/
cmd = (char *) shell;
parm = (char *) command;
} else {
/* look into the command and take out the program */
if (command) {
strcpy(temp, command);
length = strlen(command);
for (i=length-1; i>=0; i--) {
if (command[i] == ' ') {
temp[i] = (char) 0;
length--;
} else
break;
}
if (i==-1) {
/* only blanks */
return -1;
}
if (parm = strchr(temp, (char) ' ')) {
*parm = (char) 0;
parm++;
}
cmd = (char *) temp;
} else {
/* command is NULL */
cmd = parm = NULL;
}
}
return os2_system (as_shell_command, sh, cmd, parm);
}
static int
ux_startp (const char *shell, const char *command, const char *parm)
{
if (parm) {
spawnlp (P_WAIT,
(char *) shell,
(char *) shell,
"/c",
(char *) command,
(char *) parm,
(char *) 0);
} else {
spawnlp (P_WAIT,
(char *) shell,
(char *) shell,
"/c",
(char *) command,
(char *) 0);
}
return 0;
}
static int
os2_system (int as_shell_command, const char *shell, const char *command, char *parm)
{
register int i, j;
ULONG AppType = 0; /* Application type flags (returned) */
APIRET rc = NO_ERROR; /* Return Code */
char pathValue[5] = "PATH"; /* For DosSearchPath */
UCHAR searchResult[MC_MAXPATHLEN * 2 + 1]; /* For DosSearchPath */
char *cmdString;
char *postFix[3];
char *line;
/* ------------------------------------------------------- */
STARTDATA StartData;
CHAR ObjBuf[100];
ULONG SessionID;
PID pid;
if (command == NULL) {
/* .ado: just start a shell, we don't need the parameter */
spawnl (P_WAIT,
(char *) shell,
(char *) shell,
(char *) command, (char *) 0);
return 0;
}
memset(&StartData, 0, sizeof(StartData)) ;
StartData.Length = sizeof(StartData);
StartData.Related = SSF_RELATED_CHILD;
StartData.FgBg = SSF_FGBG_BACK;
StartData.TraceOpt = SSF_TRACEOPT_NONE;
StartData.PgmTitle = NULL;
StartData.TermQ = NULL;
StartData.InheritOpt = SSF_INHERTOPT_PARENT;
StartData.IconFile = 0;
StartData.PgmHandle = 0;
StartData.PgmControl = SSF_CONTROL_VISIBLE ;
StartData.ObjectBuffer = ObjBuf;
StartData.ObjectBuffLen = 100;
StartData.PgmInputs = parm;
postFix[0] = ".exe";
postFix[1] = ".cmd";
postFix[2] = ".bat";
i = strlen(command);
if (command[i-1] == ' ') {
/* The user has used ALT-RETURN */
i--;
}
cmdString = (char *) malloc(i+1);
for (j=0; j<i; j++) {
cmdString[j] = command[j];
}
cmdString[j] = (char) 0;
if ((i < 5) || ((i > 4) && (cmdString[i-4]) != '.')) {
/* without Extension */
line = (char *) malloc(i+5);
rc = 1;
for (i=0; (i<3 && rc); i++) {
/* Search for the file */
strcpy(line, cmdString);
strcat(line, postFix[i]);
rc = DosSearchPath((SEARCH_IGNORENETERRS | SEARCH_ENVIRONMENT | SEARCH_CUR_DIRECTORY),
(PSZ) pathValue,
line,
searchResult,
sizeof(searchResult));
}
free (line);
} else {
/* Just search */
rc = DosSearchPath((SEARCH_IGNORENETERRS | SEARCH_ENVIRONMENT | SEARCH_CUR_DIRECTORY),
(PSZ) pathValue,
cmdString,
searchResult,
sizeof(searchResult));
}
free(cmdString);
if (rc != 0) {
/* Internal command or the program was written with absolut path */
return ux_startp(shell, command, parm);
}
/* Application to be started */
StartData.PgmName = searchResult;
StartData.Environment = NULL;
rc = DosQueryAppType(searchResult, &AppType);
if (rc == NO_ERROR) {
StartData.SessionType = PROG_WINDOWABLEVIO;
if ((AppType & 0x00000007) == FAPPTYP_WINDOWAPI) {
/* Window API */
StartData.SessionType = PROG_PM;
return DosStartSession(&StartData, &SessionID, &pid);
}
if ((AppType & 0x00000007) == FAPPTYP_WINDOWCOMPAT) {
/* Window compat */
return ux_startp(shell, command, parm);
}
if (AppType & 0x0000ffff & FAPPTYP_DOS) {
/* PC/DOS Format */
StartData.SessionType = PROG_WINDOWEDVDM;
return DosStartSession(&StartData, &SessionID, &pid);
}
if (AppType & 0x0000ffff & FAPPTYP_WINDOWSREAL) {
/* Windows real mode app */
return StartWindowsProg(searchResult, 0);
}
if (AppType & 0x0000ffff & FAPPTYP_WINDOWSPROT) {
/* Windows Protect mode app*/
return StartWindowsProg(searchResult, 1);
}
if (AppType & 0x0000ffff & FAPPTYP_WINDOWSPROT31) {
/* Windows 3.1 Protect mode app*/
return StartWindowsProg(searchResult, 2);
}
rc = DosStartSession(&StartData, &SessionID, &pid) ;
} else {
/* It's not a known exe type or it's a CMD/BAT file */
i = strlen(searchResult);
if ((toupper(searchResult[--i]) == 'T') &&
(toupper(searchResult[--i]) == 'A') &&
(toupper(searchResult[--i]) == 'B') &&
(searchResult[--i] == '.') ) {
StartData.SessionType = PROG_WINDOWEDVDM;
rc = DosStartSession(&StartData, &SessionID, &pid) ;
} else {
rc = ux_startp (shell, command, parm);
}
}
return rc;
}
char *tilde_expand (char *directory)
{
return strdup (directory);
}
/* Canonicalize path, and return a new path. Do everything in situ.
The new path differs from path in:
Multiple BACKSLASHs are collapsed to a single BACKSLASH.
Leading `./'s and trailing `/.'s are removed.
Trailing BACKSLASHs are removed.
Non-leading `../'s and trailing `..'s are handled by removing
portions of the path. */
char *
canonicalize_pathname (char *path)
{
int i, start;
char stub_char;
stub_char = (*path == PATH_SEP) ? PATH_SEP : '.';
/* Walk along path looking for things to compact. */
i = 0;
for (;;) {
if (!path[i])
break;
while (path[i] && path[i] != PATH_SEP)
i++;
start = i++;
/* If we didn't find any slashes, then there is nothing left to do. */
if (!path[start])
break;
/* Handle multiple BACKSLASHs in a row. */
while (path[i] == PATH_SEP)
i++;
if ((start + 1) != i) {
strcpy (path + start + 1, path + i);
i = start + 1;
}
/* Handle backquoted BACKSLASH. */
/* if (start > 0 && path[start - 1] == '\\')
continue; */
/* Check for trailing BACKSLASH. */
if (start && !path[i]) {
zero_last:
path[--i] = '\0';
break;
}
/* Check for `../', `./' or trailing `.' by itself. */
if (path[i] == '.') {
/* Handle trailing `.' by itself. */
if (!path[i + 1])
goto zero_last;
/* Handle `./'. */
if (path[i + 1] == PATH_SEP) {
strcpy (path + i, path + i + 1);
i = start;
continue;
}
/* Handle `../' or trailing `..' by itself.
Remove the previous ?/ part with the exception of
../, which we should leave intact. */
if (path[i + 1] == '.' && (path[i + 2] == PATH_SEP || !path[i + 2])) {
while (--start > -1 && path[start] != PATH_SEP);
if (!strncmp (path + start + 1, "..\\", 3))
continue;
strcpy (path + start + 1, path + i + 2);
i = start;
continue;
}
}
}
if (!*path) {
*path = stub_char;
path[1] = '\0';
}
return path;
}
void
my_statfs (struct my_statfs *myfs_stats, char *path)
{
PFSALLOCATE pBuf;
PFSINFO pFsInfo;
ULONG lghBuf;
ULONG diskNum = 0;
ULONG logical = 0;
UCHAR szDeviceName[3] = "A:";
PBYTE pszFSDName = NULL; /* pointer to FS name */
APIRET rc = NO_ERROR; /* Return code */
BYTE fsqBuffer[sizeof(FSQBUFFER2) + (3 * CCHMAXPATH)] = {0};
ULONG cbBuffer = sizeof(fsqBuffer); /* Buffer length) */
PFSQBUFFER2 pfsqBuffer = (PFSQBUFFER2) fsqBuffer;
int i, len = 0;
/* ------------------------------------------------------------------ */
lghBuf = sizeof(FSALLOCATE);
pBuf = (PFSALLOCATE) malloc(lghBuf);
/* Get the free number of Bytes */
rc = DosQueryFSInfo(0L, FSIL_ALLOC, (PVOID) pBuf, lghBuf);
/* KBytes available */
myfs_stats->avail = pBuf->cSectorUnit * pBuf->cUnitAvail * pBuf->cbSector / 1024;
/* KBytes total */
myfs_stats->total = pBuf->cSectorUnit * pBuf->cUnit * pBuf->cbSector / 1024;
myfs_stats->nfree = pBuf->cUnitAvail;
myfs_stats->nodes = pBuf->cbSector;
lghBuf = sizeof(FSINFO);
pFsInfo = (PFSINFO) malloc(lghBuf);
rc = DosQueryFSInfo(0L,
FSIL_VOLSER,
(PVOID) pFsInfo,
lghBuf);
/* Get name */
myfs_stats->device = strdup(pFsInfo->vol.szVolLabel); /* Label of the Disk */
/* Get the current disk for DosQueryFSAttach */
rc = DosQueryCurrentDisk(&diskNum, &logical);
szDeviceName[0] = (UCHAR) (diskNum + (ULONG) 'A' - 1);
/* Now get the type of the disk */
rc = DosQueryFSAttach(szDeviceName,
0L,
FSAIL_QUERYNAME,
pfsqBuffer,
&cbBuffer);
pszFSDName = pfsqBuffer->szName + pfsqBuffer->cbName + 1;
myfs_stats->mpoint = strdup(pszFSDName); /* FAT, HPFS ... */
myfs_stats->type = pBuf->idFileSystem;
/* What is about 3 ?*/
if (myfs_stats->type == 0) {
myfs_stats->typename = (char *) malloc(11);
strcpy(myfs_stats->typename, "Local Disk");
} else {
myfs_stats->typename = (char *) malloc(13);
strcpy(myfs_stats->typename, "Other Device");
}
free(pBuf);
free(pFsInfo);
}
int
gettimeofday (struct timeval* tvp, void *p)
{
DATETIME pdt = {0};
if (p != NULL) /* what is "p"? */
return 0;
/* Since MC only calls this func from get_random_hint we return
* some value, not exactly the "correct" one
*/
DosGetDateTime(&pdt);
tvp->tv_usec = (pdt.hours * 60 + pdt.minutes) * 60 + pdt.seconds;
/* Number of milliseconds since Windows started */
tvp->tv_sec = tvp->tv_usec * 1000 + pdt.hundredths * 10;
return 0;
}
/* FAKE functions */
int
look_for_exe(const char* pathname)
{
int j;
char *p;
int lgh = strlen(pathname);
if (lgh < 4) {
return 0;
} else {
p = (char *) pathname;
for (j=0; j<lgh-4; j++) {
p++;
}
if (!stricmp(p, ".exe") ||
!stricmp(p, ".bat") ||
!stricmp(p, ".com") ||
!stricmp(p, ".cmd")) {
return 1;
}
}
return 0;
}
int
lstat (const char* pathname, struct stat *buffer)
{
int rc = stat (pathname, buffer);
#ifdef __BORLANDC__
if (rc == 0) {
if (!(buffer->st_mode & S_IFDIR)) {
if (!look_for_exe(pathname)) {
buffer->st_mode &= !S_IXUSR & !S_IXGRP & !S_IXOTH;
}
}
}
#endif
return rc;
}
int
getuid ()
{
return 0;
}
int
getgid ()
{
return 0;
}
int
readlink (char* path, char* buf, int size)
{
return -1;
}
int
symlink (char *n1, char *n2)
{
return -1;
}
int
link (char *p1, char *p2)
{
return -1;
}
int
chown (char *path, int owner, int group)
{
return -1;
}
int
mknod (char *path, int mode, int dev)
{
return -1;
}
void
init_uid_gid_cache (void)
{
return;
}
int
mc_doublepopen (int inhandle, int inlen, pid_t *the_pid, char *command, ...)
{
return 0;
}
int
mc_doublepclose (int pipe, pid_t pid)
{
return 0;
}
/*hacks to get it compile, remove these after vfs works */
char *
vfs_get_current_dir (void)
{
return NULL;
}
int
vfs_current_is_extfs (void)
{
return 0;
}
int
vfs_file_is_ftp (char *filename)
{
return 0;
}
int
mc_utime (char *path, void *times)
{
return 0;
}
void
extfs_run (char *file)
{
return;
}
int
geteuid(void)
{
return 0;
}
int
mc_chdir(char *pathname)
{
APIRET ret;
register int lgh = strlen(pathname);
/* Set the current drive */
if (lgh == 0) {
return -1;
} else {
/* First set the default drive */
if (lgh > 1) {
if (pathname[1] == ':') {
ret = DosSetDefaultDisk(toupper(pathname[0]) - 'A' + 1);
}
}
/* After that, set the current dir! */
ret = DosSetCurrentDir(pathname);
}
return ret;
}
int
mc_chmod(char *pathName, int unxmode)
{
/* OS/2 does not need S_REG */
int os2Mode = unxmode & 0x0FFF;
return chmod(pathName, os2Mode);
}
static int
conv_os2_unx_rc(int os2rc)
{
int errCode;
switch (os2rc) {
case ERROR_FILE_NOT_FOUND:
case ERROR_PATH_NOT_FOUND:
case ERROR_FILENAME_EXCED_RANGE:
errCode = ENOENT;
break;
case ERROR_NOT_DOS_DISK:
case ERROR_SHARING_VIOLATION:
case ERROR_SHARING_BUFFER_EXCEEDED:
case ERROR_ACCESS_DENIED:
errCode = EACCES;
break;
case ERROR_INVALID_PARAMETER:
errCode = EINVAL;
break;
default:
errCode = EINVAL;
break;
}
return errCode;
}
int
mc_open (char *file, int flags, int pmode)
{
return open(file, (flags | O_BINARY), pmode);
}
int
mc_unlink(char *pathName)
{
/* Use OS/2 API to delete a file, if the file is set as read-only,
the file will be deleted without asking the user! */
APIRET rc;
rc = DosDelete(pathName);
if (!rc) {
return 0;
}
if (rc == ERROR_ACCESS_DENIED) {
chmod(pathName, (S_IREAD|S_IWRITE));
rc = DosDelete(pathName);
if (rc) {
errno = conv_os2_unx_rc(rc) ;
return -1;
} else {
return 0;
}
} else {
errno = conv_os2_unx_rc(rc) ;
return -1;
}
}
char *
get_default_editor (void)
{
char *tmp;
APIRET rc;
char pathValue[5] = "PATH";
UCHAR searchResult[MC_MAXPATHLEN + 1];
/* EPM is not always be installed */
rc = DosSearchPath((SEARCH_IGNORENETERRS | SEARCH_ENVIRONMENT | SEARCH_CUR_DIRECTORY),
(PSZ) pathValue,
"EPM.EXE",
searchResult,
sizeof(searchResult));
if (rc != 0) {
/* The system editor is always there */
return strdup("e.exe");
} else {
/* Let it be searched from my_system */
return strdup("epm.exe");
}
}
/* get_default_shell
Get the default shell for the current hardware platform
TODO: Get the value of %OS2_SHELL% or %SHELL%: which one?
*/
char *
get_default_shell()
{
return getenv ("COMSPEC");
}
int
errno_dir_not_empty (int err)
{
if (err == ENOTEMPTY)
return 1;
return 0;
}
/* The MC library directory is by default the directory where mc.exe
is situated. It is recommended to specify this directory via MCHOME
environment variable, otherwise you will be unable to rename mc.exe */
char *
get_mc_lib_dir ()
{
HMODULE mc_hm;
int rc;
char *cur = NULL;
char *mchome = getenv("MCHOME");
if (mchome && *mchome)
return mchome;
mchome = malloc(MC_MAXPATHLEN);
rc = DosQueryModuleHandle ("MC.EXE", &mc_hm);
if (!rc)
rc = DosQueryModuleName (mc_hm, MC_MAXPATHLEN, mchome);
if (!rc)
{
for (cur = mchome + strlen(mchome); \
(cur > mchome) && (*cur != PATH_SEP); cur--);
*cur = 0;
cur = strdup(mchome);
free(mchome);
}
if (!cur || !*cur) {
free(cur);
return "C:\\MC";
}
return cur;
}
int get_user_rights (struct stat *buf)
{
return 2;
}
void init_groups (void)
{
}
void delete_groups (void)
{
}

187
rosapps/mc/pc/util_win32.c Normal file
View File

@@ -0,0 +1,187 @@
/* Utilities - Win32 utilities (Windows NT and Windows '95)
Copyright (C) 1994, 1995, 1996 the Free Software Foundation.
Written 1996 by Juan Grigera<grigera@isis.unlp.edu.ar>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <config.h>
#include <windows.h>
#include "util_win32.h"
#include "trace_nt.h"
/* int win32_GetPlatform ()
Checks in which OS Midnight Commander is running.
Returns:
OS_WinNT - Windows NT 3.x
OS_Win95 - Windows 4.x
Note: GetVersionEx (Win32API) is called only once.
*/
int win32_GetPlatform ()
{
static int platform = 0;
return (platform ? platform : (platform = win32_GetVersionEx()) );
}
/* int win32_GetVersionEx ()
intended for use by win32_GetPlatform only
*/
int win32_GetVersionEx ()
{
OSVERSIONINFO ovi;
ovi.dwOSVersionInfoSize = sizeof(ovi);
win32APICALL( GetVersionEx(&ovi) );
return ovi.dwPlatformId;
}
/* int win32_GetEXEType (const char* filename)
Determines whether filename (an Executable) is
a Console application (CUI) or a Graphical application(GUI).
filename - Name of executable file to check
Returns: EXE_win16 - Windows 3.x archive or OS/2
EXE_win32CUI - NT or Chicago Console API, also OS/2
EXE_win32GUI - NT or Chicago GUI API
EXE_otherCUI - DOS COM, MZ, ZM, Phar Lap
EXE_Unknown - Unknown
EXE_Error - Couldn't read file/EXE image
TODO: better management of OS/2 images
EXE_CompressedArchive can be easily implemented
Notes: This function parses the executable header (the only ugly way
to do it). If header is not found or not understood,
0 is returned.
Information on NE, LE, LX and MZ taken from Ralf Brown's interrupt
list, under INT 21-function 4B ("EXEC" - LOAD AND/OR EXECUTE PROGRAM),
Tables 0806 - 836.
Parsing of PE header (Win32 signature, "Portable Executable")
taken from MSKBase article Number: Q90493.
*/
/* ---- Executable Signatures ---- */
/* Alternative DOS signagure */
#define IMAGE_DOS_SIGNATURE_ALTERNATIVE 0x4D5A /* ZM */
/* Phar Lap .EXP files */
#define IMAGE_OLDPHARLAP_SIGNATURE 0x504D /* MP */
#define IMAGE_NEWPHARLAP_286_SIGNATURE 0x3250 /* P2 */
#define IMAGE_NEWPHARLAP_386_SIGNATURE 0x3350 /* P3 */
/* New Executables */
#define IMAGE_LX_SIGNATURE 0x584C /* LX */
#define IMAGE_PE_SIGNATURE 0x4550 /* PE */
int win32_GetEXEType (const char* a_szFileName)
{
/* FIXME: MinGW cannot compile this code */
#ifndef __MINGW32__
HANDLE hImage;
DWORD dwDumm;
DWORD SectionOffset;
DWORD CoffHeaderOffset;
WORD wSignature;
/* DWORD MoreDosHeader[16]; */
IMAGE_DOS_HEADER image_dos_header;
IMAGE_FILE_HEADER image_file_header;
IMAGE_OPTIONAL_HEADER image_optional_header;
/* IMAGE_SECTION_HEADER image_section_header; */
/* Open the EXE file - Use Native API for SHARE compatibility */
hImage = CreateFile(a_szFileName, GENERIC_READ, FILE_SHARE_READ, NULL,
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
if (hImage == INVALID_HANDLE_VALUE) {
win32Trace (("win32_GetEXEType: Could not open file %s. API Error %d.", a_szFileName, GetLastError()));
return EXE_Error;
}
/* Read the MZ (DOS) image header. */
win32APICALL( ReadFile (hImage, (LPVOID)&image_dos_header, sizeof(IMAGE_DOS_HEADER), &dwDumm, NULL) );
switch (image_dos_header.e_magic) {
case IMAGE_DOS_SIGNATURE: /* MZ or ZM */
case IMAGE_DOS_SIGNATURE_ALTERNATIVE:
break;
case IMAGE_OLDPHARLAP_SIGNATURE: /* MP, P2, P3: Phar Lap executables */
case IMAGE_NEWPHARLAP_286_SIGNATURE:
case IMAGE_NEWPHARLAP_386_SIGNATURE:
return EXE_otherCUI;
default:
return EXE_otherCUI; /* Probably .COM? */
}
/* Read more MS-DOS header. */
/* win32APICALL( ReadFile (hImage, MoreDosHeader, sizeof(MoreDosHeader)); */
/* Get new executable header */
CoffHeaderOffset = SetFilePointer(hImage, image_dos_header.e_lfanew, NULL, FILE_BEGIN);
/* + sizeof(ULONG); */
win32APICALL( ReadFile (hImage, (LPVOID) &wSignature, sizeof(WORD), &dwDumm, NULL) );
switch (wSignature) {
case IMAGE_PE_SIGNATURE: /* PE - Portable Executable */
break;
case IMAGE_OS2_SIGNATURE: /* NE - New Executable OS/2 and Windows 3.x */
case IMAGE_OS2_SIGNATURE_LE: /* LE - Linear Execuable (Windows 3.x) */
case IMAGE_LX_SIGNATURE: /* LX - Linear Execuable (OS/2) */
return EXE_win16;
default:
return EXE_Unknown; /* unknown New Executable or bad pointer */
}
/* Continue parsing PE (COFF-like) */
SectionOffset = CoffHeaderOffset + IMAGE_SIZEOF_FILE_HEADER + IMAGE_SIZEOF_NT_OPTIONAL_HEADER;
win32APICALL( ReadFile(hImage, (LPVOID) &image_file_header, IMAGE_SIZEOF_FILE_HEADER, &dwDumm, NULL) );
/* Read optional header. */
win32APICALL( ReadFile(hImage, (LPVOID) &image_optional_header, IMAGE_SIZEOF_NT_OPTIONAL_HEADER, &dwDumm, NULL) );
switch (image_optional_header.Subsystem) {
case IMAGE_SUBSYSTEM_WINDOWS_GUI:
return EXE_win32GUI;
case IMAGE_SUBSYSTEM_WINDOWS_CUI:
case IMAGE_SUBSYSTEM_OS2_CUI:
case IMAGE_SUBSYSTEM_POSIX_CUI:
return EXE_win32CUI;
case IMAGE_SUBSYSTEM_UNKNOWN:
case IMAGE_SUBSYSTEM_NATIVE:
return EXE_Unknown; /* FIXME: what is "NATIVE??" */
default:
win32Trace(("Unknown type %u.\n", image_optional_header.Subsystem));
return EXE_Unknown;
}
#else
return EXE_Unknown;
#endif /* !__MINGW32__ */
}

View File

@@ -0,0 +1,42 @@
/* util.Win32.h - Header
Utilities - Win32 utilities (Windows NT and Windows '95)
Copyright (C) 1994, 1995, 1996 the Free Software Foundation.
Written 1996 by Juan Grigera<grigera@isis.unlp.edu.ar>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* Prototypes */
int win32_GetPlatform ();
int win32_GetEXEType (const char* a_szFileName);
int win32_GetVersionEx ();
/* Constants */
enum {
OS_WinNT = VER_PLATFORM_WIN32_NT, /* windows.h values */
OS_Win95 = VER_PLATFORM_WIN32_WINDOWS,
};
enum {
EXE_Unknown,
EXE_win16,
EXE_win32CUI,
EXE_win32GUI,
EXE_otherCUI,
EXE_Error
};

View File

@@ -0,0 +1,85 @@
/* Utilities - Windows NT specific utilities (not in Win95)
Copyright (C) 1994, 1995, 1996 the Free Software Foundation.
Written 1996 by Juan Grigera<grigera@isis.unlp.edu.ar>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <config.h>
#include <windows.h>
#include "util_win32.h"
#include "trace_nt.h"
/* int winnt_IsAdministrator() - Determines whether user has Administrator (root)
priviledges.
Return: 1 if administrator
0 if not
Note: Code taken from MSKbase Number: Q118626.
To determine whether or not a user is an administrator, you need to examine
the user's access token with GetTokenInformation(). The access token
represents the user's privileges and the groups to which the user belongs.
*/
int winnt_IsAdministrator()
{
HANDLE hAccessToken;
UCHAR InfoBuffer[1024];
PTOKEN_GROUPS ptgGroups = (PTOKEN_GROUPS)InfoBuffer;
DWORD dwInfoBufferSize;
PSID psidAdministrators;
SID_IDENTIFIER_AUTHORITY siaNtAuthority = SECURITY_NT_AUTHORITY;
UINT x;
BOOL bSuccess;
if(!OpenProcessToken(GetCurrentProcess(),TOKEN_READ,&hAccessToken))
return 0;
bSuccess = GetTokenInformation(hAccessToken,TokenGroups,InfoBuffer,
1024, &dwInfoBufferSize);
CloseHandle(hAccessToken);
if( !bSuccess )
return 0;
if(!AllocateAndInitializeSid(&siaNtAuthority, 2,
SECURITY_BUILTIN_DOMAIN_RID,
DOMAIN_ALIAS_RID_ADMINS,
0, 0, 0, 0, 0, 0,
&psidAdministrators))
return 0;
bSuccess = 0;
for(x=0;x<ptgGroups->GroupCount;x++) {
if( EqualSid(psidAdministrators, ptgGroups->Groups[x].Sid) ) {
bSuccess = 1;
break;
}
}
FreeSid(psidAdministrators);
return bSuccess;
}
int geteuid ()
{
if (winnt_IsAdministrator())
return 0;
return 1;
}

1
rosapps/mc/pc/utime.h Normal file
View File

@@ -0,0 +1 @@
#include <sys/utime.h>

80
rosapps/mc/slang/Makefile Normal file
View File

@@ -0,0 +1,80 @@
# Generated automatically from Makefile.in by configure.
srcdir = .
rootdir = $(srcdir)/..
include ../Make.common
CFLAGS = $(XCFLAGS)
CPPFLAGS = $(XCPPFLAGS)
LDFLAGS = $(XLDFLAGS)
DEFS = $(XDEFS)
LIBS = $(XLIBS) $(XLIB)
AR = /usr/bin/ar
SLANGSRCS = sldisply.c slerr.c slsmg.c slutty.c slgetkey.c slmemcpy.c \
slmemset.c sltermin.c sltoken.c slsignal.c \
slvideo.c slw32tty.c slos2tty.c
SLANGHDRS = slang.h _slang.h sl-feat.h jdmacros.h
SLANGOBJS = sldisply.o slerr.o slsmg.o slutty.o \
slgetkey.o slmemcpy.o slmemset.o sltermin.o \
sltoken.o slsignal.o
#
# Distribution variables
#
DISTSLANG = Makefile.in README $(SLANGSRCS) $(SLANGHDRS)
all: libmcslang.a
.c.o:
$(CC) -c $(CPPFLAGS) $(DEFS) $(CFLAGS) $<
check:
@echo no tests are supplied.
libmcslang.a: $(SLANGOBJS)
$(RMF) $@
$(AR) cr $@ $(SLANGOBJS)
-$(RANLIB) $@
showlibdep:
@echo 'OBJS="$(SLANGOBJS)"'
cross:
$(MAKE) CC=gcc-linux CPP="gcc-linux -E" \
CPPFLAGS="$(CPPFLAGS) -I/usr/local/lib/gcc-lib/i386-linux-linux/include/ncurses "
TAGS: $(SLANGSRCS)
etags $(SLANGSRCS)
clean:
$(RMF) *.o core a.out libmcslang.a
realclean: clean
$(RMF) .depend
$(RMF) TAGS
$(RMF) *~
distclean:
-$(RMF) $(srcdir)/*~ $(srcdir)/*.o $(srcdir)/core $(srcdir)/a.out
-$(RMF) $(srcdir)/libmcslang.a
-if test $(srcdir) = .; then $(MAKE) realclean; fi
-$(RMF) $(srcdir)/Makefile
distcopy:
$(CP) $(DISTSLANG) ../../mc-$(VERSION)/slang
install uninstall:
depend dep: mcdep
fastdeploc:
# ***Dependencies***Do not edit***
ifeq (.depend,$(wildcard .depend))
include .depend
endif
# ***End of dependencies***

325
rosapps/mc/slang/_slang.h Normal file
View File

@@ -0,0 +1,325 @@
/* header file for S-Lang internal structures that users do not (should not)
need. Use slang.h for that purpose. */
/* Copyright (c) 1992, 1995 John E. Davis
* All rights reserved.
*
* You may distribute under the terms of either the GNU General Public
* License or the Perl Artistic License.
*/
#include "config.h"
#include <string.h>
#include "jdmacros.h"
#ifdef VMS
# define SLANG_SYSTEM_NAME "_VMS"
#else
# if defined (__GO32__) || defined (__EMX__) || \
defined (msdos) || defined (__os2__)
# define SLANG_SYSTEM_NAME "_IBMPC"
# else
# define SLANG_SYSTEM_NAME "_UNIX"
# endif
#endif /* VMS */
#ifdef msdos
#define SLANG_MAX_SYMBOLS 500
#else
#define SLANG_MAX_SYMBOLS 2500
#endif
/* maximum number of global symbols--- slang builtin, functions, global vars */
/* These quantities are main_types for byte-compiled code. They are used
* by the inner_interp routine. The ones commented out with a // are
* actually defined in slang.h because they are also used as the main_type in
* the name table.
*/
/* // #define SLANG_LVARIABLE 0x01 */
#define SLANG_LOGICAL 0x02
#define SLANG_BINARY 0x03
/* // #define SLANG_INTRINSIC 0x06 */
/* // #define SLANG_FUNCTION 0x07 */
#define SLANG_LITERAL 0x08 /* constant objects */
#define SLANG_BLOCK 0x09
#define SLANG_EQS 0x0A
#define SLANG_UNARY 0x0B
#define SLANG_LUNARY 0x0C
/* // #define SLANG_GVARIABLE 0x0D */
/* // #define SLANG_IVARIABLE 0x0E */ /* intrinsic variables */
/* // #define SLANG_RVARIABLE 0x0F */ /* read only variable */
/* These 3 MUST be in this order too ! */
#define SLANG_RETURN 0x10
#define SLANG_BREAK 0x11
#define SLANG_CONTINUE 0x12
#define SLANG_EXCH 0x13
#define SLANG_LABEL 0x14
#define SLANG_LOBJPTR 0x15
#define SLANG_GOBJPTR 0x16
#define SLANG_X_ERROR 0x17
/* These must be in this order */
#define SLANG_X_USER0 0x18
#define SLANG_X_USER1 0x19
#define SLANG_X_USER2 0x1A
#define SLANG_X_USER3 0x1B
#define SLANG_X_USER4 0x1C
#ifdef SLANG_NOOP
# define SLANG_NOOP_DIRECTIVE 0x2F
#endif
/* If SLANG_DATA occurs as the main_type for an object in the interpreter's
* byte-code, it currently refers to a STRING.
*/
/* // #define SLANG_DATA 0x30 */ /* real objects which may be destroyed */
/* Subtypes */
#define ERROR_BLOCK 0x01
/* gets executed if block encounters error other than stack related */
#define EXIT_BLOCK 0x02
#define USER_BLOCK0 0x03
#define USER_BLOCK1 0x04
#define USER_BLOCK2 0x05
#define USER_BLOCK3 0x06
#define USER_BLOCK4 0x07
/* The user blocks MUST be in the above order */
/* directive subtypes */
#define SLANG_LOOP_MASK 0x80
#define SLANG_LOOP 0x81
#define SLANG_WHILE 0x82
#define SLANG_FOR 0x83
#define SLANG_FOREVER 0x84
#define SLANG_CFOR 0x85
#define SLANG_DOWHILE 0x86
#define SLANG_IF_MASK 0x40
#define SLANG_IF 0x41
#define SLANG_IFNOT 0x42
#define SLANG_ELSE 0x43
/* local, global variable assignments
* The order here is important. See interp_variable_eqs to see how this
* is exploited. */
#define SLANG_EQS_MASK 0x20
/* local variables */
/* Keep these in this order!! */
#define SLANG_LEQS 0x21
#define SLANG_LPEQS 0x22
#define SLANG_LMEQS 0x23
#define SLANG_LPP 0x24
#define SLANG_LMM 0x25
/* globals */
/* Keep this on this order!! */
#define SLANG_GEQS 0x26
#define SLANG_GPEQS 0x27
#define SLANG_GMEQS 0x28
#define SLANG_GPP 0x29
#define SLANG_GMM 0x2A
/* intrinsic variables */
#define SLANG_IEQS 0x2B
#define SLANG_IPEQS 0x2C
#define SLANG_IMEQS 0x2D
#define SLANG_IPP 0x2E
#define SLANG_IMM 0x2F
#define SLANG_ELSE_MASK 0x10
#define SLANG_ANDELSE 0x11
#define SLANG_ORELSE 0x12
#define SLANG_SWITCH 0x13
/* LOGICAL SUBTYPES (operate on integers) */
#define SLANG_MOD 16
#define SLANG_OR 17
#define SLANG_AND 18
#define SLANG_BAND 19
#define SLANG_BOR 20
#define SLANG_BXOR 21
#define SLANG_SHL 22
#define SLANG_SHR 23
/* LUnary Subtypes */
#define SLANG_NOT 24
#define SLANG_BNOT 25
typedef struct SLBlock_Type
{
unsigned char main_type;
unsigned char sub_type;
union
{
struct SLBlock_Type *blk;
int i_blk;
SLang_Name_Type *n_blk;
char *s_blk;
#ifdef FLOAT_TYPE
float64 *f_blk; /*literal float is a pointer */
#endif
long l_blk;
}
b;
}
SLBlock_Type;
typedef struct
{
unsigned char main_type; /* block, intrinsic... */
unsigned char sub_type; /* SLANG_WHILE, SLANG_DATA, ... */
union
{
long l_val;
char *s_val;
int i_val;
SLuser_Object_Type *uobj;
SLang_Name_Type *n_val;
#ifdef FLOAT_TYPE
float64 f_val;
#endif
} v;
} SLang_Object_Type;
extern void SLang_free_object (SLang_Object_Type *);
extern int SLang_pop_non_object (SLang_Object_Type *);
extern void _SLdo_error (char *, ...);
extern void SLcompile(char *);
extern void (*SLcompile_ptr)(char *);
typedef struct
{
char *name; int type;
} SLang_Name2_Type;
extern void SLstupid_hash(void);
typedef struct SLName_Table
{
struct SLName_Table *next; /* next table */
SLang_Name_Type *table; /* pointer to table */
int n; /* entries in this table */
char name[32]; /* name of table */
int ofs[256]; /* offsets into table */
} SLName_Table;
extern SLName_Table *SLName_Table_Root;
#ifdef MSWINDOWS
extern SLang_Name_Type *SLang_Name_Table;
#else
extern SLang_Name_Type SLang_Name_Table[SLANG_MAX_SYMBOLS];
#endif
extern SLang_Name2_Type SL_Binary_Ops [];
extern SLang_Object_Type *SLStack_Pointer;
extern char *SLbyte_compile_name(char *);
extern int SLang_pop(SLang_Object_Type *);
extern char *SLexpand_escaped_char(char *, char *);
extern void SLexpand_escaped_string (char *, char *, char *);
extern SLang_Object_Type *_SLreverse_stack (int);
extern SLang_Name_Type *SLang_locate_name(char *);
/* returns a pointer to a MALLOCED string */
extern char *SLstringize_object (SLang_Object_Type *);
/* array types */
typedef struct SLArray_Type
{
unsigned char type; /* int, float, etc... */
int dim; /* # of dims (max 3) */
int x, y, z; /* actual dims */
union
{
unsigned char *c_ptr;
unsigned char **s_ptr;
int *i_ptr;
#ifdef FLOAT_TYPE
float64 *f_ptr;
#endif
SLuser_Object_Type **u_ptr;
}
buf;
unsigned char flags; /* readonly, etc... If this is non-zero,
* the buf pointer will NOT be freed.
* See SLarray_free_array.
*/
} SLArray_Type;
/* Callback to delete array */
extern void SLarray_free_array (long *);
/* maximum size of run time stack */
#ifdef msdos
#define SLANG_MAX_STACK_LEN 500
#else
#define SLANG_MAX_STACK_LEN 2500
#endif
#ifdef MSWINDOWS
extern SLang_Object_Type *SLRun_Stack;
#else
extern SLang_Object_Type SLRun_Stack[SLANG_MAX_STACK_LEN];
#endif
extern SLang_Object_Type *SLStack_Pointer;
extern int SLang_Trace;
extern int SLstack_depth(void);
extern void SLang_trace_fun(char *);
extern void SLexecute_function(SLang_Name_Type *);
extern char *SLmake_string (char *);
extern int _SLeqs_name(char *, SLang_Name2_Type *);
extern void SLang_push(SLang_Object_Type *);
extern void SLang_push_float(float64);
extern void SLadd_variable(char *);
extern void SLang_clear_error(void);
extern void SLarray_info (void);
extern int SLPreprocess_Only; /* preprocess instead of
* bytecompiling
*/
extern void SLdo_pop (void);
extern unsigned int SLsys_getkey (void);
extern int SLsys_input_pending (int);
#ifdef REAL_UNIX_SYSTEM
extern int SLtt_tigetflag (char *, char **);
extern int SLtt_tigetnum (char *, char **);
extern char *SLtt_tigetstr (char *, char **);
extern char *SLtt_tigetent (char *);
#endif
#ifdef msdos
#define MAX_INPUT_BUFFER_LEN 40
#else
#define MAX_INPUT_BUFFER_LEN 1024
#endif
extern unsigned char SLang_Input_Buffer [MAX_INPUT_BUFFER_LEN];
extern unsigned int SLang_Input_Buffer_Len;
extern int SLregister_types (void);
#ifndef pc_system
extern char *SLtt_Graphics_Char_Pairs;
#endif /* NOT pc_system */
extern void _SLerrno_set_return_status (void);
extern char *_SLerrno_strerror (void);
extern int _SLerrno_Return_Status;

View File

@@ -0,0 +1,76 @@
#ifndef _JD_MACROS_H_
#define _JD_MACROS_H_
/* This file defines some macros that I use with programs that link to
* the slang library.
*/
#ifdef HAVE_STDLIB_H
# include <stdlib.h>
#endif
#ifdef HAVE_MALLOC_H
# include <malloc.h>
#endif
#ifdef HAVE_MEMORY_H
# include <memory.h>
#endif
#ifndef SLMEMSET
# ifdef HAVE_MEMSET
# define SLMEMSET memset
# else
# define SLMEMSET SLmemset
# endif
#endif
#ifndef SLMEMCHR
# ifdef HAVE_MEMCHR
# define SLMEMCHR memchr
# else
# define SLMEMCHR SLmemchr
# endif
#endif
#ifndef SLMEMCPY
# ifdef HAVE_MEMCPY
# define SLMEMCPY memcpy
# else
# define SLMEMCPY SLmemcpy
# endif
#endif
/* Note: HAVE_MEMCMP requires an unsigned memory comparison!!! */
#ifndef SLMEMCMP
# ifdef HAVE_MEMCMP
# define SLMEMCMP memcmp
# else
# define SLMEMCMP SLmemcmp
# endif
#endif
#if SLANG_VERSION < 9934
# define SLmemcmp jed_memcmp
# define SLmemcpy jed_memcpy
# define SLmemset jed_memset
# define SLmemchr jed_memchr
#endif
#ifndef SLFREE
# define SLFREE free
#endif
#ifndef SLMALLOC
# define SLMALLOC malloc
#endif
#ifndef SLCALLOC
# define SLCALLOC calloc
#endif
#ifndef SLREALLOC
# define SLREALLOC realloc
#endif
#endif /* _JD_MACROS_H_ */

View File

@@ -0,0 +1,78 @@
srcdir = @srcdir@
VPATH = @srcdir@
rootdir = $(srcdir)/..
@MCFG@@MCF@
CFLAGS = $(XCFLAGS)
CPPFLAGS = $(XCPPFLAGS)
LDFLAGS = $(XLDFLAGS)
DEFS = $(XDEFS)
LIBS = $(XLIBS) $(XLIB)
AR = @AR@
SLANGSRCS = sldisply.c slerr.c slsmg.c slutty.c slgetkey.c slmemcpy.c \
slmemset.c sltermin.c sltoken.c slsignal.c \
slvideo.c slw32tty.c slos2tty.c
SLANGHDRS = slang.h _slang.h sl-feat.h jdmacros.h
SLANGOBJS = sldisply.o slerr.o slsmg.o slutty.o \
slgetkey.o slmemcpy.o slmemset.o sltermin.o \
sltoken.o slsignal.o
#
# Distribution variables
#
DISTSLANG = Makefile.in README $(SLANGSRCS) $(SLANGHDRS)
all: @LIBSLANG@
.c.o:
$(CC) -c $(CPPFLAGS) $(DEFS) $(CFLAGS) $<
check:
@echo no tests are supplied.
libmcslang.a: $(SLANGOBJS)
$(RMF) $@
$(AR) cr $@ $(SLANGOBJS)
-$(RANLIB) $@
showlibdep:
@echo 'OBJS="$(SLANGOBJS)"'
cross:
$(MAKE) CC=gcc-linux CPP="gcc-linux -E" \
CPPFLAGS="$(CPPFLAGS) -I/usr/local/lib/gcc-lib/i386-linux-linux/include/ncurses "
TAGS: $(SLANGSRCS)
etags $(SLANGSRCS)
clean:
$(RMF) *.o core a.out libmcslang.a
realclean: clean
$(RMF) .depend
$(RMF) TAGS
$(RMF) *~
distclean:
-$(RMF) $(srcdir)/*~ $(srcdir)/*.o $(srcdir)/core $(srcdir)/a.out
-$(RMF) $(srcdir)/libmcslang.a
-if test $(srcdir) = .; then $(MAKE) realclean; fi
-$(RMF) $(srcdir)/Makefile
distcopy:
$(CP) $(DISTSLANG) ../../mc-$(VERSION)/slang
install uninstall:
depend dep: mcdep
fastdeploc:
# ***Dependencies***Do not edit***
@DOTDEPEND@
# ***End of dependencies***

12
rosapps/mc/slang/readme Normal file
View File

@@ -0,0 +1,12 @@
This is the Slang Screen Manager, it has been modified a little to
make it work with the Midnight Commander. If you want to get the
complete Slang distribution, you may grab it from:
space.mit.edu:/pub/davis
All of the patches relevant to Slang have been sumbited to John Davis
for inclusion in his Slang version, changes that are only useful for
the Midnight Commander have not been submited.
miguel.

View File

@@ -0,0 +1,2 @@
/* Set this to 1 to enable Kanji support */
#define SLANG_HAS_KANJI_SUPPORT 0

1284
rosapps/mc/slang/slang.h Normal file

File diff suppressed because it is too large Load Diff

2240
rosapps/mc/slang/sldisply.c Normal file

File diff suppressed because it is too large Load Diff

59
rosapps/mc/slang/slerr.c Normal file
View File

@@ -0,0 +1,59 @@
/* error handling common to all routines. */
/* Copyright (c) 1992, 1995 John E. Davis
* All rights reserved.
*
* You may distribute under the terms of either the GNU General Public
* License or the Perl Artistic License.
*/
#include "config.h"
#include <stdio.h>
#include <string.h>
#include <stdarg.h>
#ifdef HAVE_STDLIB_H
# include <stdlib.h>
#endif
#include "slang.h"
#include "_slang.h"
void (*SLang_Error_Routine)(char *);
void (*SLang_Exit_Error_Hook)(char *);
volatile int SLang_Error = 0;
char *SLang_Error_Message;
volatile int SLKeyBoard_Quit = 0;
void SLang_doerror (char *error)
{
char err [1024];
char *str = NULL;
*err = 0;
str = "Slang/Midnight Commander unknown error";
sprintf(err, "S-Lang Error: %s", str);
if (SLang_Error_Routine == NULL)
{
fputs (err, stderr);
fputs("\r\n", stderr);
}
else
(*SLang_Error_Routine)(err);
}
void SLang_exit_error (char *s)
{
if (SLang_Exit_Error_Hook != NULL)
{
(*SLang_Exit_Error_Hook) (s);
}
if (s != NULL) fprintf (stderr, "%s\n", s);
exit (-1);
}

125
rosapps/mc/slang/slgetkey.c Normal file
View File

@@ -0,0 +1,125 @@
/* Copyright (c) 1992, 1995 John E. Davis
* All rights reserved.
*
* You may distribute under the terms of either the GNU General Public
* License or the Perl Artistic License.
*/
#include "config.h"
#include <stdio.h>
#include "slang.h"
#include "_slang.h"
unsigned int SLang_Input_Buffer_Len = 0;
unsigned char SLang_Input_Buffer [MAX_INPUT_BUFFER_LEN];
int SLang_Abort_Char = 7;
int SLang_Ignore_User_Abort = 0;
/* This has the effect of mapping all characters in the range 128-169 to
* ESC [ something
*/
#ifndef __GO32__
# if defined(__unix__) || defined(vms)
# define DEC_8BIT_HACK 64
# endif
#endif
#ifdef OS2_NT /* see the replacement in src/slint.c */
unsigned int SLang_getkey (void)
{
unsigned int imax;
unsigned int ch;
if (SLang_Input_Buffer_Len)
{
ch = (unsigned int) *SLang_Input_Buffer;
SLang_Input_Buffer_Len--;
imax = SLang_Input_Buffer_Len;
SLMEMCPY ((char *) SLang_Input_Buffer,
(char *) (SLang_Input_Buffer + 1), imax);
}
else if (0xFFFF == (ch = SLsys_getkey ())) return ch;
#ifdef DEC_8BIT_HACK
if (ch & 0x80)
{
unsigned char i;
i = (unsigned char) (ch & 0x7F);
if (i < ' ')
{
i += DEC_8BIT_HACK;
SLang_ungetkey (i);
ch = 27;
}
}
#endif
return(ch);
}
#endif /* OS2_NT */
void SLang_ungetkey_string (unsigned char *s, unsigned int n)
{
register unsigned char *bmax, *b, *b1;
if (SLang_Input_Buffer_Len + n + 3 > MAX_INPUT_BUFFER_LEN) return;
b = SLang_Input_Buffer;
bmax = (b - 1) + SLang_Input_Buffer_Len;
b1 = bmax + n;
while (bmax >= b) *b1-- = *bmax--;
bmax = b + n;
while (b < bmax) *b++ = *s++;
SLang_Input_Buffer_Len += n;
}
void SLang_buffer_keystring (unsigned char *s, unsigned int n)
{
if (n + SLang_Input_Buffer_Len + 3 > MAX_INPUT_BUFFER_LEN) return;
SLMEMCPY ((char *) SLang_Input_Buffer + SLang_Input_Buffer_Len,
(char *) s, n);
SLang_Input_Buffer_Len += n;
}
void SLang_ungetkey (unsigned char ch)
{
SLang_ungetkey_string(&ch, 1);
}
#ifdef OS2_NT /* see the replacement in src/slint.c */
int SLang_input_pending (int tsecs)
{
int n;
unsigned char c;
if (SLang_Input_Buffer_Len) return (int) SLang_Input_Buffer_Len;
n = SLsys_input_pending (tsecs);
if (n <= 0) return 0;
c = (unsigned char) SLang_getkey ();
SLang_ungetkey_string (&c, 1);
return n;
}
#endif /* OS2_NT */
void SLang_flush_input (void)
{
int quit = SLKeyBoard_Quit;
SLang_Input_Buffer_Len = 0;
SLKeyBoard_Quit = 0;
while (SLsys_input_pending (0) > 0)
{
(void) SLsys_getkey ();
/* Set this to 0 because SLsys_getkey may stuff keyboard buffer if
* key sends key sequence (OS/2, DOS, maybe VMS).
*/
SLang_Input_Buffer_Len = 0;
}
SLKeyBoard_Quit = quit;
}

View File

@@ -0,0 +1,51 @@
/* Copyright (c) 1992, 1995 John E. Davis
* All rights reserved.
*
* You may distribute under the terms of either the GNU General Public
* License or the Perl Artistic License.
*/
/* These routines are fast memcpy, memset routines. When available, I
use system rouines. For msdos, I use inline assembly. */
/* The current versions only work in the forward direction only!! */
#include "config.h"
#include <stdio.h>
#include "slang.h"
#include "_slang.h"
char *SLmemcpy(char *s1, char *s2, int n)
{
#if defined(msdos) && !defined(__WIN32__) && !defined(__GO32__)
asm mov ax, ds
asm mov bx, si
asm mov dx, di
asm mov cx, n
asm les di, s1
asm lds si, s2
asm cld
asm rep movsb
asm mov ds, ax
asm mov si, bx
asm mov di, dx
return(s1);
#else
register char *smax, *s = s1;
int n2;
n2 = n % 4;
smax = s + (n - 4);
while (s <= smax)
{
*s = *s2; *(s + 1) = *(s2 + 1); *(s + 2) = *(s2 + 2); *(s + 3) = *(s2 + 3);
s += 4;
s2 += 4;
}
while (n2--) *s++ = *s2++;
return(s1);
#endif
}

View File

@@ -0,0 +1,43 @@
/* Copyright (c) 1992, 1995 John E. Davis
* All rights reserved.
*
* You may distribute under the terms of either the GNU General Public
* License or the Perl Artistic License.
*/
/* These routines are fast memcpy, memset routines. When available, I
use system rouines. For msdos, I use inline assembly. */
/* The current versions only work in the forward direction only!! */
#include "config.h"
#include <stdio.h>
#include "slang.h"
#include "_slang.h"
void SLmemset(char *p, char space, int n)
{
#if defined(msdos) && !defined(__WIN32__) && !defined(__GO32__)
asm mov al, space
asm mov dx, di
asm mov cx, n
asm les di, p
asm cld
asm rep stosb
asm mov di, dx
#else
register char *pmax;
pmax = p + (n - 4);
n = n % 4;
while (p <= pmax)
{
*p++ = space; *p++ = space; *p++ = space; *p++= space;
}
while (n--) *p++ = space;
#endif
}

261
rosapps/mc/slang/slos2tty.c Normal file
View File

@@ -0,0 +1,261 @@
/* Copyright (c) 1992, 1995 John E. Davis
* All rights reserved.
*
* You may distribute under the terms of either the GNU General Public
* License or the Perl Artistic License.
*/
#include "config.h"
#include <stdio.h>
#include "slang.h"
#include "_slang.h"
#define INCL_BASE
#define INCL_NOPM
#define INCL_VIO
#define INCL_KBD
#define INCL_DOS
#if 0
# define INCL_DOSSEMAPHORES
#endif
#ifdef LONG
#undef LONG
#endif
#ifdef VOID
#undef VOID
#endif
#include <os2.h>
#include <signal.h>
#include <process.h>
KBDINFO initialKbdInfo; /* keyboard info */
/* Code to read keystrokes in a separate thread */
typedef struct kbdcodes {
UCHAR ascii;
UCHAR scan;
/* USHORT shift; */
} KBDCODES;
#define BUFFER_LEN 4096
static KBDCODES threadKeys[BUFFER_LEN];
static int atEnd = 0;
static int startBuf;
static int endBuf;
/* Original code used semaphores to control access to threadKeys.
* It is expected that the semaphore code will be deleted after 0.97.
*/
#if 0
#ifdef __os2_16__
typedef USHORT APIRET;
static HSEM Hmtx;
#define DosRequestMutexSem(hmtx,timeout) DosSemRequest(hmtx,timeout)
#define DosReleaseMutexSem(hmtx) DosSemClear(hmtx)
#define DosCloseMutexSem(hmtx) DosCloseSem(hmtx)
#else /* !defined(__os2_16__) */
static HMTX Hmtx; /* Mutex Semaphore */
#endif
static APIRET CreateSem(void)
{
#ifdef __os2_16__
char SemName[32];
sprintf(SemName, "\\SEM\\jed\\%u", getpid());
return ( DosCreateSem (0, &Hmtx, SemName) );
#else
return ( DosCreateMutexSem (NULL, &Hmtx, 0, 0) );
#endif
}
static APIRET RequestSem(void)
{
return ( DosRequestMutexSem (Hmtx, -1) );
}
static APIRET ReleaseSem(void)
{
return ( DosReleaseMutexSem (Hmtx) );
}
static APIRET CloseSem(void)
{
return( DosCloseMutexSem (Hmtx) );
}
#else
#define CreateSem()
#define RequestSem()
#define ReleaseSem()
#define CloseSem()
#endif
static void set_kbd(void)
{
KBDINFO kbdInfo;
kbdInfo = initialKbdInfo;
kbdInfo.fsMask &= ~0x0001; /* not echo on */
kbdInfo.fsMask |= 0x0002; /* echo off */
kbdInfo.fsMask &= ~0x0008; /* cooked mode off */
kbdInfo.fsMask |= 0x0004; /* raw mode */
kbdInfo.fsMask &= ~0x0100; /* shift report off */
KbdSetStatus(&kbdInfo, 0);
}
static void thread_getkey ()
{
KBDKEYINFO keyInfo;
int n;
while (!atEnd) { /* at end is a flag */
set_kbd();
KbdCharIn(&keyInfo, IO_NOWAIT, 0); /* get a character */
if (keyInfo.fbStatus & 0x040) { /* found a char process it */
if (keyInfo.chChar == SLang_Abort_Char) {
if (SLang_Ignore_User_Abort == 0) SLang_Error = USER_BREAK;
SLKeyBoard_Quit = 1;
}
n = (endBuf + 1) % BUFFER_LEN;
if (n == startBuf) {
DosBeep (500, 20);
KbdFlushBuffer(0);
continue;
}
RequestSem();
threadKeys [n].ascii = keyInfo.chChar;
threadKeys [n].scan = keyInfo.chScan;
/* threadKeys [n].shift = keyInfo.fsState; */
endBuf = n;
ReleaseSem();
} else /* no char available*/
DosSleep (20);
}
}
static void thread_code (void *Args)
{
(void) Args;
startBuf = -1; /* initialize the buffer pointers */
endBuf = -1;
thread_getkey ();
atEnd = 0; /* reset the flag */
_endthread();
}
/* The code below is in the main thread */
int SLang_init_tty(int abort_char, int dum2, int dum3)
{
VIOCURSORINFO cursorInfo, OldcursorInfo;
(void) dum2; (void) dum3;
if (abort_char == -1) abort_char = 3; /* ^C */
SLang_Abort_Char = abort_char;
/* set ^C off */
signal (SIGINT, SIG_IGN);
signal (SIGBREAK, SIG_IGN);
/* set up the keyboard */
initialKbdInfo.cb = sizeof(initialKbdInfo);
KbdGetStatus(&initialKbdInfo, 0);
set_kbd();
/* open a semaphore */
CreateSem();
/* start a separate thread to read the keyboard */
#if defined(__BORLANDC__)
_beginthread (thread_code, 8096, NULL);
#else
_beginthread (thread_code, NULL, 8096, NULL);
#endif
VioGetCurType (&OldcursorInfo, 0);
cursorInfo.yStart = 1;
cursorInfo.cEnd = 15;
cursorInfo.cx = 1;
cursorInfo.attr = 1;
if (VioSetCurType (&cursorInfo, 0))
VioSetCurType (&OldcursorInfo, 0); /* reset to previous value */
return 0;
}
void SLang_reset_tty (void)
{
atEnd = 1; /* set flag and wait until thread ends */
while (atEnd) {DosSleep (0);}
CloseSem();
/* close the keyboard */
KbdSetStatus(&initialKbdInfo, 0); /* restore original state */
}
#define keyWaiting() (endBuf != startBuf)
/* sleep for *tsecs tenths of a sec waiting for input */
int SLsys_input_pending(int tsecs)
{
int count = tsecs * 5;
if (count)
{
while(count > 0)
{
DosSleep(20); /* 20 ms or 1/50 sec */
if (keyWaiting ()) break;
count--;
}
return(count);
}
else return(keyWaiting ());
}
unsigned int SLsys_getkey ()
{
unsigned int c;
unsigned char scan;
int tsecs = 300;
if (!keyWaiting())
while (!SLsys_input_pending(tsecs));
/* read codes from buffer */
RequestSem();
startBuf = (startBuf + 1) % BUFFER_LEN;
c = threadKeys [startBuf].ascii;
scan = threadKeys [startBuf].scan;
ReleaseSem();
if ((c == 8) && (scan == 0x0e)) c = 127;
if (c == 0xE0) c = 0;
if (c == 0) SLang_ungetkey (scan);
return (c);
}
void SLang_set_abort_signal (void (*dum)(int))
{
(void) dum;
}

139
rosapps/mc/slang/slsignal.c Normal file
View File

@@ -0,0 +1,139 @@
#include "config.h"
#include <stdio.h>
#include <signal.h>
#ifdef HAVE_STDLIB_H
# include <stdlib.h>
#endif
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
#include <errno.h>
#include "slang.h"
#include "_slang.h"
/* This function will cause system calls to be restarted after signal if possible */
SLSig_Fun_Type *SLsignal (int sig, SLSig_Fun_Type *f)
{
#ifdef SLANG_POSIX_SIGNALS
struct sigaction old_sa, new_sa;
# ifdef SIGALRM
/* We want system calls to be interrupted by SIGALRM. */
if (sig == SIGALRM) return SLsignal_intr (sig, f);
# endif
sigemptyset (&new_sa.sa_mask);
new_sa.sa_handler = f;
new_sa.sa_flags = 0;
# ifdef SA_RESTART
new_sa.sa_flags |= SA_RESTART;
# endif
if (-1 == sigaction (sig, &new_sa, &old_sa))
return (SLSig_Fun_Type *) SIG_ERR;
return old_sa.sa_handler;
#else
/* Not POSIX. */
return signal (sig, f);
#endif
}
/* This function will NOT cause system calls to be restarted after
* signal if possible
*/
SLSig_Fun_Type *SLsignal_intr (int sig, SLSig_Fun_Type *f)
{
#ifdef SLANG_POSIX_SIGNALS
struct sigaction old_sa, new_sa;
sigemptyset (&new_sa.sa_mask);
new_sa.sa_handler = f;
new_sa.sa_flags = 0;
# ifdef SA_INTERRUPT
new_sa.sa_flags |= SA_INTERRUPT;
# endif
if (-1 == sigaction (sig, &new_sa, &old_sa))
return (SLSig_Fun_Type *) SIG_ERR;
return old_sa.sa_handler;
#else
/* Not POSIX. */
return signal (sig, f);
#endif
}
/* We are primarily interested in blocking signals that would cause the
* application to reset the tty. These include suspend signals and
* possibly interrupt signals.
*/
#ifdef SLANG_POSIX_SIGNALS
static sigset_t Old_Signal_Mask;
#endif
static volatile unsigned int Blocked_Depth;
int SLsig_block_signals (void)
{
#ifdef SLANG_POSIX_SIGNALS
sigset_t new_mask;
#endif
Blocked_Depth++;
if (Blocked_Depth != 1)
{
return 0;
}
#ifdef SLANG_POSIX_SIGNALS
sigemptyset (&new_mask);
# ifdef SIGQUIT
sigaddset (&new_mask, SIGQUIT);
# endif
# ifdef SIGTSTP
sigaddset (&new_mask, SIGTSTP);
# endif
# ifdef SIGINT
sigaddset (&new_mask, SIGINT);
# endif
# ifdef SIGTTIN
sigaddset (&new_mask, SIGTTIN);
# endif
# ifdef SIGTTOU
sigaddset (&new_mask, SIGTTOU);
# endif
(void) sigprocmask (SIG_BLOCK, &new_mask, &Old_Signal_Mask);
return 0;
#else
/* Not implemented. */
return -1;
#endif
}
int SLsig_unblock_signals (void)
{
if (Blocked_Depth == 0)
return -1;
Blocked_Depth--;
if (Blocked_Depth != 0)
return 0;
#ifdef SLANG_POSIX_SIGNALS
(void) sigprocmask (SIG_SETMASK, &Old_Signal_Mask, NULL);
return 0;
#else
return -1;
#endif
}

1185
rosapps/mc/slang/slsmg.c Normal file

File diff suppressed because it is too large Load Diff

913
rosapps/mc/slang/sltermin.c Normal file
View File

@@ -0,0 +1,913 @@
/* This file contains enough terminfo reading capabilities sufficient for
* the slang SLtt interface.
*/
/* Copyright (c) 1992, 1995 John E. Davis
* All rights reserved.
*
* You may distribute under the terms of either the GNU General Public
* License or the Perl Artistic License.
*/
#include "config.h"
#include <stdio.h>
#ifdef HAVE_STDLIB_H
# include <stdlib.h>
#endif
#ifndef USE_SETUPTERM
#include "slang.h"
#include "_slang.h"
/*
* The majority of the comments found in the file were taken from the
* term(4) man page on an SGI.
*/
/* Short integers are stored in two 8-bit bytes. The first byte contains
* the least significant 8 bits of the value, and the second byte contains
* the most significant 8 bits. (Thus, the value represented is
* 256*second+first.) The value -1 is represented by 0377,0377, and the
* value -2 is represented by 0376,0377; other negative values are illegal.
* The -1 generally means that a capability is missing from this terminal.
* The -2 means that the capability has been cancelled in the terminfo
* source and also is to be considered missing.
*/
static int make_integer (unsigned char *buf)
{
register int lo, hi;
lo = (int) *buf++; hi = (int) *buf;
if (hi == 0377)
{
if (lo == 0377) return -1;
if (lo == 0376) return -2;
}
return lo + 256 * hi;
}
/*
* The compiled file is created from the source file descriptions of the
* terminals (see the -I option of infocmp) by using the terminfo compiler,
* tic, and read by the routine setupterm [see curses(3X).] The file is
* divided into six parts in the following order: the header, terminal
* names, boolean flags, numbers, strings, and string table.
*
* The header section begins the file. This section contains six short
* integers in the format described below. These integers are (1) the magic
* number (octal 0432); (2) the size, in bytes, of the names section; (3)
* the number of bytes in the boolean section; (4) the number of short
* integers in the numbers section; (5) the number of offsets (short
* integers) in the strings section; (6) the size, in bytes, of the string
* table.
*/
#define MAGIC 0432
/* In this structure, all char * fields are malloced EXCEPT if the
* structure is SLTERMCAP. In that case, only terminal_names is malloced
* and the other fields are pointers into it.
*/
typedef struct
{
#define SLTERMINFO 1
#define SLTERMCAP 2
unsigned int flags;
unsigned int name_section_size;
char *terminal_names;
unsigned int boolean_section_size;
unsigned char *boolean_flags;
unsigned int num_numbers;
unsigned char *numbers;
unsigned int num_string_offsets;
unsigned char *string_offsets;
unsigned int string_table_size;
char *string_table;
} Terminfo_Type;
static char *tcap_getstr (char *, Terminfo_Type *);
static int tcap_getnum (char *, Terminfo_Type *);
static int tcap_getflag (char *, Terminfo_Type *);
static int tcap_getent (char *, Terminfo_Type *);
static FILE *open_terminfo (char *file, Terminfo_Type *h)
{
FILE *fp;
unsigned char buf[12];
fp = fopen (file, "rb");
if (fp == NULL) return NULL;
if ((12 == fread ((char *) buf, 1, 12, fp) && (MAGIC == make_integer (buf))))
{
h->name_section_size = make_integer (buf + 2);
h->boolean_section_size = make_integer (buf + 4);
h->num_numbers = make_integer (buf + 6);
h->num_string_offsets = make_integer (buf + 8);
h->string_table_size = make_integer (buf + 10);
}
else
{
fclose (fp);
fp = NULL;
}
return fp;
}
/*
* The terminal names section comes next. It contains the first line of the
* terminfo description, listing the various names for the terminal,
* separated by the bar ( | ) character (see term(5)). The section is
* terminated with an ASCII NUL character.
*/
/* returns pointer to malloced space */
static unsigned char *read_terminfo_section (FILE *fp, unsigned int size)
{
char *s;
if (NULL == (s = (char *) SLMALLOC (size))) return NULL;
if (size != fread (s, 1, size, fp))
{
SLFREE (s);
return NULL;
}
return (unsigned char *) s;
}
static char *read_terminal_names (FILE *fp, Terminfo_Type *t)
{
return t->terminal_names = (char *) read_terminfo_section (fp, t->name_section_size);
}
/*
* The boolean flags have one byte for each flag. This byte is either 0 or
* 1 as the flag is present or absent. The value of 2 means that the flag
* has been cancelled. The capabilities are in the same order as the file
* <term.h>.
*/
static unsigned char *read_boolean_flags (FILE *fp, Terminfo_Type *t)
{
/* Between the boolean section and the number section, a null byte is
* inserted, if necessary, to ensure that the number section begins on an
* even byte offset. All short integers are aligned on a short word
* boundary.
*/
unsigned int size = (t->name_section_size + t->boolean_section_size) % 2;
size += t->boolean_section_size;
return t->boolean_flags = read_terminfo_section (fp, size);
}
/*
* The numbers section is similar to the boolean flags section. Each
* capability takes up two bytes, and is stored as a short integer. If the
* value represented is -1 or -2, the capability is taken to be missing.
*/
static unsigned char *read_numbers (FILE *fp, Terminfo_Type *t)
{
return t->numbers = read_terminfo_section (fp, 2 * t->num_numbers);
}
/* The strings section is also similar. Each capability is stored as a
* short integer, in the format above. A value of -1 or -2 means the
* capability is missing. Otherwise, the value is taken as an offset from
* the beginning of the string table. Special characters in ^X or \c
* notation are stored in their interpreted form, not the printing
* representation. Padding information ($<nn>) and parameter information
* (%x) are stored intact in uninterpreted form.
*/
static unsigned char *read_string_offsets (FILE *fp, Terminfo_Type *t)
{
return t->string_offsets = (unsigned char *) read_terminfo_section (fp, 2 * t->num_string_offsets);
}
/* The final section is the string table. It contains all the values of
* string capabilities referenced in the string section. Each string is
* null terminated.
*/
static char *read_string_table (FILE *fp, Terminfo_Type *t)
{
return t->string_table = (char *) read_terminfo_section (fp, t->string_table_size);
}
/*
* Compiled terminfo(4) descriptions are placed under the directory
* /usr/share/lib/terminfo. In order to avoid a linear search of a huge
* UNIX system directory, a two-level scheme is used:
* /usr/share/lib/terminfo/c/name where name is the name of the terminal,
* and c is the first character of name. Thus, att4425 can be found in the
* file /usr/share/lib/terminfo/a/att4425. Synonyms for the same terminal
* are implemented by multiple links to the same compiled file.
*/
#define MAX_TI_DIRS 7
static char *Terminfo_Dirs [MAX_TI_DIRS] =
{
NULL,
"/usr/lib/terminfo",
"/usr/share/lib/terminfo",
"/usr/local/lib/terminfo",
"/lib/terminfo",
"/usr/local/share/terminfo",
"/usr/share/terminfo"
};
char *SLtt_tigetent (char *term)
{
char *tidir;
int i;
FILE *fp = NULL;
char file[256];
Terminfo_Type *ti;
if (
(term == NULL)
#ifdef SLANG_UNTIC
&& (SLang_Untic_Terminfo_File == NULL)
#endif
)
return NULL;
if (NULL == (ti = (Terminfo_Type *) SLMALLOC (sizeof (Terminfo_Type))))
{
return NULL;
}
#ifdef SLANG_UNTIC
if (SLang_Untic_Terminfo_File != NULL)
{
fp = open_terminfo (SLang_Untic_Terminfo_File, ti);
goto fp_open_label;
}
else
#endif
/* If we are on a termcap based system, use termcap */
if (0 == tcap_getent (term, ti)) return (char *) ti;
Terminfo_Dirs[0] = getenv ("TERMINFO");
i = 0;
while (i < MAX_TI_DIRS)
{
tidir = Terminfo_Dirs[i];
if (tidir != NULL)
{
sprintf (file, "%s/%c/%s", tidir, *term, term);
if (NULL != (fp = open_terminfo (file, ti))) break;
}
i++;
}
#ifdef SLANG_UNTIC
fp_open_label:
#endif
if (fp != NULL)
{
if (NULL != read_terminal_names (fp, ti))
{
if (NULL != read_boolean_flags (fp, ti))
{
if (NULL != read_numbers (fp, ti))
{
if (NULL != read_string_offsets (fp, ti))
{
if (NULL != read_string_table (fp, ti))
{
/* success */
fclose (fp);
ti->flags = SLTERMINFO;
return (char *) ti;
}
SLFREE (ti->string_offsets);
}
SLFREE (ti->numbers);
}
SLFREE (ti->boolean_flags);
}
SLFREE (ti->terminal_names);
}
fclose (fp);
}
SLFREE (ti);
return NULL;
}
#ifdef SLANG_UNTIC
# define UNTIC_COMMENT(x) ,x
#else
# define UNTIC_COMMENT(x)
#endif
typedef struct
{
char name[3];
int offset;
#ifdef SLANG_UNTIC
char *comment;
#endif
}
Tgetstr_Map_Type;
/* I need to add: K1-5, %0-5(not important), @8, &8... */
static Tgetstr_Map_Type Tgetstr_Map [] =
{
{"@7", 164 UNTIC_COMMENT("KEY End")},
{"AB", 360 UNTIC_COMMENT("set a color background")},
{"AF", 359 UNTIC_COMMENT("set a color foreground")},
{"AL", 110 UNTIC_COMMENT("parm_insert_line")},
{"DL", 106 UNTIC_COMMENT("parm_delete_line")},
{"RI", 112 UNTIC_COMMENT("parm_right_cursor")},
{"Sf", 302 UNTIC_COMMENT("set foreground (color)")},
{"Sb", 303 UNTIC_COMMENT("set background (color)")},
{"ac", 146 UNTIC_COMMENT("acs_chars")},
{"ae", 38 UNTIC_COMMENT("exit_alt_charset_mode")},
{"as", 25 UNTIC_COMMENT("enter_alt_charset_mode")},
{"ce", 6 UNTIC_COMMENT("clr_eol")},
{"cl", 5 UNTIC_COMMENT("clear_screen")},
{"cm", 10 UNTIC_COMMENT("cursor_address")},
{"cs", 3 UNTIC_COMMENT("change_scroll_region")},
{"dc", 21 UNTIC_COMMENT("delete_character")},
{"ds", 23 UNTIC_COMMENT("disable status line")},
{"eA", 155 UNTIC_COMMENT("enable alt char set")},
{"ei", 42 UNTIC_COMMENT("exit_insert_mode")},
{"fs", 47 UNTIC_COMMENT("return from status line")},
{"im", 31 UNTIC_COMMENT("enter_insert_mode")},
{"k0", 65 UNTIC_COMMENT("key_f0")},
{"k1", 66 UNTIC_COMMENT("key_f1")},
{"k2", 68 UNTIC_COMMENT("key_f2")},
{"k3", 69 UNTIC_COMMENT("key_f3")},
{"k4", 70 UNTIC_COMMENT("key_f4")},
{"k5", 71 UNTIC_COMMENT("key_f5")},
{"k6", 72 UNTIC_COMMENT("key_f6")},
{"k7", 73 UNTIC_COMMENT("key_f7")},
{"k8", 74 UNTIC_COMMENT("key_f8")},
{"k9", 75 UNTIC_COMMENT("key_f9")},
{"kA", 78 UNTIC_COMMENT("key_il")},
{"kC", 57 UNTIC_COMMENT("key_clear")},
{"kD", 59 UNTIC_COMMENT("key_dc")},
{"kE", 63 UNTIC_COMMENT("key_eol,")},
{"kF", 84 UNTIC_COMMENT("key_sf")},
{"kH", 80 UNTIC_COMMENT("key_ll")},
{"kI", 77 UNTIC_COMMENT("key_ic")},
{"kL", 60 UNTIC_COMMENT("key_dl")},
{"kM", 62 UNTIC_COMMENT("key_eic,")},
{"kN", 81 UNTIC_COMMENT("key_npage")},
{"kP", 82 UNTIC_COMMENT("key_ppage")},
{"kR", 85 UNTIC_COMMENT("key_sr")},
{"kS", 64 UNTIC_COMMENT("key_eos,")},
{"kT", 86 UNTIC_COMMENT("key_stab")},
{"ka", 56 UNTIC_COMMENT("key_catab")},
{"k;", 67 UNTIC_COMMENT("key_f10")},
{"kb", 55 UNTIC_COMMENT("key_backspace")},
{"kd", 61 UNTIC_COMMENT("key_down")},
{"ke", 88 UNTIC_COMMENT("End keypad transmit mode")},
{"kh", 76 UNTIC_COMMENT("key_home")},
{"kl", 79 UNTIC_COMMENT("key_left")},
{"kr", 83 UNTIC_COMMENT("key_right")},
{"ks", 89 UNTIC_COMMENT("Start keypad transmit mode")},
{"kt", 58 UNTIC_COMMENT("key_ctab")},
{"ku", 87 UNTIC_COMMENT("key_up")},
{"mb", 26 UNTIC_COMMENT("enter_blink_mode")},
{"md", 27 UNTIC_COMMENT("enter_bold_mode")},
{"me", 39 UNTIC_COMMENT("exit_attribute_mode")},
{"mr", 34 UNTIC_COMMENT("enter_reverse_mode")},
{"op", 297 UNTIC_COMMENT("orig_pair (color)")},
{"pf", 119 UNTIC_COMMENT("turn OFF printer")},
{"po", 120 UNTIC_COMMENT("turn ON printer")},
{"se", 43 UNTIC_COMMENT("exit_standout_mode")},
{"so", 35 UNTIC_COMMENT("enter_standout_mode")},
{"sr", 130 UNTIC_COMMENT("scroll_reverse")},
{"te", 40 UNTIC_COMMENT("end cursor addressing")},
{"ti", 28 UNTIC_COMMENT("begin cursor addressing")},
{"ts", 135 UNTIC_COMMENT("goto to status line")},
{"up", 19 UNTIC_COMMENT("cursor_up")},
{"us", 36 UNTIC_COMMENT("enter_underline_mode")},
{"vb", 45 UNTIC_COMMENT("flash_screen")},
{"ve", 16 UNTIC_COMMENT("make cursor very visible")},
{"vi", 13 UNTIC_COMMENT("make cursor invisible")},
{"vs", 20 UNTIC_COMMENT("make cursor very visible")},
{"", 0 UNTIC_COMMENT(NULL)}
};
static int compute_cap_offset (char *cap, Terminfo_Type *t, Tgetstr_Map_Type *map, unsigned int max_ofs)
{
char cha, chb;
(void) t;
cha = *cap++; chb = *cap;
while (*map->name != 0)
{
if ((cha == *map->name) && (chb == *(map->name + 1)))
{
if (map->offset >= (int) max_ofs) return -1;
return map->offset;
}
map++;
}
return -1;
}
char *SLtt_tigetstr (char *cap, char **pp)
{
int offset;
Terminfo_Type *t;
if ((pp == NULL) || (NULL == (t = (Terminfo_Type *) *pp))) return NULL;
if (t->flags == SLTERMCAP) return tcap_getstr (cap, t);
offset = compute_cap_offset (cap, t, Tgetstr_Map, t->num_string_offsets);
if (offset < 0) return NULL;
offset = make_integer (t->string_offsets + 2 * offset);
if (offset < 0) return NULL;
return t->string_table + offset;
}
static Tgetstr_Map_Type Tgetnum_Map[] =
{
{"co", 0 UNTIC_COMMENT("columns")},
{"li", 2 UNTIC_COMMENT("lines")},
{"Co", 13 UNTIC_COMMENT("max colors")},
{"pa", 14 UNTIC_COMMENT("max pairs")},
{"sg", 4 UNTIC_COMMENT("magic cookie glitch")},
{"ws", 7 UNTIC_COMMENT("num columns in status line")},
{"", -1 UNTIC_COMMENT(NULL)}
};
int SLtt_tigetnum (char *cap, char **pp)
{
int offset;
Terminfo_Type *t;
if ((pp == NULL) || (NULL == (t = (Terminfo_Type *) *pp))) return -1;
if (t->flags == SLTERMCAP) return tcap_getnum (cap, t);
offset = compute_cap_offset (cap, t, Tgetnum_Map, t->num_numbers);
if (offset < 0) return -1;
return make_integer (t->numbers + 2 * offset);
}
static Tgetstr_Map_Type Tgetflag_Map[] =
{
{"am", 1 UNTIC_COMMENT("auto right margin")},
{"hs", 9 UNTIC_COMMENT("has status line")},
{"ms", 14 UNTIC_COMMENT("move standout mode")},
{"xs", 3 UNTIC_COMMENT("ceol standout glitch")},
{"xn", 4 UNTIC_COMMENT("NEWLINE ignored after 80 columns")},
{"es", 16 UNTIC_COMMENT("status line esc ok")},
{"", -1 UNTIC_COMMENT(NULL)}
};
int SLtt_tigetflag (char *cap, char **pp)
{
int offset;
Terminfo_Type *t;
if ((pp == NULL) || (NULL == (t = (Terminfo_Type *) *pp))) return -1;
if (t->flags == SLTERMCAP) return tcap_getflag (cap, t);
offset = compute_cap_offset (cap, t, Tgetflag_Map, t->boolean_section_size);
if (offset < 0) return -1;
return (int) *(t->boolean_flags + offset);
}
/* These are my termcap routines. They only work with the TERMCAP environment
* variable. This variable must contain the termcap entry and NOT the file.
*/
static int tcap_getflag (char *cap, Terminfo_Type *t)
{
char a, b;
char *f = (char *) t->boolean_flags;
char *fmax;
if (f == NULL) return 0;
fmax = f + t->boolean_section_size;
a = *cap;
b = *(cap + 1);
while (f < fmax)
{
if ((a == f[0]) && (b == f[1]))
return 1;
f += 2;
}
return 0;
}
static char *tcap_get_cap (unsigned char *cap, unsigned char *caps, unsigned int len)
{
unsigned char c0, c1;
unsigned char *caps_max;
c0 = cap[0];
c1 = cap[1];
if (caps == NULL) return NULL;
caps_max = caps + len;
while (caps < caps_max)
{
if ((c0 == caps[0]) && (c1 == caps[1]))
{
return (char *) caps + 3;
}
caps += (int) caps[2];
}
return NULL;
}
static int tcap_getnum (char *cap, Terminfo_Type *t)
{
cap = tcap_get_cap ((unsigned char *) cap, t->numbers, t->num_numbers);
if (cap == NULL) return -1;
return atoi (cap);
}
static char *tcap_getstr (char *cap, Terminfo_Type *t)
{
return tcap_get_cap ((unsigned char *) cap, (unsigned char *) t->string_table, t->string_table_size);
}
static int tcap_extract_field (unsigned char *t0)
{
register unsigned char ch, *t = t0;
while (((ch = *t) != 0) && (ch != ':')) t++;
if (ch == ':') return (int) (t - t0);
return -1;
}
int SLtt_Try_Termcap = 1;
static int tcap_getent (char *term, Terminfo_Type *ti)
{
unsigned char *termcap, ch;
unsigned char *buf, *b;
unsigned char *t;
int len;
if (SLtt_Try_Termcap == 0) return -1;
#if 1
/* XFREE86 xterm sets the TERMCAP environment variable to an invalid
* value. Specifically, it lacks the tc= string.
*/
if (!strncmp (term, "xterm", 5))
return -1;
#endif
termcap = (unsigned char *) getenv ("TERMCAP");
if ((termcap == NULL) || (*termcap == '/')) return -1;
/* We have a termcap so lets use it provided it does not have a reference
* to another terminal via tc=. In that case, user terminfo. The alternative
* would be to parse the termcap file which I do not want to do right now.
* Besides, this is a terminfo based system and if the termcap were parsed
* terminfo would almost never get a chance to run. In addition, the tc=
* thing should not occur if tset is used to set the termcap entry.
*/
t = termcap;
while ((len = tcap_extract_field (t)) != -1)
{
if ((len > 3) && (t[0] == 't') && (t[1] == 'c') && (t[2] == '='))
return -1;
t += (len + 1);
}
/* malloc some extra space just in case it is needed. */
len = strlen ((char *) termcap) + 256;
if (NULL == (buf = (unsigned char *) SLMALLOC ((unsigned int) len))) return -1;
b = buf;
/* The beginning of the termcap entry contains the names of the entry.
* It is terminated by a colon.
*/
ti->terminal_names = (char *) b;
t = termcap;
len = tcap_extract_field (t);
if (len < 0)
{
SLFREE (buf);
return -1;
}
strncpy ((char *) b, (char *) t, (unsigned int) len);
b[len] = 0;
b += len + 1;
ti->name_section_size = len;
/* Now, we are really at the start of the termcap entries. Point the
* termcap variable here since we want to refer to this a number of times.
*/
termcap = t + (len + 1);
/* Process strings first. */
ti->string_table = (char *) b;
t = termcap;
while (-1 != (len = tcap_extract_field (t)))
{
unsigned char *b1;
unsigned char *tmax;
/* We are looking for: XX=something */
if ((len < 4) || (t[2] != '=') || (*t == '.'))
{
t += len + 1;
continue;
}
tmax = t + len;
b1 = b;
while (t < tmax)
{
ch = *t++;
if ((ch == '\\') && (t < tmax))
{
t = (unsigned char *) SLexpand_escaped_char ((char *) t, (char *) &ch);
}
else if ((ch == '^') && (t < tmax))
{
ch = *t++;
if (ch == '?') ch = 127;
else ch = (ch | 0x20) - ('a' - 1);
}
*b++ = ch;
}
/* Null terminate it. */
*b++ = 0;
len = (int) (b - b1);
b1[2] = (unsigned char) len; /* replace the = by the length */
/* skip colon to next field. */
t++;
}
ti->string_table_size = (int) (b - (unsigned char *) ti->string_table);
/* Now process the numbers. */
t = termcap;
ti->numbers = b;
while (-1 != (len = tcap_extract_field (t)))
{
unsigned char *b1;
unsigned char *tmax;
/* We are looking for: XX#NUMBER */
if ((len < 4) || (t[2] != '#') || (*t == '.'))
{
t += len + 1;
continue;
}
tmax = t + len;
b1 = b;
while (t < tmax)
{
*b++ = *t++;
}
/* Null terminate it. */
*b++ = 0;
len = (int) (b - b1);
b1[2] = (unsigned char) len; /* replace the # by the length */
t++;
}
ti->num_numbers = (int) (b - ti->numbers);
/* Now process the flags. */
t = termcap;
ti->boolean_flags = b;
while (-1 != (len = tcap_extract_field (t)))
{
/* We are looking for: XX#NUMBER */
if ((len != 2) || (*t == '.') || (*t <= ' '))
{
t += len + 1;
continue;
}
b[0] = t[0];
b[1] = t[1];
t += 3;
b += 2;
}
ti->boolean_section_size = (int) (b - ti->boolean_flags);
ti->flags = SLTERMCAP;
return 0;
}
#else /* USE_SETUPTERM */
/* Ching Hui fixes so that it will work on AIX and OSF/1 */
#include <curses.h>
#include <term.h>
int SLtt_Try_Termcap = 1;
char *SLtt_tigetent (char *term)
{
int rc;
setupterm(term, 1, &rc);
if (rc != 1)
return NULL;
return (char *)cur_term;
}
#define MATCH_CHAR(c, variable) \
do { \
if (*(cap + 1) == c) \
return variable; \
} while (0)
char *SLtt_tigetstr (char *cap, char **pp)
{
if ((pp == NULL) || ((cur_term = (struct term *) *pp) == NULL))
return NULL;
switch(*cap) {
case '@':
MATCH_CHAR('7', key_end);
break;
case 'A':
MATCH_CHAR('A', parm_insert_line);
break;
case 'D':
MATCH_CHAR('L', parm_delete_line);
break;
case 'R':
MATCH_CHAR('I', parm_right_cursor);
break;
case 'a':
#ifdef acs_chars
MATCH_CHAR('c', acs_chars);
#elif defined (box_chars_1)
MATCH_CHAR('c', box_chars_1); /* AIX hack */
#else
MATCH_CHAR('c', NULL);
#endif
MATCH_CHAR('e', exit_alt_charset_mode);
MATCH_CHAR('s', enter_alt_charset_mode);
break;
case 'c':
MATCH_CHAR('e', clr_eol);
MATCH_CHAR('l', clear_screen);
MATCH_CHAR('m', cursor_address);
MATCH_CHAR('s', change_scroll_region);
break;
case 'd':
MATCH_CHAR('c', delete_character);
break;
case 'e':
MATCH_CHAR('i', exit_insert_mode);
#ifdef ena_acs
MATCH_CHAR('A', ena_acs); /* aix hack */
#else
MATCH_CHAR('A', NULL);
#endif
break;
case 'i':
MATCH_CHAR('m', enter_insert_mode);
break;
case 'k':
MATCH_CHAR('0', key_f0);
MATCH_CHAR('1', key_f1);
MATCH_CHAR('1', key_f1);
MATCH_CHAR('2', key_f2);
MATCH_CHAR('3', key_f3);
MATCH_CHAR('4', key_f4);
MATCH_CHAR('5', key_f5);
MATCH_CHAR('6', key_f6);
MATCH_CHAR('7', key_f7);
MATCH_CHAR('8', key_f8);
MATCH_CHAR('9', key_f9);
MATCH_CHAR('A', key_il);
MATCH_CHAR('C', key_clear);
MATCH_CHAR('D', key_dc);
MATCH_CHAR('E', key_eol);
MATCH_CHAR('F', key_sf);
MATCH_CHAR('H', key_ll);
MATCH_CHAR('I', key_ic);
MATCH_CHAR('L', key_dl);
MATCH_CHAR('M', key_eic);
MATCH_CHAR('N', key_npage);
MATCH_CHAR('P', key_ppage);
MATCH_CHAR('R', key_sr);
MATCH_CHAR('S', key_eos);
MATCH_CHAR('T', key_stab);
MATCH_CHAR('a', key_catab);
MATCH_CHAR(';', key_f10);
MATCH_CHAR('b', key_backspace);
MATCH_CHAR('d', key_down);
MATCH_CHAR('e', keypad_local);
MATCH_CHAR('h', key_home);
MATCH_CHAR('l', key_left);
MATCH_CHAR('r', key_right);
MATCH_CHAR('s', keypad_xmit);
MATCH_CHAR('t', key_ctab);
MATCH_CHAR('u', key_up);
break;
case 'm':
MATCH_CHAR('b', enter_blink_mode);
MATCH_CHAR('d', enter_bold_mode);
MATCH_CHAR('e', exit_attribute_mode);
MATCH_CHAR('r', enter_reverse_mode);
break;
case 's':
MATCH_CHAR('e', exit_standout_mode);
MATCH_CHAR('o', enter_standout_mode);
MATCH_CHAR('r', scroll_reverse);
break;
case 't':
MATCH_CHAR('e', exit_ca_mode);
MATCH_CHAR('i', enter_ca_mode);
break;
case 'u':
MATCH_CHAR('p', cursor_up);
MATCH_CHAR('s', enter_underline_mode);
break;
case 'v':
MATCH_CHAR('b', flash_screen);
MATCH_CHAR('i', cursor_invisible);
MATCH_CHAR('s', cursor_visible);
break;
case 'F':
MATCH_CHAR('1', key_f11);
MATCH_CHAR('2', key_f12);
MATCH_CHAR('3', key_f13);
MATCH_CHAR('4', key_f14);
MATCH_CHAR('5', key_f15);
MATCH_CHAR('6', key_f16);
MATCH_CHAR('7', key_f17);
MATCH_CHAR('8', key_f18);
MATCH_CHAR('9', key_f19);
MATCH_CHAR('A', key_f20);
break;
#ifdef orig_pair
case 'o':
MATCH_CHAR('p', orig_pair);
break;
#endif
}
return NULL;
}
int SLtt_tigetnum (char *cap, char **pp)
{
if ((pp == NULL) || ((cur_term = (struct term *) *pp) == NULL))
return (int) NULL;
switch(*cap) {
case 'c':
MATCH_CHAR('o', columns);
break;
case 'l':
MATCH_CHAR('i', lines);
break;
}
return -1;
}
int SLtt_tigetflag (char *cap, char **pp)
{
if ((pp == NULL) || ((cur_term = (struct term *) *pp) == NULL))
return (int) NULL;
switch(*cap) {
case 'a':
MATCH_CHAR('m', auto_right_margin);
break;
case 'm':
MATCH_CHAR('s', move_standout_mode);
break;
case 'x':
MATCH_CHAR('s', ceol_standout_glitch);
break;
case 's':
MATCH_CHAR('g', magic_cookie_glitch);
break;
}
return -1;
}
#endif /* !USE_SETUPTERM */

355
rosapps/mc/slang/sltoken.c Normal file
View File

@@ -0,0 +1,355 @@
/*--------------------------------*-C-*---------------------------------*
* File: sltoken.c
*
* Descript: ---
*
* Requires: ---
*
* Public: SLexpand_escaped_char ();
* SLexpand_escaped_string ();
* SLang_extract_token ();
* SLang_guess_type ();
* SLatoi ();
*
* Private: ---
*
* Notes: ---
*
* Copyright (c) 1992, 1995 John E. Davis
* All rights reserved.
*
* You may distribute under the terms of either the GNU General Public
* License or the Perl Artistic License.
\*----------------------------------------------------------------------*/
#include "config.h"
#include <stdio.h>
#ifdef HAVE_STDLIB_H
# include <stdlib.h>
#endif
#include <string.h>
#include "slang.h"
#include "_slang.h"
/* There are non-zeros at positions "\t %()*,/:;[]{}" */
static unsigned char special_chars[256] =
{
/* 0 */ 0,0,0,0,0,0,0,0, 0,'\t',0,0,0,0,0,0,
/* 16 */ 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,
/* 32 */ ' ',0,0,0,0,'%',0,0, '(',')','*',0,',',0,0,'/',
/* 48 */ 0,0,0,0,0,0,0,0, 0,0,':',';',0,0,0,0,
/* 64 */ 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,
/* 80 */ 0,0,0,0,0,0,0,0, 0,0,0,'[',0,']',0,0,
/* 96 */ 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,
/* 112 */ 0,0,0,0,0,0,0,0, 0,0,0,'{',0,'}',0,0,
/* 8-bit characters */
/* 128 */ 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,
/* 144 */ 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,
/* 160 */ 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,
/* 176 */ 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,
/* 192 */ 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,
/* 208 */ 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,
/* 224 */ 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,
/* 240 */ 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0
};
char *SLexpand_escaped_char(char *p, char *ch)
{
int i = 0;
int max = 0, num, base = 0;
char ch1;
ch1 = *p++;
switch (ch1)
{
default: num = ch1; break;
case 'n': num = '\n'; break;
case 't': num = '\t'; break;
case 'v': num = '\v'; break;
case 'b': num = '\b'; break;
case 'r': num = '\r'; break;
case 'f': num = '\f'; break;
case 'E': case 'e': num = 27; break;
case 'a': num = 7;
break;
/* octal */
case '0': case '1': case '2': case '3':
case '4': case '5': case '6': case '7':
max = '7';
base = 8; i = 2; num = ch1 - '0';
break;
case 'd': /* decimal -- S-Lang extension */
base = 10;
i = 3;
max = '9';
num = 0;
break;
case 'x': /* hex */
base = 16;
max = '9';
i = 2;
num = 0;
break;
}
while (i--)
{
ch1 = *p;
if ((ch1 <= max) && (ch1 >= '0'))
{
num = base * num + (ch1 - '0');
}
else if (base == 16)
{
ch1 |= 0x20;
if ((ch1 < 'a') || ((ch1 > 'f'))) break;
num = base * num + 10 + (ch1 - 'a');
}
else break;
p++;
}
*ch = (char) num;
return p;
}
void SLexpand_escaped_string (register char *s, register char *t,
register char *tmax)
{
char ch;
while (t < tmax)
{
ch = *t++;
if (ch == '\\')
{
t = SLexpand_escaped_char (t, &ch);
}
*s++ = ch;
}
*s = 0;
}
int SLang_extract_token (char **linep, char *word_parm, int byte_comp)
{
register char ch, *line, *word = word_parm;
int string;
char ch1;
char *word_max;
word_max = word + 250;
line = *linep;
/* skip white space */
while (((ch = *line) == ' ')
|| (ch == '\t')) line++;
if ((!ch) || (ch == '\n'))
{
*linep = line;
return(0);
}
*word++ = ch;
line++;
/* Look for -something and rule out --something and -= something */
if ((ch == '-') &&
(*line != '-') && (*line != '=') && ((*line > '9') || (*line < '0')))
{
*word = 0;
*linep = line;
return 1;
}
if (ch == '"') string = 1; else string = 0;
if (ch == '\'')
{
if ((ch = *line++) != 0)
{
if (ch == '\\')
{
line = SLexpand_escaped_char(line, &ch1);
ch = ch1;
}
if (*line++ == '\'')
{
--word;
sprintf(word, "%d", (int) ((unsigned char) ch));
word += strlen (word); ch = '\'';
}
else SLang_Error = SYNTAX_ERROR;
}
else SLang_Error = SYNTAX_ERROR;
}
else if (!special_chars[(unsigned char) ch])
{
while (ch = *line++,
(ch > '"') ||
((ch != '\n') && (ch != 0) && (ch != '"')))
{
if (string)
{
if (ch == '\\')
{
ch = *line++;
if ((ch == 0) || (ch == '\n')) break;
if (byte_comp) *word++ = '\\';
else
{
line = SLexpand_escaped_char(line - 1, &ch1);
ch = ch1;
}
}
}
else if (special_chars[(unsigned char) ch])
{
line--;
break;
}
*word++ = ch;
if (word > word_max)
{
SLang_doerror ("Token to large.");
break;
}
}
}
if ((!ch) || (ch == '\n')) line--;
if ((ch == '"') && string) *word++ = '"'; else if (string) SLang_Error = SYNTAX_ERROR;
*word = 0;
*linep = line;
/* massage variable-- and ++ into --variable, etc... */
if (((int) (word - word_parm) > 2)
&& (ch = *(word - 1), (ch == '+') || (ch == '-'))
&& (ch == *(word - 2)))
{
word--;
while (word >= word_parm + 2)
{
*word = *(word - 2);
word--;
}
*word-- = ch;
*word-- = ch;
}
return(1);
}
int SLang_guess_type (char *t)
{
char *p;
register char ch;
if (*t == '-') t++;
p = t;
#ifdef FLOAT_TYPE
if (*p != '.')
{
#endif
while ((*p >= '0') && (*p <= '9')) p++;
if (t == p) return(STRING_TYPE);
if ((*p == 'x') && (p == t + 1)) /* 0x?? */
{
p++;
while (ch = *p,
((ch >= '0') && (ch <= '9'))
|| (((ch | 0x20) >= 'a') && ((ch | 0x20) <= 'f'))) p++;
}
if (*p == 0) return(INT_TYPE);
#ifndef FLOAT_TYPE
return(STRING_TYPE);
#else
}
/* now down to float case */
if (*p == '.')
{
p++;
while ((*p >= '0') && (*p <= '9')) p++;
}
if (*p == 0) return(FLOAT_TYPE);
if ((*p != 'e') && (*p != 'E')) return(STRING_TYPE);
p++;
if ((*p == '-') || (*p == '+')) p++;
while ((*p >= '0') && (*p <= '9')) p++;
if (*p != 0) return(STRING_TYPE); else return(FLOAT_TYPE);
#endif
}
int SLatoi (unsigned char *s)
{
register unsigned char ch;
register unsigned int value;
register int base;
if (*s != '0') return atoi((char *) s);
/* look for 'x' which indicates hex */
s++;
if ((*s | 0x20) == 'x')
{
base = 16;
s++;
if (*s == 0)
{
SLang_Error = SYNTAX_ERROR;
return -1;
}
}
else base = 8;
value = 0;
while ((ch = *s++) != 0)
{
char ch1 = ch | 0x20;
switch (ch1)
{
default:
SLang_Error = SYNTAX_ERROR;
break;
case '8':
case '9':
if (base != 16) SLang_Error = SYNTAX_ERROR;
/* drop */
case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
ch1 -= '0';
break;
case 'a':
case 'b':
case 'c':
case 'd':
case 'e':
case 'f':
if (base != 16) SLang_Error = SYNTAX_ERROR;
ch1 = (ch1 - 'a') + 10;
break;
}
value = value * base + ch1;
}
return (int) value;
}

537
rosapps/mc/slang/slutty.c Normal file
View File

@@ -0,0 +1,537 @@
/* slutty.c --- Unix Low level terminal (tty) functions for S-Lang */
/* Copyright (c) 1992, 1995 John E. Davis
* All rights reserved.
*
* You may distribute under the terms of either the GNU General Public
* License or the Perl Artistic License.
*/
#include "config.h"
#include <stdio.h>
#include <signal.h>
/* sequent support thanks to Kenneth Lorber <keni@oasys.dt.navy.mil> */
/* SYSV (SYSV ISC R3.2 v3.0) provided by iain.lea@erlm.siemens.de */
#if defined (_AIX) && !defined (_ALL_SOURCE)
# define _ALL_SOURCE /* so NBBY is defined in <sys/types.h> */
#endif
#ifdef HAVE_STDLIB_H
# include <stdlib.h>
#endif
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
#include <sys/time.h>
#include <sys/types.h>
#ifdef SYSV
# include <fcntl.h>
# ifndef CRAY
# include <sys/termio.h>
# include <sys/stream.h>
# include <sys/ptem.h>
# include <sys/tty.h>
# endif
#endif
#ifdef __BEOS__
/* Prototype for select */
# include <net/socket.h>
#endif
#include <sys/file.h>
#ifndef sun
# include <sys/ioctl.h>
#endif
#ifdef __QNX__
# include <sys/select.h>
#endif
#include <sys/stat.h>
#include <errno.h>
#if defined (_AIX) && !defined (FD_SET)
# include <sys/select.h> /* for FD_ISSET, FD_SET, FD_ZERO */
#endif
#ifndef O_RDWR
# include <fcntl.h>
#endif
#include "slang.h"
#include "_slang.h"
int SLang_TT_Read_FD = -1;
int SLang_TT_Baud_Rate;
#ifdef HAVE_TERMIOS_H
# if !defined(HAVE_TCGETATTR) || !defined(HAVE_TCSETATTR)
# undef HAVE_TERMIOS_H
# endif
#endif
#ifndef HAVE_TERMIOS_H
# if !defined(CBREAK) && defined(sun)
# ifndef BSD_COMP
# define BSD_COMP 1
# endif
# include <sys/ioctl.h>
# endif
typedef struct
{
struct tchars t;
struct ltchars lt;
struct sgttyb s;
}
TTY_Termio_Type;
#else
# include <termios.h>
typedef struct termios TTY_Termio_Type;
#endif
static TTY_Termio_Type Old_TTY;
#ifdef HAVE_TERMIOS_H
static struct
{
speed_t key;
int value;
} Baud_Rates[] =
{
{B0, 0},
{B50, 50},
{B75, 75},
{B110, 110},
{B134, 134},
{B150, 150},
{B200, 200},
{B300, 300},
{B600, 600},
{B1200, 1200},
{B1800, 1800},
{B2400, 2400},
{B4800, 4800},
{B9600, 9600},
{B19200, 19200},
{B38400, 38400}
#ifdef B57600
, {B57600, 57600}
#endif
#ifdef B115200
, {B115200, 115200}
#endif
#ifdef B230400
, {B230400, 230400}
#endif
};
#endif
#ifdef HAVE_TERMIOS_H
# define GET_TERMIOS(fd, x) tcgetattr(fd, x)
# define SET_TERMIOS(fd, x) tcsetattr(fd, TCSADRAIN, x)
#else
# ifdef TCGETS
# define GET_TERMIOS(fd, x) ioctl(fd, TCGETS, x)
# define SET_TERMIOS(fd, x) ioctl(fd, TCSETS, x)
# else
# define X(x,m) &(((TTY_Termio_Type *)(x))->m)
# define GET_TERMIOS(fd, x) \
((ioctl(fd, TIOCGETC, X(x,t)) || \
ioctl(fd, TIOCGLTC, X(x,lt)) || \
ioctl(fd, TIOCGETP, X(x,s))) ? -1 : 0)
# define SET_TERMIOS(fd, x) \
((ioctl(fd, TIOCSETC, X(x,t)) ||\
ioctl(fd, TIOCSLTC, X(x,lt)) || \
ioctl(fd, TIOCSETP, X(x,s))) ? -1 : 0)
# endif
#endif
static int TTY_Inited = 0;
static int TTY_Open = 0;
#ifdef ultrix /* Ultrix gets _POSIX_VDISABLE wrong! */
# define NULL_VALUE -1
#else
# ifdef _POSIX_VDISABLE
# define NULL_VALUE _POSIX_VDISABLE
# else
# define NULL_VALUE 255
# endif
#endif
static int
speed_t2baud_rate (speed_t s)
{
int i;
for (i = 0; i < sizeof (Baud_Rates)/sizeof (Baud_Rates[0]); i++)
if (Baud_Rates[i].key == s)
return (Baud_Rates[i].value);
return 0;
}
int SLang_init_tty (int abort_char, int no_flow_control, int opost)
{
TTY_Termio_Type newtty;
SLsig_block_signals ();
if (TTY_Inited)
{
SLsig_unblock_signals ();
return 0;
}
TTY_Open = 0;
if ((SLang_TT_Read_FD == -1)
|| (1 != isatty (SLang_TT_Read_FD)))
{
#if 0
#ifdef O_RDWR
# ifndef __BEOS__ /* I have been told that BEOS will HANG if passed /dev/tty */
if ((SLang_TT_Read_FD = open("/dev/tty", O_RDWR)) >= 0)
{
TTY_Open = 1;
}
# endif
#endif
#endif /* 0 */
if (TTY_Open == 0)
{
#if 0
/* In the Midnight Commander we bind stderr sometimes to a pipe. If we
use stderr for terminal input and call SLang_getkey while stderr is
bound to a pipe MC will hang completly in SLsys_input_pending.
NOTE: There's an independent fix for this problem in src/slint.c for
the case that the Midnight Commander is linked against a shared slang
library compiled from different sources.
*/
SLang_TT_Read_FD = fileno (stderr);
if (1 != isatty (SLang_TT_Read_FD))
#endif
{
SLang_TT_Read_FD = fileno (stdin);
if (1 != isatty (SLang_TT_Read_FD))
{
fprintf (stderr, "Failed to open terminal.");
return -1;
}
}
}
}
SLang_Abort_Char = abort_char;
/* Some systems may not permit signals to be blocked. As a result, the
* return code must be checked.
*/
while (-1 == GET_TERMIOS(SLang_TT_Read_FD, &Old_TTY))
{
if (errno != EINTR)
{
SLsig_unblock_signals ();
return -1;
}
}
while (-1 == GET_TERMIOS(SLang_TT_Read_FD, &newtty))
{
if (errno != EINTR)
{
SLsig_unblock_signals ();
return -1;
}
}
#ifndef HAVE_TERMIOS_H
newtty.s.sg_flags &= ~(ECHO);
newtty.s.sg_flags &= ~(CRMOD);
/* if (Flow_Control == 0) newtty.s.sg_flags &= ~IXON; */
newtty.t.t_eofc = 1;
if (abort_char == -1) SLang_Abort_Char = newtty.t.t_intrc;
newtty.t.t_intrc = SLang_Abort_Char; /* ^G */
newtty.t.t_quitc = 255;
newtty.lt.t_suspc = 255; /* to ignore ^Z */
newtty.lt.t_dsuspc = 255; /* to ignore ^Y */
newtty.lt.t_lnextc = 255;
newtty.s.sg_flags |= CBREAK; /* do I want cbreak or raw????? */
#else
/* get baud rate */
/* [not only QNX related !?!]
* ECHO(0x08) is a c_lflag bit, it means here PARMRK(0x08) in c_iflag!!!
*/
/*newtty.c_iflag &= ~(ECHO | INLCR | ICRNL);*/
newtty.c_iflag &= ~(INLCR | ICRNL);
#ifdef ISTRIP
/* newtty.c_iflag &= ~ISTRIP; */
#endif
if (opost == 0) newtty.c_oflag &= ~OPOST;
if (SLang_TT_Baud_Rate == 0)
{
/* Note: if this generates an compiler error, simply remove
the statement */
#ifdef HAVE_CFGETOSPEED
SLang_TT_Baud_Rate = cfgetospeed (&newtty);
#endif
SLang_TT_Baud_Rate = speed_t2baud_rate (SLang_TT_Baud_Rate);
}
if (no_flow_control) newtty.c_iflag &= ~IXON; else newtty.c_iflag |= IXON;
newtty.c_cc[VMIN] = 1;
newtty.c_cc[VTIME] = 0;
newtty.c_cc[VEOF] = 1;
newtty.c_lflag = ISIG | NOFLSH;
if (abort_char == -1) SLang_Abort_Char = newtty.c_cc[VINTR];
newtty.c_cc[VINTR] = SLang_Abort_Char; /* ^G */
newtty.c_cc[VQUIT] = NULL_VALUE;
newtty.c_cc[VSUSP] = NULL_VALUE; /* to ignore ^Z */
#ifdef VSWTCH
newtty.c_cc[VSWTCH] = NULL_VALUE; /* to ignore who knows what */
#endif
#endif /* NOT HAVE_TERMIOS_H */
while (-1 == SET_TERMIOS(SLang_TT_Read_FD, &newtty))
{
if (errno != EINTR)
{
SLsig_unblock_signals ();
return -1;
}
}
TTY_Inited = 1;
SLsig_unblock_signals ();
return 0;
}
void SLtty_set_suspend_state (int mode)
{
TTY_Termio_Type newtty;
SLsig_block_signals ();
if (TTY_Inited == 0)
{
SLsig_unblock_signals ();
return;
}
while ((-1 == GET_TERMIOS (SLang_TT_Read_FD, &newtty))
&& (errno == EINTR))
;
#ifndef HAVE_TERMIOS_H
if (mode == 0) newtty.lt.t_suspc = 255;
else newtty.lt.t_suspc = Old_TTY.lt.t_suspc;
#else
if (mode == 0) newtty.c_cc[VSUSP] = NULL_VALUE;
else newtty.c_cc[VSUSP] = Old_TTY.c_cc[VSUSP];
#endif
while ((-1 == SET_TERMIOS (SLang_TT_Read_FD, &newtty))
&& (errno == EINTR))
;
SLsig_unblock_signals ();
}
void SLang_reset_tty (void)
{
SLsig_block_signals ();
if (TTY_Inited == 0)
{
SLsig_unblock_signals ();
return;
}
while ((-1 == SET_TERMIOS(SLang_TT_Read_FD, &Old_TTY))
&& (errno == EINTR))
;
if (TTY_Open)
{
while ((-1 == close (SLang_TT_Read_FD))
&& (errno == EINTR))
;
TTY_Open = 0;
SLang_TT_Read_FD = -1;
}
TTY_Inited = 0;
SLsig_unblock_signals ();
}
static void default_sigint (int sig)
{
sig = errno; /* use parameter */
SLKeyBoard_Quit = 1;
if (SLang_Ignore_User_Abort == 0) SLang_Error = USER_BREAK;
SLsignal_intr (SIGINT, default_sigint);
errno = sig;
}
void SLang_set_abort_signal (void (*hand)(int))
{
int save_errno = errno;
if (hand == NULL) hand = default_sigint;
SLsignal_intr (SIGINT, hand);
errno = save_errno;
}
#ifndef FD_SET
#define FD_SET(fd, tthis) *(tthis) = 1 << (fd)
#define FD_ZERO(tthis) *(tthis) = 0
#define FD_ISSET(fd, tthis) (*(tthis) & (1 << fd))
typedef int fd_set;
#endif
static fd_set Read_FD_Set;
/* HACK: If > 0, use 1/10 seconds. If < 0, use 1/1000 seconds */
int SLsys_input_pending(int tsecs)
{
struct timeval wait;
long usecs, secs;
if (TTY_Inited == 0) return -1;
if (tsecs >= 0)
{
secs = tsecs / 10;
usecs = (tsecs % 10) * 100000;
}
else
{
tsecs = -tsecs;
secs = tsecs / 1000;
usecs = (tsecs % 1000) * 1000;
}
wait.tv_sec = secs;
wait.tv_usec = usecs;
FD_ZERO(&Read_FD_Set);
FD_SET(SLang_TT_Read_FD, &Read_FD_Set);
return select(SLang_TT_Read_FD + 1, &Read_FD_Set, NULL, NULL, &wait);
}
int (*SLang_getkey_intr_hook) (void);
static int handle_interrupt (void)
{
if (SLang_getkey_intr_hook != NULL)
{
int save_tty_fd = SLang_TT_Read_FD;
if (-1 == (*SLang_getkey_intr_hook) ())
return -1;
if (save_tty_fd != SLang_TT_Read_FD)
return -1;
}
return 0;
}
unsigned int SLsys_getkey (void)
{
unsigned char c;
if (TTY_Inited == 0)
{
int ic = fgetc (stdin);
if (ic == EOF) return SLANG_GETKEY_ERROR;
return (unsigned int) ic;
}
while (1)
{
int ret;
if (SLKeyBoard_Quit)
return SLang_Abort_Char;
if (0 == (ret = SLsys_input_pending (100)))
continue;
if (ret != -1)
break;
if (SLKeyBoard_Quit)
return SLang_Abort_Char;
if (errno == EINTR)
{
if (-1 == handle_interrupt ())
return SLANG_GETKEY_ERROR;
continue;
}
break; /* let read handle it */
}
while (-1 == read(SLang_TT_Read_FD, (char *) &c, 1))
{
if (errno == EINTR)
{
if (-1 == handle_interrupt ())
return SLANG_GETKEY_ERROR;
if (SLKeyBoard_Quit)
return SLang_Abort_Char;
continue;
}
#ifdef EAGAIN
if (errno == EAGAIN)
{
sleep (1);
continue;
}
#endif
#ifdef EWOULDBLOCK
if (errno == EWOULDBLOCK)
{
sleep (1);
continue;
}
#endif
#ifdef EIO
if (errno == EIO)
{
SLang_exit_error ("SLsys_getkey: EIO error.");
}
#endif
return SLANG_GETKEY_ERROR;
}
return((unsigned int) c);
}

1594
rosapps/mc/slang/slvideo.c Normal file

File diff suppressed because it is too large Load Diff

224
rosapps/mc/slang/slw32tty.c Normal file
View File

@@ -0,0 +1,224 @@
/* Copyright (c) 1992, 1995 John E. Davis
* All rights reserved.
*
* You may distribute under the terms of either the GNU General Public
* License or the Perl Artistic License.
*/
#include "config.h"
#include <stdio.h>
#include <windows.h>
#include <winbase.h>
#include "slang.h"
#include "_slang.h"
#ifdef __cplusplus
# define _DOTS_ ...
#else
# define _DOTS_ void
#endif
/*----------------------------------------------------------------------*\
* Function: static void set_ctrl_break (int state);
*
* set the control-break setting
\*----------------------------------------------------------------------*/
static void set_ctrl_break (int state)
{
}
/*----------------------------------------------------------------------*\
* Function: int SLang_init_tty (int abort_char, int no_flow_control,
* int opost);
*
* initialize the keyboard interface and attempt to set-up the interrupt 9
* handler if ABORT_CHAR is non-zero.
* NO_FLOW_CONTROL and OPOST are only for compatiblity and are ignored.
\*----------------------------------------------------------------------*/
HANDLE hStdout, hStdin;
CONSOLE_SCREEN_BUFFER_INFO csbiInfo;
int SLang_init_tty (int abort_char, int no_flow_control, int opost)
{
SMALL_RECT windowRect;
COORD newPosition;
long flags;
#ifndef SLANG_SAVES_CONSOLE
/* first off, create a new console so the old one can be restored on exit */
HANDLE console = CreateConsoleScreenBuffer(GENERIC_READ | GENERIC_WRITE,
FILE_SHARE_READ |FILE_SHARE_WRITE,
0,
CONSOLE_TEXTMODE_BUFFER,
0);
if (SetConsoleActiveScreenBuffer(console) == FALSE) {
return -1;
}
#endif
/* start things off at the origin */
newPosition.X = 0;
newPosition.Y = 0;
/* still read in characters from stdin, but output to the new console */
/* this way, on program exit, the original screen is restored */
hStdin = GetStdHandle(STD_INPUT_HANDLE);
/* hStdin = console; */
#ifndef SLANG_SAVES_CONSOLE
hStdout = GetStdHandle(STD_OUTPUT_HANDLE);
#else
hStdout = console;
#endif
if (hStdin == INVALID_HANDLE_VALUE || hStdout == INVALID_HANDLE_VALUE) {
return -1; /* failure */
}
if (!GetConsoleScreenBufferInfo(hStdout, &csbiInfo)) {
return -1; /* failure */
} // if
windowRect.Left = 0;
windowRect.Top = 0;
windowRect.Right = csbiInfo.srWindow.Right - csbiInfo.srWindow.Left; //dwMaximumWindowSize.X - 1;
windowRect.Bottom = csbiInfo.srWindow.Bottom - csbiInfo.srWindow.Top; //dwMaximumWindowSize.Y - 1;
if (!SetConsoleWindowInfo(hStdout, TRUE, &windowRect)) {
return -1;
}
if (SetConsoleMode(hStdin, 0) == FALSE) {
return -1; /* failure */
}
if (SetConsoleMode(hStdout, 0) == FALSE) {
return -1; /* failure */
}
if (GetConsoleMode(hStdin, &flags)) {
if (flags & ENABLE_PROCESSED_INPUT) {
return -1;
}
}
(void) SetConsoleCursorPosition(hStdout, newPosition);
/* success */
return 0;
} /* SLang_init_tty */
/*----------------------------------------------------------------------*\
* Function: void SLang_reset_tty (void);
*
* reset the tty before exiting
\*----------------------------------------------------------------------*/
void SLang_reset_tty (void)
{
set_ctrl_break (1);
}
/*----------------------------------------------------------------------*\
* Function: int SLsys_input_pending (int tsecs);
*
* sleep for *tsecs tenths of a sec waiting for input
\*----------------------------------------------------------------------*/
int SLsys_input_pending (int tsecs)
{
INPUT_RECORD record;
long one = 1;
long bytesRead;
while (1)
{
if (PeekConsoleInput(hStdin, &record, 1, &bytesRead))
{
if (bytesRead == 1)
{
if ((record.EventType == KEY_EVENT)
&& record.Event.KeyEvent.bKeyDown)
{
/* ok, there is a keypress here */
return 1;
}
else
{
/* something else is here, so read it and try again */
(void) ReadConsoleInput(hStdin, &record, 1, &bytesRead);
}
}
else
{
/* no Pending events */
return 0;
}
}
else
{
/* function failed */
return 0;
}
}
#if 0
/* no delays yet */
/* use Sleep */
/*
int count = tsecs * 5;
if (keyWaiting()) return 1;
while (count > 0)
{
delay (20); 20 ms or 1/50 sec
if (keyWaiting()) break;
count--;
}
return (count);
*/
#endif
}
/*----------------------------------------------------------------------*\
* Function: unsigned int SLsys_getkey (void);
*
* wait for and get the next available keystroke.
* Also re-maps some useful keystrokes.
*
* Backspace (^H) => Del (127)
* Ctrl-Space => ^@ (^@^3 - a pc NUL char)
* extended keys are prefixed by a null character
\*----------------------------------------------------------------------*/
unsigned int SLsys_getkey (void)
{
unsigned int scan, ch, shift;
long key, bytesRead;
INPUT_RECORD record;
while (1) {
if (!ReadConsoleInput(hStdin, &record, 1, &bytesRead)) {
return 0;
}
if (record.EventType == KEY_EVENT && record.Event.KeyEvent.bKeyDown) {
/*#ifndef __MINGW32__*/
return record.Event.KeyEvent.uChar.AsciiChar;
/*#else
return record.Event.KeyEvent.AsciiChar;
#endif*/
}
}
/* ReadFile(hStdin, &key, 1, &bytesRead, NULL); */
/* return key; */
}
/*----------------------------------------------------------------------*\
* Function: void SLang_set_abort_signal (void (*handler)(int));
\*----------------------------------------------------------------------*/
void SLang_set_abort_signal (void (*handler)(int))
{
}

153
rosapps/mc/src/Makefile Normal file
View File

@@ -0,0 +1,153 @@
# Generated automatically from Makefile.in by configure.
srcdir = .
rootdir = $(srcdir)/..
include ../Make.common
CFLAGS = $(XCFLAGS)
CPPFLAGS = $(XCPPFLAGS) -DREGEX_MALLOC
LDFLAGS = $(XLDFLAGS)
DEFS = $(XDEFS)
LIBS = $(XLIBS) $(XLIB)
OURLIBS = -lvfs -lmcslang -ledit
INSTALL = /usr/bin/install -c
INSTALL_PROGRAM = ${INSTALL}
INSTALL_DATA = ${INSTALL} -m 644
SRCS = dir.c util.c main.c screen.c dialog.c key.c keyxdef.c menu.c\
file.c win.c color.c help.c find.c profile.c user.c view.c \
ext.c mouse.c setup.c dlg.c option.c info.c \
tree.c widget.c chmod.c mad.c xcurses.c xslint.c \
wtools.c cons.handler.c chown.c subshell.c terms.c boxes.c \
hotlist.c achown.c layout.c fsusage.c mountlist.c regex.c \
complete.c slint.c command.c cmd.c panelize.c learn.c \
listmode.c utilunix.c background.c rxvt.c popt.c \
text.c
HDRS = color.h file.h mouse.h user.h dialog.h find.h main.h \
util.h dir.h global.h menu.h panel.h win.h mem.h \
help.h profile.h dlg.h option.h tree.h info.h \
widget.h chmod.h cons.saver.h mad.h wtools.h chown.h \
subshell.h view.h setup.h key.h ext.h boxes.h \
hotlist.h layout.h fsusage.h mountlist.h regex.h complete.h \
myslang.h command.h cmd.h tty.h fs.h panelize.h achown.h \
learn.h listmode.h features.inc background.h \
x.h popt.h textconf.h i18n.h
OBJS = dir.o util.o screen.o dialog.o key.o keyxdef.o menu.o\
file.o win.o color.o help.o find.o profile.o user.o view.o \
ext.o mouse.o setup.o dlg.o option.o \
tree.o widget.o chmod.o mad.o wtools.o info.o \
cons.handler.o chown.o subshell.o terms.o boxes.o \
hotlist.o achown.o layout.o fsusage.o mountlist.o \
regex.o complete.o slint.o command.o \
cmd.o main.o panelize.o learn.o listmode.o utilunix.o \
background.o rxvt.o popt.o text.o
#
# Distribution variables
#
DISTFILES = \
$(HDRS) $(SRCS) Makefile.in TODO ChangeLog OChangeLog man2hlp.c \
gindex.pl xmkdir cons.saver.c ncurses.patch mc.hlp depend.awk \
fixhlp.c mfmt.c
# Should be: mc $(srcdir)/mc.hlp but it's remaking it always
all: mc mcmfmt
.c.o:
$(CC) -c $(CPPFLAGS) $(DEFS) $(CFLAGS) $<
cons.saver: cons.saver.o
$(CC) -s cons.saver.o -o cons.saver
check:
@echo no tests are supplied.
mc: $(OBJS) libvfs.a libmcslang.a libedit.a
$(CC) $(LDFLAGS) -o $@ $(OBJS) -L../vfs -L../slang -L../edit $(OURLIBS) $(LIBS)
mfmt: mfmt.o
$(CC) $(LDFLAGS) mfmt.o -o mfmt
mcmfmt: mfmt
cp mfmt mcmfmt
libvfs.a:
cd ../vfs; $(MAKE) libvfs.a
-$(RMF) libvfs.a
$(LN_S) ../vfs/libvfs.a .
libmcslang.a:
cd ../slang; $(MAKE) libmcslang.a
-$(RMF) libmcslang.a
$(LN_S) ../slang/libmcslang.a .
libedit.a:
cd ../edit; $(MAKE) libedit.a
-$(RMF) libedit.a
$(LN_S) ../edit/libedit.a .
cross:
$(MAKE) CC=gcc-linux CPP="gcc-linux -E" \
CPPFLAGS="$(CPPFLAGS) -I/usr/local/lib/gcc-lib/i386-linux-linux/include/ncurses "
$(srcdir)/mc.hlp: $(docdir)/mc.1.in $(mclibdir)/xnc.hlp $(srcdir)/gindex.pl
$(MAKE) man2hlp
./man2hlp 58 $(docdir)/mc.1.in | cat - $(mclibdir)/xnc.hlp | \
perl $(srcdir)/gindex.pl > $(srcdir)/mc.hlp
mc.html: $(docdir)/mc.1.in man2hlp
./man2hlp 0 $(docdir)/mc.1.in > body.html
cat index.html body.html > mc.html
$(RM) index.html body.html
TAGS: $(SRCS)
etags $(SRCS)
clean:
$(RMF) mc cons.saver man2hlp fixhlp *.o core a.out mc.html mcmfmt
$(RMF) libvfs.a libedit.a libmcslang.a mfmt
realclean: clean
$(RMF) .depend
$(RMF) TAGS
$(RMF) *~
distclean:
-$(RMF) $(srcdir)/*~ $(srcdir)/mc $(srcdir)/cons.saver
-$(RMF) $(srcdir)/mfmt
-$(RMF) $(srcdir)/man2hlp $(srcdir)/fixhlp $(srcdir)/*.o $(srcdir)/core
-$(RMF) $(srcdir)/a.out $(srcdir)/mc.html
-$(RMF) $(srcdir)/libvfs.a $(srcdir)/libmcslang.a $(srcdir)/libedit.a
-if test $(srcdir) = .; then $(MAKE) realclean; fi
-$(RMF) $(srcdir)/Makefile
install: mc mfmt
$(INSTALL_PROGRAM) mc $(DESTDIR)$(bindir)/$(binprefix)mc
$(INSTALL_PROGRAM) mcmfmt $(DESTDIR)$(bindir)/$(binprefix)mcmfmt
$(SEDCMD2) < $(srcdir)/mc.hlp > $(DESTDIR)$(libdir)/$(libprefix)mc.hlp
install.saver: cons.saver
$(INSTALL_PROGRAM) -m 4755 cons.saver $(DESTDIR)$(suppbindir)/cons.saver
uninstall:
cd $(bindir); $(RMF) $(binprefix)mc
cd $(bindir); $(RMF) $(binprefix)mcmfmt
cd $(bindir); $(RMF) $(binprefix)cons.saver
cd $(libdir); $(RMF) $(libprefix)mc.hlp
distcopy: $(srcdir)/mc.hlp
$(CP) $(DISTFILES) ../../mc-$(VERSION)/src
depend dep: mcdep
fastdeploc: fastdepslang fastdepvfs
# ***Dependencies***Do not edit***
ifeq (.depend,$(wildcard .depend))
include .depend
endif
# ***End of dependencies***

710
rosapps/mc/src/achown.c Normal file
View File

@@ -0,0 +1,710 @@
/* Chown-advanced command -- for the Midnight Commander
Copyright (C) 1994, 1995 Radek Doulik
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <config.h>
/* Needed for the extern declarations of integer parameters */
#include <sys/types.h>
#include <sys/param.h>
#include <sys/stat.h>
#include <grp.h>
#include <pwd.h>
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
#include <string.h>
#include <stdio.h>
#include <stdlib.h> /* For malloc() */
#include <errno.h> /* For errno on SunOS systems */
#include "mad.h"
#include "tty.h"
#include "util.h" /* Needed for the externs */
#include "win.h"
#include "color.h"
#include "dlg.h"
#include "widget.h"
#include "dialog.h" /* For do_refresh() */
#include "wtools.h" /* For init_box_colors() */
#include "key.h" /* XCTRL and ALT macros */
#include "dir.h"
#include "panel.h" /* Needed for the externs */
#include "file.h"
#include "chmod.h"
#include "main.h"
#include "../vfs/vfs.h"
#define BX 5
#define BY 6
#define TX 50
#define TY 2
#define BUTTONS 9
#define B_SETALL B_USER
#define B_SKIP B_USER + 1
#define B_OWN B_USER + 3
#define B_GRP B_USER + 4
#define B_OTH B_USER + 5
#define B_OUSER B_USER + 6
#define B_OGROUP B_USER + 7
struct {
int ret_cmd, flags, y, x;
char *text;
} chown_advanced_but [BUTTONS] = {
{ B_CANCEL, NORMAL_BUTTON, 4, 55, N_("&Cancel") },
{ B_ENTER, DEFPUSH_BUTTON,4, 45, N_("&Set") },
{ B_SKIP, NORMAL_BUTTON, 4, 36, N_("S&kip") },
{ B_SETALL, NORMAL_BUTTON, 4, 24, N_("Set &all")},
{ B_ENTER, NARROW_BUTTON, 0, 47, " "},
{ B_ENTER, NARROW_BUTTON, 0, 29, " "},
{ B_ENTER, NARROW_BUTTON, 0, 19, " "},
{ B_ENTER, NARROW_BUTTON, 0, 11, " "},
{ B_ENTER, NARROW_BUTTON, 0, 3, " "},
};
WButton *b_att[3]; /* permission */
WButton *b_user, *b_group; /* owner */
static int files_on_begin; /* Number of files at startup */
static int flag_pos;
static int x_toggle;
static char ch_flags[11];
static char *ch_perm = "rwx";
static umode_t ch_cmode;
struct stat *sf_stat;
static int need_update;
static int end_chown;
static int current_file;
static int single_set;
static char *fname;
static void get_ownership ()
{ /* set buttons - ownership */
char *name_t;
name_t = name_trunc (get_owner (sf_stat->st_uid), 15);
memset (b_user->text, ' ', 15);
strncpy (b_user->text, name_t, strlen (name_t));
name_t = name_trunc (get_group (sf_stat->st_gid), 15);
memset (b_group->text, ' ', 15);
strncpy (b_group->text, name_t, strlen (name_t));
}
static int inc_flag_pos (int f_pos)
{
if (flag_pos == 10) {
flag_pos = 0;
return 0;
}
flag_pos++;
if (!(flag_pos % 3) || f_pos > 2)
return 0;
return 1;
}
static int dec_flag_pos (int f_pos)
{
if (!flag_pos) {
flag_pos = 10;
return 0;
}
flag_pos--;
if (!((flag_pos + 1) % 3) || f_pos > 2)
return 0;
return 1;
}
static void set_perm_by_flags (char *s, int f_p)
{
int i;
for (i = 0; i < 3; i++)
if (ch_flags[f_p + i] == '+')
s[i] = ch_perm[i];
else if (ch_flags[f_p + i] == '-')
s[i] = '-';
else
s[i] = (ch_cmode & (1 << (8 - f_p - i))) ? ch_perm[i] : '-';
}
static void set_perm (char *s, int p)
{
s[0] = (p & 4) ? 'r' : '-';
s[1] = (p & 2) ? 'w' : '-';
s[2] = (p & 1) ? 'x' : '-';
}
static umode_t get_perm (char *s, int base)
{
umode_t m;
m = 0;
m |= (s [0] == '-') ? 0 :
((s[0] == '+') ? (1 << (base + 2)) : (1 << (base + 2)) & ch_cmode);
m |= (s [1] == '-') ? 0 :
((s[1] == '+') ? (1 << (base + 1)) : (1 << (base + 1)) & ch_cmode);
m |= (s [2] == '-') ? 0 :
((s[2] == '+') ? (1 << base) : (1 << base) & ch_cmode);
return m;
}
static umode_t get_mode ()
{
umode_t m;
m = ch_cmode ^ (ch_cmode & 0777);
m |= get_perm (ch_flags, 6);
m |= get_perm (ch_flags + 3, 3);
m |= get_perm (ch_flags + 6, 0);
return m;
}
static void print_flags (void)
{
int i;
attrset (COLOR_NORMAL);
for (i = 0; i < 3; i++){
dlg_move (ch_dlg, BY+1, 9+i);
addch (ch_flags [i]);
}
for (i = 0; i < 3; i++){
dlg_move (ch_dlg, BY + 1, 17 + i);
addch (ch_flags [i+3]);
}
for (i = 0; i < 3; i++){
dlg_move (ch_dlg, BY + 1, 25 + i);
addch (ch_flags [i+6]);
}
set_perm_by_flags (b_att[0]->text, 0);
set_perm_by_flags (b_att[1]->text, 3);
set_perm_by_flags (b_att[2]->text, 6);
for (i = 0; i < 15; i++){
dlg_move (ch_dlg, BY+1, 35+i);
addch (ch_flags[9]);
}
for (i = 0; i < 15; i++){
dlg_move (ch_dlg, BY + 1, 53 + i);
addch (ch_flags[10]);
}
}
static void update_mode (Dlg_head * h)
{
print_flags ();
attrset (COLOR_NORMAL);
dlg_move (h, BY + 2, 9);
printw ("%12o", get_mode ());
send_message (h, h->current->widget, WIDGET_FOCUS, 0);
}
static int l_call (void *data)
{
return 1;
}
static int chl_callback (Dlg_head * h, int Par, int Msg)
{
switch (Msg) {
case DLG_DRAW:
attrset (COLOR_NORMAL);
dlg_erase (h);
draw_box (h, 0, 0, 13, 17);
break;
case DLG_KEY:
switch (Par) {
case KEY_LEFT:
case KEY_RIGHT:
h->ret_value = Par;
dlg_stop (h);
}
}
return 0;
}
static void do_enter_key (Dlg_head *h, int f_pos)
{
Dlg_head *chl_dlg;
WListbox *chl_list;
struct passwd *chl_pass;
struct group *chl_grp;
WLEntry *fe;
int lxx, lyy, chl_end, b_pos;
do {
lxx = (COLS - 74) / 2 + ((f_pos == 3) ? 35 : 53);
lyy = (LINES - 13) / 2;
chl_end = 0;
chl_dlg = create_dlg (lyy, lxx, 13, 17, dialog_colors, chl_callback,
"[Chown-advanced]", "achown_enter", DLG_NONE);
/* get new listboxes */
chl_list = listbox_new (1, 1, 15, 11, 0, l_call, NULL);
listbox_add_item (chl_list, 0, 0, "<Unknown>", NULL);
if (f_pos == 3) {
/* get and put user names in the listbox */
setpwent ();
while ((chl_pass = getpwent ()))
listbox_add_item (chl_list, 0, 0, chl_pass->pw_name, NULL);
endpwent ();
fe = listbox_search_text (chl_list, get_owner (sf_stat->st_uid));
}
else
{
/* get and put group names in the listbox */
setgrent ();
while ((chl_grp = getgrent ())) {
listbox_add_item (chl_list, 0, 0, chl_grp->gr_name, NULL);
}
endgrent ();
fe = listbox_search_text (chl_list, get_group (sf_stat->st_gid));
}
if (fe)
listbox_select_entry (chl_list, fe);
b_pos = chl_list->pos;
add_widget (chl_dlg, chl_list);
run_dlg (chl_dlg);
if (b_pos != chl_list->pos){
int ok = 0;
if (f_pos == 3){
chl_pass = getpwnam (chl_list->current->text);
if (chl_pass){
ok = 1;
sf_stat->st_uid = chl_pass->pw_uid;
}
} else {
chl_grp = getgrnam (chl_list->current->text);
if (chl_grp){
sf_stat->st_gid = chl_grp->gr_gid;
ok = 1;
}
}
if (ok){
ch_flags [f_pos + 6] = '+';
get_ownership ();
}
dlg_focus (h);
if (ok)
print_flags ();
}
if (chl_dlg->ret_value == KEY_LEFT){
if (f_pos == 4)
chl_end = 1;
dlg_one_up (ch_dlg);
f_pos--;
} else if (chl_dlg->ret_value == KEY_RIGHT) {
if (f_pos == 3)
chl_end = 1;
dlg_one_down (ch_dlg);
f_pos++;
}
/* Here we used to redraw the window */
destroy_dlg (chl_dlg);
} while (chl_end);
}
static void chown_refresh (void)
{
attrset (COLOR_NORMAL);
dlg_erase (ch_dlg);
draw_box (ch_dlg, 1, 2, 11, 70);
dlg_move (ch_dlg, BY - 1, 8);
addstr (_("owner"));
dlg_move (ch_dlg, BY - 1, 16);
addstr (_("group"));
dlg_move (ch_dlg, BY - 1, 24);
addstr (_("other"));
dlg_move (ch_dlg, BY - 1, 35);
addstr (_("owner"));
dlg_move (ch_dlg, BY - 1, 53);
addstr (_("group"));
dlg_move (ch_dlg, 3, 4);
addstr (_("On"));
dlg_move (ch_dlg, BY + 1, 4);
addstr (_("Flag"));
dlg_move (ch_dlg, BY + 2, 4);
addstr (_("Mode"));
if (!single_set){
dlg_move (ch_dlg, 3, 54);
printw (_("%6d of %d"), files_on_begin - (cpanel->marked) + 1,
files_on_begin);
}
print_flags ();
attrset (COLOR_HOT_NORMAL);
dlg_move (ch_dlg, 1, 24);
addstr (_(" Chown advanced command "));
}
static void chown_info_update ()
{
/* display file info */
attrset (COLOR_NORMAL);
/* name && mode */
dlg_move (ch_dlg, 3, 8);
printw ("%s", name_trunc (fname, 45));
dlg_move (ch_dlg, BY + 2, 9);
printw ("%12o", get_mode ());
/* permissions */
set_perm (b_att[0]->text, sf_stat->st_mode >> 6);
set_perm (b_att[1]->text, sf_stat->st_mode >> 3);
set_perm (b_att[2]->text, sf_stat->st_mode);
}
static void b_setpos (int f_pos) {
b_att[0]->hotpos=-1;
b_att[1]->hotpos=-1;
b_att[2]->hotpos=-1;
b_att[f_pos]->hotpos = (flag_pos % 3);
}
static int advanced_chown_callback (Dlg_head * h, int Par, int Msg)
{
int i = 0, f_pos = BUTTONS - h->current->dlg_id - single_set - 1;
switch (Msg) {
case DLG_DRAW:
chown_refresh ();
chown_info_update ();
return 1;
case DLG_POST_KEY:
if (f_pos < 3)
b_setpos (f_pos);
break;
case DLG_FOCUS:
if (f_pos < 3) {
if ((flag_pos / 3) != f_pos)
flag_pos = f_pos * 3;
b_setpos (f_pos);
} else if (f_pos < 5)
flag_pos = f_pos + 6;
break;
case DLG_KEY:
switch (Par) {
case XCTRL('b'):
case KEY_LEFT:
if (f_pos < 5)
return (dec_flag_pos (f_pos));
break;
case XCTRL('f'):
case KEY_RIGHT:
if (f_pos < 5)
return (inc_flag_pos (f_pos));
break;
case ' ':
if (f_pos < 3)
return 1;
break;
case '\n':
case KEY_ENTER:
if (f_pos <= 2 || f_pos >= 5)
break;
do_enter_key (h, f_pos);
return 1;
case ALT ('x'):
i++;
case ALT ('w'):
i++;
case ALT ('r'):
Par = i + 3;
for (i = 0; i < 3; i++)
ch_flags[i * 3 + Par - 3] = (x_toggle & (1 << Par)) ? '-' : '+';
x_toggle ^= (1 << Par);
update_mode (h);
dlg_broadcast_msg (h, WIDGET_DRAW, 0);
send_message (h, h->current->widget, WIDGET_FOCUS, 0);
break;
case XCTRL ('x'):
i++;
case XCTRL ('w'):
i++;
case XCTRL ('r'):
Par = i;
for (i = 0; i < 3; i++)
ch_flags[i * 3 + Par] = (x_toggle & (1 << Par)) ? '-' : '+';
x_toggle ^= (1 << Par);
update_mode (h);
dlg_broadcast_msg (h, WIDGET_DRAW, 0);
send_message (h, h->current->widget, WIDGET_FOCUS, 0);
break;
case 'x':
i++;
case 'w':
i++;
case 'r':
if (f_pos > 2)
break;
flag_pos = f_pos * 3 + i; /* (strchr(ch_perm,Par)-ch_perm); */
if (((WButton *) h->current->widget)->text[(flag_pos % 3)] == '-')
ch_flags[flag_pos] = '+';
else
ch_flags[flag_pos] = '-';
update_mode (h);
break;
case '4':
i++;
case '2':
i++;
case '1':
if (f_pos > 2)
break;
flag_pos = i + f_pos * 3;
ch_flags[flag_pos] = '=';
update_mode (h);
break;
case '-':
if (f_pos > 2)
break;
case '*':
if (Par == '*')
Par = '=';
case '=':
case '+':
if (f_pos > 4)
break;
ch_flags[flag_pos] = Par;
update_mode (h);
advanced_chown_callback (h, KEY_RIGHT, DLG_KEY);
if (flag_pos>8 || !(flag_pos%3)) dlg_one_down (h);
break;
}
return 0;
}
return 0;
}
static void init_chown_advanced (void)
{
int i;
sf_stat = (struct stat *) malloc (sizeof (struct stat));
do_refresh ();
end_chown = need_update = current_file = 0;
single_set = (cpanel->marked < 2) ? 2 : 0;
memset (ch_flags, '=', 11);
flag_pos = 0;
x_toggle = 070;
ch_dlg = create_dlg (0, 0, 13, 74, dialog_colors, advanced_chown_callback,
"[Chown-advanced]", "achown", DLG_CENTER);
#define XTRACT(i) BY+chown_advanced_but[i].y, BX+chown_advanced_but[i].x, \
chown_advanced_but[i].ret_cmd, chown_advanced_but[i].flags, chown_advanced_but[i].text, \
0, 0, NULL
for (i = 0; i < BUTTONS - 5; i++)
if (!single_set || i < 2)
add_widget (ch_dlg, button_new (XTRACT (i)));
b_att[0] = button_new (XTRACT (8));
b_att[1] = button_new (XTRACT (7));
b_att[2] = button_new (XTRACT (6));
b_user = button_new (XTRACT (5));
b_group = button_new (XTRACT (4));
add_widget (ch_dlg, b_group);
add_widget (ch_dlg, b_user);
add_widget (ch_dlg, b_att[2]);
add_widget (ch_dlg, b_att[1]);
add_widget (ch_dlg, b_att[0]);
}
void chown_advanced_done (void)
{
free (sf_stat);
if (need_update)
update_panels (UP_OPTIMIZE, UP_KEEPSEL);
repaint_screen ();
}
#if 0
static inline void do_chown (uid_t u, gid_t g)
{
chown (cpanel->dir.list[current_file].fname, u, g);
file_mark (cpanel, current_file, 0);
}
#endif
static char *next_file (void)
{
while (!cpanel->dir.list[current_file].f.marked)
current_file++;
return cpanel->dir.list[current_file].fname;
}
static void apply_advanced_chowns (struct stat *sf)
{
char *fname;
gid_t a_gid = sf->st_gid;
uid_t a_uid = sf->st_uid;
fname = cpanel->dir.list[current_file].fname;
need_update = end_chown = 1;
if (mc_chmod (fname, get_mode ()) == -1)
message (1, MSG_ERROR, _(" Couldn't chmod \"%s\" \n %s "),
fname, unix_error_string (errno));
/* call mc_chown only, if mc_chmod didn't fail */
else if (mc_chown (fname, (ch_flags[9] == '+') ? sf->st_uid : -1,
(ch_flags[10] == '+') ? sf->st_gid : -1) == -1)
message (1, MSG_ERROR, _(" Couldn't chown \"%s\" \n %s "),
fname, unix_error_string (errno));
do_file_mark (cpanel, current_file, 0);
do {
fname = next_file ();
if (!stat_file (fname, sf))
break;
ch_cmode = sf->st_mode;
if (mc_chmod (fname, get_mode ()) == -1)
message (1, MSG_ERROR, _(" Couldn't chmod \"%s\" \n %s "),
fname, unix_error_string (errno));
/* call mc_chown only, if mc_chmod didn't fail */
else if (mc_chown (fname, (ch_flags[9] == '+') ? a_uid : -1, (ch_flags[10] == '+') ? a_gid : -1) == -1)
message (1, MSG_ERROR, _(" Couldn't chown \"%s\" \n %s "),
fname, unix_error_string (errno));
do_file_mark (cpanel, current_file, 0);
} while (cpanel->marked);
}
void chown_advanced_cmd (void)
{
files_on_begin = cpanel->marked;
if (!vfs_current_is_local ()) {
if (vfs_current_is_extfs ()) {
message (1, _(" Oops... "),
_(" I can't run the Advanced Chown command on an extfs "));
return;
} else if (vfs_current_is_tarfs ()) {
message (1, _(" Oops... "),
_(" I can't run the Advanced Chown command on a tarfs "));
return;
}
}
do { /* do while any files remaining */
init_chown_advanced ();
if (cpanel->marked)
fname = next_file (); /* next marked file */
else
fname = selection (cpanel)->fname; /* single file */
if (!stat_file (fname, sf_stat)){ /* get status of file */
destroy_dlg (ch_dlg);
break;
}
ch_cmode = sf_stat->st_mode;
chown_refresh ();
get_ownership ();
/* game can begin */
run_dlg (ch_dlg);
switch (ch_dlg->ret_value) {
case B_CANCEL:
end_chown = 1;
break;
case B_ENTER:
need_update = 1;
if (mc_chmod (fname, get_mode ()) == -1)
message (1, MSG_ERROR, _(" Couldn't chmod \"%s\" \n %s "),
fname, unix_error_string (errno));
/* call mc_chown only, if mc_chmod didn't fail */
else if (mc_chown (fname, (ch_flags[9] == '+') ? sf_stat->st_uid : -1, (ch_flags[10] == '+') ? sf_stat->st_gid : -1) == -1)
message (1, MSG_ERROR, _(" Couldn't chown \"%s\" \n %s "),
fname, unix_error_string (errno));
break;
case B_SETALL:
apply_advanced_chowns (sf_stat);
break;
case B_SKIP:
break;
}
if (cpanel->marked && ch_dlg->ret_value != B_CANCEL) {
do_file_mark (cpanel, current_file, 0);
need_update = 1;
}
destroy_dlg (ch_dlg);
} while (cpanel->marked && !end_chown);
chown_advanced_done ();
}

4
rosapps/mc/src/achown.h Normal file
View File

@@ -0,0 +1,4 @@
#ifndef __ACHOWN_H
#define __ACHOWN_H
void chown_advanced_cmd (void);
#endif

562
rosapps/mc/src/background.c Normal file
View File

@@ -0,0 +1,562 @@
/* {{{ Copyright */
/* Background support.
Copyright (C) 1996 The Free Software Foundation
Written by: 1996 Miguel de Icaza
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
/* }}} */
#include <config.h>
#include <stdarg.h>
#include <sys/types.h>
#ifdef HAVE_SYS_WAIT_H
# include <sys/wait.h>
#endif
#include <errno.h>
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
#include <sys/stat.h>
#include <sys/param.h>
#include <stdlib.h>
#include <string.h>
#include <fcntl.h>
#include <stdio.h>
#include "dlg.h"
#include "widget.h"
#include "wtools.h"
/*
* We currenlty only support one way of comunicating the background
* and foreground process by using the socketpair system call
*/
#ifdef USE_NETCODE
# include <sys/socket.h>
#endif
#include "tty.h"
#include "util.h"
#include "dialog.h"
#include "file.h"
#include "background.h"
#include "mad.h"
#include "key.h" /* For add_select_channel(), delete_select_channel() */
/* If true, this is a background process */
int we_are_background = 0;
/* Ugh, ugly hack */
extern int do_append;
extern int recursive_result;
#ifdef WITH_BACKGROUND
/* If set background tasks wait to be attached */
int background_wait = 0;
#ifndef HAVE_SOCKETPAIR
int socketpair(int, int, int, int fd[2]);
#endif
/* File descriptor for talking to our parent */
static int parent_fd;
#define MAXCALLARGS 4 /* Number of arguments supported */
#define mymsg "Desde el hijo\n\r"
struct TaskList *task_list = NULL;
void
register_task_running (pid_t pid, int fd, char *info)
{
TaskList *new;
new = xmalloc (sizeof (TaskList), "note_task_running");
new->pid = pid;
new->info = info;
new->state = Task_Running;
new->next = task_list;
new->fd = fd;
task_list = new;
add_select_channel (fd, background_attention, (void *) pid);
}
void
unregister_task_running (pid_t pid, int fd)
{
TaskList *p = task_list;
TaskList *prev = 0;
while (p){
if (p->pid == pid){
if (prev)
prev->next = p->next;
else
task_list = p->next;
free (p->info);
free (p);
break;
}
prev = p;
p = p->next;
}
delete_select_channel (fd);
}
/*
* Try to make the Midnight Commander a background job
*
* Returns:
* 1 for parent
* 0 for child
* -1 on failure
*/
int
do_background (char *info)
{
int comm [2]; /* control connection stream */
int pid;
if (socketpair (AF_UNIX, SOCK_STREAM, 0, comm) == -1)
return -1;
if ((pid = fork ()) == -1)
return -1;
if (pid == 0){
int nullfd;
parent_fd = comm [1];
we_are_background = 1;
/* Make stdin/stdout/stderr point somewhere */
close (0);
close (1);
close (2);
if ((nullfd = open ("/dev/null", O_RDONLY)) != -1){
dup2 (nullfd, 0);
dup2 (nullfd, 1);
dup2 (nullfd, 2);
}
/* To make it obvious if it fails, there is a bug report on this */
write (2, mymsg, sizeof (mymsg));
write (1, mymsg, sizeof (mymsg));
/* Just for debugging the background back end */
if (background_wait){
volatile int i = 1;
while (i)
;
}
return 0;
} else {
close (comm [1]);
register_task_running (pid, comm [0], info);
return 1;
}
}
char *
background_title (char *str)
{
char *result = copy_strings (_("Background process:"), str, NULL);
return result;
}
/* {{{ Routines that do the real job */
void
real_message_1s (enum OperationMode mode, int *flags, char *title, char *str1)
{
char *full_title;
if (mode == Background)
full_title = background_title (title);
else
full_title = title;
message (*flags, title, str1);
if (title != full_title)
free (full_title);
}
void
real_message_2s (enum OperationMode mode, int *flags, char *title, char *str1, char *str2)
{
char *full_title;
if (mode == Background)
full_title = background_title (title);
else
full_title = title;
message (*flags, title, str1, str2);
if (title != full_title)
free (full_title);
}
void
real_message_3s (enum OperationMode mode, int *flags, char *title, char *str1, char *str2, const char *str3)
{
char *full_title;
if (mode == Background)
full_title = background_title (title);
else
full_title = title;
message (*flags, title, str1, str2, str3);
if (title != full_title)
free (full_title);
}
/* }}} */
/* {{{ Parent handlers */
/* Parent/child protocol
*
* the child (the background) process send the following:
* void *routine -- routine to be invoked in the parent
* int nargc -- number of arguments
* int type -- Return argument type.
*
* If the routine is zero, then it is a way to tell the parent
* that the process is dying.
*
* nargc arguments in the following format:
* int size of the coming block
* size bytes with the block
*
* Now, the parent loads all those and then invokes
* the routine with pointers to the information passed
* (we just support pointers).
*
* If the return type is integer:
*
* the parent then writes an int to the child with
* the return value from the routine and the values
* of any global variable that is modified in the parent
* currently: do_append and recursive_result.
*
* If the return type is a string:
*
* the parent writes the resulting string lenght
* if the result string was NULL or the empty string,
* then the lenght is zero.
* The parent then writes the string lenght and frees
* the result string.
*/
/*
* Receive requests from background process and invoke the
* specified routine
*/
int
background_attention (int fd, void *xpid)
{
void *routine;
int argc, i, result, status;
char *data [MAXCALLARGS];
char *resstr;
pid_t pid = (pid_t) xpid;
int bytes;
enum ReturnType type;
char *background_process_error = _(" Background process error ");
bytes = read (fd, &routine, sizeof (routine));
if (bytes < (sizeof (routine))){
if (errno == ECHILD)
message (1, background_process_error, _(" Child died unexpectedly "));
else
message (1, background_process_error, _(" Unknown error in child "));
unregister_task_running (pid, fd);
waitpid (pid, &status, 0);
return 0;
}
/* If the routine is zero, then the child is telling us that he is dying */
if ((int) routine == MSG_CHILD_EXITING){
unregister_task_running (pid, fd);
waitpid (pid, &status, 0);
return 0;
}
read (fd, &argc, sizeof (argc));
if (argc > MAXCALLARGS){
message (1, _(" Background protocol error "),
_(" Background process sent us a request for more arguments \n"
" than we can handle. \n"));
}
read (fd, &type, sizeof (type));
for (i = 0; i < argc; i++){
int size;
read (fd, &size, sizeof (size));
data [i] = xmalloc (size+1, "RPC Arguments");
read (fd, data [i], size);
data [i][size] = 0; /* NULL terminate the blocks (they could be strings) */
}
/* Handle the call */
if (type == Return_Integer){
switch (argc){
case 1:
result = (*(int (*)(int, char *))routine)(Background, data [0]);
break;
case 2:
result = (*(int (*)(int, char *, char *))routine)
(Background, data [0], data [1]);
break;
case 3:
result = (*(int (*)(int, char *, char *, char *))routine)
(Background, data [0], data [1], data [2]);
break;
case 4:
result = (*(int (*)(int, char *, char *, char *, char *))routine)
(Background, data [0], data [1], data [2], data [3]);
break;
}
/* Send the result code and the value for shared variables */
write (fd, &result, sizeof (int));
write (fd, &do_append, sizeof (do_append));
write (fd, &recursive_result, sizeof (recursive_result));
} else if (type == Return_String) {
int len;
/* FIXME: string routines should also use the Foreground/Background
* parameter. Currently, this is not used here
*/
switch (argc){
case 1:
resstr = (*(char * (*)(char *))routine)(data [0]);
break;
case 2:
resstr = (*(char * (*)(char *, char *))routine)
(data [0], data [1]);
break;
case 3:
resstr = (*(char * (*)(char *, char *, char *))routine)
(data [0], data [1], data [2]);
break;
case 4:
resstr = (*(char * (*)(char *, char *, char *, char *))routine)
(data [0], data [1], data [2], data [3]);
break;
}
if (resstr){
len = strlen (resstr);
write (fd, &len, sizeof (len));
if (len){
write (fd, resstr, len);
free (resstr);
}
} else {
len = 0;
write (fd, &len, sizeof (len));
}
}
for (i = 0; i < argc; i++)
free (data [i]);
do_refresh ();
mc_refresh ();
#ifndef HAVE_X
doupdate ();
#endif
return 0;
}
/* }}} */
/* {{{ client RPC routines */
void
parent_call_header (void *routine, int argc, enum ReturnType type)
{
write (parent_fd, &routine, sizeof (routine));
write (parent_fd, &argc, sizeof (int));
write (parent_fd, &type, sizeof (type));
}
int
parent_call (void *routine, int argc, ...)
{
va_list ap;
int i;
va_start (ap, argc);
parent_call_header (routine, argc, Return_Integer);
for (i = 0; i < argc; i++){
int len;
void *value;
len = va_arg (ap, int);
value = va_arg (ap, void *);
write (parent_fd, &len, sizeof (int));
write (parent_fd, value, len);
}
/* Besides the regular result, get the value for
* variables that may be modified in the parent that affect our behaviour
*/
read (parent_fd, &i, sizeof (int));
read (parent_fd, &do_append, sizeof (do_append));
read (parent_fd, &recursive_result, sizeof (recursive_result));
return i;
}
char *
parent_call_string (void *routine, int argc, ...)
{
va_list ap;
char *str;
int i;
va_start (ap, argc);
parent_call_header (routine, argc, Return_String);
for (i = 0; i < argc; i++){
int len;
void *value;
len = va_arg (ap, int);
value = va_arg (ap, void *);
write (parent_fd, &len, sizeof (int));
write (parent_fd, value, len);
}
read (parent_fd, &i, sizeof (int));
if (!i)
return NULL;
str = xmalloc (i + 1, "parent_return");
read (parent_fd, str, i);
str [i] = 0;
return str;
}
void
tell_parent (int msg)
{
write (parent_fd, &msg, sizeof (int));
}
int
call_1s (int (*routine)(enum OperationMode, char *), char *str)
{
if (we_are_background)
return parent_call ((void *)routine, 1, strlen (str), str);
else
return (*routine)(Foreground, str);
}
void
message_1s (int flags, char *title, char *str1)
{
if (we_are_background)
parent_call ((void *)real_message_1s, 3, sizeof (flags), &flags,
strlen (title), title, strlen (str1), str1);
else
real_message_1s (Foreground, &flags, title, str1);
}
void
message_2s (int flags, char *title, char *str1, char *str2)
{
if (we_are_background)
parent_call ((void *)real_message_2s, 4, sizeof (flags), &flags,
strlen (title), title, strlen (str1), str1,
strlen (str2), str2);
else
real_message_2s (Foreground, &flags, title, str1, str2);
}
void
message_3s (int flags, char *title, char *str1, char *str2, const char *str3)
{
if (we_are_background)
parent_call ((void *)real_message_3s, 3, sizeof (flags), &flags,
strlen (title), title, strlen (str1), str1,
strlen (str2), str2, strlen (str3), str3);
else
real_message_3s (Foreground, &flags, title, str1, str2, str3);
}
char *
input_dialog_help (char *header, char *text, char *help, char *def_text)
{
extern char *real_input_dialog_help (char *header, char *text, char *help, char *def_text);
if (we_are_background)
return parent_call_string ((void *)real_input_dialog_help, 4,
strlen (header), header,
strlen (text), text,
strlen (help), help,
strlen (def_text), def_text);
else
return real_input_dialog_help (header, text, help, def_text);
}
#else /* Else => No background code support */
/* {{{ Stubs if background code is not supported */
void
message_1s (int flags, char *title, char *str1)
{
message (flags, title, str1);
}
void
message_2s (int flags, char *title, char *str1, char *str2)
{
message (flags, title, str1, str2);
}
void
message_3s (int flags, char *title, char *str1, char *str2, const char *str3)
{
message (flags, title, str1, str2, str3);
}
char *
input_dialog_help (char *header, char *text, char *help, char *def_text)
{
return real_input_dialog_help (header, text, help, def_text);
}
/* }}} */
#endif
/* {{{ Functions shared between background and foreground */
void
message_1s1d (int flags, char *title, char *str, int d)
{
char *p;
p = xmalloc (strlen (str) + 30, "1s1d");
sprintf (p, str, d);
message_1s (flags, title, p);
free (p);
}
/* }}} */

View File

@@ -0,0 +1,60 @@
#ifndef __BACKGROUND_H
#define __BACKGROUND_H
/* Background code requires socketpair to be available */
/* Do not add the background code if it is not supported */
#ifdef USE_NETCODE
# define WITH_BACKGROUND
#endif
/* Used for parent/child communication. These are numbers that
* could not possible be a routine address.
*/
enum {
MSG_CHILD_EXITING
};
/* First argument passed to real functions */
enum OperationMode {
Foreground,
Background
};
enum ReturnType {
Return_String,
Return_Integer
};
enum TaskState {
Task_Running,
Task_Stopped
};
typedef struct TaskList {
int fd;
pid_t pid;
int state;
char *info;
struct TaskList *next;
} TaskList;
extern struct TaskList *task_list;
extern int background_wait;
int do_background (char *info);
int background_attention (int fd, void *xpid);
void tell_parent (int msg);
int parent_call (void *routine, int argc, ...);
int call_1s (int (*routine)(enum OperationMode, char *), char *str);
void unregister_task_running (pid_t, int fd);
void register_task_running (pid_t, int, char *);
/* stubs */
void message_1s (int flags, char *title, char *str1);
void message_2s (int flags, char *title, char *str1, char *str2);
void message_3s (int flags, char *title, char *str1, char *str2, const char *str3);
void message_1s1d (int flags, char *title, char *str, int d);
#endif

991
rosapps/mc/src/boxes.c Normal file
View File

@@ -0,0 +1,991 @@
/* Some misc dialog boxes for the program.
Copyright (C) 1994, 1995 the Free Software Foundation
Authors: 1994, 1995 Miguel de Icaza
1995 Jakub Jelinek
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include <config.h>
#include "tty.h"
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/param.h>
#include <malloc.h>
#include <signal.h>
#include <ctype.h>
#include "global.h"
#include "mad.h" /* The great mad */
#include "util.h" /* Required by panel.h */
#include "win.h" /* Our window tools */
#include "color.h" /* Color definitions */
#include "dlg.h" /* The nice dialog manager */
#include "widget.h" /* The widgets for the nice dialog manager */
#include "dialog.h" /* For do_refresh() */
#include "wtools.h"
#include "setup.h" /* For profile_name */
#include "profile.h" /* Load/save user formats */
#include "key.h" /* XCTRL and ALT macros */
#include "command.h" /* For cmdline */
#include "dir.h"
#include "panel.h"
#include "boxes.h"
#include "main.h" /* For the confirm_* variables */
#include "tree.h"
#include "layout.h" /* for get_nth_panel_name proto */
#include "background.h" /* for background definitions */
#include "x.h"
static int DISPLAY_X = 45, DISPLAY_Y = 14;
static Dlg_head *dd;
static WRadio *my_radio;
static WInput *user;
static WInput *status;
static WCheck *check_status;
static int current_mode;
extern int ftpfs_always_use_proxy;
static char **displays_status;
static char* display_title = N_(" Listing mode ");
/* Controls whether the array strings have been translated */
static int i18n_displays_flag;
static char *displays [LIST_TYPES] = {
N_("&Full file list"),
N_("&Brief file list"),
N_("&Long file list"),
N_("&User defined:"),
N_("&Icon view"),
};
static int user_hotkey = 'u';
static int display_callback (struct Dlg_head *h, int id, int Msg)
{
#ifndef HAVE_X
char *text;
WInput *input;
switch (Msg){
case DLG_DRAW:
attrset (COLOR_NORMAL);
dlg_erase (h);
draw_box (h, 1, 2, h->lines - 2, h->cols - 4);
attrset (COLOR_HOT_NORMAL);
dlg_move (h, 1, (h->cols - strlen(display_title))/2);
addstr (display_title);
attrset (COLOR_NORMAL);
break;
case DLG_UNFOCUS:
if((WRadio *) h->current->widget == my_radio){
assign_text (status, displays_status [my_radio->sel]);
input_set_point (status, 0);
}
break;
case DLG_KEY:
if (id == '\n'){
if((WRadio *) h->current->widget == my_radio){
assign_text (status, displays_status [my_radio->sel]);
dlg_stop (h);
break;
}
if ((WInput *) h->current->widget == user){
h->ret_value = B_USER + 6;
dlg_stop (h);
break;
}
if ((WInput *) h->current->widget == status){
h->ret_value = B_USER + 7;
dlg_stop (h);
break;
}
}
if (tolower(id) == user_hotkey && h->current->widget != (Widget *) user
&& h->current->widget != (Widget *) status){
my_radio->sel = 3;
dlg_select_widget (h, my_radio); /* force redraw */
dlg_select_widget (h, user);
return MSG_HANDLED;
}
}
#endif
return MSG_NOT_HANDLED;
}
static void display_init (int radio_sel, char *init_text,
int _check_status, char ** _status)
{
char* user_mini_status = _("user &Mini status");
char* ok_button = _("&Ok");
char* cancel_button = _("&Cancel");
static int button_start = 30;
displays_status = _status;
if (!i18n_displays_flag){
int i, l, maxlen = 0;
char* cp;
display_title = _(display_title);
for (i = 0; i < LIST_TYPES; i++)
{
displays [i] = _(displays [i]);
if ((l = strlen(displays [i])) > maxlen)
maxlen = l;
}
i = strlen (ok_button) + 5;
l = strlen (cancel_button) + 3;
l = max(i, l);
i = maxlen + l + 16;
if (i > DISPLAY_X)
DISPLAY_X = i;
i = strlen (user_mini_status) + 13;
if (i > DISPLAY_X)
DISPLAY_X = i;
i = strlen (display_title) + 8;
if (i > DISPLAY_X)
DISPLAY_X = i;
button_start = DISPLAY_X - l - 5;
/* get hotkey of user-defined format string */
cp = strchr(displays[LIST_TYPES-1],'&');
if (cp != NULL && *++cp != '\0')
user_hotkey = tolower(*cp);
i18n_displays_flag = 1;
}
dd = create_dlg (0, 0, DISPLAY_Y, DISPLAY_X, dialog_colors,
display_callback, "[Left and Right Menus]", "display",
DLG_CENTER | DLG_GRID);
x_set_dialog_title (dd, _("Listing mode"));
add_widgetl (dd,
button_new (4, button_start, B_CANCEL,
NORMAL_BUTTON, cancel_button, 0, 0, "cancel-button"),
XV_WLAY_RIGHTOF);
add_widgetl (dd,
button_new (3, button_start, B_ENTER,
DEFPUSH_BUTTON, ok_button, 0, 0, "ok-button"),
XV_WLAY_CENTERROW);
status = input_new (10, 9, INPUT_COLOR, DISPLAY_X-14, _status [radio_sel], "mini-input");
add_widgetl (dd, status, XV_WLAY_RIGHTDOWN);
input_set_point (status, 0);
check_status = check_new (9, 5, _check_status, user_mini_status, "mini-status");
add_widgetl (dd, check_status, XV_WLAY_NEXTROW);
user = input_new (7, 9, INPUT_COLOR, DISPLAY_X-14, init_text, "user-fmt-input");
add_widgetl (dd, user, XV_WLAY_RIGHTDOWN);
input_set_point (user, 0);
#ifdef PORT_HAS_ICON_VIEW
my_radio = radio_new (3, 5, LIST_TYPES, displays, 1, "radio");
#else
my_radio = radio_new (3, 5, LIST_TYPES-1, displays, 1, "radio");
#endif
my_radio->sel = my_radio->pos = current_mode;
add_widgetl (dd, my_radio, XV_WLAY_BELOWCLOSE);
}
int display_box (WPanel *panel, char **userp, char **minip, int *use_msformat,
int num)
{
int result, i;
char *section = NULL;
char *p;
if (!panel) {
p = get_nth_panel_name (num);
panel = (WPanel *) xmalloc (sizeof (WPanel), "temporary panel");
panel->list_type = list_full;
panel->user_format = strdup (DEFAULT_USER_FORMAT);
panel->user_mini_status = 0;
for (i = 0; i < LIST_TYPES; i++)
panel->user_status_format[i] = strdup (DEFAULT_USER_FORMAT);
section = copy_strings ("Temporal:", p, 0);
if (!profile_has_section (section, profile_name)) {
free (section);
section = strdup (p);
}
panel_load_setup (panel, section);
free (section);
}
current_mode = panel->list_type;
display_init (current_mode, panel->user_format,
panel->user_mini_status, panel->user_status_format);
run_dlg (dd);
result = -1;
if (section) {
free (panel->user_format);
for (i = 0; i < LIST_TYPES; i++)
free (panel->user_status_format [i]);
free (panel);
}
if (dd->ret_value != B_CANCEL){
result = my_radio->sel;
*userp = strdup (user->buffer);
*minip = strdup (status->buffer);
*use_msformat = check_status->state & C_BOOL;
}
destroy_dlg (dd);
return result;
}
int SORT_X = 40, SORT_Y = 14;
char *sort_orders_names [SORT_TYPES];
sortfn *sort_box (sortfn *sort_fn, int *reverse, int *case_sensitive)
{
int i, r, l;
sortfn *result;
WCheck *c, *case_sense;
char* ok_button = _("&Ok");
char* cancel_button = _("&Cancel");
char* reverse_label = _("&Reverse");
char* case_label = _("case sensi&tive");
char* sort_title = _("Sort order");
static int i18n_sort_flag = 0, check_pos = 0, button_pos = 0;
if (!i18n_sort_flag)
{
int maxlen = 0;
for (i = SORT_TYPES-1; i >= 0; i--)
{
sort_orders_names [i] = _(sort_orders [i].sort_name);
r = strlen (sort_orders_names [i]);
if (r > maxlen)
maxlen = r;
}
check_pos = maxlen + 9;
r = strlen (reverse_label) + 4;
i = strlen (case_label) + 4;
if (i > r)
r = i;
l = strlen (ok_button) + 6;
i = strlen (cancel_button) + 4;
if (i > l)
l = i;
i = check_pos + max(r,l) + 2;
if (i > SORT_X)
SORT_X = i;
i = strlen (sort_title) + 6;
if (i > SORT_X)
SORT_X = i;
button_pos = SORT_X - l - 2;
i18n_sort_flag = 1;
}
result = 0;
for (i = 0; i < SORT_TYPES; i++)
if ((sortfn *) (sort_orders [i].sort_fn) == sort_fn){
current_mode = i;
break;
}
dd = create_dlg (0, 0, SORT_Y, SORT_X, dialog_colors, common_dialog_callback,
"[Left and Right Menus]", "sort", DLG_CENTER | DLG_GRID);
x_set_dialog_title (dd, sort_title);
add_widgetl (dd,
button_new (10, button_pos, B_CANCEL, NORMAL_BUTTON, cancel_button,
0, 0, "cancel-button"), XV_WLAY_CENTERROW);
add_widgetl (dd,
button_new (9, button_pos, B_ENTER, DEFPUSH_BUTTON, ok_button,
0, 0, "ok-button"), XV_WLAY_RIGHTDOWN);
case_sense = check_new (4, check_pos, *case_sensitive, case_label, "case-check");
add_widgetl (dd, case_sense, XV_WLAY_RIGHTDOWN);
c = check_new (3, check_pos, *reverse, reverse_label, "reverse-check");
add_widgetl (dd, c, XV_WLAY_RIGHTDOWN);
my_radio = radio_new (3, 3, SORT_TYPES, sort_orders_names, 1, "radio-1");
my_radio->sel = my_radio->pos = current_mode;
add_widget (dd, my_radio);
run_dlg (dd);
r = dd->ret_value;
if (r != B_CANCEL){
result = (sortfn *) sort_orders [my_radio->sel].sort_fn;
*reverse = c->state & C_BOOL;
*case_sensitive = case_sense->state & C_BOOL;
} else
result = sort_fn;
destroy_dlg (dd);
return result;
}
#define CONFY 10
#define CONFX 46
static int my_delete;
static int my_overwrite;
static int my_execute;
static int my_exit;
static QuickWidget conf_widgets [] = {
{ quick_button, 4, 6, 4, CONFY, N_("&Cancel"),
0, B_CANCEL, 0, 0, XV_WLAY_RIGHTOF, "c" },
{ quick_button, 4, 6, 3, CONFY, N_("&Ok"),
0, B_ENTER, 0, 0, XV_WLAY_CENTERROW, "o" },
{ quick_checkbox, 1, 13, 6, CONFY, N_(" confirm &Exit "),
9, 0, &my_exit, 0, XV_WLAY_BELOWCLOSE, "e" },
{ quick_checkbox, 1, 13, 5, CONFY, N_(" confirm e&Xecute "),
10, 0, &my_execute, 0, XV_WLAY_BELOWCLOSE, "x" },
{ quick_checkbox, 1, 13, 4, CONFY, N_(" confirm o&Verwrite "),
10, 0, &my_overwrite, 0, XV_WLAY_BELOWCLOSE, "ov" },
{ quick_checkbox, 1, 13, 3, CONFY, N_(" confirm &Delete "),
9, 0, &my_delete, 0, XV_WLAY_BELOWCLOSE, "de" },
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, XV_WLAY_DONTCARE }
};
static QuickDialog confirmation =
{ CONFX, CONFY, -1, -1, N_(" Confirmation "), "[Confirmation]", "quick_confirm",
conf_widgets, 0 };
void confirm_box ()
{
#ifdef ENABLE_NLS
static int i18n_flag = 0;
if (!i18n_flag)
{
register int i = sizeof(conf_widgets)/sizeof(QuickWidget) - 1;
int l1, maxlen = 0;
while (i--)
{
conf_widgets [i].text = _(conf_widgets [i].text);
l1 = strlen (conf_widgets [i].text) + 3;
if (l1 > maxlen)
maxlen = l1;
}
/*
* If buttons start on 4/6, checkboxes (with some add'l space)
* must take not more than it.
*/
confirmation.xlen = (maxlen + 5) * 6 / 4;
/*
* And this for the case when buttons with some space to the right
* do not fit within 2/6
*/
l1 = strlen (conf_widgets [0].text) + 3;
i = strlen (conf_widgets [1].text) + 5;
if (i > l1)
l1 = i;
i = (l1 + 3) * 6 / 2;
if (i > confirmation.xlen)
confirmation.xlen = i;
confirmation.title = _(confirmation.title);
i18n_flag = confirmation.i18n = 1;
}
#endif /* ENABLE_NLS */
my_delete = confirm_delete;
my_overwrite = confirm_overwrite;
my_execute = confirm_execute;
my_exit = confirm_exit;
if (quick_dialog (&confirmation) != B_CANCEL){
confirm_delete = my_delete;
confirm_overwrite = my_overwrite;
confirm_execute = my_execute;
confirm_exit = my_exit;
}
}
#define DISPY 11
#define DISPX 46
static int new_mode;
static int new_meta;
char *display_bits_str [] =
{ N_("Full 8 bits output"), N_("ISO 8859-1"), N_("7 bits") };
static QuickWidget display_widgets [] = {
{ quick_button, 4, 6, 4, DISPY, N_("&Cancel"),
0, B_CANCEL, 0, 0, XV_WLAY_CENTERROW, "c" },
{ quick_button, 4, 6, 3, DISPY, N_("&Ok"),
0, B_ENTER, 0, 0, XV_WLAY_CENTERROW, "o" },
{ quick_checkbox, 4, DISPX, 7, DISPY, N_("F&ull 8 bits input"),
0, 0, &new_meta, 0, XV_WLAY_BELOWCLOSE, "u" },
{ quick_radio, 4, DISPX, 3, DISPY, "", 3, 0,
&new_mode, display_bits_str, XV_WLAY_BELOWCLOSE, "r" },
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, XV_WLAY_DONTCARE }
};
static QuickDialog display_bits =
{ DISPX, DISPY, -1, -1, N_(" Display bits "), "[Display bits]",
"dbits", display_widgets, 0 };
void display_bits_box ()
{
int current_mode;
#ifdef ENABLE_NLS
static int i18n_flag = 0;
if (!i18n_flag)
{
register int i;
int l1, maxlen = 0;
for (i = 0; i < 3; i++)
{
display_widgets [i].text = _(display_widgets[i].text);
display_bits_str [i] = _(display_bits_str [i]);
l1 = strlen (display_bits_str [i]);
if (l1 > maxlen)
maxlen = l1;
}
l1 = strlen (display_widgets [2].text);
if (l1 > maxlen)
maxlen = l1;
display_bits.xlen = (maxlen + 5) * 6 / 4;
/* See above confirm_box */
l1 = strlen (display_widgets [0].text) + 3;
i = strlen (display_widgets [1].text) + 5;
if (i > l1)
l1 = i;
i = (l1 + 3) * 6 / 2;
if (i > display_bits.xlen)
display_bits.xlen = i;
display_bits.title = _(display_bits.title);
i18n_flag = display_bits.i18n = 1;
}
#endif /* ENABLE_NLS */
if (full_eight_bits)
current_mode = 0;
else if (eight_bit_clean)
current_mode = 1;
else
current_mode = 2;
display_widgets [3].value = current_mode;
new_meta = !use_8th_bit_as_meta;
if (quick_dialog (&display_bits) != B_ENTER)
return;
eight_bit_clean = new_mode < 2;
full_eight_bits = new_mode == 0;
#ifndef HAVE_SLANG
meta (stdscr, eight_bit_clean);
#else
SLsmg_Display_Eight_Bit = full_eight_bits ? 128 : 160;
#endif
use_8th_bit_as_meta = !new_meta;
}
#define TREE_Y 20
#define TREE_X 60
static int tree_colors [4];
static int tree_callback (struct Dlg_head *h, int id, int msg)
{
switch (msg){
case DLG_POST_KEY:
/* The enter key will be processed by the tree widget */
if (id == '\n' || ((WTree *)(h->current->widget))->done){
h->ret_value = B_ENTER;
dlg_stop (h);
}
return MSG_HANDLED;
case DLG_DRAW:
common_dialog_repaint (h);
break;
}
return MSG_NOT_HANDLED;
}
char *tree (char *current_dir)
{
WTree *mytree;
Dlg_head *dlg;
char *val;
WButtonBar *bar;
tree_colors [3] = dialog_colors [0];
tree_colors [1] = dialog_colors [1];
/* Create the components */
dlg = create_dlg (0, 0, TREE_Y, TREE_X, tree_colors,
tree_callback, "[Directory Tree]", "tree", DLG_CENTER);
mytree = tree_new (0, 2, 2, TREE_Y - 6, TREE_X - 5);
add_widget (dlg, mytree);
bar = buttonbar_new(1);
add_widget (dlg, bar);
bar->widget.x = 0;
bar->widget.y = LINES - 1;
run_dlg (dlg);
if (dlg->ret_value == B_ENTER)
val = strdup (mytree->selected_ptr->name);
else
val = 0;
destroy_dlg (dlg);
return val;
}
#ifndef USE_VFS
#ifdef USE_NETCODE
#undef USE_NETCODE
#endif
#endif
#ifdef USE_VFS
#if defined(USE_NETCODE)
#define VFSY 15
#else
#define VFSY 11
#endif
#define VFSX 56
extern int vfs_timeout;
extern int tar_gzipped_memlimit;
extern int ftpfs_always_use_proxy;
#if defined(USE_NETCODE)
extern char *ftpfs_anonymous_passwd;
extern char *ftpfs_proxy_host;
extern ftpfs_directory_timeout;
extern int use_netrc;
#endif
int vfs_use_limit = 1;
static char *ret_timeout;
static char *ret_limit;
#if defined(USE_NETCODE)
static char *ret_passwd;
static char *ret_directory_timeout;
static char *ret_ftp_proxy;
static int ret_use_netrc;
#endif
#if 0
/* Not used currently */
{ quick_checkbox, 4, VFSX, 10, VFSY, "Use ~/.netrc",
'U', 0, 0, &ret_use_netrc, 0, XV_WLAY_BELOWCLOSE, "" },
#endif
char *confvfs_str [] =
{ N_("Always to memory"), N_("If size less than:") };
static QuickWidget confvfs_widgets [] = {
{ quick_button, 30, VFSX, VFSY - 3, VFSY, N_("&Cancel"),
0, B_CANCEL, 0, 0, XV_WLAY_RIGHTOF, "button-cancel" },
{ quick_button, 12, VFSX, VFSY - 3, VFSY, N_("&Ok"),
0, B_ENTER, 0, 0, XV_WLAY_CENTERROW, "button-ok" },
#if defined(USE_NETCODE)
{ quick_input, 30, VFSX, 10, VFSY, "", 22, 0, 0, &ret_ftp_proxy,
XV_WLAY_RIGHTDOWN, "input-ftp-proxy" },
{ quick_checkbox, 4, VFSX, 10, VFSY, N_("&Always use ftp proxy"), 0, 0,
&ftpfs_always_use_proxy, 0, XV_WLAY_RIGHTDOWN, "check-ftp-proxy" },
{ quick_label, 46, VFSX, 9, VFSY, N_("sec"),
0, 0, 0, 0, XV_WLAY_RIGHTOF, "label-sec" },
{ quick_input, 35, VFSX, 9, VFSY, "", 10, 0, 0, &ret_directory_timeout,
XV_WLAY_RIGHTDOWN, "input-timeout" },
{ quick_label, 4, VFSX, 9, VFSY, N_("ftpfs directory cache timeout:"),
0, 0, 0, 0, XV_WLAY_NEXTROW, "label-cache"},
{ quick_input, 28, VFSX, 8, VFSY, "", 24, 0, 0, &ret_passwd,
XV_WLAY_RIGHTDOWN, "input-passwd" },
{ quick_label, 4, VFSX, 8, VFSY, N_("ftp anonymous password:"),
0, 0, 0, 0, XV_WLAY_NEXTROW, "label-pass"},
#endif
{ quick_input, 26, VFSX, 6, VFSY, "", 10, 0, 0, &ret_limit,
XV_WLAY_RIGHTDOWN, "input-limit" },
{ quick_radio, 4, VFSX, 5, VFSY, "", 2, 0,
&vfs_use_limit, confvfs_str, XV_WLAY_BELOWCLOSE, "radio" },
{ quick_label, 4, VFSX, 4, VFSY, N_("Gzipped tar archive extract:"),
0, 0, 0, 0, XV_WLAY_NEXTROW, "label-tar" },
{ quick_label, 46, VFSX, 3, VFSY, "sec",
0, 0, 0, 0, XV_WLAY_RIGHTOF, "label-sec2" },
{ quick_input, 35, VFSX, 3, VFSY, "", 10, 0, 0, &ret_timeout,
XV_WLAY_RIGHTOF, "input-timo-vfs" },
{ quick_label, 4, VFSX, 3, VFSY, N_("Timeout for freeing VFSs:"),
0, 0, 0, 0, XV_WLAY_BELOWCLOSE, "label-vfs" },
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, XV_WLAY_DONTCARE, 0 }
};
static QuickDialog confvfs_dlg =
{ VFSX, VFSY, -1, -1, N_(" Virtual File System Setting "), "[Virtual FS]", "quick_vfs", confvfs_widgets, 0 };
#if defined(USE_NETCODE)
#define VFS_WIDGETBASE 7
#else
#define VFS_WIDGETBASE 0
#endif
void configure_vfs ()
{
char buffer1 [15], buffer2 [15];
#if defined(USE_NETCODE)
char buffer3[15];
#endif
if (tar_gzipped_memlimit > -1) {
if (tar_gzipped_memlimit == 0)
strcpy (buffer1, "0 B");
else if ((tar_gzipped_memlimit % (1024*1024)) == 0) /* I.e. in M */
sprintf (buffer1, "%i MB", (int)(((unsigned)tar_gzipped_memlimit) >> 20));
else if ((tar_gzipped_memlimit % 1024) == 0) /* I.e. in K */
sprintf (buffer1, "%i KB", (int)(((unsigned)tar_gzipped_memlimit) >> 10));
else if ((tar_gzipped_memlimit % 1000) == 0)
sprintf (buffer1, "%i kB", (int)(tar_gzipped_memlimit / 1000));
else
sprintf (buffer1, "%i B", (int)tar_gzipped_memlimit);
confvfs_widgets [2 + VFS_WIDGETBASE].text = buffer1;
} else
confvfs_widgets [2 + VFS_WIDGETBASE].text = "5 MB";
sprintf (buffer2, "%i", vfs_timeout);
confvfs_widgets [6 + VFS_WIDGETBASE].text = buffer2;
confvfs_widgets [3 + VFS_WIDGETBASE].value = vfs_use_limit;
#if defined(USE_NETCODE)
ret_use_netrc = use_netrc;
sprintf(buffer3, "%i", ftpfs_directory_timeout);
confvfs_widgets[5].text = buffer3;
confvfs_widgets[7].text = ftpfs_anonymous_passwd;
confvfs_widgets[2].text = ftpfs_proxy_host ? ftpfs_proxy_host : "";
#endif
if (quick_dialog (&confvfs_dlg) != B_CANCEL) {
char *p;
vfs_timeout = atoi (ret_timeout);
free (ret_timeout);
if (vfs_timeout < 0 || vfs_timeout > 10000)
vfs_timeout = 10;
if (!vfs_use_limit)
tar_gzipped_memlimit = -1;
else {
tar_gzipped_memlimit = atoi (ret_limit);
if (tar_gzipped_memlimit < 0)
tar_gzipped_memlimit = -1;
else {
for (p = ret_limit; *p == ' ' || (*p >= '0' && *p <= '9'); p++);
switch (*p) {
case 'm':
case 'M': tar_gzipped_memlimit <<= 20; break;
case 'K': tar_gzipped_memlimit <<= 10; break;
case 'k': tar_gzipped_memlimit *= 1000; break;
}
}
}
free (ret_limit);
#if defined(USE_NETCODE)
free(ftpfs_anonymous_passwd);
ftpfs_anonymous_passwd = ret_passwd;
if (ftpfs_proxy_host)
free(ftpfs_proxy_host);
ftpfs_proxy_host = ret_ftp_proxy;
ftpfs_directory_timeout = atoi(ret_directory_timeout);
use_netrc = ret_use_netrc;
free(ret_directory_timeout);
#endif
}
}
#endif
char *cd_dialog (void)
{
QuickDialog Quick_input;
QuickWidget quick_widgets [] = {
#ifdef HAVE_TK
#define INPUT_INDEX 2
{ quick_button, 0, 1, 0, 1, N_("&Cancel"), 0, B_CANCEL, 0, 0, XV_WLAY_DONTCARE, "cancel" },
{ quick_button, 0, 1, 0, 1, N_("&Ok"), 0, B_ENTER, 0, 0, XV_WLAY_DONTCARE, "ok" },
#else
#define INPUT_INDEX 0
#endif
{ quick_input, 6, 57, 5, 0, "", 50, 0, 0, 0, XV_WLAY_RIGHTOF, "input" },
{ quick_label, 3, 57, 2, 0, "", 0, 0, 0, 0, XV_WLAY_DONTCARE, "label" },
{ 0 } };
char *my_str;
int len;
Quick_input.xlen = 57;
Quick_input.title = _("Quick cd");
Quick_input.help = "[Quick cd]";
Quick_input.class = "quick_input";
quick_widgets [INPUT_INDEX].text = "";
quick_widgets [INPUT_INDEX].value = 2; /* want cd like completion */
quick_widgets [INPUT_INDEX+1].text = _("cd");
quick_widgets [INPUT_INDEX+1].y_divisions =
quick_widgets [INPUT_INDEX].y_divisions = Quick_input.ylen = 5;
len = strlen (quick_widgets [INPUT_INDEX+1].text);
quick_widgets [INPUT_INDEX+1].relative_x = 3;
quick_widgets [INPUT_INDEX].relative_x =
quick_widgets [INPUT_INDEX+1].relative_x + len + 1;
Quick_input.xlen = len + quick_widgets [INPUT_INDEX].hotkey_pos + 7;
quick_widgets [INPUT_INDEX].x_divisions =
quick_widgets [INPUT_INDEX+1].x_divisions = Quick_input.xlen;
Quick_input.i18n = 1;
Quick_input.xpos = 2;
Quick_input.ypos = LINES - 2 - Quick_input.ylen;
quick_widgets [INPUT_INDEX].relative_y = 2;
quick_widgets [INPUT_INDEX].str_result = &my_str;
Quick_input.widgets = quick_widgets;
if (quick_dialog (&Quick_input) != B_CANCEL){
return *(quick_widgets [INPUT_INDEX].str_result);
} else
return 0;
}
void symlink_dialog (char *existing, char *new, char **ret_existing,
char **ret_new)
{
QuickDialog Quick_input;
QuickWidget quick_widgets [] = {
#undef INPUT_INDEX
#if defined(HAVE_TK) || defined(HAVE_GNOME)
#define INPUT_INDEX 2
{ quick_button, 0, 1, 0, 1, _("&Cancel"), 0, B_CANCEL, 0, 0,
XV_WLAY_DONTCARE, "cancel" },
{ quick_button, 0, 1, 0, 1, _("&Ok"), 0, B_ENTER, 0, 0,
XV_WLAY_DONTCARE, "ok" },
#else
#define INPUT_INDEX 0
#endif
{ quick_input, 6, 80, 5, 8, "", 58, 0, 0, 0, XV_WLAY_BELOWCLOSE, "input-1" },
{ quick_label, 6, 80, 4, 8, "", 0, 0, 0, 0, XV_WLAY_BELOWOF, "label-1" },
{ quick_input, 6, 80, 3, 8, "", 58, 0, 0, 0, XV_WLAY_BELOWCLOSE, "input-2" },
{ quick_label, 6, 80, 2, 8, "", 0, 0, 0, 0, XV_WLAY_DONTCARE, "label-2" },
{ 0 } };
Quick_input.xlen = 64;
Quick_input.ylen = 8;
Quick_input.title = "Symbolic link";
Quick_input.help = "[File Menu]";
Quick_input.class = "quick_symlink";
Quick_input.i18n = 0;
quick_widgets [INPUT_INDEX].text = new;
quick_widgets [INPUT_INDEX+1].text = _("Symbolic link filename:");
quick_widgets [INPUT_INDEX+2].text = existing;
quick_widgets [INPUT_INDEX+3].text = _("Existing filename (filename symlink will point to):");
Quick_input.xpos = -1;
quick_widgets [INPUT_INDEX].str_result = ret_new;
quick_widgets [INPUT_INDEX+2].str_result = ret_existing;
Quick_input.widgets = quick_widgets;
if (quick_dialog (&Quick_input) == B_CANCEL){
*ret_new = NULL;
*ret_existing = NULL;
}
}
#ifdef WITH_BACKGROUND
#define B_STOP B_USER+1
#define B_RESUME B_USER+2
#define B_KILL B_USER+3
static int JOBS_X = 60;
#define JOBS_Y 15
static WListbox *bg_list;
static Dlg_head *jobs_dlg;
static void
jobs_fill_listbox (void)
{
static char *state_str [2];
TaskList *tl = task_list;
if (!state_str [0]){
state_str [0] = _("Running ");
state_str [1] = _("Stopped");
}
while (tl){
char *s;
s = copy_strings (state_str [tl->state], " ", tl->info, NULL);
listbox_add_item (bg_list, LISTBOX_APPEND_AT_END, 0, s, (void *) tl);
free (s);
tl = tl->next;
}
}
static int
task_cb (int action, void *ignored)
{
TaskList *tl;
int sig;
if (!bg_list->list)
return 0;
/* Get this instance information */
tl = (TaskList *) bg_list->current->data;
if (action == B_STOP){
sig = SIGSTOP;
tl->state = Task_Stopped;
} else if (action == B_RESUME){
sig = SIGCONT;
tl->state = Task_Running;
} else if (action == B_KILL){
sig = SIGKILL;
}
if (sig == SIGINT)
unregister_task_running (tl->pid, tl->fd);
kill (tl->pid, sig);
listbox_remove_list (bg_list);
jobs_fill_listbox ();
/* This can be optimized to just redraw this widget :-) */
dlg_redraw (jobs_dlg);
return 0;
}
static struct
{
char* name;
int xpos;
int value;
int (*callback)();
char* tkname;
}
job_buttons [] =
{
{N_("&Stop"), 3, B_STOP, task_cb, "button-stop"},
{N_("&Resume"), 12, B_RESUME, task_cb, "button-cont"},
{N_("&Kill"), 23, B_KILL, task_cb, "button-kill"},
{N_("&Ok"), 35, B_CANCEL, NULL, "button-ok"},
};
void
jobs_cmd (void)
{
register int i;
int n_buttons = sizeof (job_buttons) / sizeof (job_buttons[0]);
#ifdef ENABLE_NLS
static int i18n_flag = 0;
if (!i18n_flag)
{
int startx = job_buttons [0].xpos;
int len;
for (i = 0; i < n_buttons; i++)
{
job_buttons [i].name = _(job_buttons [i].name);
len = strlen (job_buttons [i].name) + 4;
JOBS_X = max (JOBS_X, startx + len + 3);
job_buttons [i].xpos = startx;
startx += len;
}
/* Last button - Ok a.k.a. Cancel :) */
job_buttons [n_buttons - 1].xpos =
JOBS_X - strlen (job_buttons [n_buttons - 1].name) - 7;
i18n_flag = 1;
}
#endif /* ENABLE_NLS */
jobs_dlg = create_dlg (0, 0, JOBS_Y, JOBS_X, dialog_colors,
common_dialog_callback, "[Background jobs]", "jobs",
DLG_CENTER | DLG_GRID);
x_set_dialog_title (jobs_dlg, _("Background Jobs"));
bg_list = listbox_new (2, 3, JOBS_X-7, JOBS_Y-9, listbox_nothing, 0, "listbox");
add_widget (jobs_dlg, bg_list);
i = n_buttons;
while (i--)
{
add_widget (jobs_dlg, button_new (JOBS_Y-4,
job_buttons [i].xpos, job_buttons [i].value,
NORMAL_BUTTON, job_buttons [i].name,
job_buttons [i].callback, 0,
job_buttons [i].tkname));
}
/* Insert all of task information in the list */
jobs_fill_listbox ();
run_dlg (jobs_dlg);
destroy_dlg (jobs_dlg);
}
#endif

16
rosapps/mc/src/boxes.h Normal file
View File

@@ -0,0 +1,16 @@
#ifndef __BOXES_H
#define __BOXES_H
extern char *user_format [];
int display_box (WPanel *p, char **user, char **mini, int *use_msformat, int num);
sortfn *sort_box (sortfn *sort_fn, int *reverse, int *case_sensitive);
void confirm_box (void);
void display_bits_box ();
#ifdef USE_VFS
void configure_vfs ();
#endif
void jobs_cmd ();
char *cd_dialog (void);
void symlink_dialog (char *existing, char *new, char **ret_existing, char **ret_new);
#endif

1317
rosapps/mc/src/changelog Normal file

File diff suppressed because it is too large Load Diff

453
rosapps/mc/src/chmod.c Normal file
View File

@@ -0,0 +1,453 @@
/* Chmod command -- for the Midnight Commander
Copyright (C) 1994 Radek Doulik
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <config.h>
#include <string.h>
#include <stdio.h>
#include <errno.h> /* For errno on SunOS systems */
/* Needed for the extern declarations of integer parameters */
#include <sys/types.h>
#include <sys/param.h>
#include <sys/stat.h>
#include <grp.h>
#include <pwd.h>
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
#include "tty.h"
#include "mad.h"
#include "util.h"
#include "win.h"
#include "color.h"
#include "dlg.h"
#include "widget.h"
#include "dialog.h" /* For do_refresh() */
#include "dir.h"
#include "panel.h" /* Needed for the externs */
#include "file.h"
#include "main.h"
#include "chmod.h"
#include "achown.h"
#include "chown.h"
#include "../vfs/vfs.h"
#ifdef HAVE_TK
# include "tkmain.h"
#endif
static int single_set;
struct Dlg_head *ch_dlg;
#define PX 5
#define PY 2
#define FX 40
#define FY 2
#define BX 6
#define BY 17
#define TX 40
#define TY 12
#define PERMISSIONS 12
#define BUTTONS 6
#define B_MARKED B_USER
#define B_ALL B_USER+1
#define B_SETMRK B_USER+2
#define B_CLRMRK B_USER+3
int mode_change, need_update;
int c_file, end_chmod;
umode_t and_mask, or_mask, c_stat;
char *c_fname, *c_fown, *c_fgrp, *c_fperm;
int c_fsize;
static WLabel *statl;
static int normal_color;
static int title_color;
static int selection_color;
struct {
mode_t mode;
char *text;
int selected;
WCheck *check;
} check_perm[PERMISSIONS] =
{
{ S_IXOTH, N_("execute/search by others"), 0, 0, },
{ S_IWOTH, N_("write by others"), 0, 0, },
{ S_IROTH, N_("read by others"), 0, 0, },
{ S_IXGRP, N_("execute/search by group"), 0, 0, },
{ S_IWGRP, N_("write by group"), 0, 0, },
{ S_IRGRP, N_("read by group"), 0, 0, },
{ S_IXUSR, N_("execute/search by owner"), 0, 0, },
{ S_IWUSR, N_("write by owner"), 0, 0, },
{ S_IRUSR, N_("read by owner"), 0, 0, },
{ S_ISVTX, N_("sticky bit"), 0, 0, },
{ S_ISGID, N_("set group ID on execution"), 0, 0, },
{ S_ISUID, N_("set user ID on execution"), 0, 0, },
};
struct {
int ret_cmd, flags, y, x;
char *text;
} chmod_but[BUTTONS] =
{
{ B_CANCEL, NORMAL_BUTTON, 2, 33, N_("&Cancel") },
{ B_ENTER, DEFPUSH_BUTTON, 2, 17, N_("&Set") },
{ B_CLRMRK, NORMAL_BUTTON, 0, 42, N_("C&lear marked") },
{ B_SETMRK, NORMAL_BUTTON, 0, 27, N_("S&et marked") },
{ B_MARKED, NORMAL_BUTTON, 0, 12, N_("&Marked all") },
{ B_ALL, NORMAL_BUTTON, 0, 0, N_("Set &all") },
};
#ifdef HAVE_X
static void chmod_toggle_select (void)
{
#ifdef HAVE_TK
char *wn = (char *) ch_dlg->current->widget->wdata;
int id = ch_dlg->current->dlg_id -BUTTONS + single_set * 2;
check_perm [id].selected ^= 1;
tk_evalf ("%s configure -color $setup(%s)",
wn+1, check_perm [id].selected ? "marked":"black");
#endif
}
#else
static void chmod_toggle_select (void)
{
int Id = ch_dlg->current->dlg_id - BUTTONS + single_set * 2;
attrset (normal_color);
check_perm[Id].selected ^= 1;
dlg_move (ch_dlg, PY + PERMISSIONS - Id, PX + 1);
addch ((check_perm[Id].selected) ? '*' : ' ');
dlg_move (ch_dlg, PY + PERMISSIONS - Id, PX + 3);
}
static void chmod_refresh (void)
{
attrset (COLOR_NORMAL);
dlg_erase (ch_dlg);
draw_box (ch_dlg, 1, 2, 20 - single_set, 66);
draw_box (ch_dlg, PY, PX, PERMISSIONS + 2, 33);
draw_box (ch_dlg, FY, FX, 10, 25);
dlg_move (ch_dlg, FY + 1, FX + 2);
addstr (_("Name"));
dlg_move (ch_dlg, FY + 3, FX + 2);
addstr (_("Permissions (Octal)"));
dlg_move (ch_dlg, FY + 5, FX + 2);
addstr (_("Owner name"));
dlg_move (ch_dlg, FY + 7, FX + 2);
addstr (_("Group name"));
attrset (title_color);
dlg_move (ch_dlg, 1, 28);
addstr (_(" Chmod command "));
dlg_move (ch_dlg, PY, PX + 1);
addstr (_(" Permission "));
dlg_move (ch_dlg, FY, FX + 1);
addstr (_(" File "));
attrset (selection_color);
dlg_move (ch_dlg, TY, TX);
addstr (_("Use SPACE to change"));
dlg_move (ch_dlg, TY + 1, TX);
addstr (_("an option, ARROW KEYS"));
dlg_move (ch_dlg, TY + 2, TX);
addstr (_("to move between options"));
dlg_move (ch_dlg, TY + 3, TX);
addstr (_("and T or INS to mark"));
}
#endif
static int chmod_callback (Dlg_head *h, int Par, int Msg)
{
char buffer [10];
switch (Msg) {
case DLG_ACTION:
if (Par >= BUTTONS - single_set * 2){
c_stat ^= check_perm[Par - BUTTONS + single_set * 2].mode;
sprintf (buffer, "%o", c_stat);
label_set_text (statl, buffer);
chmod_toggle_select ();
mode_change = 1;
}
break;
case DLG_KEY:
if ((Par == 'T' || Par == 't' || Par == KEY_IC) &&
ch_dlg->current->dlg_id >= BUTTONS - single_set * 2) {
chmod_toggle_select ();
if (Par == KEY_IC)
dlg_one_down (ch_dlg);
return 1;
}
break;
#ifndef HAVE_X
case DLG_DRAW:
chmod_refresh ();
break;
#endif
}
return 0;
}
static void init_chmod (void)
{
int i;
do_refresh ();
end_chmod = c_file = need_update = 0;
single_set = (cpanel->marked < 2) ? 2 : 0;
if (use_colors){
normal_color = COLOR_NORMAL;
title_color = COLOR_HOT_NORMAL;
selection_color = COLOR_NORMAL;
} else {
normal_color = NORMAL_COLOR;
title_color = SELECTED_COLOR;
selection_color = SELECTED_COLOR;
}
ch_dlg = create_dlg (0, 0, 22 - single_set, 70, dialog_colors,
chmod_callback, "[Chmod]", "chmod", DLG_CENTER);
x_set_dialog_title (ch_dlg, _("Chmod command"));
#define XTRACT(i) BY+chmod_but[i].y-single_set, BX+chmod_but[i].x, \
chmod_but[i].ret_cmd, chmod_but[i].flags, _(chmod_but[i].text), 0, 0, NULL
tk_new_frame (ch_dlg, "b.");
for (i = 0; i < BUTTONS; i++) {
if (i == 2 && single_set)
break;
else
add_widgetl (ch_dlg, button_new (XTRACT (i)), XV_WLAY_RIGHTOF);
}
#define XTRACT2(i) 0, _(check_perm [i].text), NULL
tk_new_frame (ch_dlg, "c.");
for (i = 0; i < PERMISSIONS; i++) {
check_perm[i].check = check_new (PY + (PERMISSIONS - i), PX + 2,
XTRACT2 (i));
add_widget (ch_dlg, check_perm[i].check);
}
}
int stat_file (char *filename, struct stat *st)
{
if (mc_stat (filename, st))
return 0;
if (!(S_ISREG(st->st_mode) || S_ISDIR(st->st_mode) ||
S_ISLNK(st->st_mode)))
return 0;
return 1;
}
static void chmod_done (void)
{
if (need_update)
update_panels (UP_OPTIMIZE, UP_KEEPSEL);
repaint_screen ();
}
static char *next_file (void)
{
while (!cpanel->dir.list[c_file].f.marked)
c_file++;
return cpanel->dir.list[c_file].fname;
}
static void do_chmod (struct stat *sf)
{
sf->st_mode &= and_mask;
sf->st_mode |= or_mask;
if (mc_chmod (cpanel->dir.list [c_file].fname, sf->st_mode) == -1)
message (1, MSG_ERROR, _(" Couldn't chmod \"%s\" \n %s "),
cpanel->dir.list [c_file].fname, unix_error_string (errno));
do_file_mark (cpanel, c_file, 0);
}
static void apply_mask (struct stat *sf)
{
char *fname;
need_update = end_chmod = 1;
do_chmod (sf);
do {
fname = next_file ();
if (!stat_file (fname, sf))
return;
c_stat = sf->st_mode;
do_chmod (sf);
} while (cpanel->marked);
}
void chmod_cmd (void)
{
char buffer [10];
char *fname;
int i;
struct stat sf_stat;
if (!vfs_current_is_local ()) {
if (vfs_current_is_extfs ()) {
message (1, _(" Oops... "),
_(" I can't run the Chmod command on an extfs "));
return;
} else if (vfs_current_is_tarfs ()) {
message (1, _(" Oops... "),
(" I can't run the Chmod command on a tarfs "));
return;
}
}
do { /* do while any files remaining */
init_chmod ();
if (cpanel->marked)
fname = next_file (); /* next marked file */
else
fname = selection (cpanel)->fname; /* single file */
if (!stat_file (fname, &sf_stat)){ /* get status of file */
destroy_dlg (ch_dlg);
break;
}
c_stat = sf_stat.st_mode;
mode_change = 0; /* clear changes flag */
/* set check buttons */
for (i = 0; i < PERMISSIONS; i++){
check_perm[i].check->state = (c_stat & check_perm[i].mode) ? 1 : 0;
check_perm[i].selected = 0;
}
tk_new_frame (ch_dlg, "l.");
/* Set the labels */
c_fname = name_trunc (fname, 21);
add_widget (ch_dlg, label_new (FY+2, FX+2, c_fname, NULL));
c_fown = name_trunc (get_owner (sf_stat.st_uid), 21);
add_widget (ch_dlg, label_new (FY+6, FX+2, c_fown, NULL));
c_fgrp = name_trunc (get_group (sf_stat.st_gid), 21);
add_widget (ch_dlg, label_new (FY+8, FX+2, c_fgrp, NULL));
sprintf (buffer, "%o", c_stat);
statl = label_new (FY+4, FX+2, buffer, NULL);
add_widget (ch_dlg, statl);
tk_end_frame ();
run_dlg (ch_dlg); /* retrieve an action */
/* do action */
switch (ch_dlg->ret_value){
case B_ENTER:
if (mode_change)
if (mc_chmod (fname, c_stat) == -1)
message (1, MSG_ERROR, _(" Couldn't chmod \"%s\" \n %s "),
fname, unix_error_string (errno));
need_update = 1;
break;
case B_CANCEL:
end_chmod = 1;
break;
case B_ALL:
case B_MARKED:
and_mask = or_mask = 0;
and_mask = ~and_mask;
for (i = 0; i < PERMISSIONS; i++) {
if (check_perm[i].selected || ch_dlg->ret_value == B_ALL)
if (check_perm[i].check->state & C_BOOL)
or_mask |= check_perm[i].mode;
else
and_mask &= ~check_perm[i].mode;
}
apply_mask (&sf_stat);
break;
case B_SETMRK:
and_mask = or_mask = 0;
and_mask = ~and_mask;
for (i = 0; i < PERMISSIONS; i++) {
if (check_perm[i].selected)
or_mask |= check_perm[i].mode;
}
apply_mask (&sf_stat);
break;
case B_CLRMRK:
and_mask = or_mask = 0;
and_mask = ~and_mask;
for (i = 0; i < PERMISSIONS; i++) {
if (check_perm[i].selected)
and_mask &= ~check_perm[i].mode;
}
apply_mask (&sf_stat);
break;
}
if (cpanel->marked && ch_dlg->ret_value!=B_CANCEL) {
do_file_mark (cpanel, c_file, 0);
need_update = 1;
}
destroy_dlg (ch_dlg);
} while (cpanel->marked && !end_chmod);
chmod_done ();
}
void ch1_cmd (int id)
{
if (advanced_chfns)
chown_advanced_cmd ();
else
chmod_cmd ();
}
void ch2_cmd (int id)
{
if (advanced_chfns)
chown_advanced_cmd ();
else
chown_cmd ();
}

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