mirror of
https://github.com/reactos/reactos
synced 2025-10-08 17:32:43 +02:00
Compare commits
1 Commits
backups/ne
...
ReactOS-0.
Author | SHA1 | Date | |
---|---|---|---|
|
6caaf63c2c |
2
reactos/.cvsignore
Normal file
2
reactos/.cvsignore
Normal file
@@ -0,0 +1,2 @@
|
||||
dist
|
||||
errors
|
@@ -1,78 +1,14 @@
|
||||
ReactOS is available thanks to the work of
|
||||
In no particular order
|
||||
|
||||
Emanuele Aliberti <ea@iol.it>
|
||||
Robert Bergkvist <fragdance@hotmail.com>
|
||||
Hartmut Birr <hartmut.birr@gmx.de>
|
||||
Aleksey Bragin <aleksey@studiocerebral.com>
|
||||
Richard Campbell <eek2121@comcast.net>
|
||||
Gunnar Andre' Dalsnes <hardon@online.no>
|
||||
Arindam Das
|
||||
Boudewijn Dekker <ariadne@xs4all.nl>
|
||||
Robert Dickenson <robd@reactos.org>
|
||||
Marty Dill <mdill@uvic.ca>
|
||||
Jason Eager
|
||||
Steven Edwards <steven_ed4153@yahoo.com>
|
||||
Iwan Fatahi <i_fatahi@hotmail.com>
|
||||
Jason Filby <jasonfilby@yahoo.com>
|
||||
Martin Fuchs <martin-fuchs@gmx.net>
|
||||
Jurgen van Gael <jurgen.vangael@student.kuleuven.ac.be>
|
||||
Ge van Geldorp <ge@gse.nl>
|
||||
Andrew Greenwood <lists@silverblade.co.uk>
|
||||
Casper S. Hornstrup <chorns@users.sourceforge.net>
|
||||
KJK::Hyperion <noog@libero.it>
|
||||
Eugene Ingerman <geneing@myrealbox.com>
|
||||
Rex Jolliff <rex@lvcablemodem.com>
|
||||
Guido de Jong
|
||||
Victor Kirhenshtein <sauros@iname.com>
|
||||
Eric Kohl <ekohl@rz-online.de>
|
||||
Hans Kremer
|
||||
Frederik Leemans
|
||||
Jean Michault
|
||||
Royce Mitchell III <royce3@ev1.net>
|
||||
Filip Navara <xnavara@volny.cz>
|
||||
Jim Noeth
|
||||
Mike Nordell ("tamlin")
|
||||
Hernan Ochoa
|
||||
Brian Palmer <brianp@sginet.com>
|
||||
Paolo Pantaleo <paolopan@freemail.it>
|
||||
Matt Pyne
|
||||
Phillip Susi <phreak@iag.net>
|
||||
James B. Tabor <jimtabor@adsl-64-217-116-74.dsl.hstntx.swbell.net>
|
||||
Mark Tempel <mtempel@visi.com>
|
||||
Vizzini <vizzini@plasmic.com>
|
||||
Mark Weaver <mark@npsl.co.uk>
|
||||
Thomas Weidenmueller <w3seek@users.sourceforge.net>
|
||||
Jason Weiler
|
||||
David Welch <welch@cwcom.net>
|
||||
Jonathan Wilson <jonwil@tpgi.com.au>
|
||||
Art Yerkes <ayerkes@speakeasy.net>
|
||||
|
||||
Graphic Design from
|
||||
|
||||
Everaldo (http://everaldo.com) for Explorer icons
|
||||
|
||||
Source and inspiration from
|
||||
|
||||
WINE (http://www.winehq.com)
|
||||
WinFree (http://www.stack.nl/~onno/win32/)
|
||||
Linux (http://www.kernel.org)
|
||||
XFree86 (http://www.xfree86.org/)
|
||||
|
||||
References (Rex's at least)
|
||||
|
||||
Baker, Art. The Windows NT Device Driver Book. Prentice Hall, 1997.
|
||||
Borate, Dabak & Phadke. Undocumented Windows NT. M&T Books, 1999.
|
||||
Brain, Marshall. Win32 System Services. Prentice Hall, 1996.
|
||||
Cant, Chris. Writing Windows WDM Device Drivers. R&D Books, 1999.
|
||||
Canton & Sanchez. IBM Microcomputers: A Programmer's Handbook. McGraw Hill, 1990.
|
||||
Davis & Wallace. Windows Undocumented File Formats. R&D Books, 1997.
|
||||
Mason & Viscarola. Windows NT Device Driver Development. Macmillan, 1999.
|
||||
Mitchell, Stan. Inside the Windows 95 File System. O'Reilly, 1997.
|
||||
Murray, James D. Windows NT Event Logging. O'Reilly, 1998.
|
||||
Nagar, Rajeev. Windows NT File System Internals. O'Reilly, 1997.
|
||||
Osbourne, Sandra. Windows NT Registry: A Settings Reference. New Riders, 1998.
|
||||
Pietrek, Matt. Windows 95 System Programming Secrets. IDG, 1995.
|
||||
Richter, Jeffery. Advanced Windows, 3rd ed. Microsoft, 1997.
|
||||
Simon, Richard J. Windows NT Win32 API Superbible. Waite Group, 1996.
|
||||
Solomon, David A. Inside Windows NT, 2nd Ed. Microsoft, 1998.
|
||||
"The NT Insider." Open Systems Resources, 1999-2000.
|
||||
Rex Jolliff (rex@lvcablemodem.com)
|
||||
Boudewijn Dekker (ariadne@xs4all.nl)
|
||||
Eric Kohl (ekohl@abo.rhein-zeitung.de)
|
||||
Emanuele Aliberti (ea@iol.it)
|
||||
David Welch (welch@cwcom.net)
|
||||
Iwan Fatahi (i_fatahi@hotmail.com)
|
||||
Robert Bergkvist (fragdance@hotmail.com)
|
||||
Victor Kirhenshtein (sauros@iname.com)
|
||||
Jason Filby (jasonfilby@yahoo.com)
|
||||
Brian Palmer (brianp@sginet.com)
|
||||
Phillip Susi (phreak@iag.net)
|
||||
Paolo Pantaleo (paolopan@freemail.it)
|
||||
|
12
reactos/ChangeLog
Normal file
12
reactos/ChangeLog
Normal file
@@ -0,0 +1,12 @@
|
||||
9/6/99: Implemented ZwOpenProcess
|
||||
Partially implemented killing other threads (possible memory
|
||||
leaks)
|
||||
Made a start on a proper implemention of APCs (based on
|
||||
article in NT insider)
|
||||
|
||||
8/12/98: Corrected bug in shell (Read two keypresses and assumed they
|
||||
where the key going up and down respectively)
|
||||
Corrected race in dpc handling
|
||||
Took out cleanup sections in ZwReadFile (now handled by the APC)
|
||||
Disabled broken code in kernel32
|
||||
|
211
reactos/Doxyfile
211
reactos/Doxyfile
@@ -1,211 +0,0 @@
|
||||
# Doxyfile 1.3.5
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# Project related configuration options
|
||||
#---------------------------------------------------------------------------
|
||||
PROJECT_NAME = ReactOS
|
||||
PROJECT_NUMBER =
|
||||
OUTPUT_DIRECTORY = doxy-doc
|
||||
OUTPUT_LANGUAGE = English
|
||||
USE_WINDOWS_ENCODING = YES
|
||||
BRIEF_MEMBER_DESC = YES
|
||||
REPEAT_BRIEF = YES
|
||||
ALWAYS_DETAILED_SEC = NO
|
||||
INLINE_INHERITED_MEMB = NO
|
||||
FULL_PATH_NAMES = YES
|
||||
STRIP_FROM_PATH = .
|
||||
SHORT_NAMES = NO
|
||||
JAVADOC_AUTOBRIEF = YES
|
||||
MULTILINE_CPP_IS_BRIEF = NO
|
||||
DETAILS_AT_TOP = NO
|
||||
INHERIT_DOCS = NO
|
||||
DISTRIBUTE_GROUP_DOC = NO
|
||||
TAB_SIZE = 8
|
||||
ALIASES =
|
||||
OPTIMIZE_OUTPUT_FOR_C = YES
|
||||
OPTIMIZE_OUTPUT_JAVA = NO
|
||||
SUBGROUPING = YES
|
||||
#---------------------------------------------------------------------------
|
||||
# Build related configuration options
|
||||
#---------------------------------------------------------------------------
|
||||
EXTRACT_ALL = YES
|
||||
EXTRACT_PRIVATE = YES
|
||||
EXTRACT_STATIC = YES
|
||||
EXTRACT_LOCAL_CLASSES = YES
|
||||
HIDE_UNDOC_MEMBERS = NO
|
||||
HIDE_UNDOC_CLASSES = NO
|
||||
HIDE_FRIEND_COMPOUNDS = NO
|
||||
HIDE_IN_BODY_DOCS = NO
|
||||
INTERNAL_DOCS = YES
|
||||
CASE_SENSE_NAMES = YES
|
||||
HIDE_SCOPE_NAMES = NO
|
||||
SHOW_INCLUDE_FILES = YES
|
||||
INLINE_INFO = YES
|
||||
SORT_MEMBER_DOCS = YES
|
||||
GENERATE_TODOLIST = YES
|
||||
GENERATE_TESTLIST = YES
|
||||
GENERATE_BUGLIST = YES
|
||||
GENERATE_DEPRECATEDLIST= YES
|
||||
ENABLED_SECTIONS =
|
||||
MAX_INITIALIZER_LINES = 30
|
||||
SHOW_USED_FILES = YES
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to warning and progress messages
|
||||
#---------------------------------------------------------------------------
|
||||
QUIET = NO
|
||||
WARNINGS = NO
|
||||
WARN_IF_UNDOCUMENTED = NO
|
||||
WARN_IF_DOC_ERROR = YES
|
||||
WARN_FORMAT = "$file:$line: $text"
|
||||
WARN_LOGFILE =
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the input files
|
||||
#---------------------------------------------------------------------------
|
||||
INPUT = hal \
|
||||
subsys \
|
||||
services \
|
||||
regtests \
|
||||
iface
|
||||
FILE_PATTERNS = *.c \
|
||||
*.h
|
||||
RECURSIVE = YES
|
||||
EXCLUDE = subsys/win32k \
|
||||
subsys/system/explorer
|
||||
EXCLUDE_SYMLINKS = NO
|
||||
EXCLUDE_PATTERNS =
|
||||
EXAMPLE_PATH =
|
||||
EXAMPLE_PATTERNS =
|
||||
EXAMPLE_RECURSIVE = YES
|
||||
IMAGE_PATH =
|
||||
INPUT_FILTER =
|
||||
FILTER_SOURCE_FILES = NO
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to source browsing
|
||||
#---------------------------------------------------------------------------
|
||||
SOURCE_BROWSER = YES
|
||||
INLINE_SOURCES = YES
|
||||
STRIP_CODE_COMMENTS = YES
|
||||
REFERENCED_BY_RELATION = YES
|
||||
REFERENCES_RELATION = YES
|
||||
VERBATIM_HEADERS = NO
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the alphabetical class index
|
||||
#---------------------------------------------------------------------------
|
||||
ALPHABETICAL_INDEX = YES
|
||||
COLS_IN_ALPHA_INDEX = 5
|
||||
IGNORE_PREFIX =
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the HTML output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_HTML = YES
|
||||
HTML_OUTPUT = html
|
||||
HTML_FILE_EXTENSION = .html
|
||||
HTML_HEADER =
|
||||
HTML_FOOTER =
|
||||
HTML_STYLESHEET =
|
||||
HTML_ALIGN_MEMBERS = YES
|
||||
GENERATE_HTMLHELP = NO
|
||||
CHM_FILE =
|
||||
HHC_LOCATION =
|
||||
GENERATE_CHI = NO
|
||||
BINARY_TOC = NO
|
||||
TOC_EXPAND = NO
|
||||
DISABLE_INDEX = NO
|
||||
ENUM_VALUES_PER_LINE = 4
|
||||
GENERATE_TREEVIEW = YES
|
||||
TREEVIEW_WIDTH = 250
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the LaTeX output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_LATEX = NO
|
||||
LATEX_OUTPUT = latex
|
||||
LATEX_CMD_NAME = latex
|
||||
MAKEINDEX_CMD_NAME = makeindex
|
||||
COMPACT_LATEX = NO
|
||||
PAPER_TYPE = a4wide
|
||||
EXTRA_PACKAGES =
|
||||
LATEX_HEADER =
|
||||
PDF_HYPERLINKS = NO
|
||||
USE_PDFLATEX = NO
|
||||
LATEX_BATCHMODE = NO
|
||||
LATEX_HIDE_INDICES = NO
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the RTF output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_RTF = NO
|
||||
RTF_OUTPUT = rtf
|
||||
COMPACT_RTF = YES
|
||||
RTF_HYPERLINKS = YES
|
||||
RTF_STYLESHEET_FILE =
|
||||
RTF_EXTENSIONS_FILE =
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the man page output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_MAN = NO
|
||||
MAN_OUTPUT = man
|
||||
MAN_EXTENSION = .3
|
||||
MAN_LINKS = NO
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the XML output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_XML = NO
|
||||
XML_OUTPUT = xml
|
||||
XML_SCHEMA =
|
||||
XML_DTD =
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options for the AutoGen Definitions output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_AUTOGEN_DEF = NO
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the Perl module output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_PERLMOD = NO
|
||||
PERLMOD_LATEX = NO
|
||||
PERLMOD_PRETTY = YES
|
||||
PERLMOD_MAKEVAR_PREFIX =
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to the preprocessor
|
||||
#---------------------------------------------------------------------------
|
||||
ENABLE_PREPROCESSING = NO
|
||||
MACRO_EXPANSION = NO
|
||||
EXPAND_ONLY_PREDEF = NO
|
||||
SEARCH_INCLUDES = YES
|
||||
INCLUDE_PATH = include
|
||||
INCLUDE_FILE_PATTERNS = *.h
|
||||
PREDEFINED =
|
||||
EXPAND_AS_DEFINED =
|
||||
SKIP_FUNCTION_MACROS = YES
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration::addtions related to external references
|
||||
#---------------------------------------------------------------------------
|
||||
TAGFILES =
|
||||
GENERATE_TAGFILE =
|
||||
ALLEXTERNALS = NO
|
||||
EXTERNAL_GROUPS = YES
|
||||
PERL_PATH = /usr/bin/perl
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to the dot tool
|
||||
#---------------------------------------------------------------------------
|
||||
CLASS_DIAGRAMS = YES
|
||||
HIDE_UNDOC_RELATIONS = NO
|
||||
HAVE_DOT = YES
|
||||
CLASS_GRAPH = YES
|
||||
COLLABORATION_GRAPH = YES
|
||||
UML_LOOK = NO
|
||||
TEMPLATE_RELATIONS = NO
|
||||
INCLUDE_GRAPH = YES
|
||||
INCLUDED_BY_GRAPH = YES
|
||||
CALL_GRAPH = YES
|
||||
GRAPHICAL_HIERARCHY = YES
|
||||
DOT_IMAGE_FORMAT = png
|
||||
DOT_PATH =
|
||||
DOTFILE_DIRS =
|
||||
MAX_DOT_GRAPH_WIDTH = 1024
|
||||
MAX_DOT_GRAPH_HEIGHT = 1024
|
||||
MAX_DOT_GRAPH_DEPTH = 0
|
||||
GENERATE_LEGEND = YES
|
||||
DOT_CLEANUP = YES
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration::addtions related to the search engine
|
||||
#---------------------------------------------------------------------------
|
||||
SEARCHENGINE = YES
|
@@ -1,73 +1,31 @@
|
||||
1. Build environment
|
||||
|
||||
To build the system you need either mingw32 installed on Windows or a mingw32
|
||||
cross compiler running on unix. You may obtain MinGW binaries that build
|
||||
ReactOS from http://www.reactos.com.
|
||||
To build the system you need either mingw32 installed on Windows or a
|
||||
mingw32 cross compiler running on unix.
|
||||
|
||||
2. Building
|
||||
|
||||
2. Building ReactOS
|
||||
|
||||
To build from Windows run 'make' (wihout the quotes) from the top directory.
|
||||
To build from unix, edit rules.mak and change the PREFIX variable to the
|
||||
correct value for your cross-compiler. Run 'export HOST=mingw32-linux' to
|
||||
tell the ReactOS build system that it is building ReactOS on a linux machine.
|
||||
Now run 'make'.
|
||||
|
||||
To build from Windows run make. To build from unix, edit rules.mak and change
|
||||
the PREFIX variable to the correct value for your cross-compiler, then run
|
||||
'make'.
|
||||
|
||||
3. Installation
|
||||
|
||||
The system can only be installed on the first partition on the first harddisk.
|
||||
The partition must be formatted as FAT16 or FAT32. The system can only be
|
||||
started from DOS and not from a Windows DOS-prompt.
|
||||
Installation isn't yet automated, sorry. The system can only be installed on
|
||||
the first partition which must be formatted for DOS. Set up a directory
|
||||
structure like the following
|
||||
|
||||
ReactOS can be installed from the source distribution or from the binary
|
||||
distribution. The two ways to install ReactOS are explained below.
|
||||
make directories C:\reactos,C:\reactos\system,C:\reactos\system\drivers
|
||||
|
||||
Copy apps/shell/shell.exe to C:\reactos\system32
|
||||
Copy subsys/smss/smss.exe to C:\reactos\system32
|
||||
Copy services/dd/keyboard/keyboard.sys to C:\reactos\system32\drivers
|
||||
Copy services/dd/blue/blue.sys to C:\reactos\system32\drivers
|
||||
Copy lib/ntdll/ntdll.dll to C:\reactos\system32
|
||||
Copy lib/kernel32/kernel32.dll to C:\reactos\system32
|
||||
Copy lib/crtdll/crtdll.dll to C:\reactos\system32
|
||||
|
||||
3.1 Installation from sources
|
||||
|
||||
To install ReactOS after building it, type 'make install'. This will create
|
||||
the directory 'reactos' in the top directory. Copy this directory to the root
|
||||
of your first partition on your first harddisk. This is usually c:\ on a
|
||||
Windows machine.
|
||||
|
||||
If you don't want to copy the files manually every time you run a 'make install',
|
||||
you can specify the directory where the files are to be copied to during
|
||||
installation.
|
||||
|
||||
In rules.mak find the variable INSTALL_DIR and change the assigned value to the
|
||||
name of the directory where the files are to be copied to. If you are using
|
||||
Windows this could be:
|
||||
|
||||
INSTALL_DIR = c:\reactos
|
||||
|
||||
If you are on linux this could be:
|
||||
|
||||
INSTALL_DIR = /mnt/windows/reactos
|
||||
|
||||
Save the changes to rules.mak and run 'make install' to install the files to
|
||||
the new location. If you don't want to change rules.mak, you can specify the
|
||||
installtion directory when invoking make. Run
|
||||
'make INSTALL_DIR=c:\reactos install' to install to c:\reactos.
|
||||
|
||||
|
||||
3.2 Installation from binany distribution
|
||||
|
||||
To install ReactOS from the binary distribution, extract the archive contents
|
||||
to c:\reactos. Remember to extract the files with full paths.
|
||||
|
||||
|
||||
4. Booting ReactOS
|
||||
|
||||
Startup in DOS mode. 'cd' to c:\reactos and type 'boot' and press <enter>.
|
||||
A simple shell is started where you can use simple commands like 'cd' and 'dir'.
|
||||
|
||||
|
||||
5. Help
|
||||
|
||||
If you run into problems or have suggestions for making ReactOS better, please
|
||||
surf to the address below and subscribe to one or more of the mailing lists.
|
||||
|
||||
http://www.reactos.com/index.php?tab=discussion§ion=lists
|
||||
|
||||
ReactOS Development Team
|
||||
The system can only be started from DOS. Copy the following files,
|
||||
services/dd/ide/ide.sys, services/fs/vfat/vfatfsd.sys and
|
||||
loaders/dos/loadros.com, to a suitable directory. The system can then be
|
||||
booted with the command 'loadros.com ide.sys vfatfsd.sys'.
|
||||
|
@@ -1,5 +0,0 @@
|
||||
# Main jamfile for ReactOS
|
||||
|
||||
SubDir ROS_TOP ;
|
||||
|
||||
SubInclude ROS_TOP Lib ;
|
@@ -1,54 +0,0 @@
|
||||
# customization for ReactOS goes here
|
||||
|
||||
# The SharedLibrary and SharedLibraryFromObjects rules were
|
||||
# borrowed from here:
|
||||
# http://www.differentpla.net/~roger/devel/jam/tutorial/shared_lib/index.html
|
||||
|
||||
SUFSHR = .dll ;
|
||||
RM = rm ; # rm comes with MinGW, and the default del doesn't work in some cases
|
||||
|
||||
rule SharedLibrary
|
||||
{
|
||||
SharedLibraryFromObjects $(<) : $(>:S=$(SUFOBJ)) ;
|
||||
Objects $(>) ;
|
||||
}
|
||||
|
||||
rule SharedLibraryFromObjects
|
||||
{
|
||||
local _s _t ;
|
||||
|
||||
# Add grist to file names
|
||||
# Add suffix to dll
|
||||
|
||||
_s = [ FGristFiles $(>) ] ;
|
||||
_t = [ FAppendSuffix $(<) : $(SUFSHR) ] ;
|
||||
|
||||
if $(_t) != $(<)
|
||||
{
|
||||
DEPENDS $(<) : $(_t) ;
|
||||
NOTFILE $(<) ;
|
||||
}
|
||||
|
||||
# make compiled sources a dependency of target
|
||||
|
||||
DEPENDS exe : $(_t) ;
|
||||
DEPENDS $(_t) : $(_s) ;
|
||||
MakeLocate $(_t) : $(LOCATE_TARGET) ;
|
||||
|
||||
Clean clean : $(_t) ;
|
||||
|
||||
Link $(_t) : $(_s) ;
|
||||
}
|
||||
|
||||
# nasm needs to know the output file first, or it doesn't
|
||||
# recognize -I :(
|
||||
actions As
|
||||
{
|
||||
$(AS) -o $(<) $(ASFLAGS) -I$(HDRS) $(>)
|
||||
}
|
||||
|
||||
AS = nasm ;
|
||||
|
||||
# why isn't DEFINES working? :(
|
||||
#DEFINES += _M_IX86 ;
|
||||
CCFLAGS += -D_M_IX86 ;
|
504
reactos/LGPL.txt
504
reactos/LGPL.txt
@@ -1,504 +0,0 @@
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
Version 2.1, February 1999
|
||||
|
||||
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
|
||||
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
[This is the first released version of the Lesser GPL. It also counts
|
||||
as the successor of the GNU Library Public License, version 2, hence
|
||||
the version number 2.1.]
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
Licenses are intended to guarantee your freedom to share and change
|
||||
free software--to make sure the software is free for all its users.
|
||||
|
||||
This license, the Lesser General Public License, applies to some
|
||||
specially designated software packages--typically libraries--of the
|
||||
Free Software Foundation and other authors who decide to use it. You
|
||||
can use it too, but we suggest you first think carefully about whether
|
||||
this license or the ordinary General Public License is the better
|
||||
strategy to use in any particular case, based on the explanations below.
|
||||
|
||||
When we speak of free software, we are referring to freedom of use,
|
||||
not price. Our General Public Licenses are designed to make sure that
|
||||
you have the freedom to distribute copies of free software (and charge
|
||||
for this service if you wish); that you receive source code or can get
|
||||
it if you want it; that you can change the software and use pieces of
|
||||
it in new free programs; and that you are informed that you can do
|
||||
these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
distributors to deny you these rights or to ask you to surrender these
|
||||
rights. These restrictions translate to certain responsibilities for
|
||||
you if you distribute copies of the library or if you modify it.
|
||||
|
||||
For example, if you distribute copies of the library, whether gratis
|
||||
or for a fee, you must give the recipients all the rights that we gave
|
||||
you. You must make sure that they, too, receive or can get the source
|
||||
code. If you link other code with the library, you must provide
|
||||
complete object files to the recipients, so that they can relink them
|
||||
with the library after making changes to the library and recompiling
|
||||
it. And you must show them these terms so they know their rights.
|
||||
|
||||
We protect your rights with a two-step method: (1) we copyright the
|
||||
library, and (2) we offer you this license, which gives you legal
|
||||
permission to copy, distribute and/or modify the library.
|
||||
|
||||
To protect each distributor, we want to make it very clear that
|
||||
there is no warranty for the free library. Also, if the library is
|
||||
modified by someone else and passed on, the recipients should know
|
||||
that what they have is not the original version, so that the original
|
||||
author's reputation will not be affected by problems that might be
|
||||
introduced by others.
|
||||
|
||||
Finally, software patents pose a constant threat to the existence of
|
||||
any free program. We wish to make sure that a company cannot
|
||||
effectively restrict the users of a free program by obtaining a
|
||||
restrictive license from a patent holder. Therefore, we insist that
|
||||
any patent license obtained for a version of the library must be
|
||||
consistent with the full freedom of use specified in this license.
|
||||
|
||||
Most GNU software, including some libraries, is covered by the
|
||||
ordinary GNU General Public License. This license, the GNU Lesser
|
||||
General Public License, applies to certain designated libraries, and
|
||||
is quite different from the ordinary General Public License. We use
|
||||
this license for certain libraries in order to permit linking those
|
||||
libraries into non-free programs.
|
||||
|
||||
When a program is linked with a library, whether statically or using
|
||||
a shared library, the combination of the two is legally speaking a
|
||||
combined work, a derivative of the original library. The ordinary
|
||||
General Public License therefore permits such linking only if the
|
||||
entire combination fits its criteria of freedom. The Lesser General
|
||||
Public License permits more lax criteria for linking other code with
|
||||
the library.
|
||||
|
||||
We call this license the "Lesser" General Public License because it
|
||||
does Less to protect the user's freedom than the ordinary General
|
||||
Public License. It also provides other free software developers Less
|
||||
of an advantage over competing non-free programs. These disadvantages
|
||||
are the reason we use the ordinary General Public License for many
|
||||
libraries. However, the Lesser license provides advantages in certain
|
||||
special circumstances.
|
||||
|
||||
For example, on rare occasions, there may be a special need to
|
||||
encourage the widest possible use of a certain library, so that it becomes
|
||||
a de-facto standard. To achieve this, non-free programs must be
|
||||
allowed to use the library. A more frequent case is that a free
|
||||
library does the same job as widely used non-free libraries. In this
|
||||
case, there is little to gain by limiting the free library to free
|
||||
software only, so we use the Lesser General Public License.
|
||||
|
||||
In other cases, permission to use a particular library in non-free
|
||||
programs enables a greater number of people to use a large body of
|
||||
free software. For example, permission to use the GNU C Library in
|
||||
non-free programs enables many more people to use the whole GNU
|
||||
operating system, as well as its variant, the GNU/Linux operating
|
||||
system.
|
||||
|
||||
Although the Lesser General Public License is Less protective of the
|
||||
users' freedom, it does ensure that the user of a program that is
|
||||
linked with the Library has the freedom and the wherewithal to run
|
||||
that program using a modified version of the Library.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow. Pay close attention to the difference between a
|
||||
"work based on the library" and a "work that uses the library". The
|
||||
former contains code derived from the library, whereas the latter must
|
||||
be combined with the library in order to run.
|
||||
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License Agreement applies to any software library or other
|
||||
program which contains a notice placed by the copyright holder or
|
||||
other authorized party saying it may be distributed under the terms of
|
||||
this Lesser General Public License (also called "this License").
|
||||
Each licensee is addressed as "you".
|
||||
|
||||
A "library" means a collection of software functions and/or data
|
||||
prepared so as to be conveniently linked with application programs
|
||||
(which use some of those functions and data) to form executables.
|
||||
|
||||
The "Library", below, refers to any such software library or work
|
||||
which has been distributed under these terms. A "work based on the
|
||||
Library" means either the Library or any derivative work under
|
||||
copyright law: that is to say, a work containing the Library or a
|
||||
portion of it, either verbatim or with modifications and/or translated
|
||||
straightforwardly into another language. (Hereinafter, translation is
|
||||
included without limitation in the term "modification".)
|
||||
|
||||
"Source code" for a work means the preferred form of the work for
|
||||
making modifications to it. For a library, complete source code means
|
||||
all the source code for all modules it contains, plus any associated
|
||||
interface definition files, plus the scripts used to control compilation
|
||||
and installation of the library.
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running a program using the Library is not restricted, and output from
|
||||
such a program is covered only if its contents constitute a work based
|
||||
on the Library (independent of the use of the Library in a tool for
|
||||
writing it). Whether that is true depends on what the Library does
|
||||
and what the program that uses the Library does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Library's
|
||||
complete source code as you receive it, in any medium, provided that
|
||||
you conspicuously and appropriately publish on each copy an
|
||||
appropriate copyright notice and disclaimer of warranty; keep intact
|
||||
all the notices that refer to this License and to the absence of any
|
||||
warranty; and distribute a copy of this License along with the
|
||||
Library.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy,
|
||||
and you may at your option offer warranty protection in exchange for a
|
||||
fee.
|
||||
|
||||
2. You may modify your copy or copies of the Library or any portion
|
||||
of it, thus forming a work based on the Library, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) The modified work must itself be a software library.
|
||||
|
||||
b) You must cause the files modified to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
c) You must cause the whole of the work to be licensed at no
|
||||
charge to all third parties under the terms of this License.
|
||||
|
||||
d) If a facility in the modified Library refers to a function or a
|
||||
table of data to be supplied by an application program that uses
|
||||
the facility, other than as an argument passed when the facility
|
||||
is invoked, then you must make a good faith effort to ensure that,
|
||||
in the event an application does not supply such function or
|
||||
table, the facility still operates, and performs whatever part of
|
||||
its purpose remains meaningful.
|
||||
|
||||
(For example, a function in a library to compute square roots has
|
||||
a purpose that is entirely well-defined independent of the
|
||||
application. Therefore, Subsection 2d requires that any
|
||||
application-supplied function or table used by this function must
|
||||
be optional: if the application does not supply it, the square
|
||||
root function must still compute square roots.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Library,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Library, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote
|
||||
it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Library.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Library
|
||||
with the Library (or with a work based on the Library) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may opt to apply the terms of the ordinary GNU General Public
|
||||
License instead of this License to a given copy of the Library. To do
|
||||
this, you must alter all the notices that refer to this License, so
|
||||
that they refer to the ordinary GNU General Public License, version 2,
|
||||
instead of to this License. (If a newer version than version 2 of the
|
||||
ordinary GNU General Public License has appeared, then you can specify
|
||||
that version instead if you wish.) Do not make any other change in
|
||||
these notices.
|
||||
|
||||
Once this change is made in a given copy, it is irreversible for
|
||||
that copy, so the ordinary GNU General Public License applies to all
|
||||
subsequent copies and derivative works made from that copy.
|
||||
|
||||
This option is useful when you wish to copy part of the code of
|
||||
the Library into a program that is not a library.
|
||||
|
||||
4. You may copy and distribute the Library (or a portion or
|
||||
derivative of it, under Section 2) in object code or executable form
|
||||
under the terms of Sections 1 and 2 above provided that you accompany
|
||||
it with the complete corresponding machine-readable source code, which
|
||||
must be distributed under the terms of Sections 1 and 2 above on a
|
||||
medium customarily used for software interchange.
|
||||
|
||||
If distribution of object code is made by offering access to copy
|
||||
from a designated place, then offering equivalent access to copy the
|
||||
source code from the same place satisfies the requirement to
|
||||
distribute the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
5. A program that contains no derivative of any portion of the
|
||||
Library, but is designed to work with the Library by being compiled or
|
||||
linked with it, is called a "work that uses the Library". Such a
|
||||
work, in isolation, is not a derivative work of the Library, and
|
||||
therefore falls outside the scope of this License.
|
||||
|
||||
However, linking a "work that uses the Library" with the Library
|
||||
creates an executable that is a derivative of the Library (because it
|
||||
contains portions of the Library), rather than a "work that uses the
|
||||
library". The executable is therefore covered by this License.
|
||||
Section 6 states terms for distribution of such executables.
|
||||
|
||||
When a "work that uses the Library" uses material from a header file
|
||||
that is part of the Library, the object code for the work may be a
|
||||
derivative work of the Library even though the source code is not.
|
||||
Whether this is true is especially significant if the work can be
|
||||
linked without the Library, or if the work is itself a library. The
|
||||
threshold for this to be true is not precisely defined by law.
|
||||
|
||||
If such an object file uses only numerical parameters, data
|
||||
structure layouts and accessors, and small macros and small inline
|
||||
functions (ten lines or less in length), then the use of the object
|
||||
file is unrestricted, regardless of whether it is legally a derivative
|
||||
work. (Executables containing this object code plus portions of the
|
||||
Library will still fall under Section 6.)
|
||||
|
||||
Otherwise, if the work is a derivative of the Library, you may
|
||||
distribute the object code for the work under the terms of Section 6.
|
||||
Any executables containing that work also fall under Section 6,
|
||||
whether or not they are linked directly with the Library itself.
|
||||
|
||||
6. As an exception to the Sections above, you may also combine or
|
||||
link a "work that uses the Library" with the Library to produce a
|
||||
work containing portions of the Library, and distribute that work
|
||||
under terms of your choice, provided that the terms permit
|
||||
modification of the work for the customer's own use and reverse
|
||||
engineering for debugging such modifications.
|
||||
|
||||
You must give prominent notice with each copy of the work that the
|
||||
Library is used in it and that the Library and its use are covered by
|
||||
this License. You must supply a copy of this License. If the work
|
||||
during execution displays copyright notices, you must include the
|
||||
copyright notice for the Library among them, as well as a reference
|
||||
directing the user to the copy of this License. Also, you must do one
|
||||
of these things:
|
||||
|
||||
a) Accompany the work with the complete corresponding
|
||||
machine-readable source code for the Library including whatever
|
||||
changes were used in the work (which must be distributed under
|
||||
Sections 1 and 2 above); and, if the work is an executable linked
|
||||
with the Library, with the complete machine-readable "work that
|
||||
uses the Library", as object code and/or source code, so that the
|
||||
user can modify the Library and then relink to produce a modified
|
||||
executable containing the modified Library. (It is understood
|
||||
that the user who changes the contents of definitions files in the
|
||||
Library will not necessarily be able to recompile the application
|
||||
to use the modified definitions.)
|
||||
|
||||
b) Use a suitable shared library mechanism for linking with the
|
||||
Library. A suitable mechanism is one that (1) uses at run time a
|
||||
copy of the library already present on the user's computer system,
|
||||
rather than copying library functions into the executable, and (2)
|
||||
will operate properly with a modified version of the library, if
|
||||
the user installs one, as long as the modified version is
|
||||
interface-compatible with the version that the work was made with.
|
||||
|
||||
c) Accompany the work with a written offer, valid for at
|
||||
least three years, to give the same user the materials
|
||||
specified in Subsection 6a, above, for a charge no more
|
||||
than the cost of performing this distribution.
|
||||
|
||||
d) If distribution of the work is made by offering access to copy
|
||||
from a designated place, offer equivalent access to copy the above
|
||||
specified materials from the same place.
|
||||
|
||||
e) Verify that the user has already received a copy of these
|
||||
materials or that you have already sent this user a copy.
|
||||
|
||||
For an executable, the required form of the "work that uses the
|
||||
Library" must include any data and utility programs needed for
|
||||
reproducing the executable from it. However, as a special exception,
|
||||
the materials to be distributed need not include anything that is
|
||||
normally distributed (in either source or binary form) with the major
|
||||
components (compiler, kernel, and so on) of the operating system on
|
||||
which the executable runs, unless that component itself accompanies
|
||||
the executable.
|
||||
|
||||
It may happen that this requirement contradicts the license
|
||||
restrictions of other proprietary libraries that do not normally
|
||||
accompany the operating system. Such a contradiction means you cannot
|
||||
use both them and the Library together in an executable that you
|
||||
distribute.
|
||||
|
||||
7. You may place library facilities that are a work based on the
|
||||
Library side-by-side in a single library together with other library
|
||||
facilities not covered by this License, and distribute such a combined
|
||||
library, provided that the separate distribution of the work based on
|
||||
the Library and of the other library facilities is otherwise
|
||||
permitted, and provided that you do these two things:
|
||||
|
||||
a) Accompany the combined library with a copy of the same work
|
||||
based on the Library, uncombined with any other library
|
||||
facilities. This must be distributed under the terms of the
|
||||
Sections above.
|
||||
|
||||
b) Give prominent notice with the combined library of the fact
|
||||
that part of it is a work based on the Library, and explaining
|
||||
where to find the accompanying uncombined form of the same work.
|
||||
|
||||
8. You may not copy, modify, sublicense, link with, or distribute
|
||||
the Library except as expressly provided under this License. Any
|
||||
attempt otherwise to copy, modify, sublicense, link with, or
|
||||
distribute the Library is void, and will automatically terminate your
|
||||
rights under this License. However, parties who have received copies,
|
||||
or rights, from you under this License will not have their licenses
|
||||
terminated so long as such parties remain in full compliance.
|
||||
|
||||
9. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Library or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Library (or any work based on the
|
||||
Library), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Library or works based on it.
|
||||
|
||||
10. Each time you redistribute the Library (or any work based on the
|
||||
Library), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute, link with or modify the Library
|
||||
subject to these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties with
|
||||
this License.
|
||||
|
||||
11. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Library at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Library by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Library.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under any
|
||||
particular circumstance, the balance of the section is intended to apply,
|
||||
and the section as a whole is intended to apply in other circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
12. If the distribution and/or use of the Library is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Library under this License may add
|
||||
an explicit geographical distribution limitation excluding those countries,
|
||||
so that distribution is permitted only in or among countries not thus
|
||||
excluded. In such case, this License incorporates the limitation as if
|
||||
written in the body of this License.
|
||||
|
||||
13. The Free Software Foundation may publish revised and/or new
|
||||
versions of the Lesser General Public License from time to time.
|
||||
Such new versions will be similar in spirit to the present version,
|
||||
but may differ in detail to address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Library
|
||||
specifies a version number of this License which applies to it and
|
||||
"any later version", you have the option of following the terms and
|
||||
conditions either of that version or of any later version published by
|
||||
the Free Software Foundation. If the Library does not specify a
|
||||
license version number, you may choose any version ever published by
|
||||
the Free Software Foundation.
|
||||
|
||||
14. If you wish to incorporate parts of the Library into other free
|
||||
programs whose distribution conditions are incompatible with these,
|
||||
write to the author to ask for permission. For software which is
|
||||
copyrighted by the Free Software Foundation, write to the Free
|
||||
Software Foundation; we sometimes make exceptions for this. Our
|
||||
decision will be guided by the two goals of preserving the free status
|
||||
of all derivatives of our free software and of promoting the sharing
|
||||
and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
|
||||
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
|
||||
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
|
||||
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
|
||||
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
|
||||
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
|
||||
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
|
||||
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
|
||||
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
|
||||
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
|
||||
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
|
||||
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
|
||||
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
|
||||
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
|
||||
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
||||
DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Libraries
|
||||
|
||||
If you develop a new library, and you want it to be of the greatest
|
||||
possible use to the public, we recommend making it free software that
|
||||
everyone can redistribute and change. You can do so by permitting
|
||||
redistribution under these terms (or, alternatively, under the terms of the
|
||||
ordinary General Public License).
|
||||
|
||||
To apply these terms, attach the following notices to the library. It is
|
||||
safest to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least the
|
||||
"copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the library's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library 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
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the library, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the
|
||||
library `Frob' (a library for tweaking knobs) written by James Random Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1990
|
||||
Ty Coon, President of Vice
|
||||
|
||||
That's all there is to it!
|
||||
|
||||
|
1129
reactos/Makefile
1129
reactos/Makefile
File diff suppressed because it is too large
Load Diff
15
reactos/NEWS
Normal file
15
reactos/NEWS
Normal file
@@ -0,0 +1,15 @@
|
||||
0.0.14: Converted to PE format
|
||||
All system libraries are now dlls
|
||||
|
||||
0.0.13: Mostly bugfixes (I think)
|
||||
|
||||
0.0.12: Added support for multiple processes (not really tested)
|
||||
System calls
|
||||
kernel32 now compiles (only as a static library)
|
||||
Fixed invalid tss bug (hopefully)
|
||||
Added section support
|
||||
Added some of the ZwxxxVirtual calls
|
||||
Added prototype caching functions (only the Minix fsd actually
|
||||
uses them)
|
||||
Added handle access and type checking
|
||||
Prototype APC implementation (no support for user APCs)
|
@@ -1,21 +1,13 @@
|
||||
========================
|
||||
ReactOS Version 0.2.x
|
||||
Updated June 23rd, 2004
|
||||
========================
|
||||
About Reactos
|
||||
|
||||
1. What is ReactOS?
|
||||
1. What is Reactos
|
||||
|
||||
ReactOS is an Open Source effort to develop a quality operating system
|
||||
that is compatible with Windows NT applications and drivers.
|
||||
A project aiming to make an approximate clone of Windows NT, compatible
|
||||
with most Windows applications.
|
||||
|
||||
The ReactOS project, although currently focused on Windows NT 4.0
|
||||
compatibility, is always keeping an eye towards compatibility with
|
||||
future Windows NT releases, that is, Windows 2000 (NT 5.0) and
|
||||
Windows XP (NT 5.1).
|
||||
The project has a website at http://www.reactos.com/
|
||||
|
||||
More information is available at http://www.reactos.com.
|
||||
|
||||
2. Building ReactOS
|
||||
2. Building Reactos
|
||||
|
||||
See the INSTALL file for more details.
|
||||
|
||||
@@ -25,4 +17,8 @@ See the doc subdirectory for some sparse notes
|
||||
|
||||
4. Who is responsible
|
||||
|
||||
See the CREDITS file
|
||||
See the CREDITS file
|
||||
|
||||
5. Recent developments
|
||||
|
||||
See the NEWS file
|
||||
|
@@ -1,33 +0,0 @@
|
||||
; Format:
|
||||
; COMPONENT_NAME PATH_TO_COMPONENT_SOURCES
|
||||
; COMPONENT_NAME - Name of the component. Eg. kernel32.dll.
|
||||
; PATH_TO_COMPONENT_SOURCES - Relative path to sources (relative to
|
||||
; where rgenstat is run from).
|
||||
advapi32.dll reactos/lib/advapi32
|
||||
crtdll.dll reactos/lib/crtdll
|
||||
gdi32.dll reactos/lib/gdi32
|
||||
gdiplus.dll reactos/lib/gdiplus
|
||||
iphlpapi.dll reactos/lib/iphlpapi
|
||||
kernel32.dll reactos/lib/kernel32
|
||||
lz32.dll reactos/lib/lzexpand
|
||||
msvcrt.dll reactos/lib/msvcrt
|
||||
ole32.dll reactos/lib/ole32
|
||||
oleaut32.dll reactos/lib/oleaut32
|
||||
rpcrt4.dll reactos/lib/rpcrt4
|
||||
secur32.dll reactos/lib/secur32
|
||||
shell32.dll reactos/lib/shell32
|
||||
snmpapi.dll reactos/lib/snmpapi
|
||||
user32.dll reactos/lib/user32
|
||||
version.dll reactos/lib/version
|
||||
winmm.dll reactos/lib/winmm
|
||||
winspool.dll reactos/lib/winspool
|
||||
ws2_32.dll reactos/lib/ws2_32
|
||||
wsock32.dll reactos/lib/wsock32
|
||||
videoprt.dll reactos/drivers/video/videoprt
|
||||
ndis.sys reactos/drivers/net/ndis
|
||||
tdi.sys reactos/drivers/net/tdi
|
||||
class2.sys reactos/drivers/storage/class2
|
||||
scsiport.sys reactos/drivers/storage/scsiport
|
||||
ntoskrnl.exe reactos/ntoskrnl
|
||||
ntoskrnl.exe reactos/lib/rtl
|
||||
win32k.sys reactos/subsys/win32k
|
@@ -1,207 +0,0 @@
|
||||
# Doxyfile 1.3.5
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# Project related configuration options
|
||||
#---------------------------------------------------------------------------
|
||||
PROJECT_NAME = "ReactOS Apps & Tools"
|
||||
PROJECT_NUMBER =
|
||||
OUTPUT_DIRECTORY = doxy-doc
|
||||
OUTPUT_LANGUAGE = English
|
||||
USE_WINDOWS_ENCODING = YES
|
||||
BRIEF_MEMBER_DESC = YES
|
||||
REPEAT_BRIEF = YES
|
||||
ALWAYS_DETAILED_SEC = NO
|
||||
INLINE_INHERITED_MEMB = NO
|
||||
FULL_PATH_NAMES = YES
|
||||
STRIP_FROM_PATH = ..
|
||||
SHORT_NAMES = NO
|
||||
JAVADOC_AUTOBRIEF = YES
|
||||
MULTILINE_CPP_IS_BRIEF = NO
|
||||
DETAILS_AT_TOP = NO
|
||||
INHERIT_DOCS = NO
|
||||
DISTRIBUTE_GROUP_DOC = NO
|
||||
TAB_SIZE = 8
|
||||
ALIASES =
|
||||
OPTIMIZE_OUTPUT_FOR_C = YES
|
||||
OPTIMIZE_OUTPUT_JAVA = NO
|
||||
SUBGROUPING = YES
|
||||
#---------------------------------------------------------------------------
|
||||
# Build related configuration options
|
||||
#---------------------------------------------------------------------------
|
||||
EXTRACT_ALL = YES
|
||||
EXTRACT_PRIVATE = NO
|
||||
EXTRACT_STATIC = NO
|
||||
EXTRACT_LOCAL_CLASSES = NO
|
||||
HIDE_UNDOC_MEMBERS = NO
|
||||
HIDE_UNDOC_CLASSES = NO
|
||||
HIDE_FRIEND_COMPOUNDS = NO
|
||||
HIDE_IN_BODY_DOCS = NO
|
||||
INTERNAL_DOCS = YES
|
||||
CASE_SENSE_NAMES = YES
|
||||
HIDE_SCOPE_NAMES = NO
|
||||
SHOW_INCLUDE_FILES = YES
|
||||
INLINE_INFO = YES
|
||||
SORT_MEMBER_DOCS = YES
|
||||
GENERATE_TODOLIST = YES
|
||||
GENERATE_TESTLIST = YES
|
||||
GENERATE_BUGLIST = YES
|
||||
GENERATE_DEPRECATEDLIST= YES
|
||||
ENABLED_SECTIONS =
|
||||
MAX_INITIALIZER_LINES = 30
|
||||
SHOW_USED_FILES = YES
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to warning and progress messages
|
||||
#---------------------------------------------------------------------------
|
||||
QUIET = NO
|
||||
WARNINGS = NO
|
||||
WARN_IF_UNDOCUMENTED = NO
|
||||
WARN_IF_DOC_ERROR = YES
|
||||
WARN_FORMAT = "$file:$line: $text"
|
||||
WARN_LOGFILE =
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the input files
|
||||
#---------------------------------------------------------------------------
|
||||
INPUT = . \
|
||||
../tools
|
||||
FILE_PATTERNS = *.c \
|
||||
*.h
|
||||
RECURSIVE = YES
|
||||
EXCLUDE =
|
||||
EXCLUDE_SYMLINKS = NO
|
||||
EXCLUDE_PATTERNS =
|
||||
EXAMPLE_PATH =
|
||||
EXAMPLE_PATTERNS =
|
||||
EXAMPLE_RECURSIVE = YES
|
||||
IMAGE_PATH =
|
||||
INPUT_FILTER =
|
||||
FILTER_SOURCE_FILES = NO
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to source browsing
|
||||
#---------------------------------------------------------------------------
|
||||
SOURCE_BROWSER = YES
|
||||
INLINE_SOURCES = YES
|
||||
STRIP_CODE_COMMENTS = YES
|
||||
REFERENCED_BY_RELATION = YES
|
||||
REFERENCES_RELATION = YES
|
||||
VERBATIM_HEADERS = NO
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the alphabetical class index
|
||||
#---------------------------------------------------------------------------
|
||||
ALPHABETICAL_INDEX = YES
|
||||
COLS_IN_ALPHA_INDEX = 5
|
||||
IGNORE_PREFIX =
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the HTML output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_HTML = YES
|
||||
HTML_OUTPUT = html
|
||||
HTML_FILE_EXTENSION = .html
|
||||
HTML_HEADER =
|
||||
HTML_FOOTER =
|
||||
HTML_STYLESHEET =
|
||||
HTML_ALIGN_MEMBERS = YES
|
||||
GENERATE_HTMLHELP = NO
|
||||
CHM_FILE =
|
||||
HHC_LOCATION =
|
||||
GENERATE_CHI = NO
|
||||
BINARY_TOC = NO
|
||||
TOC_EXPAND = NO
|
||||
DISABLE_INDEX = NO
|
||||
ENUM_VALUES_PER_LINE = 4
|
||||
GENERATE_TREEVIEW = YES
|
||||
TREEVIEW_WIDTH = 200
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the LaTeX output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_LATEX = NO
|
||||
LATEX_OUTPUT = latex
|
||||
LATEX_CMD_NAME = latex
|
||||
MAKEINDEX_CMD_NAME = makeindex
|
||||
COMPACT_LATEX = NO
|
||||
PAPER_TYPE = a4wide
|
||||
EXTRA_PACKAGES =
|
||||
LATEX_HEADER =
|
||||
PDF_HYPERLINKS = NO
|
||||
USE_PDFLATEX = NO
|
||||
LATEX_BATCHMODE = NO
|
||||
LATEX_HIDE_INDICES = NO
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the RTF output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_RTF = NO
|
||||
RTF_OUTPUT = rtf
|
||||
COMPACT_RTF = YES
|
||||
RTF_HYPERLINKS = YES
|
||||
RTF_STYLESHEET_FILE =
|
||||
RTF_EXTENSIONS_FILE =
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the man page output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_MAN = NO
|
||||
MAN_OUTPUT = man
|
||||
MAN_EXTENSION = .3
|
||||
MAN_LINKS = NO
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the XML output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_XML = NO
|
||||
XML_OUTPUT = xml
|
||||
XML_SCHEMA =
|
||||
XML_DTD =
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options for the AutoGen Definitions output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_AUTOGEN_DEF = NO
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the Perl module output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_PERLMOD = NO
|
||||
PERLMOD_LATEX = NO
|
||||
PERLMOD_PRETTY = YES
|
||||
PERLMOD_MAKEVAR_PREFIX =
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to the preprocessor
|
||||
#---------------------------------------------------------------------------
|
||||
ENABLE_PREPROCESSING = NO
|
||||
MACRO_EXPANSION = NO
|
||||
EXPAND_ONLY_PREDEF = NO
|
||||
SEARCH_INCLUDES = YES
|
||||
INCLUDE_PATH = ../include
|
||||
INCLUDE_FILE_PATTERNS = *.h
|
||||
PREDEFINED =
|
||||
EXPAND_AS_DEFINED =
|
||||
SKIP_FUNCTION_MACROS = YES
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration::addtions related to external references
|
||||
#---------------------------------------------------------------------------
|
||||
TAGFILES =
|
||||
GENERATE_TAGFILE =
|
||||
ALLEXTERNALS = NO
|
||||
EXTERNAL_GROUPS = YES
|
||||
PERL_PATH = /usr/bin/perl
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to the dot tool
|
||||
#---------------------------------------------------------------------------
|
||||
CLASS_DIAGRAMS = YES
|
||||
HIDE_UNDOC_RELATIONS = NO
|
||||
HAVE_DOT = YES
|
||||
CLASS_GRAPH = YES
|
||||
COLLABORATION_GRAPH = YES
|
||||
UML_LOOK = NO
|
||||
TEMPLATE_RELATIONS = NO
|
||||
INCLUDE_GRAPH = YES
|
||||
INCLUDED_BY_GRAPH = YES
|
||||
CALL_GRAPH = YES
|
||||
GRAPHICAL_HIERARCHY = YES
|
||||
DOT_IMAGE_FORMAT = png
|
||||
DOT_PATH =
|
||||
DOTFILE_DIRS =
|
||||
MAX_DOT_GRAPH_WIDTH = 1024
|
||||
MAX_DOT_GRAPH_HEIGHT = 1024
|
||||
MAX_DOT_GRAPH_DEPTH = 0
|
||||
GENERATE_LEGEND = YES
|
||||
DOT_CLEANUP = YES
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration::addtions related to the search engine
|
||||
#---------------------------------------------------------------------------
|
||||
SEARCHENGINE = YES
|
@@ -1,13 +0,0 @@
|
||||
# $Id$
|
||||
#
|
||||
# ReactOS apps and tools makefile to generate Doxygen documentation
|
||||
#
|
||||
|
||||
|
||||
docu:
|
||||
doxygen Doxyfile
|
||||
|
||||
.PHONY: docu
|
||||
|
||||
|
||||
# EOF
|
33
reactos/apps/common/crt0.c
Normal file
33
reactos/apps/common/crt0.c
Normal file
@@ -0,0 +1,33 @@
|
||||
#include <windows.h>
|
||||
|
||||
extern int main(int args, char* argv[], char* environ[]);
|
||||
|
||||
static unsigned int _argc = 0;
|
||||
static char** _argv = NULL;
|
||||
static char** _environ = NULL;
|
||||
|
||||
int mainCRTStartup(PWSTR args)
|
||||
{
|
||||
int nRet;
|
||||
|
||||
// SetUnhandledExceptionFilter(NULL);
|
||||
|
||||
// _fpreset();
|
||||
|
||||
// __GetMainArgs(&_argc, &_argv, &_environ, 0);
|
||||
|
||||
nRet = main(_argc, _argv, _environ);
|
||||
|
||||
// _cexit();
|
||||
|
||||
ExitProcess(nRet);
|
||||
}
|
||||
|
||||
int WinMainCRTStartup()
|
||||
{
|
||||
return mainCRTStartup(NULL);
|
||||
}
|
||||
|
||||
void __main(void)
|
||||
{
|
||||
}
|
97
reactos/apps/tests/apc/apc.c
Normal file
97
reactos/apps/tests/apc/apc.c
Normal file
@@ -0,0 +1,97 @@
|
||||
#include <ddk/ntddk.h>
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
HANDLE OutputHandle;
|
||||
HANDLE InputHandle;
|
||||
|
||||
void debug_printf(char* fmt, ...)
|
||||
{
|
||||
va_list args;
|
||||
char buffer[255];
|
||||
|
||||
va_start(args,fmt);
|
||||
vsprintf(buffer,fmt,args);
|
||||
WriteConsoleA(OutputHandle, buffer, strlen(buffer), NULL, NULL);
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
VOID STDCALL ApcRoutine(PVOID Context,
|
||||
PIO_STATUS_BLOCK IoStatus,
|
||||
ULONG Reserved)
|
||||
{
|
||||
printf("(apc.exe) ApcRoutine(Context %x)\n", Context);
|
||||
}
|
||||
|
||||
void main(int argc, char* argv[])
|
||||
{
|
||||
int i;
|
||||
NTSTATUS Status;
|
||||
HANDLE FileHandle;
|
||||
OBJECT_ATTRIBUTES ObjectAttributes;
|
||||
UNICODE_STRING FileName;
|
||||
IO_STATUS_BLOCK IoStatus;
|
||||
CHAR Buffer[256];
|
||||
HANDLE EventHandle;
|
||||
|
||||
AllocConsole();
|
||||
InputHandle = GetStdHandle(STD_INPUT_HANDLE);
|
||||
OutputHandle = GetStdHandle(STD_OUTPUT_HANDLE);
|
||||
|
||||
printf("APC test program\n");
|
||||
|
||||
EventHandle = CreateEventW(NULL,
|
||||
FALSE,
|
||||
FALSE,
|
||||
NULL);
|
||||
if (EventHandle == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
printf("Failed to create event\n");
|
||||
return;
|
||||
}
|
||||
|
||||
printf("Opening file\n");
|
||||
RtlInitUnicodeString(&FileName,
|
||||
L"\\C:\\a.txt");
|
||||
InitializeObjectAttributes(&ObjectAttributes,
|
||||
&FileName,
|
||||
0,
|
||||
NULL,
|
||||
NULL);
|
||||
|
||||
printf("Creating file\n");
|
||||
FileHandle = CreateFileW(L"C:\\a.txt",
|
||||
FILE_GENERIC_READ | FILE_GENERIC_WRITE,
|
||||
0,
|
||||
NULL,
|
||||
OPEN_EXISTING,
|
||||
FILE_FLAG_OVERLAPPED,
|
||||
NULL);
|
||||
if (FileHandle == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
printf("Open failed\n");
|
||||
return;
|
||||
}
|
||||
printf("Reading file\n");
|
||||
Status = ZwReadFile(FileHandle,
|
||||
NULL,
|
||||
ApcRoutine,
|
||||
0xdeadbeef,
|
||||
&IoStatus,
|
||||
Buffer,
|
||||
256,
|
||||
NULL,
|
||||
NULL);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
printf("Read failed\n");
|
||||
}
|
||||
printf("Waiting\n");
|
||||
WaitForSingleObjectEx(EventHandle, INFINITE, TRUE);
|
||||
printf("Returned from wait\n");
|
||||
ZwClose(FileHandle);
|
||||
printf("Program finished\n");
|
||||
for(;;);
|
||||
}
|
||||
|
44
reactos/apps/tests/apc/makefile
Normal file
44
reactos/apps/tests/apc/makefile
Normal file
@@ -0,0 +1,44 @@
|
||||
#
|
||||
#
|
||||
#
|
||||
OBJECTS= ../common/crt0.o apc.o
|
||||
PROGS= apc.exe
|
||||
|
||||
BASE_CFLAGS = -I../../include
|
||||
LIBS = ../../lib/crtdll/crtdll.a ../../lib/kernel32/kernel32.a \
|
||||
../../lib/ntdll/ntdll.a
|
||||
|
||||
all: $(PROGS)
|
||||
|
||||
.phony: all
|
||||
|
||||
clean:
|
||||
- $(RM) apc.o
|
||||
- $(RM) apc.exe
|
||||
- $(RM) apc.sym
|
||||
|
||||
.phony: clean
|
||||
|
||||
floppy: $(PROGS:%=$(FLOPPY_DIR)/apps/%)
|
||||
|
||||
$(PROGS:%=$(FLOPPY_DIR)/apps/%): $(FLOPPY_DIR)/apps/%: %
|
||||
ifeq ($(DOSCLI),yes)
|
||||
$(CP) $* $(FLOPPY_DIR)\apps\$*
|
||||
else
|
||||
$(CP) $* $(FLOPPY_DIR)/apps/$*
|
||||
endif
|
||||
|
||||
dist: $(PROGS:%=../../$(DIST_DIR)/apps/%)
|
||||
|
||||
$(PROGS:%=../../$(DIST_DIR)/apps/%): ../../$(DIST_DIR)/apps/%: %
|
||||
ifeq ($(DOSCLI),yes)
|
||||
$(CP) $* ..\..\$(DIST_DIR)\apps\$*
|
||||
else
|
||||
$(CP) $* ../../$(DIST_DIR)/apps/$*
|
||||
endif
|
||||
|
||||
apc.exe: $(OBJECTS) $(LIBS)
|
||||
$(LD) $(OBJECTS) $(LIBS) -o apc.exe
|
||||
$(NM) --numeric-sort apc.exe > apc.sym
|
||||
|
||||
include ../../rules.mak
|
39
reactos/apps/tests/args/args.c
Normal file
39
reactos/apps/tests/args/args.c
Normal file
@@ -0,0 +1,39 @@
|
||||
#include <ddk/ntddk.h>
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
HANDLE OutputHandle;
|
||||
HANDLE InputHandle;
|
||||
|
||||
void debug_printf(char* fmt, ...)
|
||||
{
|
||||
va_list args;
|
||||
char buffer[255];
|
||||
|
||||
va_start(args,fmt);
|
||||
vsprintf(buffer,fmt,args);
|
||||
WriteConsoleA(OutputHandle, buffer, strlen(buffer), NULL, NULL);
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
int i;
|
||||
|
||||
AllocConsole();
|
||||
InputHandle = GetStdHandle(STD_INPUT_HANDLE);
|
||||
OutputHandle = GetStdHandle(STD_OUTPUT_HANDLE);
|
||||
|
||||
printf("GetCommandLineA() %s\n",GetCommandLineA());
|
||||
debug_printf("GetCommandLineA() %s\n",GetCommandLineA());
|
||||
debug_printf("argc %d\n", argc);
|
||||
for (i=0; i<argc; i++)
|
||||
{
|
||||
debug_printf("Argv[%d]: %x\n",i,argv[i]);
|
||||
debug_printf("Argv[%d]: '%s'\n",i,argv[i]);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
42
reactos/apps/tests/args/makefile
Normal file
42
reactos/apps/tests/args/makefile
Normal file
@@ -0,0 +1,42 @@
|
||||
#
|
||||
#
|
||||
#
|
||||
OBJECTS= args.o
|
||||
PROGS= args.exe
|
||||
|
||||
BASE_CFLAGS = -I../../include
|
||||
|
||||
all: $(PROGS)
|
||||
|
||||
.phony: all
|
||||
|
||||
clean:
|
||||
- $(RM) args.o
|
||||
- $(RM) args.exe
|
||||
- $(RM) args.sym
|
||||
|
||||
.phony: clean
|
||||
|
||||
floppy: $(PROGS:%=$(FLOPPY_DIR)/apps/%)
|
||||
|
||||
$(PROGS:%=$(FLOPPY_DIR)/apps/%): $(FLOPPY_DIR)/apps/%: %
|
||||
ifeq ($(DOSCLI),yes)
|
||||
$(CP) $* $(FLOPPY_DIR)\apps\$*
|
||||
else
|
||||
$(CP) $* $(FLOPPY_DIR)/apps/$*
|
||||
endif
|
||||
|
||||
dist: $(PROGS:%=../../$(DIST_DIR)/apps/%)
|
||||
|
||||
$(PROGS:%=../../$(DIST_DIR)/apps/%): ../../$(DIST_DIR)/apps/%: %
|
||||
ifeq ($(DOSCLI),yes)
|
||||
$(CP) $* ..\..\$(DIST_DIR)\apps\$*
|
||||
else
|
||||
$(CP) $* ../../$(DIST_DIR)/apps/$*
|
||||
endif
|
||||
|
||||
args.exe: $(OBJECTS)
|
||||
$(CC) $(OBJECTS) -o args.exe
|
||||
$(NM) --numeric-sort args.exe > args.sym
|
||||
|
||||
include ../../rules.mak
|
8
reactos/apps/tests/bench/bench-syscall.c
Normal file
8
reactos/apps/tests/bench/bench-syscall.c
Normal file
@@ -0,0 +1,8 @@
|
||||
/*
|
||||
*
|
||||
*/
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
|
||||
}
|
82
reactos/apps/tests/bench/bench-thread.c
Normal file
82
reactos/apps/tests/bench/bench-thread.c
Normal file
@@ -0,0 +1,82 @@
|
||||
#include <stdio.h>
|
||||
#include <windows.h>
|
||||
|
||||
#define NR_THREADS (0x1)
|
||||
|
||||
|
||||
DWORD WINAPI
|
||||
thread_main1(LPVOID param)
|
||||
{
|
||||
printf("Thread 1 running (Counter %lu)\n", (DWORD)param);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
DWORD WINAPI
|
||||
thread_main2(LPVOID param)
|
||||
{
|
||||
printf("Thread 2 running (Counter %lu)\n", (DWORD)param);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int main (void)
|
||||
{
|
||||
HANDLE hThread;
|
||||
DWORD i=0;
|
||||
DWORD id;
|
||||
|
||||
#if 1
|
||||
printf("Creating %d threads...\n",NR_THREADS*2);
|
||||
for (i=0;i<NR_THREADS;i++)
|
||||
{
|
||||
CreateThread(NULL,
|
||||
0,
|
||||
thread_main1,
|
||||
(LPVOID)i,
|
||||
0,
|
||||
&id);
|
||||
|
||||
/* CreateThread(NULL,
|
||||
0,
|
||||
thread_main2,
|
||||
(LPVOID)i,
|
||||
0,
|
||||
&id);*/
|
||||
}
|
||||
|
||||
printf("All threads created...\n");
|
||||
|
||||
/*
|
||||
* Waiting for threads is not implemented yet.
|
||||
* If you want to see all threads running, uncomment the
|
||||
* call to SuspendThread(). The test application will
|
||||
* freeze after all threads are created.
|
||||
*/
|
||||
/* SuspendThread (GetCurrentThread()); */
|
||||
|
||||
#else
|
||||
|
||||
printf("Creating thread...\n");
|
||||
|
||||
hThread = CreateThread(NULL,
|
||||
0,
|
||||
thread_main1,
|
||||
(LPVOID)i,
|
||||
0,
|
||||
&id);
|
||||
|
||||
printf("Thread created. Waiting for termination...\n");
|
||||
|
||||
WaitForSingleObject (hThread,
|
||||
-1);
|
||||
|
||||
CloseHandle (hThread);
|
||||
|
||||
printf("Thread terminated...\n");
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
41
reactos/apps/tests/bench/makefile
Normal file
41
reactos/apps/tests/bench/makefile
Normal file
@@ -0,0 +1,41 @@
|
||||
#
|
||||
#
|
||||
#
|
||||
PROGS = bench-thread
|
||||
|
||||
all: $(PROGS:%=%.exe)
|
||||
|
||||
.phony: all
|
||||
|
||||
clean: $(PROGS:%=%_clean)
|
||||
|
||||
$(PROGS:%=%_clean): %_clean:
|
||||
- $(RM) $*.o
|
||||
- $(RM) $*.exe
|
||||
- $(RM) $*.sym
|
||||
|
||||
.phony: clean
|
||||
|
||||
floppy: # $(PROGS:%=$(FLOPPY_DIR)/apps/%.exe)
|
||||
|
||||
$(PROGS:%=$(FLOPPY_DIR)/apps/%.exe): $(FLOPPY_DIR)/apps/%.exe: %.exe
|
||||
ifeq ($(DOSCLI),yes)
|
||||
$(CP) $*.exe $(FLOPPY_DIR)\apps\$*.exe
|
||||
else
|
||||
$(CP) $*.exe $(FLOPPY_DIR)/apps/$*.exe
|
||||
endif
|
||||
|
||||
dist: $(PROGS:%=../../$(DIST_DIR)/apps/%.exe)
|
||||
|
||||
$(PROGS:%=../../$(DIST_DIR)/apps/%.exe): ../../$(DIST_DIR)/apps/%.exe: %.exe
|
||||
ifeq ($(DOSCLI),yes)
|
||||
$(CP) $*.exe ..\..\$(DIST_DIR)\apps\$*.exe
|
||||
else
|
||||
$(CP) $*.exe ../../$(DIST_DIR)/apps/$*.exe
|
||||
endif
|
||||
|
||||
bench-thread.exe: bench-thread.c
|
||||
$(CC) $(CFLAGS) bench-thread.c -lkernel32 -o bench-thread.exe
|
||||
$(NM) --numeric-sort bench-thread.exe > bench-thread.sym
|
||||
|
||||
include ../../rules.mak
|
33
reactos/apps/tests/event/event.c
Normal file
33
reactos/apps/tests/event/event.c
Normal file
@@ -0,0 +1,33 @@
|
||||
#include <windows.h>
|
||||
#include <stdio.h>
|
||||
|
||||
HANDLE events[2];
|
||||
|
||||
DWORD WINAPI thread( LPVOID crap )
|
||||
{
|
||||
SetEvent( events[0] );
|
||||
if( crap )
|
||||
SetEvent( events[1] );
|
||||
return 1;
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
DWORD id, Status;
|
||||
printf( "Creating events\n" );
|
||||
events[0] = CreateEvent( 0, TRUE, FALSE, 0 );
|
||||
events[1] = CreateEvent( 0, TRUE, FALSE, 0 );
|
||||
printf( "Created events\n" );
|
||||
CreateThread( 0, 0, thread, 0, 0, &id );
|
||||
printf( "WaitForSingleObject %s\n", ( WaitForSingleObject( events[0], INFINITE ) == WAIT_OBJECT_0 ? "worked" : "failed" ) );
|
||||
ResetEvent( events[0] );
|
||||
CreateThread( 0, 0, thread, 0, 0, &id );
|
||||
printf( "WaitForMultipleObjects with waitall = FALSE %s\n", ( WaitForMultipleObjects( 2, events, FALSE, INFINITE ) == WAIT_OBJECT_0 ? "worked" : "failed" ) );
|
||||
ResetEvent( events[0] );
|
||||
CreateThread( 0, 0, thread, (void *)1, 0, &id );
|
||||
Status = WaitForMultipleObjects( 2, events, TRUE, INFINITE );
|
||||
printf( "WaitForMultipleObjects with waitall = TRUE %s\n", ( Status == WAIT_OBJECT_0 || Status == WAIT_OBJECT_0 + 1 ? "worked" : "failed" ) );
|
||||
ResetEvent( events[0] );
|
||||
printf( "WaitForSingleObject with timeout %s\n", ( WaitForSingleObject( events[0], 100 ) == WAIT_TIMEOUT ? "worked" : "failed" ) );
|
||||
return 0;
|
||||
}
|
41
reactos/apps/tests/event/makefile
Normal file
41
reactos/apps/tests/event/makefile
Normal file
@@ -0,0 +1,41 @@
|
||||
#
|
||||
#
|
||||
#
|
||||
PROGS = event
|
||||
|
||||
all: $(PROGS:%=%.exe)
|
||||
|
||||
.phony: all
|
||||
|
||||
clean: $(PROGS:%=%_clean)
|
||||
|
||||
$(PROGS:%=%_clean): %_clean:
|
||||
- $(RM) $*.o
|
||||
- $(RM) $*.exe
|
||||
- $(RM) $*.sym
|
||||
|
||||
.phony: clean
|
||||
|
||||
floppy: # $(PROGS:%=$(FLOPPY_DIR)/apps/%.exe)
|
||||
|
||||
$(PROGS:%=$(FLOPPY_DIR)/apps/%.exe): $(FLOPPY_DIR)/apps/%.exe: %.exe
|
||||
ifeq ($(DOSCLI),yes)
|
||||
$(CP) $*.exe $(FLOPPY_DIR)\apps\$*.exe
|
||||
else
|
||||
$(CP) $*.exe $(FLOPPY_DIR)/apps/$*.exe
|
||||
endif
|
||||
|
||||
dist: $(PROGS:%=../../$(DIST_DIR)/apps/%.exe)
|
||||
|
||||
$(PROGS:%=../../$(DIST_DIR)/apps/%.exe): ../../$(DIST_DIR)/apps/%.exe: %.exe
|
||||
ifeq ($(DOSCLI),yes)
|
||||
$(CP) $*.exe ..\..\$(DIST_DIR)\apps\$*.exe
|
||||
else
|
||||
$(CP) $*.exe ../../$(DIST_DIR)/apps/$*.exe
|
||||
endif
|
||||
|
||||
event.exe: event.c
|
||||
$(CC) $(CFLAGS) event.c -lkernel32 -o event.exe
|
||||
$(NM) --numeric-sort event.exe > event.sym
|
||||
|
||||
include ../../rules.mak
|
8
reactos/apps/tests/hello/hello.c
Normal file
8
reactos/apps/tests/hello/hello.c
Normal file
@@ -0,0 +1,8 @@
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
printf("Hello world\n");
|
||||
return(0);
|
||||
}
|
39
reactos/apps/tests/hello/makefile
Normal file
39
reactos/apps/tests/hello/makefile
Normal file
@@ -0,0 +1,39 @@
|
||||
#
|
||||
#
|
||||
#
|
||||
OBJECTS = hello.o
|
||||
PROGS = hello.exe
|
||||
LIBS =
|
||||
CLEAN_FILES = hello.o hello.exe
|
||||
|
||||
all: hello.exe
|
||||
|
||||
clean: $(CLEAN_FILES:%=%_clean)
|
||||
|
||||
$(CLEAN_FILES:%=%_clean): %_clean:
|
||||
- $(RM) $*
|
||||
|
||||
.phony: clean $(CLEAN_FILES:%=%_clean)
|
||||
|
||||
floppy: $(PROGS:%=$(FLOPPY_DIR)/apps/%)
|
||||
|
||||
$(PROGS:%=$(FLOPPY_DIR)/apps/%): $(FLOPPY_DIR)/apps/%: %
|
||||
ifeq ($(DOSCLI),yes)
|
||||
$(CP) $* $(FLOPPY_DIR)\apps\$*
|
||||
else
|
||||
$(CP) $* $(FLOPPY_DIR)/apps/$*
|
||||
endif
|
||||
|
||||
dist: $(PROGS:%=../../$(DIST_DIR)/apps/%)
|
||||
|
||||
$(PROGS:%=../../$(DIST_DIR)/apps/%): ../../$(DIST_DIR)/apps/%: %
|
||||
ifeq ($(DOSCLI),yes)
|
||||
$(CP) $* ..\..\$(DIST_DIR)\apps\$*
|
||||
else
|
||||
$(CP) $* ../../$(DIST_DIR)/apps/$*
|
||||
endif
|
||||
|
||||
hello.exe: $(OBJECTS)
|
||||
$(CC) $(OBJECTS) -o hello.exe
|
||||
|
||||
include ../../rules.mak
|
205
reactos/apps/tests/lpc/conport.c
Normal file
205
reactos/apps/tests/lpc/conport.c
Normal file
@@ -0,0 +1,205 @@
|
||||
/* $Id: conport.c,v 1.5 1999/07/17 23:10:12 ea Exp $
|
||||
*
|
||||
* reactos/apps/lpc/conport.c
|
||||
*
|
||||
* To be run in a real WNT 4.0 system with
|
||||
* "\SmApiPort" as argument. Do not try to
|
||||
* connect to "\Windows\ApiPort" since that
|
||||
* reboots immeditely.
|
||||
*
|
||||
* Use Russinovich' HandleEx to verify
|
||||
* conport.exe owns two unnamed LPC ports:
|
||||
* the one created by kernel32.dll connecting
|
||||
* to csrss.exe, and one connected to here.
|
||||
*
|
||||
* 19990627 (Emanuele Aliberti)
|
||||
* Initial implementation.
|
||||
* 19990704 (EA)
|
||||
* Dump object's attributes moved in dumpinfo.c.
|
||||
*/
|
||||
#include <windows.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#define PROTO_LPC
|
||||
#include <ddk/ntddk.h>
|
||||
#include "dumpinfo.h"
|
||||
|
||||
#define LPC_CONNECT_FLAG1 0x00000001
|
||||
#define LPC_CONNECT_FLAG2 0x00000010
|
||||
#define LPC_CONNECT_FLAG3 0x00000100
|
||||
#define LPC_CONNECT_FLAG4 0x00001000
|
||||
#define LPC_CONNECT_FLAG5 0x00010000
|
||||
|
||||
NTSTATUS
|
||||
(STDCALL * ConnectPort)(
|
||||
OUT PHANDLE PortHandle,
|
||||
IN PUNICODE_STRING PortName,
|
||||
IN POBJECT_ATTRIBUTES ObjectAttributes,
|
||||
IN DWORD Unknown3,
|
||||
IN DWORD Unknown4,
|
||||
IN DWORD Unknown5,
|
||||
IN DWORD Unknown6,
|
||||
IN ULONG Flags
|
||||
);
|
||||
|
||||
NTSTATUS
|
||||
(STDCALL * QueryObject)(
|
||||
IN HANDLE ObjectHandle,
|
||||
IN CINT ObjectInformationClass,
|
||||
OUT PVOID ObjectInformation,
|
||||
IN ULONG Length,
|
||||
OUT PULONG ResultLength
|
||||
);
|
||||
|
||||
NTSTATUS
|
||||
(STDCALL * YieldExecution)(VOID);
|
||||
|
||||
#define BUF_SIZE 1024
|
||||
#define MAXARG 1000000
|
||||
|
||||
|
||||
VOID
|
||||
TryConnectPort(char *port_name)
|
||||
{
|
||||
DWORD Status = 0;
|
||||
HANDLE Port = 0;
|
||||
int i;
|
||||
UNICODE_STRING PortName;
|
||||
OBJECT_ATTRIBUTES ObjectAttributes;
|
||||
WORD Name [BUF_SIZE] = {0};
|
||||
int dwx = 0;
|
||||
char * port_name_save = port_name;
|
||||
|
||||
/*
|
||||
* Convert the port's name to Unicode.
|
||||
*/
|
||||
for (
|
||||
PortName.Length = 0;
|
||||
( *port_name
|
||||
&& (PortName.Length < BUF_SIZE)
|
||||
);
|
||||
)
|
||||
{
|
||||
Name[PortName.Length++] = (WORD) *port_name++;
|
||||
}
|
||||
Name[PortName.Length] = 0;
|
||||
|
||||
PortName.Length = PortName.Length * sizeof (WORD);
|
||||
PortName.MaximumLength = PortName.Length + sizeof (WORD);
|
||||
PortName.Buffer = (PWSTR) Name;
|
||||
/*
|
||||
* Prepare the port object attributes.
|
||||
*/
|
||||
ObjectAttributes.Length =
|
||||
sizeof (OBJECT_ATTRIBUTES);
|
||||
ObjectAttributes.RootDirectory =
|
||||
NULL;
|
||||
ObjectAttributes.ObjectName =
|
||||
NULL /*& PortName */;
|
||||
ObjectAttributes.Attributes =
|
||||
OBJ_CASE_INSENSITIVE;
|
||||
ObjectAttributes.SecurityDescriptor =
|
||||
NULL;
|
||||
ObjectAttributes.SecurityQualityOfService =
|
||||
NULL;
|
||||
/*
|
||||
* Try to issue a connection request.
|
||||
*/
|
||||
Port = 0;
|
||||
Status = ConnectPort(
|
||||
& Port,
|
||||
& PortName,
|
||||
& ObjectAttributes,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
LPC_CONNECT_FLAG5
|
||||
);
|
||||
if (Status == STATUS_SUCCESS)
|
||||
{
|
||||
DumpInfo(
|
||||
Name,
|
||||
Status,
|
||||
"connected",
|
||||
Port
|
||||
);
|
||||
/* Hot waiting */
|
||||
for (dwx=0; dwx<MAXARG; ++dwx)
|
||||
{
|
||||
YieldExecution();
|
||||
}
|
||||
if (FALSE == CloseHandle(Port))
|
||||
{
|
||||
printf(
|
||||
"Could not close the port handle %08X.\n",
|
||||
Port
|
||||
);
|
||||
}
|
||||
return;
|
||||
}
|
||||
printf(
|
||||
"Connection to port \"%s\" failed (Status = %08X).\n",
|
||||
port_name_save,
|
||||
Status
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
main( int argc, char * argv[] )
|
||||
{
|
||||
HINSTANCE ntdll;
|
||||
|
||||
if (argc != 2)
|
||||
{
|
||||
printf("WNT LPC Port Connector\n");
|
||||
printf("Usage: %s [port_name]\n",argv[0]);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
printf("LoadLibrary(NTDLL)\n");
|
||||
ntdll = LoadLibrary("NTDLL");
|
||||
if (ntdll == NULL)
|
||||
{
|
||||
printf("Could not load NTDLL\n");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
printf("GetProcAddress(NTDLL.NtConnectPort)\n");
|
||||
ConnectPort = (VOID*) GetProcAddress(
|
||||
ntdll,
|
||||
"NtConnectPort"
|
||||
);
|
||||
if (ConnectPort == NULL)
|
||||
{
|
||||
FreeLibrary(ntdll);
|
||||
printf("Could not find NTDLL.NtConnectPort\n");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
printf("GetProcAddress(NTDLL.NtQueryObject)\n");
|
||||
QueryObject = (VOID*) GetProcAddress(
|
||||
ntdll,
|
||||
"NtQueryObject"
|
||||
);
|
||||
if (QueryObject == NULL)
|
||||
{
|
||||
FreeLibrary(ntdll);
|
||||
printf("Could not find NTDLL.NtQueryObject\n");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
printf("GetProcAddress(NTDLL.NtYieldExecution)\n");
|
||||
YieldExecution = (VOID*) GetProcAddress(
|
||||
ntdll,
|
||||
"NtYieldExecution"
|
||||
);
|
||||
if (YieldExecution == NULL)
|
||||
{
|
||||
FreeLibrary(ntdll);
|
||||
printf("Could not find NTDLL.NtYieldExecution\n");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
printf("TryConnectPort(%s)\n",argv[1]);
|
||||
TryConnectPort(argv[1]);
|
||||
printf("Done\n");
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
/* EOF */
|
192
reactos/apps/tests/lpc/creport.c
Normal file
192
reactos/apps/tests/lpc/creport.c
Normal file
@@ -0,0 +1,192 @@
|
||||
/* $Id: creport.c,v 1.2 1999/07/17 23:10:12 ea Exp $
|
||||
*
|
||||
* reactos/apps/lpc/creport.c
|
||||
*
|
||||
* To be run in a real WNT 4.0 system to
|
||||
* create an LPC named port.
|
||||
*
|
||||
* Use Russinovich' HandleEx to verify
|
||||
* creport.exe owns the named LPC port
|
||||
* you asked to create.
|
||||
*/
|
||||
#include <windows.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#define PROTO_LPC
|
||||
#include <ddk/ntddk.h>
|
||||
#include "dumpinfo.h"
|
||||
|
||||
#define LPC_CONNECT_FLAG1 0x00000001
|
||||
#define LPC_CONNECT_FLAG2 0x00000010
|
||||
#define LPC_CONNECT_FLAG3 0x00000100
|
||||
#define LPC_CONNECT_FLAG4 0x00001000
|
||||
#define LPC_CONNECT_FLAG5 0x00010000
|
||||
|
||||
NTSTATUS
|
||||
(STDCALL * CreatePort)(
|
||||
/*OUT PHANDLE PortHandle,*/
|
||||
PVOID Buffer,
|
||||
IN POBJECT_ATTRIBUTES PortAttributes OPTIONAL,
|
||||
IN ACCESS_MASK DesiredAccess,
|
||||
IN DWORD Unknown3,
|
||||
IN ULONG Flags
|
||||
);
|
||||
|
||||
NTSTATUS
|
||||
(STDCALL * QueryObject)(
|
||||
IN HANDLE ObjectHandle,
|
||||
IN CINT ObjectInformationClass,
|
||||
OUT PVOID ObjectInformation,
|
||||
IN ULONG Length,
|
||||
OUT PULONG ResultLength
|
||||
);
|
||||
|
||||
NTSTATUS
|
||||
(STDCALL * YieldExecution)(VOID);
|
||||
|
||||
#define BUF_SIZE 1024
|
||||
#define MAXARG 5000000
|
||||
|
||||
|
||||
VOID
|
||||
TryCreatePort(char *port_name)
|
||||
{
|
||||
DWORD Status = 0;
|
||||
HANDLE Port = 0;
|
||||
int i;
|
||||
UNICODE_STRING PortName;
|
||||
OBJECT_ATTRIBUTES ObjectAttributes;
|
||||
WORD Name [BUF_SIZE] = {0};
|
||||
int dwx = 0;
|
||||
char * port_name_save = port_name;
|
||||
|
||||
/*
|
||||
* Convert the port's name to Unicode.
|
||||
*/
|
||||
for (
|
||||
PortName.Length = 0;
|
||||
( *port_name
|
||||
&& (PortName.Length < BUF_SIZE)
|
||||
);
|
||||
)
|
||||
{
|
||||
Name[PortName.Length++] = (WORD) *port_name++;
|
||||
}
|
||||
Name[PortName.Length] = 0;
|
||||
|
||||
PortName.Length = PortName.Length * sizeof (WORD);
|
||||
PortName.MaximumLength = PortName.Length + sizeof (WORD);
|
||||
PortName.Buffer = (PWSTR) Name;
|
||||
/*
|
||||
* Prepare the port object attributes.
|
||||
*/
|
||||
ObjectAttributes.Length =
|
||||
sizeof (OBJECT_ATTRIBUTES);
|
||||
ObjectAttributes.RootDirectory =
|
||||
NULL;
|
||||
ObjectAttributes.ObjectName =
|
||||
& PortName;
|
||||
ObjectAttributes.Attributes =
|
||||
0; //OBJ_CASE_INSENSITIVE --> STATUS_INVALID_PARAMETER ==> case sensitive!;
|
||||
ObjectAttributes.SecurityDescriptor =
|
||||
NULL;
|
||||
ObjectAttributes.SecurityQualityOfService =
|
||||
NULL;
|
||||
/*
|
||||
* Try to issue a connection request.
|
||||
*/
|
||||
Port = 0;
|
||||
Status = CreatePort(
|
||||
& Port,
|
||||
& ObjectAttributes,
|
||||
0, /* ACCESS_MASK? */
|
||||
0, /* Unknown3 */
|
||||
LPC_CONNECT_FLAG5
|
||||
);
|
||||
if (Status == STATUS_SUCCESS)
|
||||
{
|
||||
DumpInfo(
|
||||
Name,
|
||||
Status,
|
||||
"created",
|
||||
Port
|
||||
);
|
||||
/* Hot waiting */
|
||||
for (dwx=0; dwx<MAXARG; ++dwx)
|
||||
{
|
||||
YieldExecution();
|
||||
}
|
||||
if (FALSE == CloseHandle(Port))
|
||||
{
|
||||
printf(
|
||||
"Could not close the port handle %08X.\n",
|
||||
Port
|
||||
);
|
||||
}
|
||||
return;
|
||||
}
|
||||
printf(
|
||||
"Creating port \"%s\" failed (Status = %08X).\n",
|
||||
port_name_save,
|
||||
Status
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
main( int argc, char * argv[] )
|
||||
{
|
||||
HINSTANCE ntdll;
|
||||
|
||||
if (argc != 2)
|
||||
{
|
||||
printf("WNT LPC Port Creator\n");
|
||||
printf("Usage: %s [port_name]\n",argv[0]);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
printf("LoadLibrary(NTDLL)\n");
|
||||
ntdll = LoadLibrary("NTDLL");
|
||||
if (ntdll == NULL)
|
||||
{
|
||||
printf("Could not load NTDLL\n");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
printf("GetProcAddress(NTDLL.NtCreatePort)\n");
|
||||
CreatePort = (VOID*) GetProcAddress(
|
||||
ntdll,
|
||||
"NtCreatePort"
|
||||
);
|
||||
if (CreatePort == NULL)
|
||||
{
|
||||
FreeLibrary(ntdll);
|
||||
printf("Could not find NTDLL.NtCreatePort\n");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
printf("GetProcAddress(NTDLL.NtQueryObject)\n");
|
||||
QueryObject = (VOID*) GetProcAddress(
|
||||
ntdll,
|
||||
"NtQueryObject"
|
||||
);
|
||||
if (QueryObject == NULL)
|
||||
{
|
||||
FreeLibrary(ntdll);
|
||||
printf("Could not find NTDLL.NtQueryObject\n");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
printf("GetProcAddress(NTDLL.NtYieldExecution)\n");
|
||||
YieldExecution = (VOID*) GetProcAddress(
|
||||
ntdll,
|
||||
"NtYieldExecution"
|
||||
);
|
||||
if (YieldExecution == NULL)
|
||||
{
|
||||
FreeLibrary(ntdll);
|
||||
printf("Could not find NTDLL.NtYieldExecution\n");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
printf("TryCreatePort(%s)\n",argv[1]);
|
||||
TryCreatePort(argv[1]);
|
||||
printf("Done\n");
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
/* EOF */
|
239
reactos/apps/tests/lpc/dumpinfo.c
Normal file
239
reactos/apps/tests/lpc/dumpinfo.c
Normal file
@@ -0,0 +1,239 @@
|
||||
/* $Id: dumpinfo.c,v 1.2 1999/07/17 23:10:12 ea Exp $
|
||||
*
|
||||
* reactos/apps/lpc/dumpinfo.c
|
||||
*
|
||||
* ReactOS Operating System
|
||||
*
|
||||
* Dump a kernel object's attributes by its handle.
|
||||
*
|
||||
* 19990627 (Emanuele Aliberti)
|
||||
* Initial implementation.
|
||||
* 19990704 (EA)
|
||||
* Added code to find the basic information buffer size
|
||||
* for the LPC port object.
|
||||
* 19990710 (EA)
|
||||
*
|
||||
*/
|
||||
#include <windows.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <ddk/ntddk.h>
|
||||
|
||||
#define BUF_SIZE 1024
|
||||
#define MAX_BASIC_INFO_SIZE 512
|
||||
|
||||
|
||||
extern
|
||||
NTSTATUS
|
||||
(STDCALL * QueryObject)(
|
||||
IN HANDLE ObjectHandle,
|
||||
IN CINT ObjectInformationClass,
|
||||
OUT PVOID ObjectInformation,
|
||||
IN ULONG Length,
|
||||
OUT PULONG ResultLength
|
||||
);
|
||||
|
||||
extern
|
||||
NTSTATUS
|
||||
(STDCALL * QueryInformationPort)(
|
||||
IN HANDLE PortHandle,
|
||||
IN CINT PortInformationClass, /* guess */
|
||||
OUT PVOID PortInformation, /* guess */
|
||||
IN ULONG PortInformationLength, /* guess */
|
||||
OUT PULONG ReturnLength /* guess */
|
||||
);
|
||||
|
||||
|
||||
/*
|
||||
static
|
||||
VOID
|
||||
DumpBuffer(
|
||||
char *Name,
|
||||
BYTE *buffer,
|
||||
ULONG size
|
||||
)
|
||||
{
|
||||
register ULONG i = 0;
|
||||
|
||||
printf("%s [%d] = ",Name,size);
|
||||
for ( i = 0;
|
||||
i != size;
|
||||
++i
|
||||
)
|
||||
{
|
||||
printf("%02X",buffer[i]);
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
*/
|
||||
|
||||
VOID
|
||||
DumpInfo (
|
||||
LPCWSTR Name,
|
||||
NTSTATUS Status,
|
||||
LPCWSTR Comment,
|
||||
HANDLE Port
|
||||
)
|
||||
{
|
||||
BYTE ObjectInformation [BUF_SIZE] = {0};
|
||||
ULONG ResultLength;
|
||||
|
||||
wprintf(
|
||||
L"Port \"%s\" %s:\n",
|
||||
Name,
|
||||
Comment
|
||||
);
|
||||
|
||||
printf("\tStatus = %08X\n",Status);
|
||||
printf("\tPort = %08X\n\n",Port);
|
||||
/*
|
||||
* Query object information.
|
||||
*/
|
||||
printf("Basic Information:\n");
|
||||
Status = QueryObject(
|
||||
Port,
|
||||
ObjectBasicInformation,
|
||||
ObjectInformation,
|
||||
sizeof (LPC_PORT_BASIC_INFORMATION),
|
||||
& ResultLength
|
||||
);
|
||||
if (Status == STATUS_SUCCESS)
|
||||
{
|
||||
PLPC_PORT_BASIC_INFORMATION i;
|
||||
|
||||
i = (PLPC_PORT_BASIC_INFORMATION) ObjectInformation;
|
||||
|
||||
printf( "\tUnknown01 = 0x%08X\n", i->Unknown0 );
|
||||
printf( "\tUnknown02 = 0x%08X\n", i->Unknown1 );
|
||||
printf( "\tUnknown03 = 0x%08X\n", i->Unknown2 );
|
||||
printf( "\tUnknown04 = 0x%08X\n", i->Unknown3 );
|
||||
printf( "\tUnknown05 = 0x%08X\n", i->Unknown4 );
|
||||
printf( "\tUnknown06 = 0x%08X\n", i->Unknown5 );
|
||||
printf( "\tUnknown07 = 0x%08X\n", i->Unknown6 );
|
||||
printf( "\tUnknown08 = 0x%08X\n", i->Unknown7 );
|
||||
printf( "\tUnknown09 = 0x%08X\n", i->Unknown8 );
|
||||
printf( "\tUnknown10 = 0x%08X\n", i->Unknown9 );
|
||||
printf( "\tUnknown11 = 0x%08X\n", i->Unknown10 );
|
||||
printf( "\tUnknown12 = 0x%08X\n", i->Unknown11 );
|
||||
printf( "\tUnknown13 = 0x%08X\n", i->Unknown12 );
|
||||
printf( "\tUnknown14 = 0x%08X\n", i->Unknown13 );
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("\tStatus = %08X\n",Status);
|
||||
}
|
||||
printf("Type Information:\n");
|
||||
Status = QueryObject(
|
||||
Port,
|
||||
ObjectTypeInformation,
|
||||
ObjectInformation,
|
||||
sizeof ObjectInformation,
|
||||
& ResultLength
|
||||
);
|
||||
if (Status == STATUS_SUCCESS)
|
||||
{
|
||||
OBJECT_TYPE_INFORMATION * i;
|
||||
|
||||
i = (OBJECT_TYPE_INFORMATION *) ObjectInformation;
|
||||
|
||||
wprintf(
|
||||
L"\tName: \"%s\"\n",
|
||||
(i->Name.Length ? i->Name.Buffer : L"")
|
||||
);
|
||||
/*
|
||||
FIXME: why this always raise an access violation exception?
|
||||
wprintf(
|
||||
L"\tType: \"%s\"\n",
|
||||
(i->Type.Length ? i->Type.Buffer : L"")
|
||||
);
|
||||
/**/
|
||||
printf(
|
||||
"\tTotal Handles: %d\n",
|
||||
i->TotalHandles
|
||||
);
|
||||
printf(
|
||||
"\tReference Count: %d\n",
|
||||
i->ReferenceCount
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("\tStatus = %08X\n",Status);
|
||||
}
|
||||
printf("Name Information:\n");
|
||||
Status = QueryObject(
|
||||
Port,
|
||||
ObjectNameInformation,
|
||||
ObjectInformation,
|
||||
sizeof ObjectInformation,
|
||||
& ResultLength
|
||||
);
|
||||
if (Status == STATUS_SUCCESS)
|
||||
{
|
||||
OBJECT_NAME_INFORMATION * i;
|
||||
|
||||
i = (OBJECT_NAME_INFORMATION *) ObjectInformation;
|
||||
wprintf(
|
||||
L"\tName: \"%s\"\n",
|
||||
(i->Name.Length ? i->Name.Buffer : L"")
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("\tStatus = %08X\n",Status);
|
||||
}
|
||||
printf("Data Information:\n");
|
||||
Status = QueryObject(
|
||||
Port,
|
||||
ObjectDataInformation,
|
||||
ObjectInformation,
|
||||
sizeof ObjectInformation,
|
||||
& ResultLength
|
||||
);
|
||||
if (Status == STATUS_SUCCESS)
|
||||
{
|
||||
OBJECT_DATA_INFORMATION * i;
|
||||
|
||||
i = (OBJECT_DATA_INFORMATION *) ObjectInformation;
|
||||
printf(
|
||||
"\tInherit Handle: %s\n",
|
||||
(i->bInheritHandle ? "TRUE" : "FALSE")
|
||||
);
|
||||
printf(
|
||||
"\tProtect from Close: %s\n",
|
||||
(i->bProtectFromClose ? "TRUE" : "FALSE")
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("\tStatus = %08X\n",Status);
|
||||
}
|
||||
//---
|
||||
printf("Port Information:\n");
|
||||
/* Status = QueryInformationPort(
|
||||
Port,
|
||||
1, /* info class * /
|
||||
ObjectInformation,
|
||||
sizeof ObjectInformation,
|
||||
& ResultLength
|
||||
);
|
||||
if (Status == STATUS_SUCCESS)
|
||||
{
|
||||
DWORD * i = ObjectInformation;
|
||||
int j = 0;
|
||||
|
||||
while (j < ResultLength / sizeof (DWORD))
|
||||
{
|
||||
printf("\t%08X\n",i[j]);
|
||||
++j;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("\tStatus = %08X\n",Status);
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
/* EOF */
|
8
reactos/apps/tests/lpc/dumpinfo.h
Normal file
8
reactos/apps/tests/lpc/dumpinfo.h
Normal file
@@ -0,0 +1,8 @@
|
||||
VOID
|
||||
DumpInfo (
|
||||
LPCWSTR Name,
|
||||
NTSTATUS Status,
|
||||
LPCWSTR Comment,
|
||||
HANDLE Port
|
||||
);
|
||||
|
62
reactos/apps/tests/lpc/lpcclt.c
Normal file
62
reactos/apps/tests/lpc/lpcclt.c
Normal file
@@ -0,0 +1,62 @@
|
||||
#include <ddk/ntddk.h>
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
HANDLE OutputHandle;
|
||||
HANDLE InputHandle;
|
||||
|
||||
void debug_printf(char* fmt, ...)
|
||||
{
|
||||
va_list args;
|
||||
char buffer[255];
|
||||
|
||||
va_start(args,fmt);
|
||||
vsprintf(buffer,fmt,args);
|
||||
WriteConsoleA(OutputHandle, buffer, strlen(buffer), NULL, NULL);
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
|
||||
void main(int argc, char* argv[])
|
||||
{
|
||||
UNICODE_STRING PortName;
|
||||
NTSTATUS Status;
|
||||
HANDLE PortHandle;
|
||||
LPCMESSAGE Request;
|
||||
ULONG ConnectInfoLength;
|
||||
|
||||
printf("(lpcclt.exe) Lpc client\n");
|
||||
|
||||
RtlInitUnicodeString(&PortName, L"\\TestPort");
|
||||
|
||||
printf("(lpcclt.exe) Connecting to port\n");
|
||||
ConnectInfoLength = 0;
|
||||
Status = NtConnectPort(&PortHandle,
|
||||
&PortName,
|
||||
NULL,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
NULL,
|
||||
&ConnectInfoLength);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
printf("(lpcclt.exe) Failed to connect\n");
|
||||
return;
|
||||
}
|
||||
|
||||
strcpy(Request.MessageData, GetCommandLineA());
|
||||
Request.ActualMessageLength = strlen(Request.MessageData);
|
||||
Request.TotalMessageLength = sizeof(LPCMESSAGE);
|
||||
|
||||
printf("(lpcclt.exe) Sending message\n");
|
||||
Status = NtRequestPort(PortHandle, &Request);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
printf("(lpcclt.exe) Failed to send request\n");
|
||||
return;
|
||||
}
|
||||
|
||||
printf("(lpcclt.exe) Succeeded\n");
|
||||
}
|
98
reactos/apps/tests/lpc/lpcsrv.c
Normal file
98
reactos/apps/tests/lpc/lpcsrv.c
Normal file
@@ -0,0 +1,98 @@
|
||||
#include <ddk/ntddk.h>
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
HANDLE OutputHandle;
|
||||
HANDLE InputHandle;
|
||||
|
||||
void debug_printf(char* fmt, ...)
|
||||
{
|
||||
va_list args;
|
||||
char buffer[255];
|
||||
|
||||
va_start(args,fmt);
|
||||
vsprintf(buffer,fmt,args);
|
||||
WriteConsoleA(OutputHandle, buffer, strlen(buffer), NULL, NULL);
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
|
||||
void main(int argc, char* argv[])
|
||||
{
|
||||
UNICODE_STRING PortName;
|
||||
OBJECT_ATTRIBUTES ObjectAttributes;
|
||||
NTSTATUS Status;
|
||||
HANDLE NamedPortHandle;
|
||||
HANDLE PortHandle;
|
||||
LPCMESSAGE ConnectMsg;
|
||||
|
||||
printf("(lpcsrv.exe) Lpc test server\n");
|
||||
|
||||
RtlInitUnicodeString(&PortName, L"\\TestPort");
|
||||
InitializeObjectAttributes(&ObjectAttributes,
|
||||
&PortName,
|
||||
0,
|
||||
NULL,
|
||||
NULL);
|
||||
|
||||
printf("(lpcsrv.exe) Creating port\n");
|
||||
Status = NtCreatePort(&NamedPortHandle,
|
||||
&ObjectAttributes,
|
||||
0,
|
||||
0,
|
||||
0);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
printf("(lpcsrv.exe) Failed to create port\n");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
printf("(lpcsrv.exe) Listening for connections\n");
|
||||
Status = NtListenPort(NamedPortHandle,
|
||||
&ConnectMsg);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
printf("(lpcsrv.exe) Failed to listen for connections\n");
|
||||
return;
|
||||
}
|
||||
|
||||
printf("(lpcsrv.exe) Accepting connections\n");
|
||||
Status = NtAcceptConnectPort(&PortHandle,
|
||||
NamedPortHandle,
|
||||
NULL,
|
||||
1,
|
||||
0,
|
||||
NULL);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
printf("(lpcsrv.exe) Failed to accept connection\n");
|
||||
return;
|
||||
}
|
||||
|
||||
printf("(lpcsrv.exe) Completing connection\n");
|
||||
Status = NtCompleteConnectPort(PortHandle);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
printf("(lpcsrv.exe) Failed to complete connection\n");
|
||||
return;
|
||||
}
|
||||
|
||||
for(;;)
|
||||
{
|
||||
LPCMESSAGE Request;
|
||||
|
||||
Status = NtReplyWaitReceivePort(PortHandle,
|
||||
0,
|
||||
NULL,
|
||||
&Request);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
printf("(lpcsrv.exe) Failed to receive request\n");
|
||||
return;
|
||||
}
|
||||
|
||||
printf("(lpcsrv.exe) Message contents are <%s>\n", Request.MessageData);
|
||||
}
|
||||
}
|
51
reactos/apps/tests/lpc/makefile
Normal file
51
reactos/apps/tests/lpc/makefile
Normal file
@@ -0,0 +1,51 @@
|
||||
#
|
||||
#
|
||||
#
|
||||
SRV_OBJECTS= ../common/crt0.o lpcsrv.o
|
||||
CLT_OBJECTS= ../common/crt0.o lpcclt.o
|
||||
|
||||
PROGS= lpcsrv.exe lpcclt.exe
|
||||
|
||||
BASE_CFLAGS = -I../../include
|
||||
LIBS = ../../lib/crtdll/crtdll.a ../../lib/kernel32/kernel32.a \
|
||||
../../lib/ntdll/ntdll.a
|
||||
|
||||
all: $(PROGS)
|
||||
|
||||
.phony: all
|
||||
|
||||
clean:
|
||||
- $(RM) lpcsrv.o
|
||||
- $(RM) lpcsrv.exe
|
||||
- $(RM) lpcsrv.sym
|
||||
|
||||
.phony: clean
|
||||
|
||||
floppy: $(PROGS:%=$(FLOPPY_DIR)/apps/%)
|
||||
|
||||
$(PROGS:%=$(FLOPPY_DIR)/apps/%): $(FLOPPY_DIR)/apps/%: %
|
||||
ifeq ($(DOSCLI),yes)
|
||||
$(CP) $* $(FLOPPY_DIR)\apps\$*
|
||||
else
|
||||
$(CP) $* $(FLOPPY_DIR)/apps/$*
|
||||
endif
|
||||
|
||||
dist: $(PROGS:%=../../$(DIST_DIR)/apps/%)
|
||||
|
||||
$(PROGS:%=../../$(DIST_DIR)/apps/%): ../../$(DIST_DIR)/apps/%: %
|
||||
ifeq ($(DOSCLI),yes)
|
||||
$(CP) $* ..\..\$(DIST_DIR)\apps\$*
|
||||
else
|
||||
$(CP) $* ../../$(DIST_DIR)/apps/$*
|
||||
endif
|
||||
|
||||
lpcsrv.exe: $(SRV_OBJECTS) $(LIBS)
|
||||
$(LD) $(SRV_OBJECTS) $(LIBS) -o lpcsrv.exe
|
||||
$(NM) --numeric-sort lpcsrv.exe > lpcsrv.sym
|
||||
|
||||
lpcclt.exe: $(CLT_OBJECTS) $(LIBS)
|
||||
$(LD) $(CLT_OBJECTS) $(LIBS) -o lpcclt.exe
|
||||
$(NM) --numeric-sort lpcclt.exe > lpcclt.sym
|
||||
|
||||
|
||||
include ../../rules.mak
|
51
reactos/apps/tests/shm/makefile
Normal file
51
reactos/apps/tests/shm/makefile
Normal file
@@ -0,0 +1,51 @@
|
||||
#
|
||||
#
|
||||
#
|
||||
SRV_OBJECTS= ../common/crt0.o shmsrv.o
|
||||
CLT_OBJECTS= ../common/crt0.o shmclt.o
|
||||
|
||||
PROGS= shmsrv.exe shmclt.exe
|
||||
|
||||
BASE_CFLAGS = -I../../include
|
||||
LIBS = ../../lib/crtdll/crtdll.a ../../lib/kernel32/kernel32.a \
|
||||
../../lib/ntdll/ntdll.a
|
||||
|
||||
all: $(PROGS)
|
||||
|
||||
.phony: all
|
||||
|
||||
clean:
|
||||
- $(RM) *.o
|
||||
- $(RM) *.exe
|
||||
- $(RM) *.sym
|
||||
|
||||
.phony: clean
|
||||
|
||||
floppy: $(PROGS:%=$(FLOPPY_DIR)/apps/%)
|
||||
|
||||
$(PROGS:%=$(FLOPPY_DIR)/apps/%): $(FLOPPY_DIR)/apps/%: %
|
||||
ifeq ($(DOSCLI),yes)
|
||||
$(CP) $* $(FLOPPY_DIR)\apps\$*
|
||||
else
|
||||
$(CP) $* $(FLOPPY_DIR)/apps/$*
|
||||
endif
|
||||
|
||||
dist: $(PROGS:%=../../$(DIST_DIR)/apps/%)
|
||||
|
||||
$(PROGS:%=../../$(DIST_DIR)/apps/%): ../../$(DIST_DIR)/apps/%: %
|
||||
ifeq ($(DOSCLI),yes)
|
||||
$(CP) $* ..\..\$(DIST_DIR)\apps\$*
|
||||
else
|
||||
$(CP) $* ../../$(DIST_DIR)/apps/$*
|
||||
endif
|
||||
|
||||
shmsrv.exe: $(SRV_OBJECTS) $(LIBS)
|
||||
$(LD) $(SRV_OBJECTS) $(LIBS) -o shmsrv.exe
|
||||
$(NM) --numeric-sort shmsrv.exe > shmsrv.sym
|
||||
|
||||
shmclt.exe: $(CLT_OBJECTS) $(LIBS)
|
||||
$(LD) $(CLT_OBJECTS) $(LIBS) -o shmclt.exe
|
||||
$(NM) --numeric-sort shmsrv.exe > shmclt.sym
|
||||
|
||||
|
||||
include ../../rules.mak
|
60
reactos/apps/tests/shm/shmclt.c
Normal file
60
reactos/apps/tests/shm/shmclt.c
Normal file
@@ -0,0 +1,60 @@
|
||||
#include <ddk/ntddk.h>
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
HANDLE OutputHandle;
|
||||
HANDLE InputHandle;
|
||||
|
||||
void debug_printf(char* fmt, ...)
|
||||
{
|
||||
va_list args;
|
||||
char buffer[255];
|
||||
|
||||
va_start(args,fmt);
|
||||
vsprintf(buffer,fmt,args);
|
||||
WriteConsoleA(OutputHandle, buffer, strlen(buffer), NULL, NULL);
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
main(int argc, char* argv[])
|
||||
{
|
||||
HANDLE Section;
|
||||
PVOID BaseAddress;
|
||||
char buffer[256];
|
||||
|
||||
printf("Shm test server\n");
|
||||
|
||||
Section = OpenFileMappingW (
|
||||
// PAGE_EXECUTE_READWRITE, invalid parameter
|
||||
FILE_MAP_WRITE,
|
||||
FALSE,
|
||||
L"TestSection"
|
||||
);
|
||||
if (Section == NULL)
|
||||
{
|
||||
printf("Failed to open section (err=%d)", GetLastError());
|
||||
return 1;
|
||||
}
|
||||
|
||||
BaseAddress = MapViewOfFile(Section,
|
||||
FILE_MAP_ALL_ACCESS,
|
||||
0,
|
||||
0,
|
||||
8192);
|
||||
if (BaseAddress == NULL)
|
||||
{
|
||||
printf("Failed to map section (err=%d)\n", GetLastError());
|
||||
return 1;
|
||||
}
|
||||
printf("BaseAddress %x\n", (UINT) BaseAddress);
|
||||
printf("Copying from section\n");
|
||||
strcpy(buffer, BaseAddress);
|
||||
printf("Copyed <%s>\n", buffer);
|
||||
|
||||
// for(;;);
|
||||
return 0;
|
||||
}
|
||||
|
52
reactos/apps/tests/shm/shmsrv.c
Normal file
52
reactos/apps/tests/shm/shmsrv.c
Normal file
@@ -0,0 +1,52 @@
|
||||
/* $Id: shmsrv.c,v 1.3 1999/12/30 01:51:36 dwelch Exp $
|
||||
*
|
||||
* FILE : reactos/apps/shm/shmsrv.c
|
||||
* AUTHOR: David Welch
|
||||
*/
|
||||
#include <ddk/ntddk.h>
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
HANDLE Section;
|
||||
PVOID BaseAddress;
|
||||
|
||||
printf("Shm test server\n");
|
||||
|
||||
Section = CreateFileMappingW (
|
||||
(HANDLE) 0xFFFFFFFF,
|
||||
NULL,
|
||||
PAGE_READWRITE,
|
||||
0,
|
||||
8192,
|
||||
L"TestSection"
|
||||
);
|
||||
if (Section == NULL)
|
||||
{
|
||||
printf("Failed to create section (err=%d)", GetLastError());
|
||||
return 1;
|
||||
}
|
||||
|
||||
printf("Mapping view of section\n");
|
||||
BaseAddress = MapViewOfFile(Section,
|
||||
FILE_MAP_ALL_ACCESS,
|
||||
0,
|
||||
0,
|
||||
8192);
|
||||
printf("BaseAddress %x\n", (UINT) BaseAddress);
|
||||
if (BaseAddress == NULL)
|
||||
{
|
||||
printf("Failed to map section\n");
|
||||
}
|
||||
|
||||
printf("Copying to section\n");
|
||||
printf("Copying %s\n", GetCommandLineA());
|
||||
strcpy(BaseAddress, GetCommandLineA());
|
||||
|
||||
for(;;);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
11
reactos/apps/tests/test_old/bug2.c
Normal file
11
reactos/apps/tests/test_old/bug2.c
Normal file
@@ -0,0 +1,11 @@
|
||||
#include <stdio.h>
|
||||
|
||||
int
|
||||
main (void)
|
||||
{
|
||||
int i;
|
||||
puts ("This should print \"wow = I\" for I from 0 to 39 inclusive.");
|
||||
for (i = 0; i < 40; i++)
|
||||
printf ("%s = %d\n", "wow", i);
|
||||
return 0;
|
||||
}
|
53
reactos/apps/tests/test_old/bug3.c
Normal file
53
reactos/apps/tests/test_old/bug3.c
Normal file
@@ -0,0 +1,53 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
int
|
||||
main (void)
|
||||
{
|
||||
FILE *f;
|
||||
int i;
|
||||
const char filename[] = "/tmp/bug3.test";
|
||||
|
||||
f = fopen(filename, "w+");
|
||||
for (i=0; i<9000; i++)
|
||||
putc ('x', f);
|
||||
fseek (f, 8180L, 0);
|
||||
fwrite ("Where does this text go?", 1, 24, f);
|
||||
fflush (f);
|
||||
|
||||
rewind (f);
|
||||
for (i=0; i<9000; i++)
|
||||
{
|
||||
int j;
|
||||
|
||||
if ((j = getc(f)) != 'x')
|
||||
{
|
||||
if (i != 8180)
|
||||
{
|
||||
printf ("Test FAILED!");
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
char buf[25];
|
||||
|
||||
buf[0] = j;
|
||||
fread (buf + 1, 1, 23, f);
|
||||
buf[24] = '\0';
|
||||
if (strcmp (buf, "Where does this text go?") != 0)
|
||||
{
|
||||
printf ("%s\nTest FAILED!\n", buf);
|
||||
return 1;
|
||||
}
|
||||
i += 23;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fclose(f);
|
||||
remove(filename);
|
||||
|
||||
puts ("Test succeeded.");
|
||||
|
||||
return 0;
|
||||
}
|
74
reactos/apps/tests/test_old/makefile
Normal file
74
reactos/apps/tests/test_old/makefile
Normal file
@@ -0,0 +1,74 @@
|
||||
#
|
||||
#
|
||||
#
|
||||
PROGS= test-stdio tst-printf tstdiomisc bug2 bug3 \
|
||||
temptest test-fseek test_rdwr
|
||||
|
||||
all: $(PROGS:%=%.exe)
|
||||
|
||||
.phony: all
|
||||
|
||||
$(PROGS:%=%_clean): %_clean:
|
||||
- $(RM) $*.o
|
||||
- $(RM) $*.exe
|
||||
- $(RM) $*.sym
|
||||
|
||||
clean: $(PROGS:%=%_clean)
|
||||
|
||||
.phony: clean
|
||||
|
||||
floppy: # $(PROGS:%=$(FLOPPY_DIR)/apps/%.exe)
|
||||
|
||||
$(PROGS:%=$(FLOPPY_DIR)/apps/%.exe): $(FLOPPY_DIR)/apps/%.exe: %.exe
|
||||
ifeq ($(DOSCLI),yes)
|
||||
$(CP) $*.exe $(FLOPPY_DIR)\apps\$*.exe
|
||||
else
|
||||
$(CP) $*.exe $(FLOPPY_DIR)/apps/$*.exe
|
||||
endif
|
||||
|
||||
dist: $(PROGS:%=../../$(DIST_DIR)/apps/%.exe)
|
||||
|
||||
$(PROGS:%=../../$(DIST_DIR)/apps/%.exe): ../../$(DIST_DIR)/apps/%.exe: %.exe
|
||||
ifeq ($(DOSCLI),yes)
|
||||
$(CP) $*.exe ..\..\$(DIST_DIR)\apps\$*.exe
|
||||
else
|
||||
$(CP) $*.exe ../../$(DIST_DIR)/apps/$*.exe
|
||||
endif
|
||||
|
||||
bug2.exe: bug2.c
|
||||
$(CC) bug2.c -lkernel32 -o bug2.exe
|
||||
$(NM) --numeric-sort bug2.exe > bug2.sym
|
||||
|
||||
bug3.exe: bug3.c
|
||||
$(CC) bug3.c -lkernel32 -o bug3.exe
|
||||
$(NM) --numeric-sort bug3.exe > bug3.sym
|
||||
|
||||
temptest.exe: temptest.c
|
||||
$(CC) temptest.c -lkernel32 -o temptest.exe
|
||||
$(NM) --numeric-sort temptest.exe > temptest.sym
|
||||
|
||||
test-fseek.exe: test-fseek.c
|
||||
$(CC) test-fseek.c -lkernel32 -o test-fseek.exe
|
||||
$(NM) --numeric-sort test-fseek.exe > test-fseek.sym
|
||||
|
||||
test-fwrite.exe: test-fwrite.c
|
||||
$(CC) test-fwrite.c -lkernel32 -o test-fwrite.exe
|
||||
$(NM) --numeric-sort test-fwrite.exe > test-fwrite.sym
|
||||
|
||||
test_rdwr.exe: test_rdwr.c
|
||||
$(CC) test_rdwr.c -lkernel32 -o test_rdwr.exe
|
||||
$(NM) --numeric-sort test_rdwr.exe > test_rdwr.sym
|
||||
|
||||
test-stdio.exe: test-stdio.c
|
||||
$(CC) test-stdio.c -lkernel32 -o test-stdio.exe
|
||||
$(NM) --numeric-sort test-stdio.exe > test-stdio.sym
|
||||
|
||||
tst-printf.exe: tst-printf.c
|
||||
$(CC) tst-printf.c -lkernel32 -o tst-printf.exe
|
||||
$(NM) --numeric-sort tst-printf.exe > tst-printf.sym
|
||||
|
||||
tstdiomisc.exe: tstdiomisc.c
|
||||
$(CC) tstdiomisc.c -lkernel32 -o tstdiomisc.exe
|
||||
$(NM) --numeric-sort tstdiomisc.exe > tstdiomisc.sym
|
||||
|
||||
include ../../rules.mak
|
27
reactos/apps/tests/test_old/temptest.c
Normal file
27
reactos/apps/tests/test_old/temptest.c
Normal file
@@ -0,0 +1,27 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
char *files[500];
|
||||
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
{
|
||||
FILE *fp;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 500; i++) {
|
||||
files[i] = tempnam (NULL, "file");
|
||||
if (files[i] == NULL) {
|
||||
printf ("tempnam failed\n");
|
||||
exit (1);
|
||||
}
|
||||
printf ("file: %s\n", files[i]);
|
||||
fp = fopen (files[i], "w");
|
||||
fclose (fp);
|
||||
}
|
||||
|
||||
for (i = 0; i < 500; i++)
|
||||
remove (files[i]);
|
||||
|
||||
exit (0);
|
||||
}
|
85
reactos/apps/tests/test_old/test-fseek.c
Normal file
85
reactos/apps/tests/test_old/test-fseek.c
Normal file
@@ -0,0 +1,85 @@
|
||||
/* Copyright (C) 1991, 1992, 1996, 1997 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#define TESTFILE "/tmp/test.dat"
|
||||
|
||||
int
|
||||
main (void)
|
||||
{
|
||||
FILE *fp;
|
||||
int i, j;
|
||||
|
||||
puts ("\nFile seek test");
|
||||
fp = fopen (TESTFILE, "w");
|
||||
if (fp == NULL)
|
||||
{
|
||||
perror (TESTFILE);
|
||||
return 1;
|
||||
}
|
||||
|
||||
for (i = 0; i < 256; i++)
|
||||
putc (i, fp);
|
||||
if (freopen (TESTFILE, "r", fp) != fp)
|
||||
{
|
||||
perror ("Cannot open file for reading");
|
||||
return 1;
|
||||
}
|
||||
|
||||
for (i = 1; i <= 255; i++)
|
||||
{
|
||||
printf ("%3d\n", i);
|
||||
fseek (fp, (long) -i, SEEK_END);
|
||||
if ((j = getc (fp)) != 256 - i)
|
||||
{
|
||||
printf ("SEEK_END failed %d\n", j);
|
||||
break;
|
||||
}
|
||||
if (fseek (fp, (long) i, SEEK_SET))
|
||||
{
|
||||
puts ("Cannot SEEK_SET");
|
||||
break;
|
||||
}
|
||||
if ((j = getc (fp)) != i)
|
||||
{
|
||||
printf ("SEEK_SET failed %d\n", j);
|
||||
break;
|
||||
}
|
||||
if (fseek (fp, (long) i, SEEK_SET))
|
||||
{
|
||||
puts ("Cannot SEEK_SET");
|
||||
break;
|
||||
}
|
||||
if (fseek (fp, (long) (i >= 128 ? -128 : 128), SEEK_CUR))
|
||||
{
|
||||
puts ("Cannot SEEK_CUR");
|
||||
break;
|
||||
}
|
||||
if ((j = getc (fp)) != (i >= 128 ? i - 128 : i + 128))
|
||||
{
|
||||
printf ("SEEK_CUR failed %d\n", j);
|
||||
break;
|
||||
}
|
||||
}
|
||||
fclose (fp);
|
||||
remove (TESTFILE);
|
||||
|
||||
puts ((i > 255) ? "Test succeeded." : "Test FAILED!");
|
||||
return (i > 255) ? 0 : 1;
|
||||
}
|
68
reactos/apps/tests/test_old/test-fwrite.c
Normal file
68
reactos/apps/tests/test_old/test-fwrite.c
Normal file
@@ -0,0 +1,68 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
{
|
||||
FILE *f = tmpfile ();
|
||||
char obuf[99999], ibuf[sizeof obuf];
|
||||
char *line;
|
||||
size_t linesz;
|
||||
|
||||
if (! f)
|
||||
{
|
||||
perror ("tmpfile");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (fputs ("line\n", f) == EOF)
|
||||
{
|
||||
perror ("fputs");
|
||||
return 1;
|
||||
}
|
||||
|
||||
memset (obuf, 'z', sizeof obuf);
|
||||
memset (ibuf, 'y', sizeof ibuf);
|
||||
|
||||
if (fwrite (obuf, sizeof obuf, 1, f) != 1)
|
||||
{
|
||||
perror ("fwrite");
|
||||
return 1;
|
||||
}
|
||||
|
||||
rewind (f);
|
||||
|
||||
line = NULL;
|
||||
linesz = 0;
|
||||
if (getline (&line, &linesz, f) != 5)
|
||||
{
|
||||
perror ("getline");
|
||||
return 1;
|
||||
}
|
||||
if (strcmp (line, "line\n"))
|
||||
{
|
||||
puts ("Lines differ. Test FAILED!");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (fread (ibuf, sizeof ibuf, 1, f) != 1)
|
||||
{
|
||||
perror ("fread");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (memcmp (ibuf, obuf, sizeof ibuf))
|
||||
{
|
||||
puts ("Buffers differ. Test FAILED!");
|
||||
return 1;
|
||||
}
|
||||
|
||||
asprintf (&line, "\
|
||||
GDB is free software and you are welcome to distribute copies of it\n\
|
||||
under certain conditions; type \"show copying\" to see the conditions.\n\
|
||||
There is absolutely no warranty for GDB; type \"show warranty\" for details.\n\
|
||||
");
|
||||
|
||||
puts ("Test succeeded.");
|
||||
return 0;
|
||||
}
|
55
reactos/apps/tests/test_old/test-stdio.c
Normal file
55
reactos/apps/tests/test_old/test-stdio.c
Normal file
@@ -0,0 +1,55 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
char msg1[] = "testing _write\n";
|
||||
char msg2[] = "testing putchar.";
|
||||
char msg3[] = "testing printf.";
|
||||
char tmpbuf[255];
|
||||
FILE* f1;
|
||||
|
||||
write(1, msg1, strlen(msg1));
|
||||
|
||||
write(1, msg2, strlen(msg2));
|
||||
putchar('o'); putchar('k'); putchar('\n');
|
||||
|
||||
write(1, msg3, strlen(msg3));
|
||||
printf("ok\n");
|
||||
|
||||
printf("Testing fopen\n");
|
||||
f1 = fopen("tmp.txt","w+b");
|
||||
if (f1 == NULL)
|
||||
{
|
||||
printf("fopen failed\n");
|
||||
return(1);
|
||||
}
|
||||
|
||||
printf("Testing fwrite\n");
|
||||
if (fwrite(msg1, 1, strlen(msg1)+1, f1) != (strlen(msg1)+1))
|
||||
{
|
||||
printf("fwrite failed\n");
|
||||
return(1);
|
||||
}
|
||||
|
||||
printf("Testing fread\n");
|
||||
fseek(f1, 0, SEEK_SET);
|
||||
if (fread(tmpbuf, 1, strlen(msg1)+1, f1) != (strlen(msg1)+1))
|
||||
{
|
||||
printf("fread failed\n");
|
||||
return(1);
|
||||
}
|
||||
if (strcmp(tmpbuf,msg1) != 0)
|
||||
{
|
||||
printf("fread failed, data corrupt\n");
|
||||
return(1);
|
||||
}
|
||||
|
||||
printf("Testing fclose\n");
|
||||
if (fclose(f1) != 0)
|
||||
{
|
||||
printf("fclose failed\n");
|
||||
return(1);
|
||||
}
|
||||
return(0);
|
||||
}
|
129
reactos/apps/tests/test_old/test_rdwr.c
Normal file
129
reactos/apps/tests/test_old/test_rdwr.c
Normal file
@@ -0,0 +1,129 @@
|
||||
/* Copyright (C) 1991, 1992, 1996, 1997, 1998 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
static const char hello[] = "Hello, world.\n";
|
||||
static const char replace[] = "Hewwo, world.\n";
|
||||
static const size_t replace_from = 2, replace_to = 4;
|
||||
char filename[FILENAME_MAX];
|
||||
char *name = strrchr (*argv, '/');
|
||||
char buf[BUFSIZ];
|
||||
FILE *f;
|
||||
int lose = 0;
|
||||
|
||||
if (name != NULL)
|
||||
++name;
|
||||
else
|
||||
name = *argv;
|
||||
|
||||
(void) sprintf (filename, "/tmp/%s.test", name);
|
||||
|
||||
f = fopen (filename, "w+");
|
||||
if (f == NULL)
|
||||
{
|
||||
perror (filename);
|
||||
exit (1);
|
||||
}
|
||||
|
||||
(void) fputs (hello, f);
|
||||
rewind (f);
|
||||
(void) fgets (buf, sizeof (buf), f);
|
||||
rewind (f);
|
||||
(void) fputs (buf, f);
|
||||
rewind (f);
|
||||
{
|
||||
size_t i;
|
||||
for (i = 0; i < replace_from; ++i)
|
||||
{
|
||||
int c = getc (f);
|
||||
if (c == EOF)
|
||||
{
|
||||
printf ("EOF at %Zu.\n", i);
|
||||
lose = 1;
|
||||
break;
|
||||
}
|
||||
else if (c != hello[i])
|
||||
{
|
||||
printf ("Got '%c' instead of '%c' at %Zu.\n",
|
||||
(unsigned char) c, hello[i], i);
|
||||
lose = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
long int where = ftell (f);
|
||||
if (where == (long int) replace_from)
|
||||
{
|
||||
register size_t i;
|
||||
for (i = replace_from; i < replace_to; ++i)
|
||||
if (putc(replace[i], f) == EOF)
|
||||
{
|
||||
printf ("putc('%c') got %s at %Zu.\n",
|
||||
replace[i], strerror (errno), i);
|
||||
lose = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (where == -1L)
|
||||
{
|
||||
printf ("ftell got %s (should be at %Zu).\n",
|
||||
strerror (errno), replace_from);
|
||||
lose = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
printf ("ftell returns %lu; should be %Zu.\n", where, replace_from);
|
||||
lose = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (!lose)
|
||||
{
|
||||
rewind (f);
|
||||
if (fgets (buf, sizeof (buf), f) == NULL)
|
||||
{
|
||||
printf ("fgets got %s.\n", strerror(errno));
|
||||
lose = 1;
|
||||
}
|
||||
else if (strcmp (buf, replace))
|
||||
{
|
||||
printf ("Read \"%s\" instead of \"%s\".\n", buf, replace);
|
||||
lose = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (lose)
|
||||
printf ("Test FAILED! Losing file is \"%s\".\n", filename);
|
||||
else
|
||||
{
|
||||
(void) remove (filename);
|
||||
puts ("Test succeeded.");
|
||||
}
|
||||
|
||||
exit (lose ? EXIT_FAILURE : EXIT_SUCCESS);
|
||||
}
|
311
reactos/apps/tests/test_old/tst-printf.c
Normal file
311
reactos/apps/tests/test_old/tst-printf.c
Normal file
@@ -0,0 +1,311 @@
|
||||
/* Copyright (C) 1991, 92, 93, 95, 96, 97, 98 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#ifdef BSD
|
||||
#include </usr/include/stdio.h>
|
||||
#define EXIT_SUCCESS 0
|
||||
#else
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#endif
|
||||
|
||||
#include <float.h>
|
||||
|
||||
void rfg1 (void);
|
||||
void rfg2 (void);
|
||||
|
||||
|
||||
void
|
||||
fmtchk (const char *fmt)
|
||||
{
|
||||
(void) fputs(fmt, stdout);
|
||||
(void) printf(":\t`");
|
||||
(void) printf(fmt, 0x12);
|
||||
(void) printf("'\n");
|
||||
}
|
||||
|
||||
void
|
||||
fmtst1chk (const char *fmt)
|
||||
{
|
||||
(void) fputs(fmt, stdout);
|
||||
(void) printf(":\t`");
|
||||
(void) printf(fmt, 4, 0x12);
|
||||
(void) printf("'\n");
|
||||
}
|
||||
|
||||
void
|
||||
fmtst2chk (const char *fmt)
|
||||
{
|
||||
(void) fputs(fmt, stdout);
|
||||
(void) printf(":\t`");
|
||||
(void) printf(fmt, 4, 4, 0x12);
|
||||
(void) printf("'\n");
|
||||
}
|
||||
|
||||
/* This page is covered by the following copyright: */
|
||||
|
||||
/* (C) Copyright C E Chew
|
||||
*
|
||||
* Feel free to copy, use and distribute this software provided:
|
||||
*
|
||||
* 1. you do not pretend that you wrote it
|
||||
* 2. you leave this copyright notice intact.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Extracted from exercise.c for glibc-1.05 bug report by Bruce Evans.
|
||||
*/
|
||||
|
||||
#define DEC -123
|
||||
#define INT 255
|
||||
#define UNS (~0)
|
||||
|
||||
/* Formatted Output Test
|
||||
*
|
||||
* This exercises the output formatting code.
|
||||
*/
|
||||
|
||||
void
|
||||
fp_test (void)
|
||||
{
|
||||
int i, j, k, l;
|
||||
char buf[7];
|
||||
char *prefix = buf;
|
||||
char tp[20];
|
||||
|
||||
puts("\nFormatted output test");
|
||||
printf("prefix 6d 6o 6x 6X 6u\n");
|
||||
strcpy(prefix, "%");
|
||||
for (i = 0; i < 2; i++) {
|
||||
for (j = 0; j < 2; j++) {
|
||||
for (k = 0; k < 2; k++) {
|
||||
for (l = 0; l < 2; l++) {
|
||||
strcpy(prefix, "%");
|
||||
if (i == 0) strcat(prefix, "-");
|
||||
if (j == 0) strcat(prefix, "+");
|
||||
if (k == 0) strcat(prefix, "#");
|
||||
if (l == 0) strcat(prefix, "0");
|
||||
printf("%5s |", prefix);
|
||||
strcpy(tp, prefix);
|
||||
strcat(tp, "6d |");
|
||||
printf(tp, DEC);
|
||||
strcpy(tp, prefix);
|
||||
strcat(tp, "6o |");
|
||||
printf(tp, INT);
|
||||
strcpy(tp, prefix);
|
||||
strcat(tp, "6x |");
|
||||
printf(tp, INT);
|
||||
strcpy(tp, prefix);
|
||||
strcat(tp, "6X |");
|
||||
printf(tp, INT);
|
||||
strcpy(tp, prefix);
|
||||
strcat(tp, "6u |");
|
||||
printf(tp, UNS);
|
||||
printf("\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
printf("%10s\n", (char *) NULL);
|
||||
printf("%-10s\n", (char *) NULL);
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
{
|
||||
static char shortstr[] = "Hi, Z.";
|
||||
static char longstr[] = "Good morning, Doctor Chandra. This is Hal. \
|
||||
I am ready for my first lesson today.";
|
||||
|
||||
fmtchk("%.4x");
|
||||
fmtchk("%04x");
|
||||
fmtchk("%4.4x");
|
||||
fmtchk("%04.4x");
|
||||
fmtchk("%4.3x");
|
||||
fmtchk("%04.3x");
|
||||
|
||||
fmtst1chk("%.*x");
|
||||
fmtst1chk("%0*x");
|
||||
fmtst2chk("%*.*x");
|
||||
fmtst2chk("%0*.*x");
|
||||
|
||||
#ifndef BSD
|
||||
printf("bad format:\t\"%b\"\n");
|
||||
printf("nil pointer (padded):\t\"%10p\"\n", (void *) NULL);
|
||||
#endif
|
||||
|
||||
printf("decimal negative:\t\"%d\"\n", -2345);
|
||||
printf("octal negative:\t\"%o\"\n", -2345);
|
||||
printf("hex negative:\t\"%x\"\n", -2345);
|
||||
printf("long decimal number:\t\"%ld\"\n", -123456L);
|
||||
printf("long octal negative:\t\"%lo\"\n", -2345L);
|
||||
printf("long unsigned decimal number:\t\"%lu\"\n", -123456L);
|
||||
printf("zero-padded LDN:\t\"%010ld\"\n", -123456L);
|
||||
printf("left-adjusted ZLDN:\t\"%-010ld\"\n", -123456);
|
||||
printf("space-padded LDN:\t\"%10ld\"\n", -123456L);
|
||||
printf("left-adjusted SLDN:\t\"%-10ld\"\n", -123456L);
|
||||
|
||||
printf("zero-padded string:\t\"%010s\"\n", shortstr);
|
||||
printf("left-adjusted Z string:\t\"%-010s\"\n", shortstr);
|
||||
printf("space-padded string:\t\"%10s\"\n", shortstr);
|
||||
printf("left-adjusted S string:\t\"%-10s\"\n", shortstr);
|
||||
printf("null string:\t\"%s\"\n", (char *)NULL);
|
||||
printf("limited string:\t\"%.22s\"\n", longstr);
|
||||
|
||||
printf("e-style >= 1:\t\"%e\"\n", 12.34);
|
||||
printf("e-style >= .1:\t\"%e\"\n", 0.1234);
|
||||
printf("e-style < .1:\t\"%e\"\n", 0.001234);
|
||||
printf("e-style big:\t\"%.60e\"\n", 1e20);
|
||||
printf ("e-style == .1:\t\"%e\"\n", 0.1);
|
||||
printf("f-style >= 1:\t\"%f\"\n", 12.34);
|
||||
printf("f-style >= .1:\t\"%f\"\n", 0.1234);
|
||||
printf("f-style < .1:\t\"%f\"\n", 0.001234);
|
||||
printf("g-style >= 1:\t\"%g\"\n", 12.34);
|
||||
printf("g-style >= .1:\t\"%g\"\n", 0.1234);
|
||||
printf("g-style < .1:\t\"%g\"\n", 0.001234);
|
||||
printf("g-style big:\t\"%.60g\"\n", 1e20);
|
||||
|
||||
printf (" %6.5f\n", .099999999860301614);
|
||||
printf (" %6.5f\n", .1);
|
||||
printf ("x%5.4fx\n", .5);
|
||||
|
||||
printf ("%#03x\n", 1);
|
||||
|
||||
{
|
||||
double d = FLT_MIN;
|
||||
int niter = 17;
|
||||
|
||||
while (niter-- != 0)
|
||||
printf ("%.17e\n", d / 2);
|
||||
fflush (stdout);
|
||||
}
|
||||
|
||||
printf ("%15.5e\n", 4.9406564584124654e-324);
|
||||
|
||||
#define FORMAT "|%12.4f|%12.4e|%12.4g|\n"
|
||||
printf (FORMAT, 0.0, 0.0, 0.0);
|
||||
printf (FORMAT, 1.0, 1.0, 1.0);
|
||||
printf (FORMAT, -1.0, -1.0, -1.0);
|
||||
printf (FORMAT, 100.0, 100.0, 100.0);
|
||||
printf (FORMAT, 1000.0, 1000.0, 1000.0);
|
||||
printf (FORMAT, 10000.0, 10000.0, 10000.0);
|
||||
printf (FORMAT, 12345.0, 12345.0, 12345.0);
|
||||
printf (FORMAT, 100000.0, 100000.0, 100000.0);
|
||||
printf (FORMAT, 123456.0, 123456.0, 123456.0);
|
||||
#undef FORMAT
|
||||
|
||||
{
|
||||
char buf[20];
|
||||
printf ("sprintf (\"%%30s\", \"foo\") == %d, \"%.*s\"\n",
|
||||
sprintf (buf, "%30s", "foo"), sizeof (buf), buf);
|
||||
}
|
||||
|
||||
fp_test ();
|
||||
|
||||
printf ("%e should be 1.234568e+06\n", 1234567.8);
|
||||
printf ("%f should be 1234567.800000\n", 1234567.8);
|
||||
printf ("%g should be 1.23457e+06\n", 1234567.8);
|
||||
printf ("%g should be 123.456\n", 123.456);
|
||||
printf ("%g should be 1e+06\n", 1000000.0);
|
||||
printf ("%g should be 10\n", 10.0);
|
||||
printf ("%g should be 0.02\n", 0.02);
|
||||
|
||||
{
|
||||
double x=1.0;
|
||||
printf("%.17f\n",(1.0/x/10.0+1.0)*x-x);
|
||||
}
|
||||
|
||||
puts ("--- Should be no further output. ---");
|
||||
rfg1 ();
|
||||
rfg2 ();
|
||||
|
||||
{
|
||||
char buf[200];
|
||||
int result;
|
||||
|
||||
sprintf(buf,"%*s%*s%*s",-1,"one",-20,"two",-30,"three");
|
||||
|
||||
result = strcmp (buf,
|
||||
"onetwo three ");
|
||||
|
||||
puts (result != 0 ? "Test failed!" : "Test ok.");
|
||||
return result != 0;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
rfg1 (void)
|
||||
{
|
||||
char buf[100];
|
||||
|
||||
sprintf (buf, "%5.s", "xyz");
|
||||
if (strcmp (buf, " ") != 0)
|
||||
printf ("got: '%s', expected: '%s'\n", buf, " ");
|
||||
sprintf (buf, "%5.f", 33.3);
|
||||
if (strcmp (buf, " 33") != 0)
|
||||
printf ("got: '%s', expected: '%s'\n", buf, " 33");
|
||||
sprintf (buf, "%8.e", 33.3e7);
|
||||
if (strcmp (buf, " 3e+08") != 0)
|
||||
printf ("got: '%s', expected: '%s'\n", buf, " 3e+08");
|
||||
sprintf (buf, "%8.E", 33.3e7);
|
||||
if (strcmp (buf, " 3E+08") != 0)
|
||||
printf ("got: '%s', expected: '%s'\n", buf, " 3E+08");
|
||||
sprintf (buf, "%.g", 33.3);
|
||||
if (strcmp (buf, "3e+01") != 0)
|
||||
printf ("got: '%s', expected: '%s'\n", buf, "3e+01");
|
||||
sprintf (buf, "%.G", 33.3);
|
||||
if (strcmp (buf, "3E+01") != 0)
|
||||
printf ("got: '%s', expected: '%s'\n", buf, "3E+01");
|
||||
}
|
||||
|
||||
void
|
||||
rfg2 (void)
|
||||
{
|
||||
int prec;
|
||||
char buf[100];
|
||||
|
||||
prec = 0;
|
||||
sprintf (buf, "%.*g", prec, 3.3);
|
||||
if (strcmp (buf, "3") != 0)
|
||||
printf ("got: '%s', expected: '%s'\n", buf, "3");
|
||||
prec = 0;
|
||||
sprintf (buf, "%.*G", prec, 3.3);
|
||||
if (strcmp (buf, "3") != 0)
|
||||
printf ("got: '%s', expected: '%s'\n", buf, "3");
|
||||
prec = 0;
|
||||
sprintf (buf, "%7.*G", prec, 3.33);
|
||||
if (strcmp (buf, " 3") != 0)
|
||||
printf ("got: '%s', expected: '%s'\n", buf, " 3");
|
||||
prec = 3;
|
||||
sprintf (buf, "%04.*o", prec, 33);
|
||||
if (strcmp (buf, " 041") != 0)
|
||||
printf ("got: '%s', expected: '%s'\n", buf, " 041");
|
||||
prec = 7;
|
||||
sprintf (buf, "%09.*u", prec, 33);
|
||||
if (strcmp (buf, " 0000033") != 0)
|
||||
printf ("got: '%s', expected: '%s'\n", buf, " 0000033");
|
||||
prec = 3;
|
||||
sprintf (buf, "%04.*x", prec, 33);
|
||||
if (strcmp (buf, " 021") != 0)
|
||||
printf ("got: '%s', expected: '%s'\n", buf, " 021");
|
||||
prec = 3;
|
||||
sprintf (buf, "%04.*X", prec, 33);
|
||||
if (strcmp (buf, " 021") != 0)
|
||||
printf ("got: '%s', expected: '%s'\n", buf, " 021");
|
||||
}
|
56
reactos/apps/tests/test_old/tstdiomisc.c
Normal file
56
reactos/apps/tests/test_old/tstdiomisc.c
Normal file
@@ -0,0 +1,56 @@
|
||||
#include <stdio.h>
|
||||
|
||||
int
|
||||
t1 (void)
|
||||
{
|
||||
int n = -1;
|
||||
sscanf ("abc ", "abc %n", &n);
|
||||
printf ("t1: count=%d\n", n);
|
||||
|
||||
return n != 5;
|
||||
}
|
||||
|
||||
int
|
||||
t2 (void)
|
||||
{
|
||||
int result = 0;
|
||||
int n;
|
||||
long N;
|
||||
int retval;
|
||||
#define SCAN(INPUT, FORMAT, VAR, EXP_RES, EXP_VAL) \
|
||||
VAR = -1; \
|
||||
retval = sscanf (INPUT, FORMAT, &VAR); \
|
||||
printf ("sscanf (\"%s\", \"%s\", &x) => %d, x = %ld\n", \
|
||||
INPUT, FORMAT, retval, (long int) VAR); \
|
||||
result |= retval != EXP_RES || VAR != EXP_VAL
|
||||
|
||||
SCAN ("12345", "%ld", N, 1, 12345);
|
||||
SCAN ("12345", "%llllld", N, 0, -1);
|
||||
SCAN ("12345", "%LLLLLd", N, 0, -1);
|
||||
SCAN ("test ", "%*s%n", n, 0, 4);
|
||||
SCAN ("test ", "%2*s%n", n, 0, -1);
|
||||
SCAN ("12 ", "%l2d", n, 0, -1);
|
||||
SCAN ("12 ", "%2ld", N, 1, 12);
|
||||
|
||||
n = -1;
|
||||
N = -1;
|
||||
retval = sscanf ("1 1", "%d %Z", &n, &N);
|
||||
printf ("sscanf (\"1 1\", \"%%d %%Z\", &n, &N) => %d, n = %d, N = %ld\n", \
|
||||
retval, n, N); \
|
||||
result |= retval != 1 || n != 1 || N != -1;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
{
|
||||
int result = 0;
|
||||
|
||||
result |= t1 ();
|
||||
result |= t2 ();
|
||||
|
||||
result |= fflush (stdout) == EOF;
|
||||
|
||||
return result;
|
||||
}
|
41
reactos/apps/tests/thread/makefile
Normal file
41
reactos/apps/tests/thread/makefile
Normal file
@@ -0,0 +1,41 @@
|
||||
#
|
||||
#
|
||||
#
|
||||
PROGS = thread
|
||||
|
||||
all: $(PROGS:%=%.exe)
|
||||
|
||||
.phony: all
|
||||
|
||||
clean: $(PROGS:%=%_clean)
|
||||
|
||||
$(PROGS:%=%_clean): %_clean:
|
||||
- $(RM) $*.o
|
||||
- $(RM) $*.exe
|
||||
- $(RM) $*.sym
|
||||
|
||||
.phony: clean
|
||||
|
||||
floppy: # $(PROGS:%=$(FLOPPY_DIR)/apps/%.exe)
|
||||
|
||||
$(PROGS:%=$(FLOPPY_DIR)/apps/%.exe): $(FLOPPY_DIR)/apps/%.exe: %.exe
|
||||
ifeq ($(DOSCLI),yes)
|
||||
$(CP) $*.exe $(FLOPPY_DIR)\apps\$*.exe
|
||||
else
|
||||
$(CP) $*.exe $(FLOPPY_DIR)/apps/$*.exe
|
||||
endif
|
||||
|
||||
dist: $(PROGS:%=../../$(DIST_DIR)/apps/%.exe)
|
||||
|
||||
$(PROGS:%=../../$(DIST_DIR)/apps/%.exe): ../../$(DIST_DIR)/apps/%.exe: %.exe
|
||||
ifeq ($(DOSCLI),yes)
|
||||
$(CP) $*.exe ..\..\$(DIST_DIR)\apps\$*.exe
|
||||
else
|
||||
$(CP) $*.exe ../../$(DIST_DIR)/apps/$*.exe
|
||||
endif
|
||||
|
||||
thread.exe: thread.c
|
||||
$(CC) $(CFLAGS) thread.c -lkernel32 -o thread.exe
|
||||
$(NM) --numeric-sort thread.exe > thread.sym
|
||||
|
||||
include ../../rules.mak
|
46
reactos/apps/tests/thread/thread.c
Normal file
46
reactos/apps/tests/thread/thread.c
Normal file
@@ -0,0 +1,46 @@
|
||||
#include <stdio.h>
|
||||
#include <windows.h>
|
||||
|
||||
#define NR_THREADS (10)
|
||||
|
||||
ULONG nr;
|
||||
|
||||
DWORD WINAPI thread_main1(LPVOID param)
|
||||
{
|
||||
ULONG s;
|
||||
|
||||
printf("Thread %d running\n", (DWORD)param);
|
||||
s = nr = ((nr * 1103515245) + 12345) & 0x7fffffff;
|
||||
s = s % 10;
|
||||
printf("s %d\n", s);
|
||||
Sleep(s);
|
||||
printf("Thread %d finished\n", (DWORD)param);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int main (int argc, char* argv[])
|
||||
{
|
||||
HANDLE hThread;
|
||||
DWORD i=0;
|
||||
DWORD id;
|
||||
ULONG nr;
|
||||
|
||||
nr = atoi(argv[1]);
|
||||
printf("Seed %d\n", nr);
|
||||
|
||||
printf("Creating %d threads...\n",NR_THREADS*2);
|
||||
for (i=0;i<NR_THREADS;i++)
|
||||
{
|
||||
CreateThread(NULL,
|
||||
0,
|
||||
thread_main1,
|
||||
(LPVOID)i,
|
||||
0,
|
||||
&id);
|
||||
|
||||
}
|
||||
|
||||
printf("All threads created...\n");
|
||||
for(;;);
|
||||
return 0;
|
||||
}
|
@@ -1,162 +0,0 @@
|
||||
#
|
||||
# ReactOS system testsets makefile
|
||||
#
|
||||
|
||||
PATH_TO_TOP = ../..
|
||||
|
||||
include $(PATH_TO_TOP)/rules.mak
|
||||
|
||||
|
||||
# Testset applications
|
||||
TEST_SETS = loadlib
|
||||
|
||||
TEST_KERNEL32 =
|
||||
|
||||
TEST_MSVCRT =
|
||||
|
||||
TEST_COM =
|
||||
|
||||
TEST_SEH =
|
||||
|
||||
TEST_REGRESSIONS =
|
||||
|
||||
all: $(TEST_SETS) $(TEST_KERNEL32) $(TEST_MSVCRT) $(TEST_COM) $(TEST_SEH) $(TEST_REGRESSIONS)
|
||||
|
||||
depends:
|
||||
|
||||
implib: $(TEST_SETS:%=%_implib) \
|
||||
$(TEST_KERNEL32:%=%_implib) \
|
||||
$(TEST_MSVCRT:%=%_implib) \
|
||||
$(TEST_COM:%=%_implib) \
|
||||
$(TEST_SEH:%=%_implib) \
|
||||
$(TEST_REGRESSIONS:%=%_implib)
|
||||
|
||||
clean: $(TEST_SETS:%=%_clean) \
|
||||
$(TEST_KERNEL32:%=%_clean) \
|
||||
$(TEST_MSVCRT:%=%_clean) \
|
||||
$(TEST_COM:%=%_clean) \
|
||||
$(TEST_SEH:%=%_clean) \
|
||||
$(TEST_REGRESSIONS:%=%_clean)
|
||||
|
||||
install: $(TEST_SETS:%=%_install) \
|
||||
$(TEST_KERNEL32:%=%_install) \
|
||||
$(TEST_MSVCRT:%=%_install) \
|
||||
$(TEST_COM:%=%_install) \
|
||||
$(TEST_SEH:%=%_install) \
|
||||
$(TEST_REGRESSIONS:%=%_install)
|
||||
|
||||
.PHONY: all depends implib clean install
|
||||
|
||||
|
||||
#
|
||||
# Testset Applications
|
||||
#
|
||||
$(TEST_SETS): %:
|
||||
$(MAKE) -C $*
|
||||
|
||||
$(TEST_SETS:%=%_implib): %_implib:
|
||||
$(MAKE) -C $* implib
|
||||
|
||||
$(TEST_SETS:%=%_clean): %_clean:
|
||||
$(MAKE) -C $* clean
|
||||
|
||||
$(TEST_SETS:%=%_install): %_install:
|
||||
$(MAKE) -C $* install
|
||||
|
||||
.PHONY: $(TEST_SETS) $(TEST_SETS:%=%_implib) $(TEST_SETS:%=%_clean) $(TEST_SETS:%=%_install)
|
||||
|
||||
|
||||
#
|
||||
# Kernel32 Test Applications
|
||||
#
|
||||
$(TEST_KERNEL32): %:
|
||||
$(MAKE) -C kernel32/$*
|
||||
|
||||
$(TEST_KERNEL32:%=%_implib): %_implib:
|
||||
$(MAKE) -C kernel32/$* implib
|
||||
|
||||
$(TEST_KERNEL32:%=%_clean): %_clean:
|
||||
$(MAKE) -C kernel32/$* clean
|
||||
|
||||
$(TEST_KERNEL32:%=%_install): %_install:
|
||||
$(MAKE) -C kernel32/$* install
|
||||
|
||||
.PHONY: $(TEST_KERNEL32) $(TEST_KERNEL32:%=%_implib) $(TEST_KERNEL32:%=%_clean) $(TEST_KERNEL32:%=%_install)
|
||||
|
||||
|
||||
#
|
||||
# msvcrt Test Applications
|
||||
#
|
||||
$(TEST_MSVCRT): %:
|
||||
$(MAKE) -C msvcrt/$*
|
||||
|
||||
$(TEST_MSVCRT:%=%_implib): %_implib:
|
||||
$(MAKE) -C msvcrt/$* implib
|
||||
|
||||
$(TEST_MSVCRT:%=%_clean): %_clean:
|
||||
$(MAKE) -C msvcrt/$* clean
|
||||
|
||||
$(TEST_MSVCRT:%=%_install): %_install:
|
||||
$(MAKE) -C msvcrt/$* install
|
||||
|
||||
.PHONY: $(TEST_MSVCRT) $(TEST_MSVCRT:%=%_implib) $(TEST_MSVCRT:%=%_clean) $(TEST_MSVCRT:%=%_install)
|
||||
|
||||
|
||||
#
|
||||
# COM Test Applications
|
||||
#
|
||||
$(TEST_COM): %:
|
||||
$(MAKE) -C com/$*
|
||||
|
||||
$(TEST_COM:%=%_implib): %_implib:
|
||||
$(MAKE) -C com/$* implib
|
||||
|
||||
$(TEST_COM:%=%_clean): %_clean:
|
||||
$(MAKE) -C com/$* clean
|
||||
|
||||
$(TEST_COM:%=%_install): %_install:
|
||||
$(MAKE) -C com/$* install
|
||||
|
||||
.PHONY: $(TEST_COM) $(TEST_COM:%=%_implib) $(TEST_COM:%=%_clean) $(TEST_COM:%=%_install)
|
||||
|
||||
|
||||
#
|
||||
# SEH Test Applications
|
||||
#
|
||||
$(TEST_SEH): %:
|
||||
$(MAKE) -C seh/$*
|
||||
|
||||
$(TEST_SEH:%=%_implib): %_implib:
|
||||
$(MAKE) -C seh/$* implib
|
||||
|
||||
$(TEST_SEH:%=%_clean): %_clean:
|
||||
$(MAKE) -C seh/$* clean
|
||||
|
||||
$(TEST_SEH:%=%_install): %_install:
|
||||
$(MAKE) -C seh/$* install
|
||||
|
||||
.PHONY: $(TEST_SEH) $(TEST_SEH:%=%_implib) $(TEST_SEH:%=%_clean) $(TEST_SEH:%=%_install)
|
||||
|
||||
|
||||
#
|
||||
# Regression Test Applications
|
||||
#
|
||||
$(TEST_REGRESSIONS): %:
|
||||
$(MAKE) -C regres/$*
|
||||
|
||||
$(TEST_REGRESSIONS:%=%_implib): %_implib:
|
||||
$(MAKE) -C regres/$* implib
|
||||
|
||||
$(TEST_REGRESSIONS:%=%_clean): %_clean:
|
||||
$(MAKE) -C regres/$* clean
|
||||
|
||||
$(TEST_REGRESSIONS:%=%_install): %_install:
|
||||
$(MAKE) -C regres/$* install
|
||||
|
||||
.PHONY: $(TEST_REGRESSIONS) $(TEST_REGRESSIONS:%=%_implib) $(TEST_REGRESSIONS:%=%_clean) $(TEST_REGRESSIONS:%=%_install)
|
||||
|
||||
|
||||
etags:
|
||||
find . -name "*.[ch]" -print | etags --language=c -
|
||||
|
||||
# EOF
|
@@ -1,223 +0,0 @@
|
||||
/*
|
||||
* ReactOS test program -
|
||||
*
|
||||
* loadlib.c
|
||||
*
|
||||
* Copyright (C) 2002 Robert Dickenson <robd@reactos.org>
|
||||
*
|
||||
* 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 <windows.h>
|
||||
#include "loadlib.h"
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <wchar.h>
|
||||
|
||||
#define APP_VERSION 1
|
||||
#define MAX_LIBS 25
|
||||
|
||||
#ifdef UNICODE
|
||||
#define TARGET "UNICODE"
|
||||
BOOL bUseAnsi = FALSE;
|
||||
#else
|
||||
#define TARGET "MBCS"
|
||||
BOOL bUseAnsi = TRUE;
|
||||
#endif
|
||||
BOOL verbose_flagged = FALSE;
|
||||
BOOL debug_flagged = FALSE;
|
||||
BOOL loop_flagged = FALSE;
|
||||
BOOL recursive_flagged = FALSE;
|
||||
|
||||
HANDLE OutputHandle;
|
||||
HANDLE InputHandle;
|
||||
|
||||
|
||||
void dprintf(char* fmt, ...)
|
||||
{
|
||||
va_list args;
|
||||
char buffer[255];
|
||||
|
||||
va_start(args, fmt);
|
||||
wvsprintfA(buffer, fmt, args);
|
||||
WriteConsoleA(OutputHandle, buffer, lstrlenA(buffer), NULL, NULL);
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
long getinput(char* buf, int buflen)
|
||||
{
|
||||
DWORD result;
|
||||
|
||||
ReadConsoleA(InputHandle, buf, buflen, &result, NULL);
|
||||
return (long)result;
|
||||
}
|
||||
|
||||
DWORD ReportLastError(void)
|
||||
{
|
||||
DWORD dwError = GetLastError();
|
||||
if (dwError != ERROR_SUCCESS) {
|
||||
PSTR msg = NULL;
|
||||
if (FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER|FORMAT_MESSAGE_FROM_SYSTEM,
|
||||
0, dwError, MAKELANGID(LANG_NEUTRAL,SUBLANG_DEFAULT), (PSTR)&msg, 0, NULL)) {
|
||||
if (msg != NULL) {
|
||||
dprintf("ReportLastError() %d - %s\n", dwError, msg);
|
||||
} else {
|
||||
dprintf("ERROR: ReportLastError() %d - returned TRUE but with no msg string!\n", dwError);
|
||||
}
|
||||
} else {
|
||||
dprintf("ReportLastError() %d - unknown error\n", dwError);
|
||||
}
|
||||
if (msg != NULL) {
|
||||
LocalFree(msg);
|
||||
}
|
||||
}
|
||||
return dwError;
|
||||
}
|
||||
|
||||
const char* appName(const char* argv0)
|
||||
{
|
||||
const char* name;
|
||||
|
||||
name = (const char*)strrchr(argv0, '\\');
|
||||
if (name != NULL)
|
||||
return name + 1;
|
||||
return argv0;
|
||||
}
|
||||
|
||||
int usage(const char* appName)
|
||||
{
|
||||
dprintf("USAGE: %s libname [libname ...] [unicode]|[ansi] [loop][recurse]\n", appName);
|
||||
dprintf("\tWhere libname(s) is one or more libraries to load.\n");
|
||||
dprintf("\t[unicode] - perform tests using UNICODE api calls\n");
|
||||
dprintf("\t[ansi] - perform tests using ANSI api calls\n");
|
||||
dprintf("\t default is %s\n", TARGET);
|
||||
dprintf("\t[loop] - run test process in continuous loop\n");
|
||||
dprintf("\t[recurse] - load libraries recursively rather than sequentually\n");
|
||||
dprintf("\t[debug] - enable debug mode (unused)\n");
|
||||
dprintf("\t[verbose] - enable verbose output (unused)\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
DWORD LoadLibraryList(char** libnames, int counter, BOOL bUseAnsi)
|
||||
{
|
||||
HMODULE hModule;
|
||||
|
||||
dprintf("Attempting to LoadLibrary");
|
||||
if (bUseAnsi) {
|
||||
dprintf("A(%s) - ", *libnames);
|
||||
hModule = LoadLibraryA(*libnames);
|
||||
} else {
|
||||
int len;
|
||||
wchar_t libnameW[500];
|
||||
len = mbstowcs(libnameW, *libnames, strlen(*libnames));
|
||||
if (len) {
|
||||
libnameW[len] = L'\0';
|
||||
dprintf("W(%S) - ", libnameW);
|
||||
hModule = LoadLibraryW(libnameW);
|
||||
} else {
|
||||
return ERROR_INVALID_PARAMETER;
|
||||
}
|
||||
}
|
||||
if (hModule == NULL) {
|
||||
dprintf("\nERROR: failed to obtain handle to module %s - %x\n", *libnames, hModule);
|
||||
return ReportLastError();
|
||||
}
|
||||
dprintf("%x\n", hModule);
|
||||
|
||||
if (counter--) {
|
||||
LoadLibraryList(++libnames, counter, bUseAnsi);
|
||||
}
|
||||
|
||||
if (!FreeLibrary(hModule)) {
|
||||
dprintf("ERROR: failed to free module %s - %x\n", *libnames, hModule);
|
||||
return ReportLastError();
|
||||
} else {
|
||||
dprintf("FreeLibrary(%x) - successfull.\n", hModule);
|
||||
}
|
||||
return 0L;
|
||||
}
|
||||
|
||||
int __cdecl main(int argc, char* argv[])
|
||||
{
|
||||
char* libs[MAX_LIBS];
|
||||
int lib_count = 0;
|
||||
int result = 0;
|
||||
int i = 0;
|
||||
|
||||
AllocConsole();
|
||||
InputHandle = GetStdHandle(STD_INPUT_HANDLE);
|
||||
OutputHandle = GetStdHandle(STD_OUTPUT_HANDLE);
|
||||
|
||||
dprintf("%s application - build %03d (default: %s)\n", appName(argv[0]), APP_VERSION, TARGET);
|
||||
if (argc < 2) {
|
||||
/*return */usage(appName(argv[0]));
|
||||
}
|
||||
memset(libs, 0, sizeof(libs));
|
||||
for (i = 1; i < argc; i++) {
|
||||
if (lstrcmpiA(argv[i], "ansi") == 0) {
|
||||
bUseAnsi = TRUE;
|
||||
} else if (lstrcmpiA(argv[i], "unicode") == 0) {
|
||||
bUseAnsi = FALSE;
|
||||
} else if (lstrcmpiA(argv[i], "loop") == 0) {
|
||||
loop_flagged = 1;
|
||||
} else if (lstrcmpiA(argv[i], "recurse") == 0) {
|
||||
recursive_flagged = 1;
|
||||
} else if (lstrcmpiA(argv[i], "verbose") == 0) {
|
||||
verbose_flagged = 1;
|
||||
} else if (lstrcmpiA(argv[i], "debug") == 0) {
|
||||
debug_flagged = 1;
|
||||
} else {
|
||||
if (lib_count < MAX_LIBS) {
|
||||
libs[lib_count] = argv[i];
|
||||
++lib_count;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (lib_count) {
|
||||
do {
|
||||
if (recursive_flagged) {
|
||||
result = LoadLibraryList(libs, lib_count - 1, bUseAnsi);
|
||||
} else {
|
||||
for (i = 0; i < lib_count; i++) {
|
||||
result = LoadLibraryList(&libs[i], 0, bUseAnsi);
|
||||
//if (result != 0) break;
|
||||
}
|
||||
}
|
||||
} while (loop_flagged);
|
||||
} else {
|
||||
int len;
|
||||
char buffer[500];
|
||||
do {
|
||||
dprintf("\nEnter library name to attempt loading: ");
|
||||
len = getinput(buffer, sizeof(buffer) - 1);
|
||||
if (len > 2) {
|
||||
char* buf = buffer;
|
||||
buffer[len-2] = '\0';
|
||||
result = LoadLibraryList(&buf, 0, bUseAnsi);
|
||||
} else break;
|
||||
} while (!result && len);
|
||||
}
|
||||
dprintf("finished\n");
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
#ifdef _NOCRT
|
||||
char* args[] = { "loadlib.exe", "advapi32.dll", "user32.dll", "recurse"};
|
||||
int __cdecl mainCRTStartup(void)
|
||||
{
|
||||
return main(3, args);
|
||||
}
|
||||
#endif /*__GNUC__*/
|
@@ -1,45 +0,0 @@
|
||||
/*
|
||||
* ReactOS test program -
|
||||
*
|
||||
* loadlib.h
|
||||
*
|
||||
* Copyright (C) 2002 Robert Dickenson <robd@reactos.org>
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef __LOADLIB_H__
|
||||
#define __LOADLIB_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
extern BOOL verbose_flagged;
|
||||
extern BOOL debug_flagged;
|
||||
extern BOOL loop_flagged;
|
||||
extern BOOL recursive_flagged;
|
||||
|
||||
DWORD ReportLastError(void);
|
||||
long getinput(char* Buffer, int buflen);
|
||||
void dprintf(char* fmt, ...);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
};
|
||||
#endif
|
||||
|
||||
#endif // __LOADLIB_H__
|
@@ -1,24 +0,0 @@
|
||||
#
|
||||
# $Id: makefile,v 1.0
|
||||
|
||||
PATH_TO_TOP = ../../..
|
||||
|
||||
TARGET_NORC = yes
|
||||
|
||||
TARGET_TYPE = program
|
||||
|
||||
TARGET_APPTYPE = console
|
||||
|
||||
TARGET_NAME = loadlib
|
||||
|
||||
TARGET_CFLAGS = -Wall -Werror -D__USE_W32API -DUNICODE -D_UNICODE
|
||||
|
||||
TARGET_SDKLIBS = kernel32.a ntdll.a
|
||||
|
||||
TARGET_OBJECTS = $(TARGET_NAME).o
|
||||
|
||||
include $(PATH_TO_TOP)/rules.mak
|
||||
|
||||
include $(TOOLS_PATH)/helper.mk
|
||||
|
||||
# EOF
|
@@ -1,421 +0,0 @@
|
||||
/*
|
||||
* ReactOS test program -
|
||||
*
|
||||
* _tfileio.c
|
||||
*
|
||||
* Copyright (C) 2002 Robert Dickenson <robd@reactos.org>
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
#include <tchar.h>
|
||||
#include <wchar.h>
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
#ifdef UNICODE
|
||||
#define _tfopen _wfopen
|
||||
#define _tunlink _wunlink
|
||||
#define _TEOF WEOF
|
||||
#define _gettchar getwchar
|
||||
#define _puttchar putwchar
|
||||
#define _THEX_FORMAT _T("0x%04x ")
|
||||
#else /*UNICODE*/
|
||||
#define _tfopen fopen
|
||||
#define _tunlink _unlink
|
||||
#define _TEOF EOF
|
||||
#define _gettchar getchar
|
||||
#define _puttchar putchar
|
||||
#define _THEX_FORMAT "0x%02x "
|
||||
#endif /*UNICODE*/
|
||||
|
||||
|
||||
#define TEST_BUFFER_SIZE 200
|
||||
#define TEST_FILE_LINES 4
|
||||
|
||||
extern BOOL verbose_flagged;
|
||||
extern BOOL status_flagged;
|
||||
|
||||
static TCHAR test_buffer[TEST_BUFFER_SIZE];
|
||||
|
||||
static TCHAR dos_data[] = _T("line1: this is a bunch of readable text.\r\n")\
|
||||
_T("line2: some more printable text and punctuation !@#$%^&*()\r\n")\
|
||||
_T("line3: followed up with some numerals 1234567890\r\n")\
|
||||
_T("line4: done.\r\n");
|
||||
|
||||
static TCHAR nix_data[] = _T("line1: this is a bunch of readable text.\n")\
|
||||
_T("line2: some more printable text and punctuation !@#$%^&*()\n")\
|
||||
_T("line3: followed up with some numerals 1234567890\n")\
|
||||
_T("line4: done.\n");
|
||||
|
||||
#ifdef UNICODE
|
||||
#define TEST_B1_FILE_SIZE ((((sizeof(dos_data)/2)-1)+TEST_FILE_LINES)/2) // (166+4)/2=85
|
||||
#define TEST_B2_FILE_SIZE (((sizeof(dos_data)/2)-1)*2) // (166*2) =332
|
||||
#define TEST_B3_FILE_SIZE ((((sizeof(nix_data)/2)-1)+TEST_FILE_LINES)/2) // (162+4)/2=83
|
||||
#define TEST_B4_FILE_SIZE (((sizeof(nix_data)/2)-1)*2) // (162*2) =324
|
||||
#else /*UNICODE*/
|
||||
#define TEST_B1_FILE_SIZE (sizeof(dos_data)-1+TEST_FILE_LINES) // (166+4)=170
|
||||
#define TEST_B2_FILE_SIZE (sizeof(dos_data)-1-TEST_FILE_LINES) // (166-4)=162
|
||||
#define TEST_B3_FILE_SIZE (sizeof(nix_data)-1+TEST_FILE_LINES) // (162+4)=166
|
||||
#define TEST_B4_FILE_SIZE (sizeof(nix_data)-1) // (162) =162
|
||||
#endif /*UNICODE*/
|
||||
|
||||
|
||||
// result = create_test_file(file_name, _T("wb"), _T("rb"), file_data);
|
||||
|
||||
static BOOL test_file_truncate(TCHAR* file_name)
|
||||
{
|
||||
BOOL result = FALSE;
|
||||
int count = -1;
|
||||
int error_code;
|
||||
TCHAR ch;
|
||||
TCHAR* file_data = _T("this file should have been truncated to zero bytes...");
|
||||
FILE *file = _tfopen(file_name, _T("wb"));
|
||||
|
||||
if (verbose_flagged) {
|
||||
_tprintf(_T("test_file_truncate(\"%s\")\n"), file_name);
|
||||
}
|
||||
|
||||
if (file != NULL) {
|
||||
if (_fputts(file_data, file) != _TEOF) {
|
||||
} else {
|
||||
_tprintf(_T("ERROR: failed to write data to file \"%s\"\n"), file_name);
|
||||
_tprintf(_T("ERROR: ferror returned %d\n"), ferror(file));
|
||||
}
|
||||
fclose(file);
|
||||
} else {
|
||||
_tprintf(_T("ERROR: failed to open/create file \"%s\" for output\n"), file_name);
|
||||
_tprintf(_T("ERROR: ferror returned %d\n"), ferror(file));
|
||||
}
|
||||
|
||||
file = _tfopen(file_name, _T("wb"));
|
||||
if (file != NULL) {
|
||||
error_code = ferror(file);
|
||||
if (error_code) {
|
||||
_tprintf(_T("ERROR: (%s) ferror returned %d\n"), file_name, error_code);
|
||||
}
|
||||
fclose(file);
|
||||
} else {
|
||||
_tprintf(_T("ERROR: (%s) failed to open file for truncating\n"), file_name);
|
||||
}
|
||||
|
||||
file = _tfopen(file_name, _T("rb"));
|
||||
if (file != NULL) {
|
||||
count = 0;
|
||||
while ((ch = _fgettc(file)) != _TEOF) {
|
||||
if (verbose_flagged) {
|
||||
_tprintf(_THEX_FORMAT, ch);
|
||||
}
|
||||
++count;
|
||||
}
|
||||
error_code = ferror(file);
|
||||
if (error_code) {
|
||||
_tprintf(_T("ERROR: (%s) ferror returned %d after reading\n"), file_name, error_code);
|
||||
perror("Read error");
|
||||
}
|
||||
fclose(file);
|
||||
} else {
|
||||
_tprintf(_T("ERROR: (%s) failed to open file for reading\n"), file_name);
|
||||
}
|
||||
if (count) {
|
||||
result = TRUE;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
static BOOL create_output_file(TCHAR* file_name, TCHAR* file_mode, TCHAR* file_data)
|
||||
{
|
||||
BOOL result = FALSE;
|
||||
FILE *file = _tfopen(file_name, file_mode);
|
||||
if (file != NULL) {
|
||||
if (_fputts(file_data, file) != _TEOF) {
|
||||
result = TRUE;
|
||||
} else {
|
||||
_tprintf(_T("ERROR: failed to write data to file \"%s\"\n"), file_name);
|
||||
_tprintf(_T("ERROR: ferror returned %d\n"), ferror(file));
|
||||
}
|
||||
fclose(file);
|
||||
} else {
|
||||
_tprintf(_T("ERROR: failed to open/create file \"%s\" for output\n"), file_name);
|
||||
_tprintf(_T("ERROR: ferror returned %d\n"), ferror(file));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
static BOOL verify_output_file(TCHAR* file_name, TCHAR* file_mode, TCHAR* file_data)
|
||||
{
|
||||
int error_code;
|
||||
int offset = 0;
|
||||
int line_num = 0;
|
||||
BOOL result = FALSE;
|
||||
BOOL error_flagged = FALSE;
|
||||
FILE* file = _tfopen(file_name, file_mode);
|
||||
if (file == NULL) {
|
||||
_tprintf(_T("ERROR: (%s) Can't open file for reading\n"), file_name);
|
||||
_tprintf(_T("ERROR: ferror returned %d\n"), ferror(file));
|
||||
return FALSE;
|
||||
} else if (status_flagged) {
|
||||
_tprintf(_T("STATUS: (%s) opened file for reading\n"), file_name);
|
||||
}
|
||||
while (_fgetts(test_buffer, TEST_BUFFER_SIZE, file)) {
|
||||
int length = _tcslen(test_buffer);
|
||||
int req_len = _tcschr(file_data+offset, _T('\n')) - (file_data+offset) + 1;
|
||||
|
||||
++line_num;
|
||||
if (length > req_len) {
|
||||
_tprintf(_T("ERROR: read excess bytes from line %d, length %d, but expected %d\n"), line_num, length, req_len);
|
||||
error_flagged = TRUE;
|
||||
break;
|
||||
}
|
||||
if (length < req_len) {
|
||||
_tprintf(_T("ERROR: read to few bytes from line %d, length %d, but expected %d\n"), line_num, length, req_len);
|
||||
error_flagged = TRUE;
|
||||
break;
|
||||
}
|
||||
if (status_flagged) {
|
||||
_tprintf(_T("STATUS: Verifying %d bytes read from line %d\n"), length, line_num);
|
||||
}
|
||||
if (_tcsncmp(test_buffer, file_data+offset, length - 1) == 0) {
|
||||
result = TRUE;
|
||||
} else {
|
||||
if (status_flagged) {
|
||||
int i;
|
||||
_tprintf(_T("WARNING: (%s) failed to verify file\n"), file_name);
|
||||
for (i = 0; i < length; i++) {
|
||||
if (file_data[offset+i] != test_buffer[i]) {
|
||||
_tprintf(_T("line %d, offset %d expected: 0x%04x found: 0x%04x\n"), line_num, i, (int)file_data[offset+i], (int)test_buffer[i]);
|
||||
}
|
||||
}
|
||||
_tprintf(_T("\n"));
|
||||
} else {
|
||||
error_flagged = TRUE;
|
||||
}
|
||||
}
|
||||
offset += length;
|
||||
}
|
||||
error_code = ferror(file);
|
||||
if (error_code) {
|
||||
_tprintf(_T("ERROR: (%s) ferror returned %d after reading\n"), file_name, error_code);
|
||||
perror("Read error");
|
||||
}
|
||||
if (!line_num) {
|
||||
_tprintf(_T("ERROR: (%s) failed to read from file\n"), file_name);
|
||||
}
|
||||
if (error_flagged == TRUE) {
|
||||
_tprintf(_T("ERROR: (%s) failed to verify file\n"), file_name);
|
||||
result = FALSE;
|
||||
}
|
||||
fclose(file);
|
||||
return result;
|
||||
}
|
||||
|
||||
static int create_test_file(TCHAR* file_name, TCHAR* write_mode, TCHAR* read_mode, TCHAR* file_data)
|
||||
{
|
||||
if (status_flagged) {
|
||||
_tprintf(_T("STATUS: Attempting to create output file %s\n"), file_name);
|
||||
}
|
||||
if (create_output_file(file_name, write_mode, file_data)) {
|
||||
if (status_flagged) {
|
||||
_tprintf(_T("STATUS: Attempting to verify output file %s\n"), file_name);
|
||||
}
|
||||
if (verify_output_file(file_name, read_mode, file_data)) {
|
||||
if (status_flagged) {
|
||||
_tprintf(_T("SUCCESS: %s verified ok\n"), file_name);
|
||||
}
|
||||
} else {
|
||||
//_tprintf(_T("ERROR: failed to verify file %s\n"), file_name);
|
||||
return 2;
|
||||
}
|
||||
} else {
|
||||
_tprintf(_T("ERROR: failed to create file %s\n"), file_name);
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int check_file_size(TCHAR* file_name, TCHAR* file_mode, int expected)
|
||||
{
|
||||
int count = 0;
|
||||
FILE* file;
|
||||
TCHAR ch;
|
||||
int error_code;
|
||||
|
||||
if (status_flagged) {
|
||||
//_tprintf(_T("STATUS: (%s) checking for %d bytes in %s mode\n"), file_name, expected, _tcschr(file_mode, _T('b')) ? _T("binary") : _T("text"));
|
||||
_tprintf(_T("STATUS: (%s) checking for %d bytes with mode %s\n"), file_name, expected, file_mode);
|
||||
}
|
||||
file = _tfopen(file_name, file_mode);
|
||||
if (file == NULL) {
|
||||
_tprintf(_T("ERROR: (%s) failed to open file for reading\n"), file_name);
|
||||
return 1;
|
||||
}
|
||||
while ((ch = _fgettc(file)) != _TEOF) {
|
||||
if (verbose_flagged) {
|
||||
_tprintf(_THEX_FORMAT, ch);
|
||||
}
|
||||
++count;
|
||||
}
|
||||
error_code = ferror(file);
|
||||
if (error_code) {
|
||||
_tprintf(_T("ERROR: (%s) ferror returned %d after reading\n"), file_name, error_code);
|
||||
perror("Read error");
|
||||
}
|
||||
|
||||
if (verbose_flagged) {
|
||||
// _puttc(_T('\n'), stdout);
|
||||
}
|
||||
fclose(file);
|
||||
if (count == expected) {
|
||||
if (status_flagged) {
|
||||
_tprintf(_T("PASSED: (%s) read %d bytes\n"), file_name, count);
|
||||
}
|
||||
} else {
|
||||
_tprintf(_T("FAILED: (%s) read %d bytes but expected %d using mode \"%s\"\n"), file_name, count, expected, file_mode);
|
||||
}
|
||||
return (count == expected) ? 0 : -1;
|
||||
}
|
||||
|
||||
static int test_console_io(void)
|
||||
{
|
||||
TCHAR buffer[81];
|
||||
TCHAR ch;
|
||||
int i, j;
|
||||
|
||||
_tprintf(_T("Enter a line for echoing:\n"));
|
||||
|
||||
//for (i = 0; (i < 80) && ((ch = _gettchar()) != _TEOF) && (ch != _T('\n')); i++) {
|
||||
for (i = 0; (i < 80) && ((ch = _gettc(stdin)) != _TEOF) && (ch != _T('\n')); i++) {
|
||||
buffer[i] = (TCHAR)ch;
|
||||
}
|
||||
buffer[i] = _T('\0');
|
||||
for (j = 0; j < i; j++) {
|
||||
_puttc(buffer[j], stdout);
|
||||
}
|
||||
_puttc(_T('\n'), stdout);
|
||||
_tprintf(_T("%s\n"), buffer);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int test_console_getchar(void)
|
||||
{
|
||||
int result = 0;
|
||||
TCHAR ch;
|
||||
|
||||
_tprintf(_T("Enter lines for dumping or <ctrl-z><nl> to finish:\n"));
|
||||
|
||||
//while ((ch = _gettchar()) != _TEOF) {
|
||||
while ((ch = _gettc(stdin)) != _TEOF) {
|
||||
_tprintf(_THEX_FORMAT, ch);
|
||||
//printf("0x%04x ", ch);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
static int test_console_putch(void)
|
||||
{
|
||||
int result = 0;
|
||||
|
||||
_putch('1');
|
||||
_putch('@');
|
||||
_putch('3');
|
||||
_putch(':');
|
||||
_putch('\n');
|
||||
_putch('a');
|
||||
_putch('B');
|
||||
_putch('c');
|
||||
_putch(':');
|
||||
_putch('\n');
|
||||
return result;
|
||||
}
|
||||
|
||||
static int test_unlink_files(void)
|
||||
{
|
||||
int result = 0;
|
||||
|
||||
//printf("sizeof dos_data: %d\n", sizeof(dos_data));
|
||||
//printf("sizeof nix_data: %d\n", sizeof(nix_data));
|
||||
|
||||
result |= _tunlink(_T("binary.dos"));
|
||||
result |= _tunlink(_T("binary.nix"));
|
||||
result |= _tunlink(_T("text.dos"));
|
||||
result |= _tunlink(_T("text.nix"));
|
||||
return result;
|
||||
}
|
||||
|
||||
static int test_text_fileio(TCHAR* file_name, TCHAR* file_data, int tsize, int bsize)
|
||||
{
|
||||
int result = 0;
|
||||
|
||||
result = create_test_file(file_name, _T("w"), _T("r"), file_data);
|
||||
result = check_file_size(file_name, _T("r"), tsize);
|
||||
result = check_file_size(file_name, _T("rb"), bsize);
|
||||
return result;
|
||||
}
|
||||
|
||||
static int test_binary_fileio(TCHAR* file_name, TCHAR* file_data, int tsize, int bsize)
|
||||
{
|
||||
int result = 0;
|
||||
|
||||
result = create_test_file(file_name, _T("wb"), _T("rb"), file_data);
|
||||
result = check_file_size(file_name, _T("r"), tsize);
|
||||
result = check_file_size(file_name, _T("rb"), bsize);
|
||||
return result;
|
||||
}
|
||||
|
||||
static int test_files(int test_num, char* type)
|
||||
{
|
||||
int result = 0;
|
||||
|
||||
printf("performing test: %d (%s)\n", test_num, type);
|
||||
|
||||
|
||||
if (test_file_truncate(_T("zerosize.foo"))) {
|
||||
printf("System unable to truncate files yet, unlinking:\n");
|
||||
test_unlink_files();
|
||||
}
|
||||
|
||||
switch (test_num) {
|
||||
case 1:
|
||||
result = test_text_fileio(_T("text.dos"), dos_data, 166, TEST_B1_FILE_SIZE);
|
||||
break;
|
||||
case 2:
|
||||
result = test_binary_fileio(_T("binary.dos"), dos_data, TEST_B2_FILE_SIZE, 166);
|
||||
break;
|
||||
case 3:
|
||||
result = test_text_fileio(_T("text.nix"), nix_data, 162, TEST_B3_FILE_SIZE);
|
||||
break;
|
||||
case 4:
|
||||
result = test_binary_fileio(_T("binary.nix"), nix_data, TEST_B4_FILE_SIZE, 162);
|
||||
break;
|
||||
case 5:
|
||||
result = test_console_io();
|
||||
break;
|
||||
case 6:
|
||||
result = test_console_getchar();
|
||||
break;
|
||||
case 7:
|
||||
result = test_console_putch();
|
||||
break;
|
||||
case -1:
|
||||
result = test_unlink_files();
|
||||
break;
|
||||
default:
|
||||
_tprintf(_T("no test number selected\n"));
|
||||
break;
|
||||
}
|
||||
return result;
|
||||
}
|
@@ -1,31 +0,0 @@
|
||||
/*
|
||||
* ReactOS test program -
|
||||
*
|
||||
* _fileio.c
|
||||
*
|
||||
* Copyright (C) 2002 Robert Dickenson <robd@reactos.org>
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#undef UNICODE
|
||||
#undef _UNICODE
|
||||
#include "_tfileio.c"
|
||||
|
||||
|
||||
int run_ansi_tests(int test_num)
|
||||
{
|
||||
return test_files(test_num, "ANSI");
|
||||
}
|
@@ -1,124 +0,0 @@
|
||||
/*
|
||||
* ReactOS test program -
|
||||
*
|
||||
* main.c
|
||||
*
|
||||
* Copyright (C) 2002 Robert Dickenson <robd@reactos.org>
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
#include <tchar.h>
|
||||
#include <wchar.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "main.h"
|
||||
|
||||
|
||||
#define VERSION 1
|
||||
|
||||
#ifdef UNICODE
|
||||
#define TARGET "UNICODE"
|
||||
#else
|
||||
#define TARGET "MBCS"
|
||||
#endif
|
||||
|
||||
BOOL verbose_flagged = 0;
|
||||
BOOL status_flagged = 0;
|
||||
|
||||
int usage(char* argv0)
|
||||
{
|
||||
printf("USAGE: %s test_id [unicode]|[ansi] [clean]|[status][verbose]\n", argv0);
|
||||
printf("\tWhere test_id is one of:\n");
|
||||
printf("\t0 - (default) regression mode, run tests 1-4 displaying failures only\n");
|
||||
printf("\t1 - Write DOS style eol data to file in text mode (text.dos)\n");
|
||||
printf("\t2 - Write NIX style eol data to file in binary mode (binary.dos)\n");
|
||||
printf("\t3 - Write DOS style eol data to file in text mode (text.nix)\n");
|
||||
printf("\t4 - Write NIX style eol data to file in binary mode (binary.nix)\n");
|
||||
printf("\t5 - Echo console line input\n");
|
||||
printf("\t6 - Dump console line input in hex format\n");
|
||||
printf("\t7 - The source code is your friend\n");
|
||||
printf("\t[unicode] - perform tests using UNICODE versions of library functions\n");
|
||||
printf("\t[ansi] - perform tests using ANSI versions of library functions\n");
|
||||
printf("\t If neither unicode or ansi is specified build default is used\n");
|
||||
printf("\t[clean] - delete all temporary test output files\n");
|
||||
printf("\t[status] - enable extra status display while running\n");
|
||||
printf("\t[verbose] - enable verbose output when running\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
int __cdecl main(int argc, char* argv[])
|
||||
{
|
||||
int test_num = 0;
|
||||
int version = 0;
|
||||
int result = 0;
|
||||
int i = 0;
|
||||
|
||||
printf("%s test application - build %03d (default: %s)\n", argv[0], VERSION, TARGET);
|
||||
if (argc < 2) {
|
||||
return usage(argv[0]);
|
||||
}
|
||||
for (i = 1; i < argc; i++) {
|
||||
if (strstr(argv[i], "ansi") || strstr(argv[i], "ANSI")) {
|
||||
version = 1;
|
||||
} else if (strstr(argv[i], "unicode") || strstr(argv[i], "UNICODE")) {
|
||||
version = 2;
|
||||
} else if (strstr(argv[i], "clean") || strstr(argv[i], "CLEAN")) {
|
||||
test_num = -1;
|
||||
} else if (strstr(argv[i], "verbose") || strstr(argv[i], "VERBOSE")) {
|
||||
verbose_flagged = 1;
|
||||
} else if (strstr(argv[i], "status") || strstr(argv[i], "STATUS")) {
|
||||
status_flagged = 1;
|
||||
} else {
|
||||
test_num = atoi(argv[1]);
|
||||
//if (test_num < 0
|
||||
}
|
||||
}
|
||||
for (i = test_num; i <= test_num; i++) {
|
||||
if (!test_num) {
|
||||
test_num = 4;
|
||||
i = 1;
|
||||
}
|
||||
switch (version) {
|
||||
case 1:
|
||||
result = run_ansi_tests(i);
|
||||
break;
|
||||
case 2:
|
||||
result = run_unicode_tests(i);
|
||||
break;
|
||||
default:
|
||||
result = run_ansi_tests(i);
|
||||
result = run_unicode_tests(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
printf("finished\n");
|
||||
return result;
|
||||
}
|
||||
|
||||
#ifndef __GNUC__
|
||||
|
||||
char* args[] = { "fileio.exe", "0", "unicode", "verbose"};
|
||||
|
||||
int __cdecl mainCRTStartup(void)
|
||||
{
|
||||
main(2, args);
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif /*__GNUC__*/
|
@@ -1,42 +0,0 @@
|
||||
/*
|
||||
* ReactOS test program -
|
||||
*
|
||||
* main.h
|
||||
*
|
||||
* Copyright (C) 2002 Robert Dickenson <robd@reactos.org>
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef __MAIN_H__
|
||||
#define __MAIN_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
int app_main(int argc, char* argv[]);
|
||||
DWORD GetInput(char* Buffer, int buflen);
|
||||
|
||||
int test_ansi_files(int test_num);
|
||||
int test_unicode_files(int test_num);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
};
|
||||
#endif
|
||||
|
||||
#endif // __MAIN_H__
|
@@ -1,27 +0,0 @@
|
||||
#
|
||||
# $Id: makefile,v 1.0
|
||||
|
||||
PATH_TO_TOP = ../../../..
|
||||
|
||||
TEST_ROOT = $(PATH_TO_TOP)/apps/testsets/test
|
||||
|
||||
TARGET_NORC = yes
|
||||
|
||||
TARGET_TYPE = program
|
||||
|
||||
TARGET_APPTYPE = console
|
||||
|
||||
TARGET_NAME = fileio
|
||||
|
||||
#TARGET_CFLAGS = -I$(TEST_ROOT) -DDBG -DUNICODE -D_UNICODE
|
||||
TARGET_CFLAGS = -I$(TEST_ROOT) -DDBG
|
||||
|
||||
TARGET_SDKLIBS = ntdll.a kernel32.a
|
||||
|
||||
TARGET_OBJECTS = $(TARGET_NAME).o wfileio.o main.o
|
||||
|
||||
include $(PATH_TO_TOP)/rules.mak
|
||||
|
||||
include $(TOOLS_PATH)/helper.mk
|
||||
|
||||
# EOF
|
@@ -1,31 +0,0 @@
|
||||
/*
|
||||
* ReactOS test program -
|
||||
*
|
||||
* wfileio.c
|
||||
*
|
||||
* Copyright (C) 2002 Robert Dickenson <robd@reactos.org>
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#define UNICODE
|
||||
#define _UNICODE
|
||||
#include "_tfileio.c"
|
||||
|
||||
|
||||
int run_unicode_tests(int test_num)
|
||||
{
|
||||
return test_files(test_num, "UNICODE");
|
||||
}
|
@@ -1,71 +0,0 @@
|
||||
#
|
||||
# ReactOS system utilities makefile
|
||||
#
|
||||
|
||||
PATH_TO_TOP = ../..
|
||||
|
||||
include $(PATH_TO_TOP)/rules.mak
|
||||
|
||||
|
||||
# Console system utilities
|
||||
# cabman cat net objdir partinfo pice ps sc stats
|
||||
UTIL_APPS = cat objdir pnpdump sc shutdown stats tickcount ps
|
||||
|
||||
UTIL_NET_APPS = arp finger ftp ipconfig netstat ping route telnet whois
|
||||
|
||||
|
||||
all: $(UTIL_APPS) $(UTIL_NET_APPS)
|
||||
|
||||
depends:
|
||||
|
||||
implib: $(UTIL_APPS:%=%_implib) \
|
||||
$(UTIL_NET_APPS:%=%_implib)
|
||||
|
||||
clean: $(UTIL_APPS:%=%_clean) \
|
||||
$(UTIL_NET_APPS:%=%_clean)
|
||||
|
||||
install: $(UTIL_APPS:%=%_install) \
|
||||
$(UTIL_NET_APPS:%=%_install)
|
||||
|
||||
.PHONY: all depends implib clean install
|
||||
|
||||
|
||||
#
|
||||
# Utility Applications
|
||||
#
|
||||
$(UTIL_APPS): %:
|
||||
$(MAKE) -C $*
|
||||
|
||||
$(UTIL_APPS:%=%_implib): %_implib:
|
||||
$(MAKE) -C $* implib
|
||||
|
||||
$(UTIL_APPS:%=%_clean): %_clean:
|
||||
$(MAKE) -C $* clean
|
||||
|
||||
$(UTIL_APPS:%=%_install): %_install:
|
||||
$(MAKE) -C $* install
|
||||
|
||||
.PHONY: $(UTIL_APPS) $(UTIL_APPS:%=%_implib) $(UTIL_APPS:%=%_clean) $(UTIL_APPS:%=%_install)
|
||||
|
||||
#
|
||||
# GUI Utility Applications
|
||||
#
|
||||
$(UTIL_NET_APPS): %:
|
||||
$(MAKE) -C net/$*
|
||||
|
||||
$(UTIL_NET_APPS:%=%_implib): %_implib:
|
||||
$(MAKE) -C net/$* implib
|
||||
|
||||
$(UTIL_NET_APPS:%=%_clean): %_clean:
|
||||
$(MAKE) -C net/$* clean
|
||||
|
||||
$(UTIL_NET_APPS:%=%_install): %_install:
|
||||
$(MAKE) -C net/$* install
|
||||
|
||||
.PHONY: $(UTIL_NET_APPS) $(UTIL_NET_APPS:%=%_implib) $(UTIL_NET_APPS:%=%_clean) $(UTIL_NET_APPS:%=%_install)
|
||||
|
||||
|
||||
etags:
|
||||
find . -name "*.[ch]" -print | etags --language=c -
|
||||
|
||||
# EOF
|
@@ -1,21 +0,0 @@
|
||||
PATH_TO_TOP = ../../..
|
||||
|
||||
TARGET_NORC = yes
|
||||
|
||||
TARGET_TYPE = program
|
||||
|
||||
TARGET_APPTYPE = console
|
||||
|
||||
TARGET_NAME = binpatch
|
||||
|
||||
TARGET_SDKLIBS =
|
||||
|
||||
TARGET_OBJECTS = patch.o
|
||||
|
||||
TARGET_CFLAGS += -Wall -Werror
|
||||
|
||||
include $(PATH_TO_TOP)/rules.mak
|
||||
|
||||
include $(TOOLS_PATH)/helper.mk
|
||||
|
||||
# EOF
|
@@ -1,615 +0,0 @@
|
||||
#include <conio.h>
|
||||
#include <io.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
/** DEFINES *******************************************************************/
|
||||
|
||||
#define PATCH_BUFFER_SIZE 4096 /* Maximum size of a patch */
|
||||
#define PATCH_BUFFER_MAGIC "\xde\xad\xbe\xef MaGiC MaRk "
|
||||
#define SIZEOF_PATCH_BUFFER_MAGIC (sizeof (PATCH_BUFFER_MAGIC) - 1)
|
||||
|
||||
/** TYPES *********************************************************************/
|
||||
|
||||
typedef struct _PatchedByte
|
||||
{
|
||||
int offset; /*!< File offset of the patched byte. */
|
||||
unsigned char expected; /*!< Expected (original) value of the byte. */
|
||||
unsigned char patched; /*!< Patched (new) value for the byte. */
|
||||
} PatchedByte;
|
||||
|
||||
typedef struct _PatchedFile
|
||||
{
|
||||
const char *name; /*!< Name of the file to be patched. */
|
||||
int fileSize; /*!< Size of the file in bytes. */
|
||||
int patchCount; /*!< Number of patches for the file. */
|
||||
PatchedByte *patches; /*!< Patches for the file. */
|
||||
} PatchedFile;
|
||||
|
||||
typedef struct _Patch
|
||||
{
|
||||
const char *name; /*!< Name of the patch. */
|
||||
int fileCount; /*!< Number of files in the patch. */
|
||||
PatchedFile *files; /*!< Files for the patch. */
|
||||
} Patch;
|
||||
|
||||
/** FUNCTION PROTOTYPES *******************************************************/
|
||||
|
||||
static void printUsage();
|
||||
|
||||
/** GLOBALS *******************************************************************/
|
||||
|
||||
static Patch m_patch = { NULL, 0, NULL };
|
||||
static int m_argc = 0;
|
||||
static char **m_argv = NULL;
|
||||
|
||||
/* patch buffer where we put the patch info into */
|
||||
static unsigned char m_patchBuffer[SIZEOF_PATCH_BUFFER_MAGIC + PATCH_BUFFER_SIZE] =
|
||||
PATCH_BUFFER_MAGIC;
|
||||
|
||||
/** HELPER FUNCTIONS **********************************************************/
|
||||
|
||||
static void *
|
||||
loadFile(const char *fileName, int *fileSize_)
|
||||
{
|
||||
FILE *f;
|
||||
struct stat sb;
|
||||
int fileSize;
|
||||
void *p;
|
||||
|
||||
/* Open the file */
|
||||
f = fopen(fileName, "rb");
|
||||
if (f == NULL)
|
||||
{
|
||||
printf("Couldn't open file %s for reading!\n", fileName);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Get file size */
|
||||
if (fstat(fileno(f), &sb) < 0)
|
||||
{
|
||||
fclose(f);
|
||||
printf("Couldn't get size of file %s!\n", fileName);
|
||||
return NULL;
|
||||
}
|
||||
fileSize = sb.st_size;
|
||||
|
||||
/* Load file */
|
||||
p = malloc(fileSize);
|
||||
if (p == NULL)
|
||||
{
|
||||
fclose(f);
|
||||
printf("Couldn't allocate %d bytes for file %s!\n", fileSize, fileName);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (fread(p, fileSize, 1, f) != 1)
|
||||
{
|
||||
fclose(f);
|
||||
free(p);
|
||||
printf("Couldn't read file %s into memory!\n", fileName);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Close file */
|
||||
fclose(f);
|
||||
|
||||
*fileSize_ = fileSize;
|
||||
return p;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
saveFile(const char *fileName, void *file, int fileSize)
|
||||
{
|
||||
FILE *f;
|
||||
|
||||
/* Open the file */
|
||||
f = fopen(fileName, "wb");
|
||||
if (f == NULL)
|
||||
{
|
||||
printf("Couldn't open file %s for writing!\n", fileName);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Write file */
|
||||
if (fwrite(file, fileSize, 1, f) != 1)
|
||||
{
|
||||
fclose(f);
|
||||
printf("Couldn't write file %s!\n", fileName);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Close file */
|
||||
fclose(f);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
compareFiles(
|
||||
PatchedFile *patchedFile,
|
||||
const char *originalFileName)
|
||||
{
|
||||
const char *patchedFileName = patchedFile->name;
|
||||
unsigned char *origChunk, *patchedChunk;
|
||||
int origSize, patchedSize, i, patchCount;
|
||||
PatchedByte *patches = NULL;
|
||||
int patchesArrayCount = 0;
|
||||
|
||||
/* Load both files */
|
||||
origChunk = loadFile(originalFileName, &origSize);
|
||||
if (origChunk == NULL)
|
||||
return -1;
|
||||
patchedChunk = loadFile(patchedFileName, &patchedSize);
|
||||
if (patchedChunk == NULL)
|
||||
{
|
||||
free(origChunk);
|
||||
return -1;
|
||||
}
|
||||
if (origSize != patchedSize)
|
||||
{
|
||||
free(origChunk);
|
||||
free(patchedChunk);
|
||||
printf("File size of %s and %s differs (%d != %d)\n",
|
||||
originalFileName, patchedFileName,
|
||||
origSize, patchedSize);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Compare the files and record any differences */
|
||||
printf("Comparing %s to %s", originalFileName, patchedFileName);
|
||||
for (i = 0, patchCount = 0; i < origSize; i++)
|
||||
{
|
||||
if (origChunk[i] != patchedChunk[i])
|
||||
{
|
||||
patchCount++;
|
||||
|
||||
/* Resize patches array if needed */
|
||||
if (patchesArrayCount < patchCount)
|
||||
{
|
||||
PatchedByte *newPatches;
|
||||
newPatches = realloc(patches, patchCount * sizeof (PatchedByte));
|
||||
if (newPatches == NULL)
|
||||
{
|
||||
if (patches != NULL)
|
||||
free(patches);
|
||||
free(origChunk);
|
||||
free(patchedChunk);
|
||||
printf("\nOut of memory (tried to allocated %d bytes)\n",
|
||||
patchCount * sizeof (PatchedByte));
|
||||
return -1;
|
||||
}
|
||||
patches = newPatches;
|
||||
}
|
||||
|
||||
/* Fill in patch info */
|
||||
patches[patchCount - 1].offset = i;
|
||||
patches[patchCount - 1].expected = origChunk[i];
|
||||
patches[patchCount - 1].patched = patchedChunk[i];
|
||||
}
|
||||
if ((i % (origSize / 40)) == 0)
|
||||
printf(".");
|
||||
}
|
||||
printf(" %d changed bytes found.\n", patchCount);
|
||||
|
||||
/* Unload the files */
|
||||
free(origChunk);
|
||||
free(patchedChunk);
|
||||
|
||||
/* Save patch info */
|
||||
patchedFile->fileSize = patchedSize;
|
||||
patchedFile->patchCount = patchCount;
|
||||
patchedFile->patches = patches;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
outputPatch(const char *outputFileName)
|
||||
{
|
||||
unsigned char *patchExe, *patchBuffer;
|
||||
int i, size, patchExeSize, patchSize, stringSize, stringOffset, patchOffset;
|
||||
Patch *patch;
|
||||
PatchedFile *files;
|
||||
|
||||
printf("Putting patch into %s...\n", outputFileName);
|
||||
|
||||
/* Calculate size of the patch */
|
||||
patchSize = sizeof (Patch) + sizeof (PatchedFile) * m_patch.fileCount;
|
||||
stringSize = strlen(m_patch.name) + 1;
|
||||
for (i = 0; i < m_patch.fileCount; i++)
|
||||
{
|
||||
stringSize += strlen(m_patch.files[i].name) + 1;
|
||||
patchSize += sizeof (PatchedByte) * m_patch.files[i].patchCount;
|
||||
}
|
||||
if ((stringSize + patchSize) > PATCH_BUFFER_SIZE)
|
||||
{
|
||||
printf("Patch is too big - %d bytes maximum, %d bytes needed\n",
|
||||
PATCH_BUFFER_SIZE, stringSize + patchSize);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Load patch.exe file into memory... */
|
||||
patchExe = loadFile(m_argv[0], &patchExeSize);
|
||||
if (patchExe == NULL)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Try to find the magic mark for the patch buffer */
|
||||
for (i = 0; i < (patchExeSize - SIZEOF_PATCH_BUFFER_MAGIC); i++)
|
||||
{
|
||||
if (memcmp(patchExe + i, m_patchBuffer, SIZEOF_PATCH_BUFFER_MAGIC) == 0)
|
||||
{
|
||||
patchBuffer = patchExe + i + SIZEOF_PATCH_BUFFER_MAGIC;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!(i < (patchExeSize - SIZEOF_PATCH_BUFFER_MAGIC)))
|
||||
{
|
||||
free(patchExe);
|
||||
printf("Couldn't find patch buffer magic in file %s - this shouldn't happen!!!\n", m_argv[0]);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Pack patch together and replace string pointers by offsets */
|
||||
patch = (Patch *)patchBuffer;
|
||||
files = (PatchedFile *)(patchBuffer + sizeof (Patch));
|
||||
patchOffset = sizeof (Patch) + sizeof (PatchedFile) * m_patch.fileCount;
|
||||
stringOffset = patchSize;
|
||||
|
||||
patch->fileCount = m_patch.fileCount;
|
||||
patch->files = (PatchedFile *)sizeof (Patch);
|
||||
|
||||
patch->name = (const char *)stringOffset;
|
||||
strcpy(patchBuffer + stringOffset, m_patch.name);
|
||||
stringOffset += strlen(m_patch.name) + 1;
|
||||
|
||||
for (i = 0; i < m_patch.fileCount; i++)
|
||||
{
|
||||
files[i].fileSize = m_patch.files[i].fileSize;
|
||||
files[i].patchCount = m_patch.files[i].patchCount;
|
||||
|
||||
files[i].name = (const char *)stringOffset;
|
||||
strcpy(patchBuffer + stringOffset, m_patch.files[i].name);
|
||||
stringOffset += strlen(m_patch.files[i].name) + 1;
|
||||
|
||||
size = files[i].patchCount * sizeof (PatchedByte);
|
||||
files[i].patches = (PatchedByte *)patchOffset;
|
||||
memcpy(patchBuffer + patchOffset, m_patch.files[i].patches, size);
|
||||
patchOffset += size;
|
||||
}
|
||||
size = patchSize + stringSize;
|
||||
memset(patchBuffer + size, 0, PATCH_BUFFER_SIZE - size);
|
||||
|
||||
/* Save file */
|
||||
if (saveFile(outputFileName, patchExe, patchExeSize) < 0)
|
||||
{
|
||||
free(patchExe);
|
||||
return -1;
|
||||
}
|
||||
free(patchExe);
|
||||
|
||||
printf("Patch saved!\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
loadPatch()
|
||||
{
|
||||
char *p;
|
||||
Patch *patch;
|
||||
int i;
|
||||
|
||||
p = m_patchBuffer + SIZEOF_PATCH_BUFFER_MAGIC;
|
||||
patch = (Patch *)p;
|
||||
|
||||
if (patch->name == NULL)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
m_patch.name = p + (int)patch->name;
|
||||
m_patch.fileCount = patch->fileCount;
|
||||
m_patch.files = (PatchedFile *)(p + (int)patch->files);
|
||||
|
||||
for (i = 0; i < m_patch.fileCount; i++)
|
||||
{
|
||||
m_patch.files[i].name = p + (int)m_patch.files[i].name;
|
||||
m_patch.files[i].patches = (PatchedByte *)(p + (int)m_patch.files[i].patches);
|
||||
}
|
||||
|
||||
printf("Patch %s loaded...\n", m_patch.name);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/** MAIN FUNCTIONS ************************************************************/
|
||||
|
||||
static int
|
||||
createPatch()
|
||||
{
|
||||
int i, status;
|
||||
const char *outputFileName;
|
||||
|
||||
/* Check argument count */
|
||||
if (m_argc < 6 || (m_argc % 2) != 0)
|
||||
{
|
||||
printUsage();
|
||||
return -1;
|
||||
}
|
||||
|
||||
outputFileName = m_argv[3];
|
||||
m_patch.name = m_argv[2];
|
||||
|
||||
/* Allocate PatchedFiles array */
|
||||
m_patch.fileCount = (m_argc - 4) / 2;
|
||||
m_patch.files = malloc(m_patch.fileCount * sizeof (PatchedFile));
|
||||
if (m_patch.files == NULL)
|
||||
{
|
||||
printf("Out of memory!\n");
|
||||
return -1;
|
||||
}
|
||||
memset(m_patch.files, 0, m_patch.fileCount * sizeof (PatchedFile));
|
||||
|
||||
/* Compare original to patched files and fill m_patch.files array */
|
||||
for (i = 0; i < m_patch.fileCount; i++)
|
||||
{
|
||||
m_patch.files[i].name = m_argv[4 + (i * 2) + 1];
|
||||
status = compareFiles(m_patch.files + i, m_argv[4 + (i * 2) + 0]);
|
||||
if (status < 0)
|
||||
{
|
||||
for (i = 0; i < m_patch.fileCount; i++)
|
||||
{
|
||||
if (m_patch.files[i].patches != NULL)
|
||||
free(m_patch.files[i].patches);
|
||||
}
|
||||
free(m_patch.files);
|
||||
m_patch.files = NULL;
|
||||
m_patch.fileCount = 0;
|
||||
return status;
|
||||
}
|
||||
}
|
||||
|
||||
/* Output patch */
|
||||
return outputPatch(outputFileName);
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
applyPatch()
|
||||
{
|
||||
int c, i, j, fileSize, makeBackup;
|
||||
unsigned char *file;
|
||||
char *p;
|
||||
const char *fileName;
|
||||
char buffer[MAX_PATH];
|
||||
|
||||
|
||||
if (m_argc > 1 && strcmp(m_argv[1], "-d") != 0)
|
||||
{
|
||||
printUsage();
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Load patch */
|
||||
if (loadPatch() < 0)
|
||||
{
|
||||
printf("This executable doesn't contain a patch, use -c to create one.\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (m_argc > 1)
|
||||
{
|
||||
/* Dump patch */
|
||||
printf("Patch name: %s\n", m_patch.name);
|
||||
printf("File count: %d\n", m_patch.fileCount);
|
||||
for (i = 0; i < m_patch.fileCount; i++)
|
||||
{
|
||||
printf("----------------------\n"
|
||||
"File name: %s\n"
|
||||
"File size: %d bytes\n",
|
||||
m_patch.files[i].name, m_patch.files[i].fileSize);
|
||||
printf("Patch count: %d\n", m_patch.files[i].patchCount);
|
||||
for (j = 0; j < m_patch.files[i].patchCount; j++)
|
||||
{
|
||||
printf(" Offset 0x%x 0x%02x -> 0x%02x\n",
|
||||
m_patch.files[i].patches[j].offset,
|
||||
m_patch.files[i].patches[j].expected,
|
||||
m_patch.files[i].patches[j].patched);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Apply patch */
|
||||
printf("Applying patch...\n");
|
||||
for (i = 0; i < m_patch.fileCount; i++)
|
||||
{
|
||||
/* Load original file */
|
||||
fileName = m_patch.files[i].name;
|
||||
applyPatch_retry_file:
|
||||
file = loadFile(fileName, &fileSize);
|
||||
if (file == NULL)
|
||||
{
|
||||
printf("File %s not found! ", fileName);
|
||||
applyPatch_file_open_error:
|
||||
printf("(S)kip, (R)etry, (A)bort, (M)anually enter filename");
|
||||
do
|
||||
{
|
||||
c = getch();
|
||||
}
|
||||
while (c != 's' && c != 'r' && c != 'a' && c != 'm');
|
||||
printf("\n");
|
||||
if (c == 's')
|
||||
{
|
||||
continue;
|
||||
}
|
||||
else if (c == 'r')
|
||||
{
|
||||
goto applyPatch_retry_file;
|
||||
}
|
||||
else if (c == 'a')
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else if (c == 'm')
|
||||
{
|
||||
if (fgets(buffer, sizeof (buffer), stdin) == NULL)
|
||||
{
|
||||
printf("fgets() failed!\n");
|
||||
return -1;
|
||||
}
|
||||
p = strchr(buffer, '\r');
|
||||
if (p != NULL)
|
||||
*p = '\0';
|
||||
p = strchr(buffer, '\n');
|
||||
if (p != NULL)
|
||||
*p = '\0';
|
||||
|
||||
fileName = buffer;
|
||||
goto applyPatch_retry_file;
|
||||
}
|
||||
}
|
||||
|
||||
/* Check file size */
|
||||
if (fileSize != m_patch.files[i].fileSize)
|
||||
{
|
||||
free(file);
|
||||
printf("File %s has unexpected filesize of %d bytes (%d bytes expected)\n",
|
||||
fileName, fileSize, m_patch.files[i].fileSize);
|
||||
if (fileName != m_patch.files[i].name) /* manually entered filename */
|
||||
{
|
||||
goto applyPatch_file_open_error;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Ask for backup */
|
||||
printf("Do you want to make a backup of %s? (Y)es, (N)o, (A)bort", fileName);
|
||||
do
|
||||
{
|
||||
c = getch();
|
||||
}
|
||||
while (c != 'y' && c != 'n' && c != 'a');
|
||||
printf("\n");
|
||||
if (c == 'y')
|
||||
{
|
||||
char buffer[MAX_PATH];
|
||||
snprintf(buffer, MAX_PATH, "%s.bak", fileName);
|
||||
buffer[MAX_PATH-1] = '\0';
|
||||
makeBackup = 1;
|
||||
if (access(buffer, 0) >= 0) /* file exists */
|
||||
{
|
||||
printf("File %s already exists, overwrite? (Y)es, (N)o, (A)bort", buffer);
|
||||
do
|
||||
{
|
||||
c = getch();
|
||||
}
|
||||
while (c != 'y' && c != 'n' && c != 'a');
|
||||
printf("\n");
|
||||
if (c == 'n')
|
||||
makeBackup = 0;
|
||||
else if (c == 'a')
|
||||
{
|
||||
free(file);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
if (makeBackup && saveFile(buffer, file, fileSize) < 0)
|
||||
{
|
||||
free(file);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
else if (c == 'a')
|
||||
{
|
||||
free(file);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Patch file */
|
||||
for (j = 0; j < m_patch.files[i].patchCount; j++)
|
||||
{
|
||||
int offset = m_patch.files[i].patches[j].offset;
|
||||
if (file[offset] != m_patch.files[i].patches[j].expected)
|
||||
{
|
||||
printf("Unexpected value in file %s at offset 0x%x: expected = 0x%02x, found = 0x%02x\n",
|
||||
fileName, offset, m_patch.files[i].patches[j].expected, file[offset]);
|
||||
free(file);
|
||||
return -1;
|
||||
}
|
||||
file[offset] = m_patch.files[i].patches[j].patched;
|
||||
}
|
||||
|
||||
/* Save file */
|
||||
if (saveFile(fileName, file, fileSize) < 0)
|
||||
{
|
||||
free(file);
|
||||
return -1;
|
||||
}
|
||||
free(file);
|
||||
}
|
||||
|
||||
printf("Patch applied sucessfully!\n");
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
printUsage()
|
||||
{
|
||||
printf("Usage:\n"
|
||||
"%s -c - Create patch\n"
|
||||
"%s -d - Dump patch\n"
|
||||
"%s - Apply patch\n"
|
||||
"\n"
|
||||
"A patch can be created like this:\n"
|
||||
"%s -c \"patch name\" output.exe file1.orig file1.patched[ file2.orig file2.patched[ ...]]\n",
|
||||
m_argv[0], m_argv[0], m_argv[0], m_argv[0]);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
main(
|
||||
int argc,
|
||||
char *argv[])
|
||||
{
|
||||
m_argc = argc;
|
||||
m_argv = argv;
|
||||
|
||||
if (argc >= 2 && (strcmp(argv[1], "-h") == 0 || strcmp(argv[1], "--help") == 0))
|
||||
{
|
||||
printUsage();
|
||||
return 0;
|
||||
}
|
||||
else if (argc >= 2 && argv[1][0] == '-')
|
||||
{
|
||||
if (strcmp(argv[1], "-c") == 0)
|
||||
{
|
||||
return createPatch();
|
||||
}
|
||||
else if (strcmp(argv[1], "-d") == 0)
|
||||
{
|
||||
return applyPatch();
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("Unknown option: %s\n"
|
||||
"Use -h for help.\n",
|
||||
argv[1]);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
return applyPatch();
|
||||
}
|
||||
|
2
reactos/apps/utils/buildno/.cvsignore
Normal file
2
reactos/apps/utils/buildno/.cvsignore
Normal file
@@ -0,0 +1,2 @@
|
||||
buildno
|
||||
buildno.exe
|
26
reactos/apps/utils/buildno/Makefile
Normal file
26
reactos/apps/utils/buildno/Makefile
Normal file
@@ -0,0 +1,26 @@
|
||||
# $Id: Makefile,v 1.3 1999/11/12 12:01:09 dwelch Exp $
|
||||
#
|
||||
|
||||
BASE_CFLAGS = -I../../include
|
||||
TARGETNAME=buildno
|
||||
CLEAN_FILES= $(TARGETNAME).o $(TARGETNAME)$(EXE_POSTFIX) $(TARGETNAME).sym
|
||||
|
||||
all: $(TARGETNAME)$(EXE_POSTFIX)
|
||||
$(EXE_PREFIX)$(TARGETNAME)$(EXE_POSTFIX) -q
|
||||
|
||||
|
||||
$(TARGETNAME)$(EXE_POSTFIX): $(TARGETNAME).c ../../include/reactos/version.h
|
||||
$(NATIVE_CC) -I../../include -o $(TARGETNAME)$(EXE_POSTFIX) $(TARGETNAME).c
|
||||
|
||||
|
||||
|
||||
clean:
|
||||
$(RM) $(TARGETNAME).o
|
||||
$(RM) $(TARGETNAME).sym
|
||||
$(RM) $(TARGETNAME)$(EXE_POSTFIX)
|
||||
|
||||
.phony: clean
|
||||
|
||||
include ../../rules.mak
|
||||
|
||||
# EOF
|
262
reactos/apps/utils/buildno/buildno.c
Normal file
262
reactos/apps/utils/buildno/buildno.c
Normal file
@@ -0,0 +1,262 @@
|
||||
/* $Id: buildno.c,v 1.2 1999/12/26 20:21:02 ea Exp $
|
||||
*
|
||||
* buildno - Generate the build number for ReactOS
|
||||
*
|
||||
* Copyright (c) 1999 Emanuele Aliberti
|
||||
*
|
||||
*
|
||||
* It assumes the last release date is defined in
|
||||
* <reactos/version.h> as a macro named
|
||||
*
|
||||
* KERNEL_RELEASE_DATE
|
||||
*
|
||||
* as a 32-bit unsigned long YYYYMMDD (UTC).
|
||||
*
|
||||
* The build number is the number of full days
|
||||
* elapsed since the last release date (UTC).
|
||||
*
|
||||
* The build number is stored in the file
|
||||
* <reactos/buildno.h> as a set of macros:
|
||||
*
|
||||
* KERNEL_VERSION_BUILD
|
||||
* KERNEL_VERSION_BUILD_STR
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
#include <reactos/version.h>
|
||||
|
||||
#define FALSE 0
|
||||
#define TRUE 1
|
||||
|
||||
/* File to (over)write */
|
||||
#define BUILDNO_INCLUDE_FILE "../../include/reactos/buildno.h"
|
||||
|
||||
static char * argv0 = "";
|
||||
|
||||
|
||||
int
|
||||
elapsed_days (
|
||||
time_t t_today,
|
||||
time_t t_release_day
|
||||
)
|
||||
{
|
||||
double seconds = difftime (t_today, t_release_day);
|
||||
double days = seconds / (double) 86400.0;
|
||||
char buf [32];
|
||||
char * dot = buf;
|
||||
|
||||
sprintf (buf, "%f", days );
|
||||
|
||||
while ( *dot && *dot != '.') ++dot;
|
||||
*dot = '\0';
|
||||
|
||||
return atol (buf);
|
||||
}
|
||||
|
||||
void
|
||||
write_h (int build)
|
||||
{
|
||||
FILE *h = NULL;
|
||||
|
||||
h = fopen ( BUILDNO_INCLUDE_FILE, "w");
|
||||
if (!h)
|
||||
{
|
||||
fprintf (
|
||||
stderr,
|
||||
"%s: can not create file \"%s\"!\n",
|
||||
argv0,
|
||||
BUILDNO_INCLUDE_FILE
|
||||
);
|
||||
return;
|
||||
}
|
||||
fprintf (
|
||||
h,
|
||||
"/* Do not edit - Machine generated */\n"
|
||||
);
|
||||
|
||||
fprintf (h, "#ifndef _INC_REACTOS_BUILDNO\n" );
|
||||
fprintf (h, "#define _INC_REACTOS_BUILDNO\n" );
|
||||
|
||||
fprintf (
|
||||
h,
|
||||
"#define KERNEL_VERSION_BUILD\t%d\n",
|
||||
build
|
||||
);
|
||||
fprintf (
|
||||
h,
|
||||
"#define KERNEL_VERSION_BUILD_STR\t\"%d\"\n",
|
||||
build
|
||||
);
|
||||
fprintf (
|
||||
h,
|
||||
"#define KERNEL_RELEASE_RC\t\"%d.%d.%d.%d\\0\"\n",
|
||||
KERNEL_VERSION_MAJOR,
|
||||
KERNEL_VERSION_MINOR,
|
||||
KERNEL_VERSION_PATCH_LEVEL,
|
||||
build
|
||||
);
|
||||
fprintf (
|
||||
h,
|
||||
"#define KERNEL_RELEASE_STR\t\"%d.%d.%d.%d\"\n",
|
||||
KERNEL_VERSION_MAJOR,
|
||||
KERNEL_VERSION_MINOR,
|
||||
KERNEL_VERSION_PATCH_LEVEL,
|
||||
build
|
||||
);
|
||||
fprintf (
|
||||
h,
|
||||
"#define KERNEL_VERSION_RC\t\"%d.%d.%d\\0\"\n",
|
||||
KERNEL_VERSION_MAJOR,
|
||||
KERNEL_VERSION_MINOR,
|
||||
KERNEL_VERSION_PATCH_LEVEL
|
||||
);
|
||||
fprintf (
|
||||
h,
|
||||
"#define KERNEL_VERSION_STR\t\"%d.%d.%d\"\n",
|
||||
KERNEL_VERSION_MAJOR,
|
||||
KERNEL_VERSION_MINOR,
|
||||
KERNEL_VERSION_PATCH_LEVEL
|
||||
);
|
||||
fprintf (
|
||||
h,
|
||||
"#endif\n/* EOF */\n"
|
||||
);
|
||||
|
||||
fclose (h);
|
||||
}
|
||||
|
||||
void
|
||||
usage (void)
|
||||
{
|
||||
fprintf (
|
||||
stderr,
|
||||
"Usage: %s [-q]\n",
|
||||
argv0
|
||||
);
|
||||
exit (EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
main (int argc, char * argv [])
|
||||
{
|
||||
int quiet = FALSE;
|
||||
|
||||
int year = 0;
|
||||
int month = 0;
|
||||
int day = 0;
|
||||
int build = 0;
|
||||
|
||||
time_t t0 = 0;
|
||||
struct tm t0_tm = {0};
|
||||
time_t t1 = 0;
|
||||
struct tm * t1_tm = NULL;
|
||||
|
||||
argv0 = argv[0];
|
||||
|
||||
switch (argc)
|
||||
{
|
||||
case 1:
|
||||
break;
|
||||
case 2:
|
||||
if (argv[1][0] == '-')
|
||||
{
|
||||
if (argv[1][1] == 'q')
|
||||
{
|
||||
quiet = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
usage ();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
usage ();
|
||||
}
|
||||
break;
|
||||
default:
|
||||
usage ();
|
||||
}
|
||||
/*
|
||||
* We are building TODAY!
|
||||
*/
|
||||
time (& t0);
|
||||
/*
|
||||
* "Parse" the release date.
|
||||
*/
|
||||
day = KERNEL_RELEASE_DATE % 100;
|
||||
month = ( ( KERNEL_RELEASE_DATE
|
||||
% 10000
|
||||
)
|
||||
- day
|
||||
)
|
||||
/ 100;
|
||||
year =
|
||||
( KERNEL_RELEASE_DATE
|
||||
- (month * 100)
|
||||
- day
|
||||
)
|
||||
/ 10000;
|
||||
if (FALSE == quiet)
|
||||
{
|
||||
printf ( "\n\
|
||||
ReactOS Build Number Generator\n\n\
|
||||
Last release: %4d-%02d-%02d\n",
|
||||
year,
|
||||
month,
|
||||
day
|
||||
);
|
||||
}
|
||||
t0_tm.tm_year = year - ((year > 1999) ? 2000 : 1900);
|
||||
t0_tm.tm_mon = month;
|
||||
t0_tm.tm_mday = day;
|
||||
|
||||
t0 = mktime (& t0_tm);
|
||||
|
||||
time (& t1); /* current build time */
|
||||
t1_tm = gmtime (& t1);
|
||||
|
||||
t1_tm->tm_year +=
|
||||
(t1_tm->tm_year < 70)
|
||||
? 2000
|
||||
: 1900;
|
||||
if (FALSE == quiet)
|
||||
{
|
||||
printf (
|
||||
"Current date: %4d-%02d-%02d\n\n",
|
||||
t1_tm->tm_year,
|
||||
t1_tm->tm_mon,
|
||||
t1_tm->tm_mday
|
||||
);
|
||||
}
|
||||
/*
|
||||
* Compute delta days.
|
||||
*/
|
||||
build = elapsed_days (t1, t0);
|
||||
|
||||
if (FALSE == quiet)
|
||||
{
|
||||
printf (
|
||||
"Build number: %d (elapsed days since last release)\n",
|
||||
build
|
||||
);
|
||||
printf (
|
||||
"ROS Version : %d.%d.%d.%d\n",
|
||||
KERNEL_VERSION_MAJOR,
|
||||
KERNEL_VERSION_MINOR,
|
||||
KERNEL_VERSION_PATCH_LEVEL,
|
||||
build
|
||||
);
|
||||
}
|
||||
/*
|
||||
* (Over)write the include file.
|
||||
*/
|
||||
write_h (build);
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/* EOF */
|
@@ -1,21 +1,42 @@
|
||||
# $Id$
|
||||
#
|
||||
#
|
||||
#
|
||||
OBJECTS= cat.o
|
||||
PROGS= cat.exe
|
||||
|
||||
PATH_TO_TOP = ../../..
|
||||
all: cat.exe
|
||||
|
||||
TARGET_NORC = yes
|
||||
.phony: all
|
||||
|
||||
TARGET_TYPE = program
|
||||
clean:
|
||||
- $(RM) cat.o
|
||||
- $(RM) cat.exe
|
||||
- $(RM) cat.sym
|
||||
|
||||
TARGET_APPTYPE = console
|
||||
.phony: clean
|
||||
|
||||
TARGET_NAME = cat
|
||||
floppy: $(PROGS:%=$(FLOPPY_DIR)/apps/%)
|
||||
|
||||
TARGET_OBJECTS = $(TARGET_NAME).o
|
||||
$(PROGS:%=$(FLOPPY_DIR)/apps/%): $(FLOPPY_DIR)/apps/%: %
|
||||
ifeq ($(DOSCLI),yes)
|
||||
$(CP) $* $(FLOPPY_DIR)\apps\$*
|
||||
else
|
||||
$(CP) $* $(FLOPPY_DIR)/apps/$*
|
||||
endif
|
||||
|
||||
TARGET_CFLAGS = -Wall -Werror
|
||||
dist: $(PROGS:%=../../$(DIST_DIR)/apps/%)
|
||||
|
||||
include $(PATH_TO_TOP)/rules.mak
|
||||
$(PROGS:%=../../$(DIST_DIR)/apps/%): ../../$(DIST_DIR)/apps/%: %
|
||||
ifeq ($(DOSCLI),yes)
|
||||
$(CP) $* ..\..\$(DIST_DIR)\apps\$*
|
||||
else
|
||||
$(CP) $* ../../$(DIST_DIR)/apps/$*
|
||||
endif
|
||||
|
||||
include $(TOOLS_PATH)/helper.mk
|
||||
.PHONY: floppy dist
|
||||
|
||||
# EOF
|
||||
cat.exe: $(OBJECTS) $(LIBS)
|
||||
$(CC) $(OBJECTS) -o cat.exe
|
||||
$(NM) --numeric-sort cat.exe > cat.sym
|
||||
|
||||
include ../../rules.mak
|
||||
|
@@ -1,32 +0,0 @@
|
||||
/*
|
||||
* Load a device driver
|
||||
*/
|
||||
#include <windows.h>
|
||||
#include <ntos/zw.h>
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
NTSTATUS Status;
|
||||
UNICODE_STRING ServiceName;
|
||||
|
||||
if (argc != 2)
|
||||
{
|
||||
printf("Usage: load <ServiceName>\n");
|
||||
return 0;
|
||||
}
|
||||
ServiceName.Length = (strlen(argv[1]) + 52) * sizeof(WCHAR);
|
||||
ServiceName.Buffer = (LPWSTR)malloc(ServiceName.Length + sizeof(UNICODE_NULL));
|
||||
wsprintf(ServiceName.Buffer,
|
||||
L"\\Registry\\Machine\\System\\CurrentControlSet\\Services\\%S",
|
||||
argv[1]);
|
||||
wprintf(L"%s %d %d\n", ServiceName.Buffer, ServiceName.Length, wcslen(ServiceName.Buffer));
|
||||
Status = NtLoadDriver(&ServiceName);
|
||||
free(ServiceName.Buffer);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
printf("Failed: %X\n", Status);
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
@@ -1,21 +0,0 @@
|
||||
PATH_TO_TOP = ../../../..
|
||||
|
||||
TARGET_NORC = yes
|
||||
|
||||
TARGET_TYPE = program
|
||||
|
||||
TARGET_APPTYPE = console
|
||||
|
||||
TARGET_NAME = load
|
||||
|
||||
TARGET_CFLAGS = -DUNICODE -D_UNICODE
|
||||
|
||||
TARGET_SDKLIBS = ntdll.a
|
||||
|
||||
TARGET_OBJECTS = $(TARGET_NAME).o
|
||||
|
||||
include $(PATH_TO_TOP)/rules.mak
|
||||
|
||||
include $(TOOLS_PATH)/helper.mk
|
||||
|
||||
# EOF
|
@@ -1,21 +0,0 @@
|
||||
PATH_TO_TOP = ../../../..
|
||||
|
||||
TARGET_NORC = yes
|
||||
|
||||
TARGET_TYPE = program
|
||||
|
||||
TARGET_APPTYPE = console
|
||||
|
||||
TARGET_NAME = unload
|
||||
|
||||
TARGET_CFLAGS = -DUNICODE -D_UNICODE
|
||||
|
||||
TARGET_SDKLIBS = ntdll.a
|
||||
|
||||
TARGET_OBJECTS = $(TARGET_NAME).o
|
||||
|
||||
include $(PATH_TO_TOP)/rules.mak
|
||||
|
||||
include $(TOOLS_PATH)/helper.mk
|
||||
|
||||
# EOF
|
@@ -1,32 +0,0 @@
|
||||
/*
|
||||
* Unload a device driver
|
||||
*/
|
||||
#include <windows.h>
|
||||
#include <ntos/zw.h>
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
NTSTATUS Status;
|
||||
UNICODE_STRING ServiceName;
|
||||
|
||||
if (argc != 2)
|
||||
{
|
||||
printf("Usage: unload <ServiceName>\n");
|
||||
return 0;
|
||||
}
|
||||
ServiceName.Length = (strlen(argv[1]) + 52) * sizeof(WCHAR);
|
||||
ServiceName.Buffer = (LPWSTR)malloc(ServiceName.Length + sizeof(UNICODE_NULL));
|
||||
wsprintf(ServiceName.Buffer,
|
||||
L"\\Registry\\Machine\\System\\CurrentControlSet\\Services\\%S",
|
||||
argv[1]);
|
||||
wprintf(L"%s %d %d\n", ServiceName.Buffer, ServiceName.Length, wcslen(ServiceName.Buffer));
|
||||
Status = NtUnloadDriver(&ServiceName);
|
||||
free(ServiceName.Buffer);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
printf("Failed: %X\n", Status);
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
@@ -1,84 +0,0 @@
|
||||
/*
|
||||
* ReactOS INF Helper
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* PROJECT: INF Helper
|
||||
* FILE: infinst.c
|
||||
* PURPOSE: Pass INF files to setupapi.dll for execution
|
||||
* PROGRAMMER: Michael Biggins
|
||||
* UPDATE HISTORY:
|
||||
* Created 19/09/2004
|
||||
*/
|
||||
#include <windows.h>
|
||||
#include <tchar.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#ifdef UNICODE
|
||||
VOID WINAPI InstallHinfSectionW(HWND hwnd, HINSTANCE handle, LPCWSTR cmdline, INT show);
|
||||
#define InstallHinfSection InstallHinfSectionW
|
||||
#else
|
||||
VOID WINAPI InstallHinfSectionA(HWND hwnd, HINSTANCE handle, LPCSTR cmdline, INT show);
|
||||
#define InstallHinfSection InstallHinfSectionA
|
||||
#endif
|
||||
|
||||
#define FILEOPEN_FILTER TEXT("Inf Files (*.inf)\0*.inf\0All Files (*.*)\0*.*\0\0")
|
||||
#define FILEOPEN_TITLE TEXT("INF file to process")
|
||||
#define FILEOPEN_DEFEXT TEXT(".inf")
|
||||
#define INF_COMMAND TEXT("DefaultInstall 128 %s")
|
||||
|
||||
int
|
||||
_tmain(int argc, TCHAR *argv[])
|
||||
{
|
||||
TCHAR infCommand[MAX_PATH + 32];
|
||||
|
||||
if (argc <= 1)
|
||||
{
|
||||
TCHAR FileName[MAX_PATH + 1];
|
||||
OPENFILENAME ofc;
|
||||
int rv;
|
||||
|
||||
ZeroMemory(&ofc, sizeof(ofc));
|
||||
ZeroMemory(FileName, MAX_PATH + 1);
|
||||
ofc.lStructSize = sizeof(ofc);
|
||||
ofc.lpstrFilter = FILEOPEN_FILTER;
|
||||
ofc.nFilterIndex = 1;
|
||||
ofc.lpstrTitle = FILEOPEN_TITLE;
|
||||
ofc.Flags = OFN_FILEMUSTEXIST | OFN_LONGNAMES | OFN_PATHMUSTEXIST;
|
||||
ofc.lpstrDefExt = FILEOPEN_DEFEXT;
|
||||
ofc.lpstrFile = FileName;
|
||||
ofc.nMaxFile = sizeof(FileName) / sizeof(TCHAR);
|
||||
|
||||
rv = GetOpenFileName(&ofc);
|
||||
|
||||
if (rv == 0)
|
||||
return 1;
|
||||
|
||||
_stprintf(infCommand, INF_COMMAND, FileName);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_tcslen(argv[1]) > MAX_PATH)
|
||||
{
|
||||
MessageBox(NULL, TEXT("Command line too long to be a valid file name"), NULL, MB_OK | MB_ICONERROR);
|
||||
return 2; /* User error */
|
||||
}
|
||||
_stprintf(infCommand, INF_COMMAND, argv[1]);
|
||||
}
|
||||
|
||||
InstallHinfSection(NULL, NULL, infCommand, 0);
|
||||
|
||||
return 0;
|
||||
}
|
@@ -1,21 +0,0 @@
|
||||
PATH_TO_TOP = ../../..
|
||||
|
||||
TARGET_NORC = yes
|
||||
|
||||
TARGET_TYPE = program
|
||||
|
||||
TARGET_APPTYPE = windows
|
||||
|
||||
TARGET_NAME = infinst
|
||||
|
||||
TARGET_SDKLIBS = comdlg32.a setupapi.a
|
||||
|
||||
TARGET_OBJECTS = infinst.o
|
||||
|
||||
TARGET_CFLAGS = -Wall -Werror
|
||||
|
||||
include $(PATH_TO_TOP)/rules.mak
|
||||
|
||||
include $(TOOLS_PATH)/helper.mk
|
||||
|
||||
# EOF
|
@@ -1,99 +0,0 @@
|
||||
/*
|
||||
* arp - display ARP cache from the IP stack parameters.
|
||||
*
|
||||
* This source code is in the PUBLIC DOMAIN and has NO WARRANTY.
|
||||
*
|
||||
* Robert Dickenson <robd@reactos.org>, August 15, 2002.
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <windows.h>
|
||||
#include <tchar.h>
|
||||
#include <time.h>
|
||||
|
||||
#include <iptypes.h>
|
||||
#include <ipexport.h>
|
||||
#include <iphlpapi.h>
|
||||
#include <snmp.h>
|
||||
|
||||
#include "trace.h"
|
||||
|
||||
|
||||
VOID SNMP_FUNC_TYPE SnmpSvcInitUptime();
|
||||
DWORD SNMP_FUNC_TYPE SnmpSvcGetUptime();
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
const char szUsage[] = { "\n" \
|
||||
"Displays and modifies the IP Protocol to physical address translation tables\n" \
|
||||
"used by address resolution protocol (ARP).\n" \
|
||||
"\n" \
|
||||
"ARP -s inet_addr eth_addr [if_addr]\n" \
|
||||
"ARP -d inet_addr [if_addr]\n" \
|
||||
"ARP -a [inet_addr] [-N if_addr]\n" \
|
||||
"\n" \
|
||||
" -a Displays the active ARP table by querying the current protocol\n" \
|
||||
" data. If inet_addr is specified, the IP and physical addresses\n" \
|
||||
" for the specified address are displayed. If more than one\n" \
|
||||
" network interface is using ARP, each interfaces ARP table is\n" \
|
||||
" displayed.\n" \
|
||||
" -g Indentical to -a.\n" \
|
||||
" inet_addr Specifies the IP address.\n" \
|
||||
" -N if_addr Displays the ARP table for the specified interface only\n" \
|
||||
" -d Deletes the host entry specified by inet_addr. inet_addr may be\n" \
|
||||
" wildcarded with * to delete all host entries in the ARP table.\n" \
|
||||
" -s Adds the host and associates the IP address inet_addr with the\n" \
|
||||
" physical address eth_addr. The physical address must be specified\n" \
|
||||
" as 6 hexadecimal characters delimited by hyphens. The new entry\n" \
|
||||
" will become permanent in the ARP table.\n" \
|
||||
" eth_addr Specifies the interface physical address.\n" \
|
||||
" if_addr If present, this specifies the IP address of the interface whose\n" \
|
||||
" address translation table should be modified. If not present, the\n" \
|
||||
" first applicable interface will be used.\n" \
|
||||
"Example:\n" \
|
||||
" > arp -s 192.168.0.12 55-AA-55-01-02-03 .... Static entry creation.\n" \
|
||||
" > arp -a .... ARP table display.\n" \
|
||||
" > arp -d * .... Delete all ARP table entries.\n"
|
||||
};
|
||||
|
||||
void usage(void)
|
||||
{
|
||||
// fprintf(stderr,"USAGE:\n");
|
||||
fputs(szUsage, stderr);
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
TCHAR szComputerName[50];
|
||||
DWORD dwSize = 50;
|
||||
|
||||
int nBytes = 500;
|
||||
BYTE* pCache;
|
||||
|
||||
if (argc > 1) {
|
||||
usage();
|
||||
return 1;
|
||||
}
|
||||
|
||||
SnmpSvcInitUptime();
|
||||
|
||||
GetComputerName(szComputerName, &dwSize);
|
||||
_tprintf(_T("ReactOS ARP cache on Computer Name: %s\n"), szComputerName);
|
||||
|
||||
pCache = (BYTE*)SnmpUtilMemAlloc(nBytes);
|
||||
|
||||
Sleep(2500);
|
||||
|
||||
if (pCache != NULL) {
|
||||
|
||||
DWORD dwUptime = SnmpSvcGetUptime();
|
||||
|
||||
_tprintf(_T("SNMP uptime: %d\n"), dwUptime);
|
||||
|
||||
SnmpUtilMemFree(pCache);
|
||||
} else {
|
||||
_tprintf(_T("ERROR: call to SnmpUtilMemAlloc() failed\n"));
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@@ -1,6 +0,0 @@
|
||||
/* $Id$ */
|
||||
|
||||
#define REACTOS_STR_FILE_DESCRIPTION "ReactOS TCP/IPv4 Win32 arp\0"
|
||||
#define REACTOS_STR_INTERNAL_NAME "arp\0"
|
||||
#define REACTOS_STR_ORIGINAL_FILENAME "arp.exe\0"
|
||||
#include <reactos/version.rc>
|
@@ -1,19 +0,0 @@
|
||||
PATH_TO_TOP = ../../../..
|
||||
|
||||
TARGET_TYPE = program
|
||||
|
||||
TARGET_APPTYPE = console
|
||||
|
||||
TARGET_NAME = arp
|
||||
|
||||
TARGET_INSTALLDIR = system32
|
||||
|
||||
TARGET_CFLAGS = -D__USE_W32API
|
||||
|
||||
TARGET_SDKLIBS = user32.a snmpapi.a
|
||||
|
||||
TARGET_OBJECTS = $(TARGET_NAME).o
|
||||
|
||||
include $(PATH_TO_TOP)/rules.mak
|
||||
|
||||
include $(TOOLS_PATH)/helper.mk
|
@@ -1,53 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Diagnostic Trace
|
||||
//
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
#include <tchar.h>
|
||||
#include "trace.h"
|
||||
|
||||
|
||||
#ifdef _DEBUG
|
||||
|
||||
#undef THIS_FILE
|
||||
static char THIS_FILE[] = __FILE__;
|
||||
|
||||
void _DebugBreak(void)
|
||||
{
|
||||
DebugBreak();
|
||||
}
|
||||
|
||||
void Trace(TCHAR* lpszFormat, ...)
|
||||
{
|
||||
va_list args;
|
||||
int nBuf;
|
||||
TCHAR szBuffer[512];
|
||||
|
||||
va_start(args, lpszFormat);
|
||||
nBuf = _vsntprintf(szBuffer, sizeof(szBuffer)/sizeof(TCHAR), lpszFormat, args);
|
||||
OutputDebugString(szBuffer);
|
||||
// was there an error? was the expanded string too long?
|
||||
//ASSERT(nBuf >= 0);
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
void Assert(void* assert, TCHAR* file, int line, void* msg)
|
||||
{
|
||||
if (msg == NULL) {
|
||||
printf("ASSERT -- %s occured on line %u of file %s.\n",
|
||||
assert, line, file);
|
||||
} else {
|
||||
printf("ASSERT -- %s occured on line %u of file %s: Message = %s.\n",
|
||||
assert, line, file, msg);
|
||||
}
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
void Trace(TCHAR* lpszFormat, ...) { };
|
||||
void Assert(void* assert, TCHAR* file, int line, void* msg) { };
|
||||
|
||||
#endif //_DEBUG
|
||||
/////////////////////////////////////////////////////////////////////////////
|
@@ -1,61 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Diagnostic Trace
|
||||
//
|
||||
#ifndef __TRACE_H__
|
||||
#define __TRACE_H__
|
||||
|
||||
#ifdef _DEBUG
|
||||
|
||||
#ifdef _X86_
|
||||
#define BreakPoint() _asm { int 3h }
|
||||
#else
|
||||
#define BreakPoint() _DebugBreak()
|
||||
#endif
|
||||
|
||||
#ifndef ASSERT
|
||||
#define ASSERT(exp) \
|
||||
{ \
|
||||
if (!(exp)) { \
|
||||
Assert(#exp, __FILE__, __LINE__, NULL); \
|
||||
BreakPoint(); \
|
||||
} \
|
||||
} \
|
||||
|
||||
#define ASSERTMSG(exp, msg) \
|
||||
{ \
|
||||
if (!(exp)) { \
|
||||
Assert(#exp, __FILE__, __LINE__, msg); \
|
||||
BreakPoint(); \
|
||||
} \
|
||||
}
|
||||
#endif
|
||||
|
||||
//=============================================================================
|
||||
// MACRO: TRACE()
|
||||
//=============================================================================
|
||||
|
||||
#define TRACE Trace
|
||||
|
||||
|
||||
#else // _DEBUG
|
||||
|
||||
//=============================================================================
|
||||
// Define away MACRO's ASSERT() and TRACE() in non debug builds
|
||||
//=============================================================================
|
||||
|
||||
#ifndef ASSERT
|
||||
#define ASSERT(exp)
|
||||
#define ASSERTMSG(exp, msg)
|
||||
#endif
|
||||
|
||||
#define TRACE 0 ? (void)0 : Trace
|
||||
|
||||
#endif // !_DEBUG
|
||||
|
||||
|
||||
void Assert(void* assert, TCHAR* file, int line, void* msg);
|
||||
void Trace(TCHAR* lpszFormat, ...);
|
||||
|
||||
|
||||
#endif // __TRACE_H__
|
||||
/////////////////////////////////////////////////////////////////////////////
|
@@ -1,23 +0,0 @@
|
||||
July 22, 1999
|
||||
|
||||
To All Licensees, Distributors of Any Version of BSD:
|
||||
|
||||
As you know, certain of the Berkeley Software Distribution ("BSD") source code files
|
||||
require that further distributions of products containing all or portions of the
|
||||
software, acknowledge within their advertising materials that such products contain
|
||||
software developed by UC Berkeley and its contributors.
|
||||
|
||||
Specifically, the provision reads:
|
||||
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
|
||||
Effective immediately, licensees and distributors are no longer required to include
|
||||
the acknowledgement within advertising materials. Accordingly, the foregoing paragraph
|
||||
of those BSD Unix files containing it is hereby deleted in its entirety.
|
||||
|
||||
William Hoskins
|
||||
Director, Office of Technology Licensing
|
||||
University of California, Berkeley "
|
@@ -1,180 +0,0 @@
|
||||
/*-
|
||||
* Copyright (c) 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
static char sccsid[] = "@(#)err.c 8.1 (Berkeley) 6/4/93";
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
#include "err.h"
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#ifdef __STDC__
|
||||
#include <stdarg.h>
|
||||
#else
|
||||
#include <varargs.h>
|
||||
#endif
|
||||
|
||||
extern char *__progname; /* Program name, from crt0. */
|
||||
|
||||
void
|
||||
#ifdef __STDC__
|
||||
err(int eval, const char *fmt, ...)
|
||||
#else
|
||||
err(eval, fmt, va_alist)
|
||||
int eval;
|
||||
const char *fmt;
|
||||
va_dcl
|
||||
#endif
|
||||
{
|
||||
va_list ap;
|
||||
#if __STDC__
|
||||
va_start(ap, fmt);
|
||||
#else
|
||||
va_start(ap);
|
||||
#endif
|
||||
verr(eval, fmt, ap);
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
void
|
||||
verr(int eval, const char *fmt, va_list ap)
|
||||
{
|
||||
int sverrno;
|
||||
|
||||
sverrno = errno;
|
||||
(void)fprintf(stderr, "%s: ", __progname);
|
||||
if (fmt != NULL) {
|
||||
(void)vfprintf(stderr, fmt, ap);
|
||||
(void)fprintf(stderr, ": ");
|
||||
}
|
||||
(void)fprintf(stderr, "%s\n", strerror(sverrno));
|
||||
exit(eval);
|
||||
}
|
||||
|
||||
void
|
||||
#if __STDC__
|
||||
errx(int eval, const char *fmt, ...)
|
||||
#else
|
||||
errx(eval, fmt, va_alist)
|
||||
int eval;
|
||||
const char *fmt;
|
||||
va_dcl
|
||||
#endif
|
||||
{
|
||||
va_list ap;
|
||||
#if __STDC__
|
||||
va_start(ap, fmt);
|
||||
#else
|
||||
va_start(ap);
|
||||
#endif
|
||||
verrx(eval, fmt, ap);
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
void
|
||||
verrx(int eval, const char *fmt, va_list ap)
|
||||
{
|
||||
(void)fprintf(stderr, "%s: ", __progname);
|
||||
if (fmt != NULL)
|
||||
(void)vfprintf(stderr, fmt, ap);
|
||||
(void)fprintf(stderr, "\n");
|
||||
exit(eval);
|
||||
}
|
||||
|
||||
void
|
||||
#if __STDC__
|
||||
warn(const char *fmt, ...)
|
||||
#else
|
||||
warn(fmt, va_alist)
|
||||
const char *fmt;
|
||||
va_dcl
|
||||
#endif
|
||||
{
|
||||
va_list ap;
|
||||
#if __STDC__
|
||||
va_start(ap, fmt);
|
||||
#else
|
||||
va_start(ap);
|
||||
#endif
|
||||
vwarn(fmt, ap);
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
void
|
||||
vwarn(fmt, ap)
|
||||
const char *fmt;
|
||||
va_list ap;
|
||||
{
|
||||
int sverrno;
|
||||
|
||||
sverrno = errno;
|
||||
(void)fprintf(stderr, "%s: ", __progname);
|
||||
if (fmt != NULL) {
|
||||
(void)vfprintf(stderr, fmt, ap);
|
||||
(void)fprintf(stderr, ": ");
|
||||
}
|
||||
(void)fprintf(stderr, "%s\n", strerror(sverrno));
|
||||
}
|
||||
|
||||
void
|
||||
#ifdef __STDC__
|
||||
warnx(const char *fmt, ...)
|
||||
#else
|
||||
warnx(fmt, va_alist)
|
||||
const char *fmt;
|
||||
va_dcl
|
||||
#endif
|
||||
{
|
||||
va_list ap;
|
||||
#ifdef __STDC__
|
||||
va_start(ap, fmt);
|
||||
#else
|
||||
va_start(ap);
|
||||
#endif
|
||||
vwarnx(fmt, ap);
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
void
|
||||
vwarnx(fmt, ap)
|
||||
const char *fmt;
|
||||
va_list ap;
|
||||
{
|
||||
(void)fprintf(stderr, "%s: ", __progname);
|
||||
if (fmt != NULL)
|
||||
(void)vfprintf(stderr, fmt, ap);
|
||||
(void)fprintf(stderr, "\n");
|
||||
}
|
@@ -1,60 +0,0 @@
|
||||
/*-
|
||||
* Copyright (c) 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)err.h 8.1 (Berkeley) 6/2/93
|
||||
*/
|
||||
|
||||
#ifndef _ERR_H_
|
||||
#define _ERR_H_
|
||||
|
||||
/*
|
||||
* Don't use va_list in the err/warn prototypes. Va_list is typedef'd in two
|
||||
* places (<machine/varargs.h> and <machine/stdarg.h>), so if we include one
|
||||
* of them here we may collide with the utility's includes. It's unreasonable
|
||||
* for utilities to have to include one of them to include err.h, so we get
|
||||
* _BSD_VA_LIST_ from <machine/ansi.h> and use it.
|
||||
*/
|
||||
/*#include <machine/ansi.h>*/
|
||||
/*#include <sys/cdefs.h>*/
|
||||
#include "various.h"
|
||||
#include <stdarg.h>
|
||||
|
||||
void err __P((int, const char *, ...));
|
||||
void verr __P((int, const char *, va_list));
|
||||
void errx __P((int, const char *, ...));
|
||||
void verrx __P((int, const char *, va_list));
|
||||
void warn __P((const char *, ...));
|
||||
void vwarn __P((const char *, va_list));
|
||||
void warnx __P((const char *, ...));
|
||||
void vwarnx __P((const char *, va_list));
|
||||
|
||||
#endif /* !_ERR_H_ */
|
@@ -1,190 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 1989, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to Berkeley by
|
||||
* Tony Nardo of the Johns Hopkins University/Applied Physics Lab.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* 8/2/97 - Ted Felix <tfelix@fred.net>
|
||||
* Ported to Win32 from 4.4BSD-LITE2 at wcarchive.
|
||||
* NT Workstation already has finger, and it runs fine under
|
||||
* Win95. Thought I'd do this anyways since not everyone has
|
||||
* access to NT.
|
||||
* Had to remove local handling. Otherwise, same as whois.
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char copyright[] =
|
||||
"@(#) Copyright (c) 1989, 1993\n\
|
||||
The Regents of the University of California. All rights reserved.\n";
|
||||
#endif /* not lint */
|
||||
|
||||
#ifndef lint
|
||||
static char sccsid[] = "@(#)finger.c 8.5 (Berkeley) 5/4/95";
|
||||
#endif /* not lint */
|
||||
|
||||
/*
|
||||
* Finger prints out information about users. It is not portable since
|
||||
* certain fields (e.g. the full user name, office, and phone numbers) are
|
||||
* extracted from the gecos field of the passwd file which other UNIXes
|
||||
* may not have or may use for other things.
|
||||
*
|
||||
* There are currently two output formats; the short format is one line
|
||||
* per user and displays login name, tty, login time, real name, idle time,
|
||||
* and office location/phone number. The long format gives the same
|
||||
* information (in a more legible format) as well as home directory, shell,
|
||||
* mail info, and .plan/.project files.
|
||||
*/
|
||||
|
||||
#include <winsock2.h>
|
||||
#include "err.h"
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
#include "unistd.h"
|
||||
|
||||
#include "various.h"
|
||||
#include "getopt.h"
|
||||
|
||||
char *__progname;
|
||||
|
||||
time_t now;
|
||||
int lflag, mflag, pplan, sflag;
|
||||
|
||||
static void userlist(int, char **);
|
||||
void usage();
|
||||
void netfinger(char *);
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
int ch;
|
||||
|
||||
while ((ch = getopt(argc, argv, "lmps")) != EOF)
|
||||
switch(ch) {
|
||||
case 'l':
|
||||
lflag = 1; /* long format */
|
||||
break;
|
||||
case 'm':
|
||||
mflag = 1; /* force exact match of names */
|
||||
break;
|
||||
case 'p':
|
||||
pplan = 1; /* don't show .plan/.project */
|
||||
break;
|
||||
case 's':
|
||||
sflag = 1; /* short format */
|
||||
break;
|
||||
case '?':
|
||||
default:
|
||||
(void)fprintf(stderr,
|
||||
"usage: finger [-lmps] login [...]\n");
|
||||
exit(1);
|
||||
}
|
||||
argc -= optind;
|
||||
argv += optind;
|
||||
|
||||
(void)time(&now);
|
||||
if (!*argv) {
|
||||
usage();
|
||||
} else {
|
||||
userlist(argc, argv);
|
||||
/*
|
||||
* Assign explicit "large" format if names given and -s not
|
||||
* explicitly stated. Force the -l AFTER we get names so any
|
||||
* remote finger attempts specified won't be mishandled.
|
||||
*/
|
||||
if (!sflag)
|
||||
lflag = 1; /* if -s not explicit, force -l */
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
userlist(int argc, char **argv)
|
||||
{
|
||||
int *used;
|
||||
char **ap, **nargv, **np, **p;
|
||||
WORD wVersionRequested;
|
||||
WSADATA wsaData;
|
||||
int iErr;
|
||||
|
||||
|
||||
if ((nargv = malloc((argc+1) * sizeof(char *))) == NULL ||
|
||||
(used = calloc(argc, sizeof(int))) == NULL)
|
||||
err(1, NULL);
|
||||
|
||||
/* Pull out all network requests into nargv. */
|
||||
for (ap = p = argv, np = nargv; *p; ++p)
|
||||
if (index(*p, '@'))
|
||||
*np++ = *p;
|
||||
else
|
||||
*ap++ = *p;
|
||||
|
||||
*np++ = NULL;
|
||||
*ap++ = NULL;
|
||||
|
||||
/* If there are local requests */
|
||||
if (*argv)
|
||||
{
|
||||
fprintf(stderr, "Warning: Can't do local finger\n");
|
||||
}
|
||||
|
||||
/* Start winsock */
|
||||
wVersionRequested = MAKEWORD( 1, 1 );
|
||||
iErr = WSAStartup( wVersionRequested, &wsaData );
|
||||
if ( iErr != 0 )
|
||||
{
|
||||
/* Tell the user that we couldn't find a usable */
|
||||
/* WinSock DLL. */
|
||||
fprintf(stderr, "WSAStartup failed\n");
|
||||
return;
|
||||
}
|
||||
|
||||
/* Handle network requests. */
|
||||
for (p = nargv; *p;)
|
||||
netfinger(*p++);
|
||||
|
||||
/* Bring down winsock */
|
||||
WSACleanup();
|
||||
exit(0);
|
||||
}
|
||||
|
||||
void usage()
|
||||
{
|
||||
(void)fprintf(stderr,
|
||||
"usage: finger [-lmps] login [...]\n");
|
||||
exit(1);
|
||||
}
|
||||
|
@@ -1,6 +0,0 @@
|
||||
/* $Id$ */
|
||||
|
||||
#define REACTOS_STR_FILE_DESCRIPTION "ReactOS TCP/IPv4 Win32 finger\0"
|
||||
#define REACTOS_STR_INTERNAL_NAME "finger\0"
|
||||
#define REACTOS_STR_ORIGINAL_FILENAME "finger.exe\0"
|
||||
#include <reactos/version.rc>
|
@@ -1,120 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 1987 Regents of the University of California.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* Fri Jun 13 10:39:00 1997, tfelix@fred.net:
|
||||
* Ported to Win32, changed index/rindex to strchr/strrchr
|
||||
*/
|
||||
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
static char sccsid[] = "@(#)getopt.c 4.13 (Berkeley) 2/23/91";
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
/*
|
||||
* get option letter from argument vector
|
||||
*/
|
||||
int opterr = 1, /* if error message should be printed */
|
||||
optind = 1, /* index into parent argv vector */
|
||||
optopt; /* character checked for validity */
|
||||
char *optarg; /* argument associated with option */
|
||||
|
||||
#define BADCH (int)'?'
|
||||
#define EMSG ""
|
||||
|
||||
int
|
||||
getopt(int nargc, char * const *nargv, const char *ostr)
|
||||
{
|
||||
static char *place = EMSG; /* option letter processing */
|
||||
register char *oli; /* option letter list index */
|
||||
char *p;
|
||||
|
||||
if (!*place) { /* update scanning pointer */
|
||||
if (optind >= nargc || *(place = nargv[optind]) != '-') {
|
||||
place = EMSG;
|
||||
return(EOF);
|
||||
}
|
||||
if (place[1] && *++place == '-') { /* found "--" */
|
||||
++optind;
|
||||
place = EMSG;
|
||||
return(EOF);
|
||||
}
|
||||
} /* option letter okay? */
|
||||
if ((optopt = (int)*place++) == (int)':' ||
|
||||
!(oli = strchr(ostr, optopt))) {
|
||||
/*
|
||||
* if the user didn't specify '-' as an option,
|
||||
* assume it means EOF.
|
||||
*/
|
||||
if (optopt == (int)'-')
|
||||
return(EOF);
|
||||
if (!*place)
|
||||
++optind;
|
||||
if (opterr) {
|
||||
if (!(p = strrchr(*nargv, '/')))
|
||||
p = *nargv;
|
||||
else
|
||||
++p;
|
||||
(void)fprintf(stderr, "%s: illegal option -- %c\n",
|
||||
p, optopt);
|
||||
}
|
||||
return(BADCH);
|
||||
}
|
||||
if (*++oli != ':') { /* don't need argument */
|
||||
optarg = NULL;
|
||||
if (!*place)
|
||||
++optind;
|
||||
}
|
||||
else { /* need an argument */
|
||||
if (*place) /* no white space */
|
||||
optarg = place;
|
||||
else if (nargc <= ++optind) { /* no arg */
|
||||
place = EMSG;
|
||||
if (!(p = strrchr(*nargv, '/')))
|
||||
p = *nargv;
|
||||
else
|
||||
++p;
|
||||
if (opterr)
|
||||
(void)fprintf(stderr,
|
||||
"%s: option requires an argument -- %c\n",
|
||||
p, optopt);
|
||||
return(BADCH);
|
||||
}
|
||||
else /* white space */
|
||||
optarg = nargv[optind];
|
||||
place = EMSG;
|
||||
++optind;
|
||||
}
|
||||
return(optopt); /* dump back option letter */
|
||||
}
|
@@ -1,7 +0,0 @@
|
||||
/* getopt.h */
|
||||
|
||||
extern char *optarg;
|
||||
extern int optind;
|
||||
|
||||
int
|
||||
getopt(int nargc, char * const *nargv, const char *ostr);
|
@@ -1,24 +0,0 @@
|
||||
PATH_TO_TOP = ../../../..
|
||||
|
||||
TARGET_TYPE = program
|
||||
|
||||
TARGET_APPTYPE = console
|
||||
|
||||
TARGET_NAME = finger
|
||||
|
||||
TARGET_SDKLIBS = ws2_32.a
|
||||
|
||||
TARGET_INSTALLDIR = system32
|
||||
|
||||
TARGET_CFLAGS = -D__USE_W32_SOCKETS
|
||||
|
||||
TARGET_OBJECTS = $(TARGET_NAME).o \
|
||||
err.o \
|
||||
getopt.o \
|
||||
net.o
|
||||
|
||||
TARGET_GCCLIBS = iberty
|
||||
|
||||
include $(PATH_TO_TOP)/rules.mak
|
||||
|
||||
include $(TOOLS_PATH)/helper.mk
|
@@ -1,142 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 1989, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to Berkeley by
|
||||
* Tony Nardo of the Johns Hopkins University/Applied Physics Lab.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char sccsid[] = "@(#)net.c 8.4 (Berkeley) 4/28/95";
|
||||
#endif /* not lint */
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <winsock2.h>
|
||||
#include "unistd.h"
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "various.h"
|
||||
|
||||
void
|
||||
netfinger(char *name)
|
||||
{
|
||||
extern int lflag;
|
||||
char c, lastc;
|
||||
struct in_addr defaddr;
|
||||
struct hostent *hp, def;
|
||||
struct servent *sp;
|
||||
struct sockaddr_in sin;
|
||||
SOCKET s;
|
||||
char *alist[1], *host;
|
||||
|
||||
/* If this is a local request */
|
||||
if (!(host = rindex(name, '@')))
|
||||
return;
|
||||
|
||||
*host++ = '\0';
|
||||
if (isdigit(*host) && (defaddr.s_addr = inet_addr(host)) != -1) {
|
||||
def.h_name = host;
|
||||
def.h_addr_list = alist;
|
||||
def.h_addr = (char *)&defaddr;
|
||||
def.h_length = sizeof(struct in_addr);
|
||||
def.h_addrtype = AF_INET;
|
||||
def.h_aliases = 0;
|
||||
hp = &def;
|
||||
} else if (!(hp = gethostbyname(host))) {
|
||||
(void)fprintf(stderr,
|
||||
"finger: unknown host: %s\n", host);
|
||||
return;
|
||||
}
|
||||
if (!(sp = getservbyname("finger", "tcp"))) {
|
||||
(void)fprintf(stderr, "finger: tcp/finger: unknown service\n");
|
||||
return;
|
||||
}
|
||||
sin.sin_family = hp->h_addrtype;
|
||||
bcopy(hp->h_addr, (char *)&sin.sin_addr, hp->h_length);
|
||||
sin.sin_port = sp->s_port;
|
||||
if ((s = socket(hp->h_addrtype, SOCK_STREAM, 0)) == INVALID_SOCKET) {
|
||||
perror("finger: socket");
|
||||
return;
|
||||
}
|
||||
|
||||
/* have network connection; identify the host connected with */
|
||||
(void)printf("[%s]\n", hp->h_name);
|
||||
if (connect(s, (struct sockaddr *)&sin, sizeof(sin)) < 0) {
|
||||
fprintf(stderr, "finger: connect rc = %d", WSAGetLastError());
|
||||
(void)close(s);
|
||||
return;
|
||||
}
|
||||
|
||||
/* -l flag for remote fingerd */
|
||||
if (lflag)
|
||||
send(s, "/W ", 3, 0);
|
||||
/* send the name followed by <CR><LF> */
|
||||
send(s, name, strlen(name), 0);
|
||||
send(s, "\r\n", 2, 0);
|
||||
|
||||
/*
|
||||
* Read from the remote system; once we're connected, we assume some
|
||||
* data. If none arrives, we hang until the user interrupts.
|
||||
*
|
||||
* If we see a <CR> or a <CR> with the high bit set, treat it as
|
||||
* a newline; if followed by a newline character, only output one
|
||||
* newline.
|
||||
*
|
||||
* Otherwise, all high bits are stripped; if it isn't printable and
|
||||
* it isn't a space, we can simply set the 7th bit. Every ASCII
|
||||
* character with bit 7 set is printable.
|
||||
*/
|
||||
lastc = 0;
|
||||
while (recv(s, &c, 1, 0) == 1) {
|
||||
c &= 0x7f;
|
||||
if (c == 0x0d) {
|
||||
if (lastc == '\r') /* ^M^M - skip dupes */
|
||||
continue;
|
||||
c = '\n';
|
||||
lastc = '\r';
|
||||
} else {
|
||||
if (!isprint(c) && !isspace(c))
|
||||
c |= 0x40;
|
||||
if (lastc != '\r' || c != '\n')
|
||||
lastc = c;
|
||||
else {
|
||||
lastc = '\n';
|
||||
continue;
|
||||
}
|
||||
}
|
||||
putchar(c);
|
||||
}
|
||||
if (lastc != '\n')
|
||||
putchar('\n');
|
||||
putchar('\n');
|
||||
}
|
@@ -1,34 +0,0 @@
|
||||
// Various things you need when porting BSD and GNU utilities to
|
||||
// Win32.
|
||||
|
||||
#ifndef VARIOUS_H
|
||||
#define VARIOUS_H
|
||||
|
||||
|
||||
typedef float f4byte_t;
|
||||
typedef double f8byte_t;
|
||||
typedef long uid_t; // SunOS 5.5
|
||||
|
||||
#define __P(x) x
|
||||
|
||||
/* utmp.h */
|
||||
#define UT_LINESIZE 8
|
||||
#define UT_HOSTSIZE 16
|
||||
|
||||
/* stat.h */
|
||||
#define S_ISREG(mode) (((mode)&0xF000) == 0x8000)
|
||||
#define S_ISDIR(mode) (((mode)&0xF000) == 0x4000)
|
||||
|
||||
#undef MIN //take care of windows default
|
||||
#undef MAX //take care of windows default
|
||||
#define MIN(a, b) ((a) <= (b) ? (a) : (b))
|
||||
#define MAX(a, b) ((a) > (b) ? (a) : (b))
|
||||
|
||||
#define bcopy(s1, s2, n) memmove(s2, s1, n)
|
||||
#define bcmp(s1, s2, n) (memcmp(s1, s2, n) != 0)
|
||||
#define bzero(s, n) memset(s, 0, n)
|
||||
|
||||
#define index(s, c) strchr(s, c)
|
||||
#define rindex(s, c) strrchr(s, c)
|
||||
|
||||
#endif
|
File diff suppressed because it is too large
Load Diff
@@ -1,185 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 1985, 1989 Regents of the University of California.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms are permitted
|
||||
* provided that the above copyright notice and this paragraph are
|
||||
* duplicated in all such forms and that any documentation,
|
||||
* advertising materials, and other materials related to such
|
||||
* distribution and use acknowledge that the software was developed
|
||||
* by the University of California, Berkeley. The name of the
|
||||
* University may not be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char sccsid[] = "@(#)cmdtab.c 5.9 (Berkeley) 3/21/89";
|
||||
#endif /* not lint */
|
||||
|
||||
#include "ftp_var.h"
|
||||
|
||||
/*
|
||||
* User FTP -- Command Tables.
|
||||
*/
|
||||
int setascii(), setbell(), setbinary(), setdebug(), setform();
|
||||
int setglob(), sethash(), setmode(), setpeer(), setpassive(), setport();
|
||||
int setprompt(), setstruct();
|
||||
int settenex(), settrace(), settype(), setverbose();
|
||||
int disconnect(), restart(), reget(), syst();
|
||||
int cd(), lcd(), delete(), mdelete(), user();
|
||||
int ls(), mls(), get(), mget(), help(), append(), put(), mput();
|
||||
int quit(), renamefile(), status();
|
||||
int quote(), rmthelp(), shell(), site();
|
||||
int pwd(), makedir(), removedir(), setcr();
|
||||
int account(), doproxy(), reset(), setcase(), setntrans(), setnmap();
|
||||
int setsunique(), setrunique(), cdup(), macdef(), domacro();
|
||||
int sizecmd(), modtime(), newer(), rmtstatus();
|
||||
int do_chmod(), do_umask(), idle();
|
||||
|
||||
char accounthelp[] = "send account command to remote server";
|
||||
char appendhelp[] = "append to a file";
|
||||
char asciihelp[] = "set ascii transfer type";
|
||||
char beephelp[] = "beep when command completed";
|
||||
char binaryhelp[] = "set binary transfer type";
|
||||
char casehelp[] = "toggle mget upper/lower case id mapping";
|
||||
char cdhelp[] = "change remote working directory";
|
||||
char cduphelp[] = "change remote working directory to parent directory";
|
||||
char chmodhelp[] = "change file permissions of remote file";
|
||||
char connecthelp[] = "connect to remote tftp";
|
||||
char crhelp[] = "toggle carriage return stripping on ascii gets";
|
||||
char deletehelp[] = "delete remote file";
|
||||
char debughelp[] = "toggle/set debugging mode";
|
||||
char dirhelp[] = "list contents of remote directory";
|
||||
char disconhelp[] = "terminate ftp session";
|
||||
char domachelp[] = "execute macro";
|
||||
char formhelp[] = "set file transfer format";
|
||||
char globhelp[] = "toggle metacharacter expansion of local file names";
|
||||
char hashhelp[] = "toggle printing `#' for each buffer transferred";
|
||||
char helphelp[] = "print local help information";
|
||||
char idlehelp[] = "get (set) idle timer on remote side";
|
||||
char lcdhelp[] = "change local working directory";
|
||||
char lshelp[] = "list contents of remote directory";
|
||||
char macdefhelp[] = "define a macro";
|
||||
char mdeletehelp[] = "delete multiple files";
|
||||
char mdirhelp[] = "list contents of multiple remote directories";
|
||||
char mgethelp[] = "get multiple files";
|
||||
char mkdirhelp[] = "make directory on the remote machine";
|
||||
char mlshelp[] = "list contents of multiple remote directories";
|
||||
char modtimehelp[] = "show last modification time of remote file";
|
||||
char modehelp[] = "set file transfer mode";
|
||||
char mputhelp[] = "send multiple files";
|
||||
char newerhelp[] = "get file if remote file is newer than local file ";
|
||||
char nlisthelp[] = "nlist contents of remote directory";
|
||||
char nmaphelp[] = "set templates for default file name mapping";
|
||||
char ntranshelp[] = "set translation table for default file name mapping";
|
||||
char porthelp[] = "toggle use of PORT cmd for each data connection";
|
||||
char prompthelp[] = "force interactive prompting on multiple commands";
|
||||
char proxyhelp[] = "issue command on alternate connection";
|
||||
char pwdhelp[] = "print working directory on remote machine";
|
||||
char quithelp[] = "terminate ftp session and exit";
|
||||
char quotehelp[] = "send arbitrary ftp command";
|
||||
char receivehelp[] = "receive file";
|
||||
char regethelp[] = "get file restarting at end of local file";
|
||||
char remotehelp[] = "get help from remote server";
|
||||
char renamehelp[] = "rename file";
|
||||
char restarthelp[]= "restart file transfer at bytecount";
|
||||
char rmdirhelp[] = "remove directory on the remote machine";
|
||||
char rmtstatushelp[]="show status of remote machine";
|
||||
char runiquehelp[] = "toggle store unique for local files";
|
||||
char resethelp[] = "clear queued command replies";
|
||||
char sendhelp[] = "send one file";
|
||||
char passivehelp[] = "enter passive transfer mode";
|
||||
char sitehelp[] = "send site specific command to remote server\n\t\tTry \"rhelp site\" or \"site help\" for more information";
|
||||
char shellhelp[] = "escape to the shell";
|
||||
char sizecmdhelp[] = "show size of remote file";
|
||||
char statushelp[] = "show current status";
|
||||
char structhelp[] = "set file transfer structure";
|
||||
char suniquehelp[] = "toggle store unique on remote machine";
|
||||
char systemhelp[] = "show remote system type";
|
||||
char tenexhelp[] = "set tenex file transfer type";
|
||||
char tracehelp[] = "toggle packet tracing";
|
||||
char typehelp[] = "set file transfer type";
|
||||
char umaskhelp[] = "get (set) umask on remote side";
|
||||
char userhelp[] = "send new user information";
|
||||
char verbosehelp[] = "toggle verbose mode";
|
||||
|
||||
struct cmd cmdtab[] = {
|
||||
{ "!", shellhelp, 0, 0, 0, shell },
|
||||
{ "$", domachelp, 1, 0, 0, domacro },
|
||||
{ "account", accounthelp, 0, 1, 1, account},
|
||||
{ "append", appendhelp, 1, 1, 1, put },
|
||||
{ "ascii", asciihelp, 0, 1, 1, setascii },
|
||||
{ "bell", beephelp, 0, 0, 0, setbell },
|
||||
{ "binary", binaryhelp, 0, 1, 1, setbinary },
|
||||
{ "bye", quithelp, 0, 0, 0, quit },
|
||||
{ "case", casehelp, 0, 0, 1, setcase },
|
||||
{ "cd", cdhelp, 0, 1, 1, cd },
|
||||
{ "cdup", cduphelp, 0, 1, 1, cdup },
|
||||
{ "chmod", chmodhelp, 0, 1, 1, do_chmod },
|
||||
{ "close", disconhelp, 0, 1, 1, disconnect },
|
||||
{ "cr", crhelp, 0, 0, 0, setcr },
|
||||
{ "delete", deletehelp, 0, 1, 1, delete },
|
||||
{ "debug", debughelp, 0, 0, 0, setdebug },
|
||||
{ "dir", dirhelp, 1, 1, 1, ls },
|
||||
{ "disconnect", disconhelp, 0, 1, 1, disconnect },
|
||||
{ "form", formhelp, 0, 1, 1, setform },
|
||||
{ "get", receivehelp, 1, 1, 1, get },
|
||||
{ "glob", globhelp, 0, 0, 0, setglob },
|
||||
{ "hash", hashhelp, 0, 0, 0, sethash },
|
||||
{ "help", helphelp, 0, 0, 1, help },
|
||||
{ "idle", idlehelp, 0, 1, 1, idle },
|
||||
{ "image", binaryhelp, 0, 1, 1, setbinary },
|
||||
{ "lcd", lcdhelp, 0, 0, 0, lcd },
|
||||
{ "ls", lshelp, 1, 1, 1, ls },
|
||||
{ "macdef", macdefhelp, 0, 0, 0, macdef },
|
||||
{ "mdelete", mdeletehelp, 1, 1, 1, mdelete },
|
||||
{ "mdir", mdirhelp, 1, 1, 1, mls },
|
||||
{ "mget", mgethelp, 1, 1, 1, mget },
|
||||
{ "mkdir", mkdirhelp, 0, 1, 1, makedir },
|
||||
{ "mls", mlshelp, 1, 1, 1, mls },
|
||||
{ "mode", modehelp, 0, 1, 1, setmode },
|
||||
{ "modtime", modtimehelp, 0, 1, 1, modtime },
|
||||
{ "mput", mputhelp, 1, 1, 1, mput },
|
||||
{ "newer", newerhelp, 1, 1, 1, newer },
|
||||
{ "nmap", nmaphelp, 0, 0, 1, setnmap },
|
||||
{ "nlist", nlisthelp, 1, 1, 1, ls },
|
||||
{ "ntrans", ntranshelp, 0, 0, 1, setntrans },
|
||||
{ "open", connecthelp, 0, 0, 1, setpeer },
|
||||
{ "passive",passivehelp,0, 0, 0, setpassive },
|
||||
{ "prompt", prompthelp, 0, 0, 0, setprompt },
|
||||
{ "proxy", proxyhelp, 0, 0, 1, doproxy },
|
||||
{ "sendport", porthelp, 0, 0, 0, setport },
|
||||
{ "put", sendhelp, 1, 1, 1, put },
|
||||
{ "pwd", pwdhelp, 0, 1, 1, pwd },
|
||||
{ "quit", quithelp, 0, 0, 0, quit },
|
||||
{ "quote", quotehelp, 1, 1, 1, quote },
|
||||
{ "recv", receivehelp, 1, 1, 1, get },
|
||||
{ "reget", regethelp, 1, 1, 1, reget },
|
||||
{ "rstatus", rmtstatushelp, 0, 1, 1, rmtstatus },
|
||||
{ "rhelp", remotehelp, 0, 1, 1, rmthelp },
|
||||
{ "rename", renamehelp, 0, 1, 1, renamefile },
|
||||
{ "reset", resethelp, 0, 1, 1, reset },
|
||||
{ "restart", restarthelp, 1, 1, 1, restart },
|
||||
{ "rmdir", rmdirhelp, 0, 1, 1, removedir },
|
||||
{ "runique", runiquehelp, 0, 0, 1, setrunique },
|
||||
{ "send", sendhelp, 1, 1, 1, put },
|
||||
{ "site", sitehelp, 0, 1, 1, site },
|
||||
{ "size", sizecmdhelp, 1, 1, 1, sizecmd },
|
||||
{ "status", statushelp, 0, 0, 1, status },
|
||||
{ "struct", structhelp, 0, 1, 1, setstruct },
|
||||
{ "system", systemhelp, 0, 1, 1, syst },
|
||||
{ "sunique", suniquehelp, 0, 0, 1, setsunique },
|
||||
{ "tenex", tenexhelp, 0, 1, 1, settenex },
|
||||
{ "trace", tracehelp, 0, 0, 0, settrace },
|
||||
{ "type", typehelp, 0, 1, 1, settype },
|
||||
{ "user", userhelp, 0, 1, 1, user },
|
||||
{ "umask", umaskhelp, 0, 1, 1, do_umask },
|
||||
{ "verbose", verbosehelp, 0, 0, 0, setverbose },
|
||||
{ "?", helphelp, 0, 0, 1, help },
|
||||
{ 0 },
|
||||
};
|
||||
|
||||
int NCMDS = (sizeof (cmdtab) / sizeof (cmdtab[0])) - 1;
|
@@ -1,149 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 1985 Regents of the University of California.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms are permitted
|
||||
* provided that the above copyright notice and this paragraph are
|
||||
* duplicated in all such forms and that any documentation,
|
||||
* advertising materials, and other materials related to such
|
||||
* distribution and use acknowledge that the software was developed
|
||||
* by the University of California, Berkeley. The name of the
|
||||
* University may not be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char sccsid[] = "@(#)domacro.c 1.6 (Berkeley) 2/28/89";
|
||||
#endif /* not lint */
|
||||
|
||||
#include "ftp_var.h"
|
||||
#include "prototypes.h"
|
||||
|
||||
#include <signal.h>
|
||||
#include <stdio.h>
|
||||
//#include <errno.h>
|
||||
#include <ctype.h>
|
||||
//#include <sys/ttychars.h>
|
||||
|
||||
void domacro(argc, argv)
|
||||
int argc;
|
||||
char *argv[];
|
||||
{
|
||||
register int i, j;
|
||||
register char *cp1, *cp2;
|
||||
int count = 2, loopflg = 0;
|
||||
char line2[200];
|
||||
extern char **glob(), *globerr;
|
||||
struct cmd *getcmd(), *c;
|
||||
extern struct cmd cmdtab[];
|
||||
|
||||
if (argc < 2) {
|
||||
(void) strcat(line, " ");
|
||||
printf("(macro name) ");
|
||||
(void) fflush(stdout);
|
||||
(void) gets(&line[strlen(line)]);
|
||||
makeargv();
|
||||
argc = margc;
|
||||
argv = margv;
|
||||
}
|
||||
if (argc < 2) {
|
||||
printf("Usage: %s macro_name.\n", argv[0]);
|
||||
(void) fflush(stdout);
|
||||
code = -1;
|
||||
return;
|
||||
}
|
||||
for (i = 0; i < macnum; ++i) {
|
||||
if (!strncmp(argv[1], macros[i].mac_name, 9)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (i == macnum) {
|
||||
printf("'%s' macro not found.\n", argv[1]);
|
||||
(void) fflush(stdout);
|
||||
code = -1;
|
||||
return;
|
||||
}
|
||||
(void) strcpy(line2, line);
|
||||
TOP:
|
||||
cp1 = macros[i].mac_start;
|
||||
while (cp1 != macros[i].mac_end) {
|
||||
while (isspace(*cp1)) {
|
||||
cp1++;
|
||||
}
|
||||
cp2 = line;
|
||||
while (*cp1 != '\0') {
|
||||
switch(*cp1) {
|
||||
case '\\':
|
||||
*cp2++ = *++cp1;
|
||||
break;
|
||||
case '$':
|
||||
if (isdigit(*(cp1+1))) {
|
||||
j = 0;
|
||||
while (isdigit(*++cp1)) {
|
||||
j = 10*j + *cp1 - '0';
|
||||
}
|
||||
cp1--;
|
||||
if (argc - 2 >= j) {
|
||||
(void) strcpy(cp2, argv[j+1]);
|
||||
cp2 += strlen(argv[j+1]);
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (*(cp1+1) == 'i') {
|
||||
loopflg = 1;
|
||||
cp1++;
|
||||
if (count < argc) {
|
||||
(void) strcpy(cp2, argv[count]);
|
||||
cp2 += strlen(argv[count]);
|
||||
}
|
||||
break;
|
||||
}
|
||||
/* intentional drop through */
|
||||
default:
|
||||
*cp2++ = *cp1;
|
||||
break;
|
||||
}
|
||||
if (*cp1 != '\0') {
|
||||
cp1++;
|
||||
}
|
||||
}
|
||||
*cp2 = '\0';
|
||||
makeargv();
|
||||
c = getcmd(margv[0]);
|
||||
if (c == (struct cmd *)-1) {
|
||||
printf("?Ambiguous command\n");
|
||||
code = -1;
|
||||
}
|
||||
else if (c == 0) {
|
||||
printf("?Invalid command\n");
|
||||
code = -1;
|
||||
}
|
||||
else if (c->c_conn && !connected) {
|
||||
printf("Not connected.\n");
|
||||
code = -1;
|
||||
}
|
||||
else {
|
||||
if (verbose) {
|
||||
printf("%s\n",line);
|
||||
}
|
||||
(*c->c_handler)(margc, margv);
|
||||
if (bell && c->c_bell) {
|
||||
(void) putchar('\007');
|
||||
}
|
||||
(void) strcpy(line, line2);
|
||||
makeargv();
|
||||
argc = margc;
|
||||
argv = margv;
|
||||
}
|
||||
if (cp1 != macros[i].mac_end) {
|
||||
cp1++;
|
||||
}
|
||||
(void) fflush(stdout);
|
||||
}
|
||||
if (loopflg && ++count < argc) {
|
||||
goto TOP;
|
||||
}
|
||||
}
|
@@ -1,344 +0,0 @@
|
||||
#include <stdio.h>
|
||||
#include <time.h>
|
||||
#include <winsock.h>
|
||||
#include "prototypes.h"
|
||||
|
||||
#define MAX_ASCII 100
|
||||
|
||||
int checkRecv(SOCKET s);
|
||||
|
||||
int checkRecv(SOCKET s)
|
||||
{
|
||||
int testVal;
|
||||
fd_set sSet;
|
||||
struct timeval timeout;
|
||||
timeout.tv_sec = 60;
|
||||
|
||||
FD_ZERO(&sSet);
|
||||
|
||||
FD_SET(s, &sSet);
|
||||
|
||||
testVal = select(0, &sSet, NULL, NULL, &timeout);
|
||||
|
||||
if (testVal == SOCKET_ERROR)
|
||||
fprintf(stderr, "Socket Error");
|
||||
|
||||
return testVal;
|
||||
}
|
||||
|
||||
void blkfree(char **av0)
|
||||
{
|
||||
register char **av = av0;
|
||||
|
||||
while (*av)
|
||||
free(*av++);
|
||||
}
|
||||
|
||||
char *glob(register char *v)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
int sleep(int time)
|
||||
{
|
||||
return time;
|
||||
}
|
||||
|
||||
int herror(char *string)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
#if 0
|
||||
|
||||
int gettimeofday(struct timeval *timenow,
|
||||
struct timezone *zone)
|
||||
{
|
||||
time_t t;
|
||||
|
||||
t = clock();
|
||||
|
||||
timenow->tv_usec = t;
|
||||
timenow->tv_sec = t / CLK_TCK;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int fgetcSocket(int s)
|
||||
{
|
||||
int c;
|
||||
char buffer[10];
|
||||
|
||||
// checkRecv(s);
|
||||
|
||||
c = recv(s, buffer, 1, 0);
|
||||
|
||||
#ifdef DEBUG_IN
|
||||
printf("%c", buffer[0]);
|
||||
#endif
|
||||
|
||||
if (c == INVALID_SOCKET)
|
||||
return c;
|
||||
|
||||
if (c == 0)
|
||||
return EOF;
|
||||
|
||||
return buffer[0];
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
int fgetcSocket(int s)
|
||||
{
|
||||
static int index = 0;
|
||||
static int total = 0;
|
||||
static unsigned char buffer[4096];
|
||||
|
||||
if (index == total)
|
||||
{
|
||||
index = 0;
|
||||
total = recv(s, buffer, sizeof(buffer), 0);
|
||||
|
||||
if (total == INVALID_SOCKET)
|
||||
{
|
||||
total = 0;
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
if (total == 0)
|
||||
return EOF;
|
||||
}
|
||||
return buffer[index++];
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
char *fprintfSocket(int s, char *format, ...)
|
||||
{
|
||||
va_list argptr;
|
||||
char buffer[10009];
|
||||
|
||||
va_start(argptr, format);
|
||||
vsprintf(buffer, format, argptr);
|
||||
va_end(argptr);
|
||||
|
||||
send(s, buffer, strlen(buffer), 0);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
char *fputsSocket(char *format, int s)
|
||||
{
|
||||
send(s, format, strlen(format), 0);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int fputcSocket(int s, char putChar)
|
||||
{
|
||||
char buffer[2];
|
||||
|
||||
buffer[0] = putChar;
|
||||
buffer[1] = '\0';
|
||||
|
||||
if(SOCKET_ERROR==send(s, buffer, 1, 0)) {
|
||||
int iret=WSAGetLastError ();
|
||||
fprintf(stdout,"fputcSocket: %d\n",iret);
|
||||
return 0;
|
||||
}
|
||||
else {
|
||||
return putChar;
|
||||
}
|
||||
}
|
||||
int fputSocket(int s, char *buffer, int len)
|
||||
{
|
||||
int iret;
|
||||
while(len) {
|
||||
if(SOCKET_ERROR==(iret=send(s, buffer, len, 0)))
|
||||
{
|
||||
iret=WSAGetLastError ();
|
||||
fprintf(stdout,"fputcSocket: %d\n",iret);
|
||||
return 0;
|
||||
}
|
||||
else {
|
||||
return len-=iret;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
char *fgetsSocket(int s, char *string)
|
||||
{
|
||||
char buffer[2] = {0};
|
||||
int i, count;
|
||||
|
||||
for (i = 0, count = 1; count != 0 && buffer[0] != '\n'; i++)
|
||||
{
|
||||
checkRecv(s);
|
||||
|
||||
count = recv(s, buffer, 1, 0);
|
||||
|
||||
if (count == SOCKET_ERROR)
|
||||
{
|
||||
printf("Error in fgetssocket");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (count == 1)
|
||||
{
|
||||
string[i] = buffer[0];
|
||||
|
||||
if (i == MAX_ASCII - 3)
|
||||
{
|
||||
count = 0;
|
||||
string[++i] = '\n';
|
||||
string[++i] = '\0';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (i == 0)
|
||||
return NULL;
|
||||
else
|
||||
{
|
||||
string[i] = '\n';
|
||||
string[i + 1] = '\0'; // This is risky
|
||||
return string;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
string[i] = '\0';
|
||||
|
||||
#ifdef DEBUG_IN
|
||||
printf("%s", string);
|
||||
#endif
|
||||
return string;
|
||||
}
|
||||
|
||||
|
||||
#if 0
|
||||
char *getpass(const char *prompt)
|
||||
{
|
||||
static char string[64];
|
||||
|
||||
printf("%s", prompt);
|
||||
|
||||
gets(string);
|
||||
|
||||
return string;
|
||||
}
|
||||
#endif
|
||||
char *getpass (const char * prompt)
|
||||
{
|
||||
static char input[256];
|
||||
HANDLE in;
|
||||
HANDLE err;
|
||||
DWORD count;
|
||||
|
||||
in = GetStdHandle (STD_INPUT_HANDLE);
|
||||
err = GetStdHandle (STD_ERROR_HANDLE);
|
||||
|
||||
if (in == INVALID_HANDLE_VALUE || err == INVALID_HANDLE_VALUE)
|
||||
return NULL;
|
||||
|
||||
if (WriteFile (err, prompt, strlen (prompt), &count, NULL))
|
||||
{
|
||||
int istty = (GetFileType (in) == FILE_TYPE_CHAR);
|
||||
DWORD old_flags;
|
||||
int rc;
|
||||
|
||||
if (istty)
|
||||
{
|
||||
if (GetConsoleMode (in, &old_flags))
|
||||
SetConsoleMode (in, ENABLE_LINE_INPUT | ENABLE_PROCESSED_INPUT);
|
||||
else
|
||||
istty = 0;
|
||||
}
|
||||
/* Need to read line one byte at time to avoid blocking, if not a
|
||||
tty, so always do it this way. */
|
||||
count = 0;
|
||||
while (1)
|
||||
{
|
||||
DWORD dummy;
|
||||
char one_char;
|
||||
|
||||
rc = ReadFile (in, &one_char, 1, &dummy, NULL);
|
||||
if (rc == 0)
|
||||
break;
|
||||
if (one_char == '\r')
|
||||
{
|
||||
/* CR is always followed by LF if reading from tty. */
|
||||
if (istty)
|
||||
continue;
|
||||
else
|
||||
break;
|
||||
}
|
||||
if (one_char == '\n')
|
||||
break;
|
||||
/* Silently truncate password string if overly long. */
|
||||
if (count < sizeof (input) - 1)
|
||||
input[count++] = one_char;
|
||||
}
|
||||
input[count] = '\0';
|
||||
|
||||
WriteFile (err, "\r\n", 2, &count, NULL);
|
||||
if (istty)
|
||||
SetConsoleMode (in, old_flags);
|
||||
if (rc)
|
||||
return input;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// Stubbed out here. Should be changed in Source code...
|
||||
int access(const char *filename, int accessmethod)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifndef __GNUC__
|
||||
#define EPOCHFILETIME (116444736000000000i64)
|
||||
#else
|
||||
#define EPOCHFILETIME (116444736000000000LL)
|
||||
#endif
|
||||
|
||||
struct timezone {
|
||||
int tz_minuteswest; /* minutes W of Greenwich */
|
||||
int tz_dsttime; /* type of dst correction */
|
||||
};
|
||||
|
||||
__inline int gettimeofday(struct timeval *tv, struct timezone *tz)
|
||||
{
|
||||
FILETIME ft;
|
||||
LARGE_INTEGER li;
|
||||
__int64 t;
|
||||
static int tzflag;
|
||||
|
||||
if (tv)
|
||||
{
|
||||
GetSystemTimeAsFileTime(&ft);
|
||||
//li.LowPart = ft.dwLowDateTime;
|
||||
//li.HighPart = ft.dwHighDateTime;
|
||||
t = li.QuadPart; /* In 100-nanosecond intervals */
|
||||
t -= EPOCHFILETIME; /* Offset to the Epoch time */
|
||||
t /= 10; /* In microseconds */
|
||||
tv->tv_sec = (long)(t / 1000000);
|
||||
tv->tv_usec = (long)(t % 1000000);
|
||||
}
|
||||
|
||||
if (tz)
|
||||
{
|
||||
if (!tzflag)
|
||||
{
|
||||
_tzset();
|
||||
tzflag++;
|
||||
}
|
||||
tz->tz_minuteswest = _timezone / 60;
|
||||
tz->tz_dsttime = _daylight;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
@@ -1,10 +0,0 @@
|
||||
#define bcopy(s,d,l) memcpy((d),(s),(l))
|
||||
#define bzero(cp,l) memset((cp),0,(l))
|
||||
|
||||
#define rindex strrchr
|
||||
#define index strchr
|
||||
|
||||
#define getwd getcwd
|
||||
|
||||
#define strcasecmp strcmp
|
||||
#define strncasecmp strnicmp
|
File diff suppressed because it is too large
Load Diff
@@ -1,372 +0,0 @@
|
||||
# Microsoft Developer Studio Generated NMAKE File, Based on ftp.dsp
|
||||
!IF "$(CFG)" == ""
|
||||
CFG=ftp - Win32 Debug
|
||||
!MESSAGE No configuration specified. Defaulting to ftp - Win32 Debug.
|
||||
!ENDIF
|
||||
|
||||
!IF "$(CFG)" != "ftp - Win32 Release" && "$(CFG)" != "ftp - Win32 Debug"
|
||||
!MESSAGE Invalid configuration "$(CFG)" specified.
|
||||
!MESSAGE You can specify a configuration when running NMAKE
|
||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "ftp.mak" CFG="ftp - Win32 Debug"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "ftp - Win32 Release" (based on "Win32 (x86) Console Application")
|
||||
!MESSAGE "ftp - Win32 Debug" (based on "Win32 (x86) Console Application")
|
||||
!MESSAGE
|
||||
!ERROR An invalid configuration is specified.
|
||||
!ENDIF
|
||||
|
||||
!IF "$(OS)" == "Windows_NT"
|
||||
NULL=
|
||||
!ELSE
|
||||
NULL=nul
|
||||
!ENDIF
|
||||
|
||||
!IF "$(CFG)" == "ftp - Win32 Release"
|
||||
|
||||
OUTDIR=.\Release
|
||||
INTDIR=.\Release
|
||||
# Begin Custom Macros
|
||||
OutDir=.\Release
|
||||
# End Custom Macros
|
||||
|
||||
!IF "$(RECURSE)" == "0"
|
||||
|
||||
ALL : "$(OUTDIR)\ftp.exe"
|
||||
|
||||
!ELSE
|
||||
|
||||
ALL : "$(OUTDIR)\ftp.exe"
|
||||
|
||||
!ENDIF
|
||||
|
||||
CLEAN :
|
||||
-@erase "$(INTDIR)\cmds.obj"
|
||||
-@erase "$(INTDIR)\cmdtab.obj"
|
||||
-@erase "$(INTDIR)\domacro.obj"
|
||||
-@erase "$(INTDIR)\fake.obj"
|
||||
-@erase "$(INTDIR)\ftp.obj"
|
||||
-@erase "$(INTDIR)\main.obj"
|
||||
-@erase "$(INTDIR)\ruserpass.obj"
|
||||
-@erase "$(INTDIR)\vc*.idb"
|
||||
-@erase "$(OUTDIR)\ftp.exe"
|
||||
-@erase "$(OUTDIR)\ftp.pch"
|
||||
|
||||
"$(OUTDIR)" :
|
||||
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
|
||||
|
||||
CPP=cl.exe
|
||||
CPP_PROJ=/nologo /ML /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" \
|
||||
/D "HAVE_TIMEVAL" /Fp"$(INTDIR)\ftp.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD\
|
||||
/c
|
||||
CPP_OBJS=.\Release/
|
||||
CPP_SBRS=.
|
||||
|
||||
.c{$(CPP_OBJS)}.obj::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.cpp{$(CPP_OBJS)}.obj::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.cxx{$(CPP_OBJS)}.obj::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.c{$(CPP_SBRS)}.sbr::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.cpp{$(CPP_SBRS)}.sbr::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.cxx{$(CPP_SBRS)}.sbr::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
RSC=rc.exe
|
||||
BSC32=bscmake.exe
|
||||
BSC32_FLAGS=/nologo /o"$(OUTDIR)\ftp.bsc"
|
||||
BSC32_SBRS= \
|
||||
|
||||
LINK32=link.exe
|
||||
LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\
|
||||
advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib\
|
||||
odbccp32.lib wsock32.lib /nologo /subsystem:console /incremental:no\
|
||||
/pdb:"$(OUTDIR)\ftp.pdb" /machine:I386 /out:"$(OUTDIR)\ftp.exe"
|
||||
LINK32_OBJS= \
|
||||
"$(INTDIR)\cmds.obj" \
|
||||
"$(INTDIR)\cmdtab.obj" \
|
||||
"$(INTDIR)\domacro.obj" \
|
||||
"$(INTDIR)\fake.obj" \
|
||||
"$(INTDIR)\ftp.obj" \
|
||||
"$(INTDIR)\main.obj" \
|
||||
"$(INTDIR)\ruserpass.obj"
|
||||
|
||||
"$(OUTDIR)\ftp.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
|
||||
$(LINK32) @<<
|
||||
$(LINK32_FLAGS) $(LINK32_OBJS)
|
||||
<<
|
||||
|
||||
TargetPath=.\Release\ftp.exe
|
||||
InputPath=.\Release\ftp.exe
|
||||
SOURCE=$(InputPath)
|
||||
|
||||
!ELSEIF "$(CFG)" == "ftp - Win32 Debug"
|
||||
|
||||
OUTDIR=.\Debug
|
||||
INTDIR=.\Debug
|
||||
# Begin Custom Macros
|
||||
OutDir=.\Debug
|
||||
# End Custom Macros
|
||||
|
||||
!IF "$(RECURSE)" == "0"
|
||||
|
||||
ALL : "$(OUTDIR)\ftp.exe"
|
||||
|
||||
!ELSE
|
||||
|
||||
ALL : "$(OUTDIR)\ftp.exe"
|
||||
|
||||
!ENDIF
|
||||
|
||||
CLEAN :
|
||||
-@erase "$(INTDIR)\cmds.obj"
|
||||
-@erase "$(INTDIR)\cmdtab.obj"
|
||||
-@erase "$(INTDIR)\domacro.obj"
|
||||
-@erase "$(INTDIR)\fake.obj"
|
||||
-@erase "$(INTDIR)\ftp.obj"
|
||||
-@erase "$(INTDIR)\main.obj"
|
||||
-@erase "$(INTDIR)\ruserpass.obj"
|
||||
-@erase "$(INTDIR)\vc*.idb"
|
||||
-@erase "$(INTDIR)\vc*.pdb"
|
||||
-@erase "$(OUTDIR)\ftp.exe"
|
||||
-@erase "$(OUTDIR)\ftp.ilk"
|
||||
-@erase "$(OUTDIR)\ftp.pdb"
|
||||
-@erase "$(OUTDIR)\ftp.pch"
|
||||
|
||||
"$(OUTDIR)" :
|
||||
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
|
||||
|
||||
CPP=cl.exe
|
||||
CPP_PROJ=/nologo /MLd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS"\
|
||||
/Fp"$(INTDIR)\ftp.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c
|
||||
CPP_OBJS=.\Debug/
|
||||
CPP_SBRS=.
|
||||
|
||||
.c{$(CPP_OBJS)}.obj::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.cpp{$(CPP_OBJS)}.obj::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.cxx{$(CPP_OBJS)}.obj::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.c{$(CPP_SBRS)}.sbr::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.cpp{$(CPP_SBRS)}.sbr::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.cxx{$(CPP_SBRS)}.sbr::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
RSC=rc.exe
|
||||
BSC32=bscmake.exe
|
||||
BSC32_FLAGS=/nologo /o"$(OUTDIR)\ftp.bsc"
|
||||
BSC32_SBRS= \
|
||||
|
||||
LINK32=link.exe
|
||||
LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\
|
||||
advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib\
|
||||
odbccp32.lib wsock32.lib /nologo /subsystem:console /incremental:yes\
|
||||
/pdb:"$(OUTDIR)\ftp.pdb" /debug /machine:I386 /out:"$(OUTDIR)\ftp.exe"\
|
||||
/pdbtype:sept
|
||||
LINK32_OBJS= \
|
||||
"$(INTDIR)\cmds.obj" \
|
||||
"$(INTDIR)\cmdtab.obj" \
|
||||
"$(INTDIR)\domacro.obj" \
|
||||
"$(INTDIR)\fake.obj" \
|
||||
"$(INTDIR)\ftp.obj" \
|
||||
"$(INTDIR)\main.obj" \
|
||||
"$(INTDIR)\ruserpass.obj"
|
||||
|
||||
"$(OUTDIR)\ftp.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
|
||||
$(LINK32) @<<
|
||||
$(LINK32_FLAGS) $(LINK32_OBJS)
|
||||
<<
|
||||
|
||||
TargetPath=.\Debug\ftp.exe
|
||||
InputPath=.\Debug\ftp.exe
|
||||
SOURCE=$(InputPath)
|
||||
|
||||
!ENDIF
|
||||
|
||||
|
||||
!IF "$(CFG)" == "ftp - Win32 Release" || "$(CFG)" == "ftp - Win32 Debug"
|
||||
SOURCE=.\cmds.c
|
||||
|
||||
!IF "$(CFG)" == "ftp - Win32 Release"
|
||||
|
||||
DEP_CPP_CMDS_=\
|
||||
".\fake.h"\
|
||||
".\ftp_var.h"\
|
||||
".\pathnames.h"\
|
||||
".\prototypes.h"\
|
||||
|
||||
|
||||
"$(INTDIR)\cmds.obj" : $(SOURCE) $(DEP_CPP_CMDS_) "$(INTDIR)"
|
||||
|
||||
|
||||
!ELSEIF "$(CFG)" == "ftp - Win32 Debug"
|
||||
|
||||
DEP_CPP_CMDS_=\
|
||||
".\fake.h"\
|
||||
".\ftp_var.h"\
|
||||
".\pathnames.h"\
|
||||
".\prototypes.h"\
|
||||
{$(INCLUDE)}"sys\stat.h"\
|
||||
{$(INCLUDE)}"sys\types.h"\
|
||||
|
||||
|
||||
"$(INTDIR)\cmds.obj" : $(SOURCE) $(DEP_CPP_CMDS_) "$(INTDIR)"
|
||||
|
||||
|
||||
!ENDIF
|
||||
|
||||
SOURCE=.\cmdtab.c
|
||||
DEP_CPP_CMDTA=\
|
||||
".\fake.h"\
|
||||
".\ftp_var.h"\
|
||||
|
||||
|
||||
"$(INTDIR)\cmdtab.obj" : $(SOURCE) $(DEP_CPP_CMDTA) "$(INTDIR)"
|
||||
|
||||
|
||||
SOURCE=.\domacro.c
|
||||
DEP_CPP_DOMAC=\
|
||||
".\fake.h"\
|
||||
".\ftp_var.h"\
|
||||
".\prototypes.h"\
|
||||
|
||||
|
||||
"$(INTDIR)\domacro.obj" : $(SOURCE) $(DEP_CPP_DOMAC) "$(INTDIR)"
|
||||
|
||||
|
||||
SOURCE=.\fake.c
|
||||
DEP_CPP_FAKE_=\
|
||||
".\prototypes.h"\
|
||||
|
||||
|
||||
"$(INTDIR)\fake.obj" : $(SOURCE) $(DEP_CPP_FAKE_) "$(INTDIR)"
|
||||
|
||||
|
||||
SOURCE=.\ftp.c
|
||||
|
||||
!IF "$(CFG)" == "ftp - Win32 Release"
|
||||
|
||||
DEP_CPP_FTP_C=\
|
||||
".\fake.h"\
|
||||
".\ftp_var.h"\
|
||||
".\prototypes.h"\
|
||||
|
||||
|
||||
"$(INTDIR)\ftp.obj" : $(SOURCE) $(DEP_CPP_FTP_C) "$(INTDIR)"
|
||||
|
||||
|
||||
!ELSEIF "$(CFG)" == "ftp - Win32 Debug"
|
||||
|
||||
DEP_CPP_FTP_C=\
|
||||
".\fake.h"\
|
||||
".\ftp_var.h"\
|
||||
".\prototypes.h"\
|
||||
{$(INCLUDE)}"sys\stat.h"\
|
||||
{$(INCLUDE)}"sys\types.h"\
|
||||
|
||||
|
||||
"$(INTDIR)\ftp.obj" : $(SOURCE) $(DEP_CPP_FTP_C) "$(INTDIR)"
|
||||
|
||||
|
||||
!ENDIF
|
||||
|
||||
SOURCE=.\main.c
|
||||
|
||||
!IF "$(CFG)" == "ftp - Win32 Release"
|
||||
|
||||
DEP_CPP_MAIN_=\
|
||||
".\fake.h"\
|
||||
".\ftp_var.h"\
|
||||
".\prototypes.h"\
|
||||
|
||||
|
||||
"$(INTDIR)\main.obj" : $(SOURCE) $(DEP_CPP_MAIN_) "$(INTDIR)"
|
||||
|
||||
|
||||
!ELSEIF "$(CFG)" == "ftp - Win32 Debug"
|
||||
|
||||
DEP_CPP_MAIN_=\
|
||||
".\fake.h"\
|
||||
".\ftp_var.h"\
|
||||
".\prototypes.h"\
|
||||
{$(INCLUDE)}"sys\types.h"\
|
||||
|
||||
|
||||
"$(INTDIR)\main.obj" : $(SOURCE) $(DEP_CPP_MAIN_) "$(INTDIR)"
|
||||
|
||||
|
||||
!ENDIF
|
||||
|
||||
SOURCE=.\ruserpass.c
|
||||
|
||||
!IF "$(CFG)" == "ftp - Win32 Release"
|
||||
|
||||
DEP_CPP_RUSER=\
|
||||
".\fake.h"\
|
||||
".\ftp_var.h"\
|
||||
".\prototypes.h"\
|
||||
|
||||
|
||||
"$(INTDIR)\ruserpass.obj" : $(SOURCE) $(DEP_CPP_RUSER) "$(INTDIR)"
|
||||
|
||||
|
||||
!ELSEIF "$(CFG)" == "ftp - Win32 Debug"
|
||||
|
||||
DEP_CPP_RUSER=\
|
||||
".\fake.h"\
|
||||
".\ftp_var.h"\
|
||||
".\prototypes.h"\
|
||||
{$(INCLUDE)}"sys\stat.h"\
|
||||
{$(INCLUDE)}"sys\types.h"\
|
||||
|
||||
|
||||
"$(INTDIR)\ruserpass.obj" : $(SOURCE) $(DEP_CPP_RUSER) "$(INTDIR)"
|
||||
|
||||
|
||||
!ENDIF
|
||||
|
||||
|
||||
!ENDIF
|
@@ -1,400 +0,0 @@
|
||||
# Microsoft Developer Studio Generated NMAKE File, Based on ftp.dsp
|
||||
!IF "$(CFG)" == ""
|
||||
CFG=ftp - Win32 Debug
|
||||
!MESSAGE No configuration specified. Defaulting to ftp - Win32 Debug.
|
||||
!ENDIF
|
||||
|
||||
!IF "$(CFG)" != "ftp - Win32 Release" && "$(CFG)" != "ftp - Win32 Debug"
|
||||
!MESSAGE Invalid configuration "$(CFG)" specified.
|
||||
!MESSAGE You can specify a configuration when running NMAKE
|
||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "ftp.mak" CFG="ftp - Win32 Debug"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "ftp - Win32 Release" (based on "Win32 (x86) Console Application")
|
||||
!MESSAGE "ftp - Win32 Debug" (based on "Win32 (x86) Console Application")
|
||||
!MESSAGE
|
||||
!ERROR An invalid configuration is specified.
|
||||
!ENDIF
|
||||
|
||||
!IF "$(OS)" == "Windows_NT"
|
||||
NULL=
|
||||
!ELSE
|
||||
NULL=nul
|
||||
!ENDIF
|
||||
|
||||
!IF "$(CFG)" == "ftp - Win32 Release"
|
||||
|
||||
OUTDIR=.\Release
|
||||
INTDIR=.\Release
|
||||
# Begin Custom Macros
|
||||
OutDir=.\Release
|
||||
# End Custom Macros
|
||||
|
||||
!IF "$(RECURSE)" == "0"
|
||||
|
||||
ALL : "$(OUTDIR)\ftp.exe" "\emacs-19.34\bin\ftp.exe"
|
||||
|
||||
!ELSE
|
||||
|
||||
ALL : "$(OUTDIR)\ftp.exe" "\emacs-19.34\bin\ftp.exe"
|
||||
|
||||
!ENDIF
|
||||
|
||||
CLEAN :
|
||||
-@erase "$(INTDIR)\cmds.obj"
|
||||
-@erase "$(INTDIR)\cmdtab.obj"
|
||||
-@erase "$(INTDIR)\domacro.obj"
|
||||
-@erase "$(INTDIR)\fake.obj"
|
||||
-@erase "$(INTDIR)\ftp.obj"
|
||||
-@erase "$(INTDIR)\main.obj"
|
||||
-@erase "$(INTDIR)\ruserpass.obj"
|
||||
-@erase "$(INTDIR)\vc50.idb"
|
||||
-@erase "$(OUTDIR)\ftp.exe"
|
||||
-@erase "\emacs-19.34\bin\ftp.exe"
|
||||
|
||||
"$(OUTDIR)" :
|
||||
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
|
||||
|
||||
CPP=cl.exe
|
||||
CPP_PROJ=/nologo /ML /W3 /GX /O2 /I "C:\emacs-19.34\nt\inc" /I\
|
||||
"C:\emacs-19.34\src" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /D\
|
||||
"HAVE_TIMEVAL" /Fp"$(INTDIR)\ftp.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD\
|
||||
/c
|
||||
CPP_OBJS=.\Release/
|
||||
CPP_SBRS=.
|
||||
|
||||
.c{$(CPP_OBJS)}.obj::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.cpp{$(CPP_OBJS)}.obj::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.cxx{$(CPP_OBJS)}.obj::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.c{$(CPP_SBRS)}.sbr::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.cpp{$(CPP_SBRS)}.sbr::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.cxx{$(CPP_SBRS)}.sbr::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
RSC=rc.exe
|
||||
BSC32=bscmake.exe
|
||||
BSC32_FLAGS=/nologo /o"$(OUTDIR)\ftp.bsc"
|
||||
BSC32_SBRS= \
|
||||
|
||||
LINK32=link.exe
|
||||
LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\
|
||||
advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib\
|
||||
odbccp32.lib /nologo /subsystem:console /incremental:no\
|
||||
/pdb:"$(OUTDIR)\ftp.pdb" /machine:I386 /out:"$(OUTDIR)\ftp.exe"
|
||||
LINK32_OBJS= \
|
||||
"$(INTDIR)\cmds.obj" \
|
||||
"$(INTDIR)\cmdtab.obj" \
|
||||
"$(INTDIR)\domacro.obj" \
|
||||
"$(INTDIR)\fake.obj" \
|
||||
"$(INTDIR)\ftp.obj" \
|
||||
"$(INTDIR)\main.obj" \
|
||||
"$(INTDIR)\ruserpass.obj" \
|
||||
"d:\Program Files\DevStudio\VC\lib\WSOCK32.LIB"
|
||||
|
||||
"$(OUTDIR)\ftp.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
|
||||
$(LINK32) @<<
|
||||
$(LINK32_FLAGS) $(LINK32_OBJS)
|
||||
<<
|
||||
|
||||
TargetPath=.\Release\ftp.exe
|
||||
InputPath=.\Release\ftp.exe
|
||||
SOURCE=$(InputPath)
|
||||
|
||||
"\emacs-19.34\bin\ftp.exe" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
|
||||
# copy $(TargetPath) \emacs-19.34\bin
|
||||
|
||||
!ELSEIF "$(CFG)" == "ftp - Win32 Debug"
|
||||
|
||||
OUTDIR=.\Debug
|
||||
INTDIR=.\Debug
|
||||
# Begin Custom Macros
|
||||
OutDir=.\Debug
|
||||
# End Custom Macros
|
||||
|
||||
!IF "$(RECURSE)" == "0"
|
||||
|
||||
ALL : "$(OUTDIR)\ftp.exe" "\emacs-19.34\bin\ftp.exe"
|
||||
|
||||
!ELSE
|
||||
|
||||
ALL : "$(OUTDIR)\ftp.exe" "\emacs-19.34\bin\ftp.exe"
|
||||
|
||||
!ENDIF
|
||||
|
||||
CLEAN :
|
||||
-@erase "$(INTDIR)\cmds.obj"
|
||||
-@erase "$(INTDIR)\cmdtab.obj"
|
||||
-@erase "$(INTDIR)\domacro.obj"
|
||||
-@erase "$(INTDIR)\fake.obj"
|
||||
-@erase "$(INTDIR)\ftp.obj"
|
||||
-@erase "$(INTDIR)\main.obj"
|
||||
-@erase "$(INTDIR)\ruserpass.obj"
|
||||
-@erase "$(INTDIR)\vc50.idb"
|
||||
-@erase "$(INTDIR)\vc50.pdb"
|
||||
-@erase "$(OUTDIR)\ftp.exe"
|
||||
-@erase "$(OUTDIR)\ftp.ilk"
|
||||
-@erase "$(OUTDIR)\ftp.pdb"
|
||||
-@erase "\emacs-19.34\bin\ftp.exe"
|
||||
|
||||
"$(OUTDIR)" :
|
||||
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
|
||||
|
||||
CPP=cl.exe
|
||||
CPP_PROJ=/nologo /MLd /W3 /Gm /GX /Zi /Od /I "C:\emacs-19.34\nt\inc" /I\
|
||||
"C:\emacs-19.34\src" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS"\
|
||||
/Fp"$(INTDIR)\ftp.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c
|
||||
CPP_OBJS=.\Debug/
|
||||
CPP_SBRS=.
|
||||
|
||||
.c{$(CPP_OBJS)}.obj::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.cpp{$(CPP_OBJS)}.obj::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.cxx{$(CPP_OBJS)}.obj::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.c{$(CPP_SBRS)}.sbr::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.cpp{$(CPP_SBRS)}.sbr::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.cxx{$(CPP_SBRS)}.sbr::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
RSC=rc.exe
|
||||
BSC32=bscmake.exe
|
||||
BSC32_FLAGS=/nologo /o"$(OUTDIR)\ftp.bsc"
|
||||
BSC32_SBRS= \
|
||||
|
||||
LINK32=link.exe
|
||||
LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\
|
||||
advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib\
|
||||
odbccp32.lib /nologo /subsystem:console /incremental:yes\
|
||||
/pdb:"$(OUTDIR)\ftp.pdb" /debug /machine:I386 /out:"$(OUTDIR)\ftp.exe"\
|
||||
/pdbtype:sept
|
||||
LINK32_OBJS= \
|
||||
"$(INTDIR)\cmds.obj" \
|
||||
"$(INTDIR)\cmdtab.obj" \
|
||||
"$(INTDIR)\domacro.obj" \
|
||||
"$(INTDIR)\fake.obj" \
|
||||
"$(INTDIR)\ftp.obj" \
|
||||
"$(INTDIR)\main.obj" \
|
||||
"$(INTDIR)\ruserpass.obj" \
|
||||
"d:\Program Files\DevStudio\VC\lib\WSOCK32.LIB"
|
||||
|
||||
"$(OUTDIR)\ftp.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
|
||||
$(LINK32) @<<
|
||||
$(LINK32_FLAGS) $(LINK32_OBJS)
|
||||
<<
|
||||
|
||||
TargetPath=.\Debug\ftp.exe
|
||||
InputPath=.\Debug\ftp.exe
|
||||
SOURCE=$(InputPath)
|
||||
|
||||
"\emacs-19.34\bin\ftp.exe" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
|
||||
# copy $(TargetPath) \emacs-19.34\bin
|
||||
|
||||
!ENDIF
|
||||
|
||||
|
||||
!IF "$(CFG)" == "ftp - Win32 Release" || "$(CFG)" == "ftp - Win32 Debug"
|
||||
SOURCE=.\cmds.c
|
||||
|
||||
!IF "$(CFG)" == "ftp - Win32 Release"
|
||||
|
||||
DEP_CPP_CMDS_=\
|
||||
".\fake.h"\
|
||||
".\ftp_var.h"\
|
||||
".\pathnames.h"\
|
||||
".\prototypes.h"\
|
||||
|
||||
|
||||
"$(INTDIR)\cmds.obj" : $(SOURCE) $(DEP_CPP_CMDS_) "$(INTDIR)"
|
||||
|
||||
|
||||
!ELSEIF "$(CFG)" == "ftp - Win32 Debug"
|
||||
|
||||
DEP_CPP_CMDS_=\
|
||||
"..\..\..\emacs-19.34\nt\inc\netdb.h"\
|
||||
"..\..\..\emacs-19.34\nt\inc\netinet\in.h"\
|
||||
"..\..\..\emacs-19.34\nt\inc\sys\socket.h"\
|
||||
"..\..\..\emacs-19.34\src\nt.h"\
|
||||
".\fake.h"\
|
||||
".\ftp_var.h"\
|
||||
".\pathnames.h"\
|
||||
".\prototypes.h"\
|
||||
{$(INCLUDE)}"sys\stat.h"\
|
||||
{$(INCLUDE)}"sys\types.h"\
|
||||
|
||||
|
||||
"$(INTDIR)\cmds.obj" : $(SOURCE) $(DEP_CPP_CMDS_) "$(INTDIR)"
|
||||
|
||||
|
||||
!ENDIF
|
||||
|
||||
SOURCE=.\cmdtab.c
|
||||
DEP_CPP_CMDTA=\
|
||||
".\fake.h"\
|
||||
".\ftp_var.h"\
|
||||
|
||||
|
||||
"$(INTDIR)\cmdtab.obj" : $(SOURCE) $(DEP_CPP_CMDTA) "$(INTDIR)"
|
||||
|
||||
|
||||
SOURCE=.\domacro.c
|
||||
DEP_CPP_DOMAC=\
|
||||
".\fake.h"\
|
||||
".\ftp_var.h"\
|
||||
".\prototypes.h"\
|
||||
|
||||
|
||||
"$(INTDIR)\domacro.obj" : $(SOURCE) $(DEP_CPP_DOMAC) "$(INTDIR)"
|
||||
|
||||
|
||||
SOURCE=.\fake.c
|
||||
DEP_CPP_FAKE_=\
|
||||
".\prototypes.h"\
|
||||
|
||||
|
||||
"$(INTDIR)\fake.obj" : $(SOURCE) $(DEP_CPP_FAKE_) "$(INTDIR)"
|
||||
|
||||
|
||||
SOURCE=.\ftp.c
|
||||
|
||||
!IF "$(CFG)" == "ftp - Win32 Release"
|
||||
|
||||
DEP_CPP_FTP_C=\
|
||||
".\fake.h"\
|
||||
".\ftp_var.h"\
|
||||
".\prototypes.h"\
|
||||
|
||||
|
||||
"$(INTDIR)\ftp.obj" : $(SOURCE) $(DEP_CPP_FTP_C) "$(INTDIR)"
|
||||
|
||||
|
||||
!ELSEIF "$(CFG)" == "ftp - Win32 Debug"
|
||||
|
||||
DEP_CPP_FTP_C=\
|
||||
"..\..\..\emacs-19.34\nt\inc\netdb.h"\
|
||||
"..\..\..\emacs-19.34\nt\inc\netinet\in.h"\
|
||||
"..\..\..\emacs-19.34\nt\inc\pwd.h"\
|
||||
"..\..\..\emacs-19.34\nt\inc\sys\file.h"\
|
||||
"..\..\..\emacs-19.34\nt\inc\sys\ioctl.h"\
|
||||
"..\..\..\emacs-19.34\nt\inc\sys\param.h"\
|
||||
"..\..\..\emacs-19.34\nt\inc\sys\socket.h"\
|
||||
"..\..\..\emacs-19.34\nt\inc\sys\time.h"\
|
||||
"..\..\..\emacs-19.34\src\nt.h"\
|
||||
".\fake.h"\
|
||||
".\ftp_var.h"\
|
||||
".\prototypes.h"\
|
||||
{$(INCLUDE)}"sys\stat.h"\
|
||||
{$(INCLUDE)}"sys\types.h"\
|
||||
|
||||
|
||||
"$(INTDIR)\ftp.obj" : $(SOURCE) $(DEP_CPP_FTP_C) "$(INTDIR)"
|
||||
|
||||
|
||||
!ENDIF
|
||||
|
||||
SOURCE=.\main.c
|
||||
|
||||
!IF "$(CFG)" == "ftp - Win32 Release"
|
||||
|
||||
DEP_CPP_MAIN_=\
|
||||
".\fake.h"\
|
||||
".\ftp_var.h"\
|
||||
".\prototypes.h"\
|
||||
|
||||
|
||||
"$(INTDIR)\main.obj" : $(SOURCE) $(DEP_CPP_MAIN_) "$(INTDIR)"
|
||||
|
||||
|
||||
!ELSEIF "$(CFG)" == "ftp - Win32 Debug"
|
||||
|
||||
DEP_CPP_MAIN_=\
|
||||
"..\..\..\emacs-19.34\nt\inc\netdb.h"\
|
||||
"..\..\..\emacs-19.34\nt\inc\pwd.h"\
|
||||
"..\..\..\emacs-19.34\nt\inc\sys\ioctl.h"\
|
||||
"..\..\..\emacs-19.34\nt\inc\sys\socket.h"\
|
||||
"..\..\..\emacs-19.34\src\nt.h"\
|
||||
".\fake.h"\
|
||||
".\ftp_var.h"\
|
||||
".\prototypes.h"\
|
||||
{$(INCLUDE)}"sys\types.h"\
|
||||
|
||||
|
||||
"$(INTDIR)\main.obj" : $(SOURCE) $(DEP_CPP_MAIN_) "$(INTDIR)"
|
||||
|
||||
|
||||
!ENDIF
|
||||
|
||||
SOURCE=.\ruserpass.c
|
||||
|
||||
!IF "$(CFG)" == "ftp - Win32 Release"
|
||||
|
||||
DEP_CPP_RUSER=\
|
||||
".\fake.h"\
|
||||
".\ftp_var.h"\
|
||||
".\prototypes.h"\
|
||||
|
||||
|
||||
"$(INTDIR)\ruserpass.obj" : $(SOURCE) $(DEP_CPP_RUSER) "$(INTDIR)"
|
||||
|
||||
|
||||
!ELSEIF "$(CFG)" == "ftp - Win32 Debug"
|
||||
|
||||
DEP_CPP_RUSER=\
|
||||
".\fake.h"\
|
||||
".\ftp_var.h"\
|
||||
".\prototypes.h"\
|
||||
{$(INCLUDE)}"sys\stat.h"\
|
||||
{$(INCLUDE)}"sys\types.h"\
|
||||
|
||||
|
||||
"$(INTDIR)\ruserpass.obj" : $(SOURCE) $(DEP_CPP_RUSER) "$(INTDIR)"
|
||||
|
||||
|
||||
!ENDIF
|
||||
|
||||
|
||||
!ENDIF
|
@@ -1,6 +0,0 @@
|
||||
/* $Id: route.rc 11816 2004-11-26 06:51:47Z arty $ */
|
||||
|
||||
#define REACTOS_STR_FILE_DESCRIPTION "ReactOS TCP/IPv4 FTP Client\0"
|
||||
#define REACTOS_STR_INTERNAL_NAME "ftp\0"
|
||||
#define REACTOS_STR_ORIGINAL_FILENAME "ftp.exe\0"
|
||||
#include <reactos/version.rc>
|
@@ -1,181 +0,0 @@
|
||||
#include "fake.h"
|
||||
#include <winsock.h>
|
||||
#include <setjmp.h>
|
||||
|
||||
//typedef void (*Sig_t)(int);
|
||||
|
||||
int fgetcSocket(int s);
|
||||
char *fputsSocket(char *format, int s);
|
||||
|
||||
char *fprintfSocket(int s, char *format, ...);
|
||||
|
||||
int fputcSocket(int s, char putChar);
|
||||
int fputSocket(int s, char *putChar, int len);
|
||||
char *fgetsSocket(int s, char *string);
|
||||
|
||||
/* The following defines are from ftp.h and telnet.h from bsd.h */
|
||||
/* All relevent copyrights below apply. */
|
||||
|
||||
#define IAC 255
|
||||
#define DONT 254
|
||||
#define DO 253
|
||||
#define WONT 252
|
||||
#define WILL 251
|
||||
#define SB 250
|
||||
#define GA 249
|
||||
#define EL 248
|
||||
#define EC 247
|
||||
#define AYT 246
|
||||
#define AO 245
|
||||
#define IP 244
|
||||
#define BREAK 243
|
||||
#define DM 242
|
||||
#define NOP 241
|
||||
#define SE 240
|
||||
#define EOR 239
|
||||
#define ABORT 238
|
||||
#define SUSP 237
|
||||
#define xEOF 236
|
||||
|
||||
|
||||
#define MAXPATHLEN 255
|
||||
#define TYPE_A 'A'
|
||||
#define TYPE_I 'I'
|
||||
#define TYPE_E 'E'
|
||||
#define TYPE_L 'L'
|
||||
|
||||
#define PRELIM 1
|
||||
#define COMPLETE 2
|
||||
#define CONTINUE 3
|
||||
#define TRANSIENT 4
|
||||
|
||||
#define MODE_S 1
|
||||
#define MODE_B 2
|
||||
#define MODE_C 3
|
||||
|
||||
#define STRU_F 1
|
||||
#define STRU_R 2
|
||||
#define STRU_P 3
|
||||
|
||||
#define SIGQUIT 1
|
||||
#define SIGPIPE 2
|
||||
#define SIGALRM 3
|
||||
|
||||
|
||||
#define FORM_N 1
|
||||
#define FORM_T 2
|
||||
#define FORM_C 3
|
||||
|
||||
|
||||
/*
|
||||
* Copyright (c) 1985 Regents of the University of California.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms are permitted
|
||||
* provided that the above copyright notice and this paragraph are
|
||||
* duplicated in all such forms and that any documentation,
|
||||
* advertising materials, and other materials related to such
|
||||
* distribution and use acknowledge that the software was developed
|
||||
* by the University of California, Berkeley. The name of the
|
||||
* University may not be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* @(#)ftp_var.h 5.5 (Berkeley) 6/29/88
|
||||
*/
|
||||
|
||||
/*
|
||||
* FTP global variables.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Options and other state info.
|
||||
*/
|
||||
extern int trace; /* trace packets exchanged */
|
||||
extern int hash; /* print # for each buffer transferred */
|
||||
extern int sendport; /* use PORT cmd for each data connection */
|
||||
extern int verbose; /* print messages coming back from server */
|
||||
extern int connected; /* connected to server */
|
||||
extern int fromatty; /* input is from a terminal */
|
||||
extern int interactive; /* interactively prompt on m* cmds */
|
||||
extern int debug; /* debugging level */
|
||||
extern int bell; /* ring bell on cmd completion */
|
||||
extern int doglob; /* glob local file names */
|
||||
extern int proxy; /* proxy server connection active */
|
||||
extern int proxflag; /* proxy connection exists */
|
||||
extern int sunique; /* store files on server with unique name */
|
||||
extern int runique; /* store local files with unique name */
|
||||
extern int mcase; /* map upper to lower case for mget names */
|
||||
extern int ntflag; /* use ntin ntout tables for name translation */
|
||||
extern int mapflag; /* use mapin mapout templates on file names */
|
||||
extern int code; /* return/reply code for ftp command */
|
||||
extern int crflag; /* if 1, strip car. rets. on ascii gets */
|
||||
extern char pasv[64]; /* passive port for proxy data connection */
|
||||
extern int passivemode; /* passive mode enabled */
|
||||
extern char *altarg; /* argv[1] with no shell-like preprocessing */
|
||||
extern char ntin[17]; /* input translation table */
|
||||
extern char ntout[17]; /* output translation table */
|
||||
|
||||
extern char mapin[MAXPATHLEN]; /* input map template */
|
||||
extern char mapout[MAXPATHLEN]; /* output map template */
|
||||
extern char typename[32]; /* name of file transfer type */
|
||||
extern int type; /* file transfer type */
|
||||
extern char structname[32]; /* name of file transfer structure */
|
||||
extern int stru; /* file transfer structure */
|
||||
extern char formname[32]; /* name of file transfer format */
|
||||
extern int form; /* file transfer format */
|
||||
extern char modename[32]; /* name of file transfer mode */
|
||||
extern int mode; /* file transfer mode */
|
||||
extern char bytename[32]; /* local byte size in ascii */
|
||||
extern int bytesize; /* local byte size in binary */
|
||||
|
||||
extern jmp_buf toplevel; /* non-local goto stuff for cmd scanner */
|
||||
|
||||
extern char line[200]; /* input line buffer */
|
||||
extern char *stringbase; /* current scan point in line buffer */
|
||||
extern char argbuf[200]; /* argument storage buffer */
|
||||
extern char *argbase; /* current storage point in arg buffer */
|
||||
extern int margc; /* count of arguments on input line */
|
||||
extern char *margv[20]; /* args parsed from input line */
|
||||
extern int cpend; /* flag: if != 0, then pending server reply */
|
||||
extern int mflag; /* flag: if != 0, then active multi command */
|
||||
|
||||
extern int options; /* used during socket creation */
|
||||
|
||||
/*
|
||||
* Format of command table.
|
||||
*/
|
||||
struct cmd {
|
||||
char *c_name; /* name of command */
|
||||
char *c_help; /* help string */
|
||||
char c_bell; /* give bell when command completes */
|
||||
char c_conn; /* must be connected to use command */
|
||||
char c_proxy; /* proxy server may execute */
|
||||
int (*c_handler)(); /* function to call */
|
||||
};
|
||||
|
||||
struct macel {
|
||||
char mac_name[9]; /* macro name */
|
||||
char *mac_start; /* start of macro in macbuf */
|
||||
char *mac_end; /* end of macro in macbuf */
|
||||
};
|
||||
|
||||
int macnum; /* number of defined macros */
|
||||
struct macel macros[16];
|
||||
char macbuf[4096];
|
||||
|
||||
extern char *tail();
|
||||
extern char *remglob();
|
||||
extern int errno;
|
||||
extern char *mktemp();
|
||||
|
||||
#if defined(__ANSI__) || defined(sparc)
|
||||
typedef void sig_t;
|
||||
#else
|
||||
typedef int sig_t;
|
||||
#endif
|
||||
|
||||
typedef int uid_t;
|
||||
int herror(char *s);
|
@@ -1,602 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 1985, 1989 Regents of the University of California.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms are permitted
|
||||
* provided that the above copyright notice and this paragraph are
|
||||
* duplicated in all such forms and that any documentation,
|
||||
* advertising materials, and other materials related to such
|
||||
* distribution and use acknowledge that the software was developed
|
||||
* by the University of California, Berkeley. The name of the
|
||||
* University may not be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
char copyright[] =
|
||||
"@(#) Copyright (c) 1985, 1989 Regents of the University of California.\n\
|
||||
All rights reserved.\n";
|
||||
#endif /* not lint */
|
||||
|
||||
#ifndef lint
|
||||
static char sccsid[] = "@(#)main.c based on 5.13 (Berkeley) 3/14/89";
|
||||
#endif /* not lint */
|
||||
|
||||
/*
|
||||
* FTP User Program -- Command Interface.
|
||||
*/
|
||||
#if !defined(WIN32)
|
||||
#include <netdb.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <arpa/ftp.h>
|
||||
#include <errno.h>
|
||||
#include <pwd.h>
|
||||
#endif
|
||||
#include "ftp_var.h"
|
||||
#include "prototypes.h"
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <io.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#include <signal.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <ctype.h>
|
||||
|
||||
|
||||
#if defined(sun) && !defined(FD_SET)
|
||||
typedef int uid_t;
|
||||
#endif
|
||||
|
||||
uid_t getuid();
|
||||
void intr();
|
||||
void lostpeer();
|
||||
char *getlogin();
|
||||
|
||||
short portnum;
|
||||
|
||||
char home[128];
|
||||
char *globerr;
|
||||
int autologin;
|
||||
|
||||
|
||||
|
||||
/* Lot's of options... */
|
||||
/*
|
||||
* Options and other state info.
|
||||
*/
|
||||
int trace; /* trace packets exchanged */
|
||||
int hash; /* print # for each buffer transferred */
|
||||
int sendport; /* use PORT cmd for each data connection */
|
||||
int verbose; /* print messages coming back from server */
|
||||
int connected; /* connected to server */
|
||||
int fromatty; /* input is from a terminal */
|
||||
int interactive; /* interactively prompt on m* cmds */
|
||||
int debug; /* debugging level */
|
||||
int bell; /* ring bell on cmd completion */
|
||||
int doglob; /* glob local file names */
|
||||
int proxy; /* proxy server connection active */
|
||||
int passivemode;
|
||||
int proxflag; /* proxy connection exists */
|
||||
int sunique; /* store files on server with unique name */
|
||||
int runique; /* store local files with unique name */
|
||||
int mcase; /* map upper to lower case for mget names */
|
||||
int ntflag; /* use ntin ntout tables for name translation */
|
||||
int mapflag; /* use mapin mapout templates on file names */
|
||||
int code; /* return/reply code for ftp command */
|
||||
int crflag; /* if 1, strip car. rets. on ascii gets */
|
||||
char pasv[64]; /* passive port for proxy data connection */
|
||||
char *altarg; /* argv[1] with no shell-like preprocessing */
|
||||
char ntin[17]; /* input translation table */
|
||||
char ntout[17]; /* output translation table */
|
||||
// #include <sys/param.h>
|
||||
char mapin[MAXPATHLEN]; /* input map template */
|
||||
char mapout[MAXPATHLEN]; /* output map template */
|
||||
char typename[32]; /* name of file transfer type */
|
||||
int type; /* file transfer type */
|
||||
char structname[32]; /* name of file transfer structure */
|
||||
int stru; /* file transfer structure */
|
||||
char formname[32]; /* name of file transfer format */
|
||||
int form; /* file transfer format */
|
||||
char modename[32]; /* name of file transfer mode */
|
||||
int mode; /* file transfer mode */
|
||||
char bytename[32]; /* local byte size in ascii */
|
||||
int bytesize; /* local byte size in binary */
|
||||
|
||||
jmp_buf toplevel; /* non-local goto stuff for cmd scanner */
|
||||
|
||||
char line[200]; /* input line buffer */
|
||||
char *stringbase; /* current scan point in line buffer */
|
||||
char argbuf[200]; /* argument storage buffer */
|
||||
char *argbase; /* current storage point in arg buffer */
|
||||
int margc; /* count of arguments on input line */
|
||||
char *margv[20]; /* args parsed from input line */
|
||||
int cpend; /* flag: if != 0, then pending server reply */
|
||||
int mflag; /* flag: if != 0, then active multi command */
|
||||
|
||||
int options; /* used during socket creation */
|
||||
|
||||
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
register char *cp;
|
||||
int top;
|
||||
struct passwd *pw = NULL;
|
||||
#if 0
|
||||
char homedir[MAXPATHLEN];
|
||||
#endif
|
||||
|
||||
int err;
|
||||
WORD wVerReq;
|
||||
|
||||
WSADATA WSAData;
|
||||
struct servent *sp; /* service spec for tcp/ftp */
|
||||
|
||||
/* Disable output buffering, for the benefit of Emacs. */
|
||||
//setbuf(stdout, NULL);
|
||||
|
||||
_fmode = O_BINARY; // This causes an error somewhere.
|
||||
|
||||
wVerReq = MAKEWORD(1,1);
|
||||
|
||||
err = WSAStartup(wVerReq, &WSAData);
|
||||
if (err != 0)
|
||||
{
|
||||
fprintf(stderr, "Could not initialize Windows socket interface.");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
sp = getservbyname("ftp", "tcp");
|
||||
if (sp == 0) {
|
||||
fprintf(stderr, "ftp: ftp/tcp: unknown service\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
portnum = sp->s_port;
|
||||
|
||||
|
||||
doglob = 1;
|
||||
interactive = 1;
|
||||
autologin = 1;
|
||||
argc--, argv++;
|
||||
while (argc > 0 && **argv == '-') {
|
||||
for (cp = *argv + 1; *cp; cp++)
|
||||
switch (*cp) {
|
||||
|
||||
case 'd':
|
||||
options |= SO_DEBUG;
|
||||
debug++;
|
||||
break;
|
||||
|
||||
case 'v':
|
||||
verbose++;
|
||||
break;
|
||||
|
||||
case 't':
|
||||
trace++;
|
||||
break;
|
||||
|
||||
case 'i':
|
||||
interactive = 0;
|
||||
break;
|
||||
|
||||
case 'n':
|
||||
autologin = 0;
|
||||
break;
|
||||
|
||||
case 'g':
|
||||
doglob = 0;
|
||||
break;
|
||||
|
||||
default:
|
||||
fprintf(stdout,
|
||||
"ftp: %c: unknown option\n", *cp);
|
||||
exit(1);
|
||||
}
|
||||
argc--, argv++;
|
||||
}
|
||||
// fromatty = isatty(fileno(stdin));
|
||||
fromatty = 1; // Strengthen this test
|
||||
/*
|
||||
* Set up defaults for FTP.
|
||||
*/
|
||||
(void) strcpy(typename, "ascii"), type = TYPE_A;
|
||||
(void) strcpy(formname, "non-print"), form = FORM_N;
|
||||
(void) strcpy(modename, "stream"), mode = MODE_S;
|
||||
(void) strcpy(structname, "file"), stru = STRU_F;
|
||||
(void) strcpy(bytename, "8"), bytesize = 8;
|
||||
if (fromatty)
|
||||
verbose++;
|
||||
cpend = 0; /* no pending replies */
|
||||
proxy = 0; /* proxy not active */
|
||||
passivemode = 1; /* passive mode *is* active */
|
||||
crflag = 1; /* strip c.r. on ascii gets */
|
||||
/*
|
||||
* Set up the home directory in case we're globbing.
|
||||
*/
|
||||
#if 0
|
||||
cp = getlogin();
|
||||
if (cp != NULL) {
|
||||
pw = getpwnam(cp);
|
||||
}
|
||||
if (pw == NULL)
|
||||
pw = getpwuid(getuid());
|
||||
if (pw != NULL) {
|
||||
home = homedir;
|
||||
(void) strcpy(home, pw->pw_dir);
|
||||
}
|
||||
#endif
|
||||
strcpy(home, "C:/");
|
||||
if (argc > 0) {
|
||||
if (setjmp(toplevel))
|
||||
exit(0);
|
||||
// (void) signal(SIGINT, intr);
|
||||
// (void) signal(SIGPIPE, lostpeer);
|
||||
setpeer(argc + 1, argv - 1);
|
||||
}
|
||||
top = setjmp(toplevel) == 0;
|
||||
if (top) {
|
||||
// (void) signal(SIGINT, intr);
|
||||
// (void) signal(SIGPIPE, lostpeer);
|
||||
}
|
||||
for (;;) {
|
||||
cmdscanner(top);
|
||||
top = 1;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
intr()
|
||||
{
|
||||
|
||||
longjmp(toplevel, 1);
|
||||
}
|
||||
|
||||
void lostpeer(void)
|
||||
{
|
||||
extern int cout;
|
||||
extern int data;
|
||||
|
||||
if (connected) {
|
||||
if (cout != (int) NULL) {
|
||||
closesocket(cout);
|
||||
cout = (int) NULL;
|
||||
}
|
||||
if (data >= 0) {
|
||||
(void) shutdown(data, 1+1);
|
||||
(void) close(data);
|
||||
data = -1;
|
||||
}
|
||||
connected = 0;
|
||||
}
|
||||
pswitch(1);
|
||||
if (connected) {
|
||||
if (cout != (int)NULL) {
|
||||
closesocket(cout);
|
||||
cout = (int) NULL;
|
||||
}
|
||||
connected = 0;
|
||||
}
|
||||
proxflag = 0;
|
||||
pswitch(0);
|
||||
}
|
||||
|
||||
/*char *
|
||||
tail(filename)
|
||||
char *filename;
|
||||
{
|
||||
register char *s;
|
||||
|
||||
while (*filename) {
|
||||
s = rindex(filename, '/');
|
||||
if (s == NULL)
|
||||
break;
|
||||
if (s[1])
|
||||
return (s + 1);
|
||||
*s = '\0';
|
||||
}
|
||||
return (filename);
|
||||
}
|
||||
*/
|
||||
/*
|
||||
* Command parser.
|
||||
*/
|
||||
void cmdscanner(top)
|
||||
int top;
|
||||
{
|
||||
register struct cmd *c;
|
||||
struct cmd *getcmd();
|
||||
extern int help();
|
||||
|
||||
if (!top)
|
||||
(void) putchar('\n');
|
||||
for (;;) {
|
||||
(void) fflush(stdout);
|
||||
if (fromatty) {
|
||||
printf("ftp> ");
|
||||
(void) fflush(stdout);
|
||||
}
|
||||
if (gets(line) == 0) {
|
||||
if (feof(stdin) || ferror(stdin))
|
||||
quit();
|
||||
break;
|
||||
}
|
||||
if (line[0] == 0)
|
||||
break;
|
||||
makeargv();
|
||||
if (margc == 0) {
|
||||
continue;
|
||||
}
|
||||
c = getcmd(margv[0]);
|
||||
if (c == (struct cmd *)-1) {
|
||||
printf("?Ambiguous command\n");
|
||||
continue;
|
||||
}
|
||||
if (c == 0) {
|
||||
printf("?Invalid command\n");
|
||||
continue;
|
||||
}
|
||||
if (c->c_conn && !connected) {
|
||||
printf ("Not connected.\n");
|
||||
continue;
|
||||
}
|
||||
(*c->c_handler)(margc, margv);
|
||||
if (bell && c->c_bell)
|
||||
(void) putchar('\007');
|
||||
if (c->c_handler != help)
|
||||
break;
|
||||
}
|
||||
(void) fflush(stdout);
|
||||
// (void) signal(SIGINT, intr);
|
||||
// (void) signal(SIGPIPE, lostpeer);
|
||||
}
|
||||
|
||||
struct cmd *
|
||||
getcmd(name)
|
||||
register char *name;
|
||||
{
|
||||
extern struct cmd cmdtab[];
|
||||
register char *p, *q;
|
||||
register struct cmd *c, *found;
|
||||
register int nmatches, longest;
|
||||
|
||||
longest = 0;
|
||||
nmatches = 0;
|
||||
found = 0;
|
||||
for (c = cmdtab; p = c->c_name; c++) {
|
||||
for (q = name; *q == *p++; q++)
|
||||
if (*q == 0) /* exact match? */
|
||||
return (c);
|
||||
if (!*q) { /* the name was a prefix */
|
||||
if (q - name > longest) {
|
||||
longest = q - name;
|
||||
nmatches = 1;
|
||||
found = c;
|
||||
} else if (q - name == longest)
|
||||
nmatches++;
|
||||
}
|
||||
}
|
||||
if (nmatches > 1)
|
||||
return ((struct cmd *)-1);
|
||||
return (found);
|
||||
}
|
||||
|
||||
/*
|
||||
* Slice a string up into argc/argv.
|
||||
*/
|
||||
|
||||
int slrflag;
|
||||
|
||||
void makeargv()
|
||||
{
|
||||
char **argp;
|
||||
char *slurpstring();
|
||||
|
||||
margc = 0;
|
||||
argp = margv;
|
||||
stringbase = line; /* scan from first of buffer */
|
||||
argbase = argbuf; /* store from first of buffer */
|
||||
slrflag = 0;
|
||||
while (*argp++ = slurpstring())
|
||||
margc++;
|
||||
}
|
||||
|
||||
/*
|
||||
* Parse string into argbuf;
|
||||
* implemented with FSM to
|
||||
* handle quoting and strings
|
||||
*/
|
||||
char *
|
||||
slurpstring()
|
||||
{
|
||||
int got_one = 0;
|
||||
register char *sb = stringbase;
|
||||
register char *ap = argbase;
|
||||
char *tmp = argbase; /* will return this if token found */
|
||||
|
||||
if (*sb == '!' || *sb == '$') { /* recognize ! as a token for shell */
|
||||
switch (slrflag) { /* and $ as token for macro invoke */
|
||||
case 0:
|
||||
slrflag++;
|
||||
stringbase++;
|
||||
return ((*sb == '!') ? "!" : "$");
|
||||
/* NOTREACHED */
|
||||
case 1:
|
||||
slrflag++;
|
||||
altarg = stringbase;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
S0:
|
||||
switch (*sb) {
|
||||
|
||||
case '\0':
|
||||
goto OUT1;
|
||||
|
||||
case ' ':
|
||||
case '\t':
|
||||
sb++; goto S0;
|
||||
|
||||
default:
|
||||
switch (slrflag) {
|
||||
case 0:
|
||||
slrflag++;
|
||||
break;
|
||||
case 1:
|
||||
slrflag++;
|
||||
altarg = sb;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
goto S1;
|
||||
}
|
||||
|
||||
S1:
|
||||
switch (*sb) {
|
||||
|
||||
case ' ':
|
||||
case '\t':
|
||||
case '\0':
|
||||
goto OUT1; /* end of token */
|
||||
|
||||
case '\\':
|
||||
sb++; goto S2; /* slurp next character */
|
||||
|
||||
case '"':
|
||||
sb++; goto S3; /* slurp quoted string */
|
||||
|
||||
default:
|
||||
*ap++ = *sb++; /* add character to token */
|
||||
got_one = 1;
|
||||
goto S1;
|
||||
}
|
||||
|
||||
S2:
|
||||
switch (*sb) {
|
||||
|
||||
case '\0':
|
||||
goto OUT1;
|
||||
|
||||
default:
|
||||
*ap++ = *sb++;
|
||||
got_one = 1;
|
||||
goto S1;
|
||||
}
|
||||
|
||||
S3:
|
||||
switch (*sb) {
|
||||
|
||||
case '\0':
|
||||
goto OUT1;
|
||||
|
||||
case '"':
|
||||
sb++; goto S1;
|
||||
|
||||
default:
|
||||
*ap++ = *sb++;
|
||||
got_one = 1;
|
||||
goto S3;
|
||||
}
|
||||
|
||||
OUT1:
|
||||
if (got_one)
|
||||
*ap++ = '\0';
|
||||
argbase = ap; /* update storage pointer */
|
||||
stringbase = sb; /* update scan pointer */
|
||||
if (got_one) {
|
||||
return(tmp);
|
||||
}
|
||||
switch (slrflag) {
|
||||
case 0:
|
||||
slrflag++;
|
||||
break;
|
||||
case 1:
|
||||
slrflag++;
|
||||
altarg = (char *) 0;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return((char *)0);
|
||||
}
|
||||
|
||||
#define HELPINDENT (sizeof ("directory"))
|
||||
|
||||
/*
|
||||
* Help command.
|
||||
* Call each command handler with argc == 0 and argv[0] == name.
|
||||
*/
|
||||
int help(argc, argv)
|
||||
int argc;
|
||||
char *argv[];
|
||||
{
|
||||
extern struct cmd cmdtab[];
|
||||
register struct cmd *c;
|
||||
|
||||
if (argc == 1) {
|
||||
register int i, j, w, k;
|
||||
int columns, width = 0, lines;
|
||||
extern int NCMDS;
|
||||
|
||||
printf("Commands may be abbreviated. Commands are:\n\n");
|
||||
for (c = cmdtab; c < &cmdtab[NCMDS]; c++) {
|
||||
int len = strlen(c->c_name);
|
||||
|
||||
if (len > width)
|
||||
width = len;
|
||||
}
|
||||
width = (width + 8) &~ 7;
|
||||
columns = 80 / width;
|
||||
if (columns == 0)
|
||||
columns = 1;
|
||||
lines = (NCMDS + columns - 1) / columns;
|
||||
for (i = 0; i < lines; i++) {
|
||||
for (j = 0; j < columns; j++) {
|
||||
c = cmdtab + j * lines + i;
|
||||
if (c->c_name && (!proxy || c->c_proxy)) {
|
||||
printf("%s", c->c_name);
|
||||
}
|
||||
else if (c->c_name) {
|
||||
for (k=0; k < (int) strlen(c->c_name); k++) {
|
||||
(void) putchar(' ');
|
||||
}
|
||||
}
|
||||
if (c + lines >= &cmdtab[NCMDS]) {
|
||||
printf("\n");
|
||||
break;
|
||||
}
|
||||
w = strlen(c->c_name);
|
||||
while (w < width) {
|
||||
w = (w + 8) &~ 7;
|
||||
(void) putchar('\t');
|
||||
}
|
||||
}
|
||||
}
|
||||
(void) fflush(stdout);
|
||||
return 0;
|
||||
}
|
||||
while (--argc > 0) {
|
||||
register char *arg;
|
||||
arg = *++argv;
|
||||
c = getcmd(arg);
|
||||
if (c == (struct cmd *)-1)
|
||||
printf("?Ambiguous help command %s\n", arg);
|
||||
else if (c == (struct cmd *)0)
|
||||
printf("?Invalid help command %s\n", arg);
|
||||
else
|
||||
printf("%-*s\t%s\n", HELPINDENT,
|
||||
c->c_name, c->c_help);
|
||||
}
|
||||
(void) fflush(stdout);
|
||||
return 0;
|
||||
}
|
@@ -1,29 +0,0 @@
|
||||
PATH_TO_TOP = ../../../..
|
||||
|
||||
TARGET_TYPE = program
|
||||
|
||||
TARGET_APPTYPE = console
|
||||
|
||||
TARGET_NAME = ftp
|
||||
|
||||
TARGET_INSTALLDIR = system32
|
||||
|
||||
TARGET_CFLAGS = -D__USE_W32API
|
||||
|
||||
TARGET_SDKLIBS = ws2_32.a iphlpapi.a
|
||||
# ntdll.a
|
||||
|
||||
TARGET_OBJECTS = \
|
||||
cmds.o \
|
||||
cmdtab.o \
|
||||
domacro.o \
|
||||
fake.o \
|
||||
ftp.o \
|
||||
main.o \
|
||||
ruserpass.o
|
||||
|
||||
TARGET_GCCLIBS =
|
||||
|
||||
include $(PATH_TO_TOP)/rules.mak
|
||||
|
||||
include $(TOOLS_PATH)/helper.mk
|
@@ -1,21 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 1989 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms are permitted
|
||||
* provided that the above copyright notice and this paragraph are
|
||||
* duplicated in all such forms and that any documentation,
|
||||
* advertising materials, and other materials related to such
|
||||
* distribution and use acknowledge that the software was developed
|
||||
* by the University of California, Berkeley. The name of the
|
||||
* University may not be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* %W% (Berkeley) %G%
|
||||
*/
|
||||
|
||||
#define _PATH_TMP "/tmp/ftpXXXXXX"
|
||||
#define _PATH_BSHELL "/bin/sh"
|
@@ -1,32 +0,0 @@
|
||||
|
||||
int getreply(int expecteof);
|
||||
int ruserpass(char *host, char **aname, char **apass, char **aacct);
|
||||
char *getpass(const char *prompt);
|
||||
void makeargv(void);
|
||||
void domacro(int argc, char *argv[]);
|
||||
void proxtrans(char *cmd, char *local, char *remote);
|
||||
int null(void);
|
||||
int initconn(void);
|
||||
void disconnect(void);
|
||||
void ptransfer(char *direction, long bytes, struct timeval *t0, struct timeval *t1);
|
||||
void setascii(void);
|
||||
void setbinary(void);
|
||||
void setebcdic(void);
|
||||
void settenex(void);
|
||||
void tvsub(struct timeval *tdiff, struct timeval *t1, struct timeval *t0);
|
||||
void setpassive(int argc, char *argv[]);
|
||||
void setpeer(int argc, char *argv[]);
|
||||
void cmdscanner(int top);
|
||||
void pswitch(int flag);
|
||||
void quit(void);
|
||||
int login(char *host);
|
||||
int command(char *fmt, ...);
|
||||
int globulize(char **cpp);
|
||||
void sendrequest(char *cmd, char *local, char *remote, int printnames);
|
||||
void recvrequest(char *cmd, char *local, char *remote, char *mode,
|
||||
int printnames);
|
||||
int confirm(char *cmd, char *file);
|
||||
void blkfree(char **av0);
|
||||
int getit(int argc, char *argv[], int restartit, char *mode);
|
||||
static int token(void);
|
||||
int sleep(int time);
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user