Clean up deleted files.
This commit is contained in:
parent
4f19355481
commit
c31ecef064
|
@ -1,339 +0,0 @@
|
|||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
||||
675 Mass Ave, Cambridge, MA 02139, USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Library General Public License instead.) You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, 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 or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. You must make sure that they, too, receive or can get the
|
||||
source code. And you must show them these terms so they know their
|
||||
rights.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that redistributors of a free
|
||||
program will individually obtain patent licenses, in effect making the
|
||||
program proprietary. To prevent this, we have made it clear that any
|
||||
patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The "Program", below,
|
||||
refers to any such program or work, and a "work based on the Program"
|
||||
means either the Program or any derivative work under copyright law:
|
||||
that is to say, a work containing the Program or a portion of it,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's
|
||||
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 give any other recipients of the Program a copy of this License
|
||||
along with the Program.
|
||||
|
||||
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 Program or any portion
|
||||
of it, thus forming a work based on the Program, 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) You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
|
||||
c) If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
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 Program, 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 Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program
|
||||
with the Program (or with a work based on the Program) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) 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; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, 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 executable. However, as a
|
||||
special exception, the source code 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.
|
||||
|
||||
If distribution of executable or 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 counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program 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.
|
||||
|
||||
5. 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 Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program 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 to
|
||||
this License.
|
||||
|
||||
7. 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 Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program 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 Program.
|
||||
|
||||
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.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program 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.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions
|
||||
of the 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 Program
|
||||
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 Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, 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
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||
PROVIDE THE PROGRAM "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 PROGRAM IS WITH YOU. SHOULD THE
|
||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||
REPAIR OR CORRECTION.
|
||||
|
||||
12. 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 PROGRAM 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 PROGRAM (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 PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
Appendix: How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. 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 program's name and a brief idea of what it does.>
|
||||
Copyright (C) 19yy <name of author>
|
||||
|
||||
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.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program is interactive, make it output a short notice like this
|
||||
when it starts in an interactive mode:
|
||||
|
||||
Gnomovision version 69, Copyright (C) 19yy name of author
|
||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, the commands you use may
|
||||
be called something other than `show w' and `show c'; they could even be
|
||||
mouse-clicks or menu items--whatever suits your program.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1989
|
||||
Ty Coon, President of Vice
|
||||
|
||||
This General Public License does not permit incorporating your program into
|
||||
proprietary programs. If your program is a subroutine library, you may
|
||||
consider it more useful to permit linking proprietary applications with the
|
||||
library. If this is what you want to do, use the GNU Library General
|
||||
Public License instead of this License.
|
File diff suppressed because it is too large
Load Diff
|
@ -1,14 +0,0 @@
|
|||
PROG= tar
|
||||
SRCS= buffer.c create.c diffarch.c extract.c fnmatch.c getdate.y \
|
||||
getoldopt.c getopt.c getopt1.c gnu.c list.c mangle.c names.c port.c \
|
||||
regex.c rtapelib.c tar.c update.c version.c
|
||||
CFLAGS+= -DRETSIGTYPE=void -DDIRENT=1 -DHAVE_SYS_MTIO_H=1 -DHAVE_UNISTD_H=1
|
||||
CFLAGS+= -DHAVE_GETGRGID=1 -DHAVE_GETPWUID=1 -DHAVE_STRING_H=1
|
||||
CFLAGS+= -DHAVE_LIMITS_H=1 -DHAVE_STRSTR=1 -DHAVE_VALLOC=1 -DHAVE_MKDIR=1
|
||||
CFLAGS+= -DHAVE_MKNOD=1 -DHAVE_RENAME=1 -DHAVE_FTRUNCATE=1 -DHAVE_GETCWD=1
|
||||
CFLAGS+= -DHAVE_VPRINTF=1 -DNEEDPAD -I${.CURDIR}
|
||||
CFLAGS+= -DDEF_AR_FILE=\"/dev/rst0\" -DDEFBLOCKING=20
|
||||
NOMAN=noman
|
||||
CLEANFILES+=y.tab.h
|
||||
|
||||
.include <bsd.prog.mk>
|
|
@ -1,185 +0,0 @@
|
|||
# Generated automatically from Makefile.in by configure.
|
||||
# Un*x Makefile for GNU tar program.
|
||||
# Copyright (C) 1991, 1992, 1993 Free Software Foundation, Inc.
|
||||
|
||||
# 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, 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.
|
||||
|
||||
#### Start of system configuration section. ####
|
||||
|
||||
srcdir = .
|
||||
VPATH = .
|
||||
|
||||
# If you use gcc, you should either run the fixincludes script that
|
||||
# comes with it or else use gcc with the -traditional option. Otherwise
|
||||
# ioctl calls will be compiled incorrectly on some systems.
|
||||
CC = gcc
|
||||
YACC = bison -y
|
||||
INSTALL = /usr/local/bin/install -c
|
||||
INSTALL_PROGRAM = $(INSTALL)
|
||||
INSTALL_DATA = $(INSTALL) -m 644
|
||||
|
||||
# Things you might add to DEFS:
|
||||
# -DSTDC_HEADERS If you have ANSI C headers and libraries.
|
||||
# -DHAVE_UNISTD_H If you have unistd.h.
|
||||
# -DHAVE_STRING_H If you don't have ANSI C headers but have string.h.
|
||||
# -DHAVE_LIMITS_H If you have limits.h.
|
||||
# -DBSD42 If you have sys/dir.h (unless you use -DPOSIX),
|
||||
# sys/file.h, and st_blocks in `struct stat'.
|
||||
# -DDIRENT If you have dirent.h.
|
||||
# -DSYSNDIR Old Xenix systems (sys/ndir.h).
|
||||
# -DSYSDIR Old BSD systems (sys/dir.h).
|
||||
# -DNDIR Old System V systems (ndir.h).
|
||||
# -DMAJOR_IN_MKDEV If major, minor, makedev defined in sys/mkdev.h.
|
||||
# -DMAJOR_IN_SYSMACROS If major, minor, makedev defined in sys/sysmacros.h.
|
||||
# -DRETSIGTYPE=int If your signal handlers return int, not void.
|
||||
# -DHAVE_SYS_MTIO_H If you have sys/mtio.h (magtape ioctls).
|
||||
# -DHAVE_SYS_GENTAPE_H If you have sys/gentape.h (ISC magtape ioctls).
|
||||
# -DHAVE_NETDB_H To use rexec for remote tape operations
|
||||
# instead of forking rsh or remsh.
|
||||
# -DNO_REMOTE If you have neither a remote shell nor rexec.
|
||||
# -DHAVE_VPRINTF If you have vprintf function.
|
||||
# -DHAVE_DOPRNT If you have _doprnt function (but lack vprintf).
|
||||
# -DHAVE_FTIME If you have ftime system call.
|
||||
# -DHAVE_STRSTR If you have strstr function.
|
||||
# -DHAVE_VALLOC If you have valloc function.
|
||||
# -DHAVE_MKDIR If you have mkdir and rmdir system calls.
|
||||
# -DHAVE_MKNOD If you have mknod system call.
|
||||
# -DHAVE_RENAME If you have rename system call.
|
||||
# -DHAVE_GETCWD If not POSIX.1 but have getcwd function.
|
||||
# -DHAVE_FTRUNCATE If you have ftruncate system call.
|
||||
# -DV7 On Version 7 Unix (not tested in a long time).
|
||||
# -DEMUL_OPEN3 If you lack a 3-argument version of open, and want
|
||||
# to emulate it with system calls you do have.
|
||||
# -DNO_OPEN3 If you lack the 3-argument open and want to
|
||||
# disable the tar -k option instead of emulating open.
|
||||
# -DXENIX If you have sys/inode.h and need it to be included.
|
||||
|
||||
DEF_AR_FILE = /dev/rst0
|
||||
DEFBLOCKING = 20
|
||||
DEFS = -DRETSIGTYPE=void -DDIRENT=1 -DHAVE_SYS_MTIO_H=1 -DHAVE_UNISTD_H=1 -DHAVE_GETGRGID=1 -DHAVE_GETPWUID=1 -DHAVE_STRING_H=1 -DHAVE_LIMITS_H=1 -DHAVE_STRSTR=1 -DHAVE_VALLOC=1 -DHAVE_MKDIR=1 -DHAVE_MKNOD=1 -DHAVE_RENAME=1 -DHAVE_FTRUNCATE=1 -DHAVE_GETCWD=1 -DHAVE_VPRINTF=1 -DDEF_AR_FILE=\"$(DEF_AR_FILE)\" -DDEFBLOCKING=$(DEFBLOCKING)
|
||||
|
||||
# Set this to rtapelib.o unless you defined NO_REMOTE, in which case
|
||||
# make it empty.
|
||||
RTAPELIB = rtapelib.o
|
||||
LIBS =
|
||||
|
||||
CFLAGS = -g
|
||||
LDFLAGS = -g
|
||||
|
||||
prefix = /usr/bin
|
||||
exec_prefix = $(prefix)
|
||||
|
||||
# Prefix for each installed program, normally empty or `g'.
|
||||
binprefix =
|
||||
|
||||
# The directory to install tar in.
|
||||
bindir = $(exec_prefix)/bin
|
||||
|
||||
# Where to put the rmt executable.
|
||||
libdir = /sbin
|
||||
|
||||
# The directory to install the info files in.
|
||||
infodir = $(prefix)/info
|
||||
|
||||
#### End of system configuration section. ####
|
||||
|
||||
SHELL = /bin/sh
|
||||
|
||||
SRC1 = tar.c create.c extract.c buffer.c getoldopt.c update.c gnu.c mangle.c
|
||||
SRC2 = version.c list.c names.c diffarch.c port.c fnmatch.c getopt.c malloc.c
|
||||
SRC3 = getopt1.c regex.c getdate.y getdate.c alloca.c
|
||||
SRCS = $(SRC1) $(SRC2) $(SRC3)
|
||||
OBJ1 = tar.o create.o extract.o buffer.o getoldopt.o update.o gnu.o mangle.o
|
||||
OBJ2 = version.o list.o names.o diffarch.o port.o fnmatch.o getopt.o
|
||||
OBJ3 = getopt1.o regex.o getdate.o $(RTAPELIB)
|
||||
OBJS = $(OBJ1) $(OBJ2) $(OBJ3)
|
||||
AUX = README INSTALL NEWS COPYING ChangeLog Makefile.in makefile.pc \
|
||||
configure configure.in \
|
||||
tar.h fnmatch.h pathmax.h port.h open3.h getopt.h regex.h \
|
||||
rmt.h rmt.c rtapelib.c \
|
||||
msd_dir.h msd_dir.c tcexparg.c \
|
||||
level-0 level-1 backup-specs dump-remind getpagesize.h
|
||||
# tar.texinfo tar.info* texinfo.tex \
|
||||
|
||||
all: tar rmt
|
||||
# tar.info
|
||||
|
||||
.c.o:
|
||||
$(CC) -c $(CFLAGS) $(CPPFLAGS) $(DEFS) -I$(srcdir) -I. $<
|
||||
|
||||
tar: $(OBJS)
|
||||
$(CC) $(LDFLAGS) -o $@ $(OBJS) $(LIBS)
|
||||
|
||||
rmt: rmt.c
|
||||
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(srcdir)/rmt.c $(LIBS)
|
||||
|
||||
tar.info: tar.texinfo
|
||||
makeinfo $(srcdir)/tar.texinfo
|
||||
|
||||
install: all
|
||||
$(INSTALL_PROGRAM) tar $(bindir)/$(binprefix)tar
|
||||
-test ! -f rmt || $(INSTALL_PROGRAM) rmt $(libdir)/rmt
|
||||
# for file in $(srcdir)/tar.info*; \
|
||||
# do $(INSTALL_DATA) $$file $(infodir)/$$file; \
|
||||
# done
|
||||
|
||||
uninstall:
|
||||
rm -f $(bindir)/$(binprefix)tar $(infodir)/tar.info*
|
||||
-rm -f $(libdir)/rmt
|
||||
|
||||
$(OBJS): tar.h pathmax.h port.h
|
||||
regex.o buffer.o tar.o: regex.h
|
||||
tar.o fnmatch.o: fnmatch.h
|
||||
|
||||
getdate.c: getdate.y
|
||||
$(YACC) $(srcdir)/getdate.y
|
||||
mv y.tab.c getdate.c
|
||||
# getdate.y has 8 shift/reduce conflicts.
|
||||
|
||||
TAGS: $(SRCS)
|
||||
etags $(SRCS)
|
||||
|
||||
clean:
|
||||
rm -f *.o tar rmt core
|
||||
mostlyclean: clean
|
||||
|
||||
distclean: clean
|
||||
rm -f Makefile config.status
|
||||
|
||||
realclean: distclean
|
||||
rm -f TAGS *.info* getdate.c y.tab.c
|
||||
|
||||
shar: $(SRCS) $(AUX)
|
||||
shar $(SRCS) $(AUX) | gzip > tar-`sed -e '/version_string/!d' -e 's/[^0-9.]*\([0-9.]*\).*/\1/' -e q version.c`.shar.z
|
||||
|
||||
dist: $(SRCS) $(AUX)
|
||||
echo tar-`sed -e '/version_string/!d' -e 's/[^0-9.]*\([0-9.]*\).*/\1/' -e q version.c` > .fname
|
||||
-rm -rf `cat .fname`
|
||||
mkdir `cat .fname`
|
||||
for file in $(SRCS) $(AUX); do \
|
||||
ln $$file `cat .fname` || cp $$file `cat .fname`; done
|
||||
tar chzf `cat .fname`.tar.z `cat .fname`
|
||||
-rm -rf `cat .fname` .fname
|
||||
|
||||
tar.zoo: $(SRCS) $(AUX)
|
||||
-rm -rf tmp.dir
|
||||
-mkdir tmp.dir
|
||||
-rm tar.zoo
|
||||
for X in $(SRCS) $(AUX) ; do echo $$X ; sed 's/$$/
/' $$X > tmp.dir/$$X ; done
|
||||
cd tmp.dir ; zoo aM ../tar.zoo *
|
||||
-rm -rf tmp.dir
|
||||
|
||||
# Prevent GNU make v3 from overflowing arg limit on SysV.
|
||||
.NOEXPORT:
|
|
@ -1,40 +0,0 @@
|
|||
Hey! Emacs! Yo! This is -*- Text -*- !!!
|
||||
|
||||
This GNU tar 1.11.2. Please send bug reports, etc., to
|
||||
bug-gnu-utils@prep.ai.mit.edu. This is a beta-test release. Please
|
||||
try it out. There is no manual; the release of version 1.12 will
|
||||
contain a manual.
|
||||
|
||||
GNU tar is based heavily on John Gilmore's public domain tar, but with
|
||||
added features. The manual is currently being written.
|
||||
|
||||
This distribution also includes rmt, the remote tape server (which
|
||||
normally must reside in /etc). The mt tape drive control program is
|
||||
in the GNU cpio distribution.
|
||||
|
||||
See the file INSTALL for compilation and installation instructions for Unix.
|
||||
See the file NEWS for information on all that is new in this version
|
||||
of tar.
|
||||
|
||||
makefile.pc is a makefile for Turbo C 2.0 on MS-DOS.
|
||||
|
||||
Various people have been having problems using floppies on a NeXT. In
|
||||
order to have them work right, you need to kill the automounting
|
||||
program which tries to monut floppies as soon as they are added.
|
||||
|
||||
If you want to do incremental dumps, use the distributed backup
|
||||
scripts. They are what we use at the FSF to do all our backups. Most
|
||||
importantly, do not use --incremental (-G) or --after-date (-N) or
|
||||
--newer-mtime to do incremental dumps. The only option that works
|
||||
correctly for this purpose is --listed-incremental. (When extracting
|
||||
incremental dumps, use --incremental (-G).)
|
||||
|
||||
If your system needs to link with -lPW to get alloca, but has
|
||||
rename in the C library (so HAVE_RENAME is defined), -lPW might
|
||||
give you an incorrect version of rename. On HP-UX this manifests
|
||||
itself as an undefined data symbol called "Error" when linking cp, ln,
|
||||
and mv. If this happens, use `ar x' to extract alloca.o from libPW.a
|
||||
and `ar rc' to put it in a library liballoca.a, and put that in LIBS
|
||||
instead of -lPW. This problem does not occur when using gcc, which
|
||||
has alloca built in.
|
||||
|
File diff suppressed because it is too large
Load Diff
|
@ -1,316 +0,0 @@
|
|||
# Makefile for GNU tar program.
|
||||
|
||||
SHELL = /bin/sh
|
||||
|
||||
# In order to disable remote-tape support, add -DNO_REMOTE to the
|
||||
# appropriate DEFS line, and remove rtape_lib.* from LOCAL_{SRC,OBJ}
|
||||
# For Ultrix 3.1, you will have to compile rtape_lib.c with -DUSG.
|
||||
# Add -DUSE_REXEC to use rexec for remote tape operations
|
||||
# instead of forking rsh or remsh.
|
||||
#
|
||||
# If tar fails to properly print error msgs, or core-dumps doing same,
|
||||
# you may need to change which version of msg...() you are using.
|
||||
# To do so, add one of the following to your DEFS= line
|
||||
# -DSTDC_MSG If you are using an ANSI compiler, and have vfprintf().
|
||||
# -DVARARGS_MSG If you have varargs.h and vfprintf()
|
||||
# -DDOPRNT_MSG If you have _doprnt(), and no useful varargs support
|
||||
# -DLOSING_MSG If nothing else works.
|
||||
#
|
||||
# Some non-BSD systems may have to add -DNEED_TZSET in order to have getdate.y
|
||||
# compile correctly.
|
||||
#
|
||||
# If you have a system V system which defines size_t, add -DHAVE_SIZE_T.
|
||||
# If you have a system which defines strstr, add -DHAVE_STRSTR.
|
||||
#
|
||||
# If you can't use remote tar with the rmt library, you can still get
|
||||
# some stuff to work right by adding -DUSE_REXEC.
|
||||
#
|
||||
# Some people's systems define a prototype for signal handlers which
|
||||
# require them to be declared as void. If you get such problems in
|
||||
# rtape_lib, function command, then define -DSIGNAL_VOID.
|
||||
#
|
||||
# getdate.y has 8 shift/reduce conflicts.
|
||||
#
|
||||
# In addition to setting DEFS appropriately for your system, you might
|
||||
# have to hand edit the #defines and #undefs in port.c.
|
||||
#
|
||||
|
||||
## GNU version
|
||||
#DEFS = -DBSD42
|
||||
#LOCAL_SRC =
|
||||
#LOCAL_OBJ =
|
||||
#LDFLAGS =
|
||||
#LIBS = -lutils
|
||||
#LINT = lint
|
||||
#LINTFLAGS = -abchx
|
||||
#DEF_AR_FILE = \"-\"
|
||||
#DEFBLOCKING = 20
|
||||
#O = o
|
||||
|
||||
## Berserkeley version
|
||||
CC=gcc
|
||||
DEFS = -DBSD42 -DSTDC_MSG -DNEED_TZSET -DUSE_REXEC
|
||||
LOCAL_SRC = getdate.y
|
||||
LOCAL_OBJ = getdate.$O
|
||||
LDFLAGS =
|
||||
LIBS =
|
||||
LINT = lint
|
||||
LINTFLAGS = -abchx
|
||||
DEF_AR_FILE = \"/dev/rmt8\"
|
||||
DEFBLOCKING = 20
|
||||
O = o
|
||||
|
||||
## Ultrix
|
||||
#CC=gcc
|
||||
#DEFS = -DBSD42 -DSIGNAL_VOID
|
||||
#LOCAL_SRC = getdate.y rtape_lib.c
|
||||
#LOCAL_OBJ = getdate.$O rtape_lib.$O
|
||||
#LDFLAGS =
|
||||
#LIBS =
|
||||
#LINT = lint
|
||||
#LINTFLAGS = -abchx
|
||||
#DEF_AR_FILE = \"/dev/rmt8\"
|
||||
#DEFBLOCKING = 20
|
||||
#O = o
|
||||
|
||||
# HPUX 7.0 version
|
||||
#DEFS = -DBSD42 -Dhpux -DVARARGS_MSG
|
||||
#LOCAL_SRC = getdate.y rtape_lib.c
|
||||
#LOCAL_OBJ = getdate.$O rtape_lib.$O alloca.$O
|
||||
#LDFLAGS =
|
||||
#LIBS = -lBSD
|
||||
#LINT = lint
|
||||
#LINTFLAGS = -abchx
|
||||
#DEF_AR_FILE = \"/dev/rct/c3d0s2\"
|
||||
#DEFBLOCKING = 20
|
||||
#O = o
|
||||
|
||||
# IBM AIX version -- this saves "hidden" directories, but doesn't restore
|
||||
# them as hidden. Add -Di386 for a PS/2. If you don't have GCC, turn it off.
|
||||
# Some people think you need -lbsd, some don't. Dunno.
|
||||
#CC=gcc
|
||||
#DEFS= -DUSG -Daix -DSTDC_MSG -DHAVE_MTIO -DHAVE_SIZE_T -DSIGNAL_VOID
|
||||
#LOCAL_SRC = getdate.y rtape_lib.c
|
||||
#LOCAL_OBJ = getdate.$O rtape_lib.$O
|
||||
#LDFLAGS =
|
||||
#LIBS = -lbsd
|
||||
#LINT = lint
|
||||
#LINTFLAGS = -p
|
||||
#DEF_AR_FILE = \"/dev/rmt0\"
|
||||
#DEFBLOCKING = 20
|
||||
#O = o
|
||||
|
||||
# USG version
|
||||
# Add -DNDIR to DEFS if your system uses ndir.h instead of dirent.h
|
||||
# Add -DDIRECT to DEFS if your system uses 'struct direct' instead of
|
||||
# 'struct dirent' (this is the case at least with one add-on ndir
|
||||
# library)
|
||||
# Add -DHAVE_MTIO to DEFS if your system has sys/mtio.h and defines MTIOCTOP
|
||||
# Add -DDAYLIGHT_MISSING to DEFS if your system doesn't define the
|
||||
# external variable `daylight'.
|
||||
# Add -lndir to LIBS if your ndir routines aren't in libc.a
|
||||
# Add -lPW to LIBS if you don't compile with gcc (to get alloca)
|
||||
#DEFS = -DUSG -DSIGNAL_VOID #-DNDIR -DDIRECT -DHAVE_MTIO
|
||||
#LOCAL_SRC = getdate.y rtape_lib.c
|
||||
#LOCAL_OBJ = getdate.$O rtape_lib.$O
|
||||
#LDFLAGS =
|
||||
#LIBS = #-lndir -lPW
|
||||
#LINT = lint
|
||||
#LINTFLAGS = -p
|
||||
#DEF_AR_FILE = \"/dev/rmt8\"
|
||||
#DEFBLOCKING = 20
|
||||
#O = o
|
||||
|
||||
# UniSoft's Uniplus SVR2 with NFS
|
||||
#DEFS = -DUSG -DUNIPLUS -DNFS -DSVR2 -DSIGNAL_VOID
|
||||
#LOCAL_SRC = getdate.y rtape_lib.c
|
||||
#LOCAL_OBJ = getdate.$O rtape_lib.$O
|
||||
#LDFLAGS =
|
||||
#LIBS = -lndir
|
||||
#LINT = lint
|
||||
#LINTFLAGS = -bx
|
||||
#DEF_AR_FILE = \"/dev/rmt8\"
|
||||
#DEFBLOCKING = 20
|
||||
#O = o
|
||||
|
||||
# MASSCOMP version
|
||||
#CC = ucb cc
|
||||
#DEFS = -DBSD42
|
||||
#LOCAL_SRC = getdate.y rtape_lib.c
|
||||
#LOCAL_OBJ = getdate.$O rtape_lib.$O
|
||||
#LDFLAGS =
|
||||
#LIBS =
|
||||
#LINT = lint
|
||||
#LINTFLAGS = -bx
|
||||
#DEF_AR_FILE = \"/dev/rmt0\"
|
||||
#DEFBLOCKING = 20
|
||||
#O = o
|
||||
|
||||
# (yuk) MS-DOS (Microsoft C 4.0) version
|
||||
#MODEL = S
|
||||
#DEFS = -DNONAMES -A$(MODEL) -DNO_REMOTE
|
||||
#LOCAL_SRC = getdate.y rtape_lib.c
|
||||
#LOCAL_OBJ = getdate.$O rtape_lib.$O
|
||||
#LDFLAGS =
|
||||
#LIBS = $(MODEL)dir.lib
|
||||
#LINT = $(CC)
|
||||
#LINTFLAGS = -W3
|
||||
#DEF_AR_FILE = \"tar.out\"
|
||||
#DEFBLOCKING = 20
|
||||
#O = obj
|
||||
|
||||
# V7 version
|
||||
# Pick open3 emulation or nonexistence. See open3.h, port.c.
|
||||
##DEFS = -DV7 -DEMUL_OPEN3 -Dvoid=int
|
||||
##DEFS = -DV7 -DNO_OPEN3 -Dvoid=int
|
||||
#LOCAL_SRC = getdate.y rtape_lib.c
|
||||
#LOCAL_OBJ = getdate.$O rtape_lib.$O
|
||||
#LDFLAGS =
|
||||
#LIBS = -lndir
|
||||
#LINT = lint
|
||||
#LINTFLAGS = -abchx
|
||||
#DEF_AR_FILE = \"/dev/rmt8\"
|
||||
#DEFBLOCKING = 20
|
||||
#O = o
|
||||
|
||||
# Minix version
|
||||
# No lint, so no lintflags. Default file is stdin/out. (Minix "tar"
|
||||
# doesn't even take an "f" flag, it assumes argv[2] is the archive name!)
|
||||
# Minix "make" doesn't expand macros right, so Minix users will have
|
||||
# to expand CFLAGS, SRCS, O, etc by hand, or fix your make. Not my problem!
|
||||
# You'll also need to come up with ctime(), the directory
|
||||
# library, and a fixed doprintf() that handles %*s. Put this stuff in
|
||||
# the "SUBSRC/SUBOBJ" macro below if you didn't put it in your C library.
|
||||
# Note that Minix "cc" produces ".s" files, not .o's, so O = s has been set.
|
||||
#
|
||||
# Pick open3 emulation or nonexistence. See open3.h, port.c.
|
||||
##DEFS = -DV7 -DMINIX -DEMUL_OPEN3
|
||||
##DEFS = -DV7 -DMINIX -DNO_OPEN3
|
||||
#LOCAL_SRC = getdate.y rtape_lib.c
|
||||
#LOCAL_OBJ = getdate.$O rtape_lib.$O
|
||||
#LDFLAGS =
|
||||
#LIBS =
|
||||
#DEF_AR_FILE = \"-\"
|
||||
#DEFBLOCKING = 8 # No good reason for this, change at will
|
||||
#O = s
|
||||
|
||||
# Xenix version
|
||||
#DEFS = -DUSG -DXENIX -DSIGNAL_VOID
|
||||
#LOCAL_SRC = getdate.y rtape_lib.c
|
||||
#LOCAL_OBJ = getdate.$O rtape_lib.$O
|
||||
#LDFLAGS =
|
||||
#LIBS = -lx
|
||||
#LINT = lint
|
||||
#LINTFLAGS = -p
|
||||
#DEF_AR_FILE = \"/dev/rmt8\"
|
||||
#DEFBLOCKING = 20
|
||||
#O = o
|
||||
|
||||
# SGI 4D version
|
||||
# You will need to define NEED_TZSET in getdate.y
|
||||
#DEFS = -DUSG -I/usr/include/bsd
|
||||
#LOCAL_SRC = getdate.y rtape_lib.c
|
||||
#LOCAL_OBJ = getdate.$O rtape_lib.$O
|
||||
#LDFLAGS =
|
||||
#LIBS = -lxmalloc
|
||||
#LINT = lint
|
||||
#LINTFLAGS = -p
|
||||
#DEF_AR_FILE = \"/dev/tape\"
|
||||
#DEFBLOCKING = 20
|
||||
#O = o
|
||||
|
||||
#CC = gcc
|
||||
#TARGET_ARCH =
|
||||
|
||||
CFLAGS = $(COPTS) $(ALLDEFS)
|
||||
ALLDEFS = $(DEFS) \
|
||||
-DDEF_AR_FILE=$(DEF_AR_FILE) \
|
||||
-DDEFBLOCKING=$(DEFBLOCKING)
|
||||
# next line for Debugging
|
||||
#COPTS = -g
|
||||
# next line for Production
|
||||
#COPTS = -O
|
||||
|
||||
# Add things here like readdir that aren't in your standard libraries.
|
||||
# (E.g. MSDOS needs msd_dir.c, msd_dir.obj)
|
||||
SUBSRC=
|
||||
SUBOBJ=
|
||||
|
||||
# Destination directory and installation program for make install
|
||||
bindir = /usr/local/gnubin
|
||||
INSTALL = cp
|
||||
RM = rm -f
|
||||
|
||||
SRC1 = tar.c create.c extract.c buffer.c getoldopt.c update.c gnu.c mangle.c
|
||||
SRC2 = version.c list.c names.c diffarch.c port.c wildmat.c getopt.c getopt1.c regex.c
|
||||
SRC3 = $(LOCAL_SRC) $(SUBSRC)
|
||||
SRCS = $(SRC1) $(SRC2) $(SRC3)
|
||||
OBJ1 = tar.$O create.$O extract.$O buffer.$O getoldopt.$O list.$O update.$O
|
||||
OBJ2 = version.$O names.$O diffarch.$O port.$O wildmat.$O getopt.$O getopt1.$O regex.$O
|
||||
OBJ3 = gnu.$O mangle.$O $(LOCAL_OBJ) $(SUBOBJ)
|
||||
OBJS = $(OBJ1) $(OBJ2) $(OBJ3)
|
||||
# AUX = README PORTING Makefile TODO tar.h port.h open3.h \
|
||||
# msd_dir.h msd_dir.c
|
||||
AUX = README COPYING ChangeLog Makefile tar.texinfo tar.h port.h open3.h \
|
||||
rmt.h msd_dir.h msd_dir.c rtape_server.c rtape_lib.c getdate.y \
|
||||
getopt.h regex.h level-0 level-1 backup-specs testpad.c
|
||||
|
||||
all: tar rmt
|
||||
|
||||
tar: $(OBJS)
|
||||
$(CC) $(LDFLAGS) -o tar $(COPTS) $(OBJS) $(LIBS)
|
||||
|
||||
rmt: rtape_server.c
|
||||
$(CC) $(CFLAGS) $(LDFLAGS) -o rmt rtape_server.c
|
||||
|
||||
testpad.h: testpad
|
||||
testpad > testpad.h
|
||||
|
||||
testpad: testpad.o
|
||||
$(CC) -o testpad testpad.o
|
||||
|
||||
# command is too long for Messy-Dos (128 char line length limit) so
|
||||
# this kludge is used...
|
||||
# @echo $(OBJ1) + > command
|
||||
# @echo $(OBJ2) >> command
|
||||
# link @command, $@,,$(LIBS) /NOI;
|
||||
# @$(RM) command
|
||||
|
||||
install: all
|
||||
$(RM) $(bindir)/tar
|
||||
$(INSTALL) tar $(bindir)/tar
|
||||
$(INSTALL) rmt /etc/rmt
|
||||
|
||||
lint: $(SRCS)
|
||||
$(LINT) $(LINTFLAGS) $(ALLDEFS) $(SRCS)
|
||||
|
||||
TAGS: $(SRCS)
|
||||
etags $(SRCS)
|
||||
|
||||
clean:
|
||||
$(RM) errs $(OBJS) tar rmt testpad.o testpad testpad.h
|
||||
|
||||
distclean: clean
|
||||
|
||||
realclean: clean
|
||||
|
||||
shar: $(SRCS) $(AUX)
|
||||
shar $(SRCS) $(AUX) | compress > tar-`sed -e '/version_string/!d' -e 's/[^0-9.]*\([0-9.]*\).*/\1/' -e q version.c`.shar.Z
|
||||
|
||||
dist: $(SRC1) $(SRC2) $(AUX)
|
||||
echo tar-`sed -e '/version_string/!d' -e 's/[^0-9.]*\([0-9.]*\).*/\1/' -e q < version.c` > .fname
|
||||
-rm -rf `cat .fname`
|
||||
mkdir `cat .fname`
|
||||
ln $(SRC1) $(SRC2) $(AUX) `cat .fname`
|
||||
tar chZf `cat .fname`.tar.Z `cat .fname`
|
||||
-rm -rf `cat .fname` .fname
|
||||
|
||||
tar.zoo: $(SRCS) $(AUX)
|
||||
-mkdir tmp.dir
|
||||
-rm tar.zoo
|
||||
for X in $(SRCS) $(AUX) ; do echo $$X ; sed 's/$$/
/' $$X > tmp.dir/$$X ; done
|
||||
cd tmp.dir ; zoo aM ../tar.zoo *
|
||||
-rmdir tmp.dir
|
||||
|
||||
$(OBJS): tar.h port.h testpad.h
|
||||
regex.$O tar.$O: regex.h
|
|
@ -1,652 +0,0 @@
|
|||
/* Remote tape emulator subroutines.
|
||||
Copyright (C) 1988 Free Software Foundation
|
||||
|
||||
This file is part of GNU Tar.
|
||||
|
||||
GNU Tar 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 1, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU Tar 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 GNU Tar; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
|
||||
/* JF: modified to make all rmtXXX calls into macros for speed */
|
||||
|
||||
#ifndef lint
|
||||
static char *RCSid = "$Header: /cvsroot/src/gnu/usr.bin/tar/Attic/rtape_lib.c,v 1.1.1.1 1993/03/21 09:45:37 cgd Exp $";
|
||||
#endif
|
||||
|
||||
/*
|
||||
* $Log: rtape_lib.c,v $
|
||||
* Revision 1.1.1.1 1993/03/21 09:45:37 cgd
|
||||
* initial import of 386bsd-0.1 sources
|
||||
*
|
||||
* Revision 1.7 89/03/23 14:09:51 root
|
||||
* Fix from haynes@ucscc.ucsc.edu for use w/compat. ADR.
|
||||
*
|
||||
* Revision 1.6 88/10/25 17:04:29 root
|
||||
* rexec code and a bug fix from srs!dan, miscellanious cleanup. ADR.
|
||||
*
|
||||
* Revision 1.5 88/10/25 16:30:17 root
|
||||
* Fix from jeff@gatech.edu for getting user@host:dev right. ADR.
|
||||
*
|
||||
* Revision 1.4 87/10/30 10:36:12 root
|
||||
* Made 4.2 syntax a compile time option. ADR.
|
||||
*
|
||||
* Revision 1.3 87/04/22 11:16:48 root
|
||||
* Two fixes from parmelee@wayback.cs.cornell.edu to correctly
|
||||
* do fd biasing and rmt protocol on 'S' command. ADR.
|
||||
*
|
||||
* Revision 1.2 86/10/09 16:38:53 root
|
||||
* Changed to reflect 4.3BSD rcp syntax. ADR.
|
||||
*
|
||||
* Revision 1.1 86/10/09 16:17:35 root
|
||||
* Initial revision
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* rmt --- remote tape emulator subroutines
|
||||
*
|
||||
* Originally written by Jeff Lee, modified some by Arnold Robbins
|
||||
*
|
||||
* WARNING: The man page rmt(8) for /etc/rmt documents the remote mag
|
||||
* tape protocol which rdump and rrestore use. Unfortunately, the man
|
||||
* page is *WRONG*. The author of the routines I'm including originally
|
||||
* wrote his code just based on the man page, and it didn't work, so he
|
||||
* went to the rdump source to figure out why. The only thing he had to
|
||||
* change was to check for the 'F' return code in addition to the 'E',
|
||||
* and to separate the various arguments with \n instead of a space. I
|
||||
* personally don't think that this is much of a problem, but I wanted to
|
||||
* point it out.
|
||||
* -- Arnold Robbins
|
||||
*
|
||||
* Redone as a library that can replace open, read, write, etc, by
|
||||
* Fred Fish, with some additional work by Arnold Robbins.
|
||||
*/
|
||||
|
||||
/* Use -DUSE_REXEC for rexec code, courtesy of Dan Kegel, srs!dan */
|
||||
|
||||
#if defined(USG) && !defined(HAVE_MTIO)
|
||||
#define NO_RMTIOCTL
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <signal.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#ifndef NO_RMTIOCTL
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/mtio.h>
|
||||
#endif
|
||||
|
||||
#ifdef USE_REXEC
|
||||
#include <netdb.h>
|
||||
#endif
|
||||
|
||||
#include <errno.h>
|
||||
#include <setjmp.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#define BUFMAGIC 64 /* a magic number for buffer sizes */
|
||||
|
||||
/*
|
||||
* MAXUNIT --- Maximum number of remote tape file units
|
||||
*/
|
||||
#define MAXUNIT 4
|
||||
|
||||
/*
|
||||
* READ --- Return the number of the read side file descriptor
|
||||
* WRITE --- Return the number of the write side file descriptor
|
||||
*/
|
||||
#define READ(fd) (Ctp[fd][0])
|
||||
#define WRITE(fd) (Ptc[fd][1])
|
||||
|
||||
static int Ctp[MAXUNIT][2] = { -1, -1, -1, -1, -1, -1, -1, -1 };
|
||||
static int Ptc[MAXUNIT][2] = { -1, -1, -1, -1, -1, -1, -1, -1 };
|
||||
|
||||
extern int errno;
|
||||
|
||||
char *__rmt_path;
|
||||
|
||||
/*
|
||||
* _rmt_panic --- close off a remote tape connection
|
||||
*/
|
||||
|
||||
static void _rmt_panic(fildes)
|
||||
int fildes;
|
||||
{
|
||||
close(READ(fildes));
|
||||
close(WRITE(fildes));
|
||||
READ(fildes) = -1;
|
||||
WRITE(fildes) = -1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* command --- attempt to perform a remote tape command
|
||||
*/
|
||||
|
||||
static int command(fildes, buf)
|
||||
int fildes;
|
||||
char *buf;
|
||||
{
|
||||
register int blen;
|
||||
#ifdef SIGNAL_VOID
|
||||
void (*pstat)();
|
||||
#else
|
||||
int (*pstat)();
|
||||
#endif
|
||||
|
||||
/*
|
||||
* save current pipe status and try to make the request
|
||||
*/
|
||||
|
||||
blen = strlen(buf);
|
||||
pstat = signal(SIGPIPE, SIG_IGN);
|
||||
if (write(WRITE(fildes), buf, blen) == blen)
|
||||
{
|
||||
signal(SIGPIPE, pstat);
|
||||
return(0);
|
||||
}
|
||||
|
||||
/*
|
||||
* something went wrong. close down and go home
|
||||
*/
|
||||
|
||||
signal(SIGPIPE, pstat);
|
||||
_rmt_panic(fildes);
|
||||
|
||||
errno = EIO;
|
||||
return(-1);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* status --- retrieve the status from the pipe
|
||||
*/
|
||||
|
||||
static int status(fildes)
|
||||
int fildes;
|
||||
{
|
||||
int i;
|
||||
char c, *cp;
|
||||
char buffer[BUFMAGIC];
|
||||
|
||||
/*
|
||||
* read the reply command line
|
||||
*/
|
||||
|
||||
for (i = 0, cp = buffer; i < BUFMAGIC; i++, cp++)
|
||||
{
|
||||
if (read(READ(fildes), cp, 1) != 1)
|
||||
{
|
||||
_rmt_panic(fildes);
|
||||
errno = EIO;
|
||||
return(-1);
|
||||
}
|
||||
if (*cp == '\n')
|
||||
{
|
||||
*cp = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (i == BUFMAGIC)
|
||||
{
|
||||
_rmt_panic(fildes);
|
||||
errno = EIO;
|
||||
return(-1);
|
||||
}
|
||||
|
||||
/*
|
||||
* check the return status
|
||||
*/
|
||||
|
||||
for (cp = buffer; *cp; cp++)
|
||||
if (*cp != ' ')
|
||||
break;
|
||||
|
||||
if (*cp == 'E' || *cp == 'F')
|
||||
{
|
||||
errno = atoi(cp + 1);
|
||||
while (read(READ(fildes), &c, 1) == 1)
|
||||
if (c == '\n')
|
||||
break;
|
||||
|
||||
if (*cp == 'F')
|
||||
_rmt_panic(fildes);
|
||||
|
||||
return(-1);
|
||||
}
|
||||
|
||||
/*
|
||||
* check for mis-synced pipes
|
||||
*/
|
||||
|
||||
if (*cp != 'A')
|
||||
{
|
||||
_rmt_panic(fildes);
|
||||
errno = EIO;
|
||||
return(-1);
|
||||
}
|
||||
|
||||
return(atoi(cp + 1));
|
||||
}
|
||||
|
||||
#ifdef USE_REXEC
|
||||
|
||||
/*
|
||||
* _rmt_rexec
|
||||
*
|
||||
* execute /etc/rmt on a remote system using rexec().
|
||||
* Return file descriptor of bidirectional socket for stdin and stdout
|
||||
* If username is NULL, or an empty string, uses current username.
|
||||
*
|
||||
* ADR: By default, this code is not used, since it requires that
|
||||
* the user have a .netrc file in his/her home directory, or that the
|
||||
* application designer be willing to have rexec prompt for login and
|
||||
* password info. This may be unacceptable, and .rhosts files for use
|
||||
* with rsh are much more common on BSD systems.
|
||||
*/
|
||||
|
||||
static int
|
||||
_rmt_rexec(host, user)
|
||||
char *host;
|
||||
char *user; /* may be NULL */
|
||||
{
|
||||
struct servent *rexecserv;
|
||||
int save_stdin = dup(fileno(stdin));
|
||||
int save_stdout = dup(fileno(stdout));
|
||||
int tape_fd; /* Return value. */
|
||||
|
||||
/*
|
||||
* When using cpio -o < filename, stdin is no longer the tty.
|
||||
* But the rexec subroutine reads the login and the passwd on stdin,
|
||||
* to allow remote execution of the command.
|
||||
* So, reopen stdin and stdout on /dev/tty before the rexec and
|
||||
* give them back their original value after.
|
||||
*/
|
||||
if (freopen("/dev/tty", "r", stdin) == NULL)
|
||||
freopen("/dev/null", "r", stdin);
|
||||
if (freopen("/dev/tty", "w", stdout) == NULL)
|
||||
freopen("/dev/null", "w", stdout);
|
||||
|
||||
rexecserv = getservbyname("exec", "tcp");
|
||||
if (NULL == rexecserv) {
|
||||
fprintf (stderr, "? exec/tcp: service not available.");
|
||||
exit (-1);
|
||||
}
|
||||
if ((user != NULL) && *user == '\0')
|
||||
user = (char *) NULL;
|
||||
tape_fd = rexec (&host, rexecserv->s_port, user, NULL,
|
||||
"/etc/rmt", (int *)NULL);
|
||||
fclose(stdin);
|
||||
fdopen(save_stdin, "r");
|
||||
fclose(stdout);
|
||||
fdopen(save_stdout, "w");
|
||||
|
||||
return tape_fd;
|
||||
}
|
||||
#endif /* USE_REXEC */
|
||||
|
||||
/*
|
||||
* _rmt_open --- open a magtape device on system specified, as given user
|
||||
*
|
||||
* file name has the form [user@]system:/dev/????
|
||||
#ifdef COMPAT
|
||||
* file name has the form system[.user]:/dev/????
|
||||
#endif
|
||||
*/
|
||||
|
||||
#define MAXHOSTLEN 257 /* BSD allows very long host names... */
|
||||
|
||||
int __rmt_open (path, oflag, mode, bias)
|
||||
char *path;
|
||||
int oflag;
|
||||
int mode;
|
||||
int bias;
|
||||
{
|
||||
int i, rc;
|
||||
char buffer[BUFMAGIC];
|
||||
char system[MAXHOSTLEN];
|
||||
char device[BUFMAGIC];
|
||||
char login[BUFMAGIC];
|
||||
char *sys, *dev, *user;
|
||||
|
||||
sys = system;
|
||||
dev = device;
|
||||
user = login;
|
||||
|
||||
/*
|
||||
* first, find an open pair of file descriptors
|
||||
*/
|
||||
|
||||
for (i = 0; i < MAXUNIT; i++)
|
||||
if (READ(i) == -1 && WRITE(i) == -1)
|
||||
break;
|
||||
|
||||
if (i == MAXUNIT)
|
||||
{
|
||||
errno = EMFILE;
|
||||
return(-1);
|
||||
}
|
||||
|
||||
/*
|
||||
* pull apart system and device, and optional user
|
||||
* don't munge original string
|
||||
* if COMPAT is defined, also handle old (4.2) style person.site notation.
|
||||
*/
|
||||
|
||||
while (*path != '@'
|
||||
#ifdef COMPAT
|
||||
&& *path != '.'
|
||||
#endif
|
||||
&& *path != ':') {
|
||||
*sys++ = *path++;
|
||||
}
|
||||
*sys = '\0';
|
||||
path++;
|
||||
|
||||
if (*(path - 1) == '@')
|
||||
{
|
||||
(void) strcpy (user, system); /* saw user part of user@host */
|
||||
sys = system; /* start over */
|
||||
while (*path != ':') {
|
||||
*sys++ = *path++;
|
||||
}
|
||||
*sys = '\0';
|
||||
path++;
|
||||
}
|
||||
#ifdef COMPAT
|
||||
else if (*(path - 1) == '.')
|
||||
{
|
||||
while (*path != ':') {
|
||||
*user++ = *path++;
|
||||
}
|
||||
*user = '\0';
|
||||
path++;
|
||||
}
|
||||
#endif
|
||||
else
|
||||
*user = '\0';
|
||||
|
||||
while (*path) {
|
||||
*dev++ = *path++;
|
||||
}
|
||||
*dev = '\0';
|
||||
|
||||
#ifdef USE_REXEC
|
||||
/*
|
||||
* Execute the remote command using rexec
|
||||
*/
|
||||
READ(i) = WRITE(i) = _rmt_rexec(system, login);
|
||||
if (READ(i) < 0)
|
||||
return -1;
|
||||
#else
|
||||
/*
|
||||
* setup the pipes for the 'rsh' command and fork
|
||||
*/
|
||||
|
||||
if (pipe(Ptc[i]) == -1 || pipe(Ctp[i]) == -1)
|
||||
return(-1);
|
||||
|
||||
if ((rc = fork()) == -1)
|
||||
return(-1);
|
||||
|
||||
if (rc == 0)
|
||||
{
|
||||
close(0);
|
||||
dup(Ptc[i][0]);
|
||||
close(Ptc[i][0]); close(Ptc[i][1]);
|
||||
close(1);
|
||||
dup(Ctp[i][1]);
|
||||
close(Ctp[i][0]); close(Ctp[i][1]);
|
||||
(void) setuid (getuid ());
|
||||
(void) setgid (getgid ());
|
||||
if (*login)
|
||||
{
|
||||
execl("/usr/ucb/rsh", "rsh", system, "-l", login,
|
||||
"/etc/rmt", (char *) 0);
|
||||
execl("/usr/bin/remsh", "remsh", system, "-l", login,
|
||||
"/etc/rmt", (char *) 0);
|
||||
execl("/usr/bin/rsh", "rsh", system, "-l", login,
|
||||
"/etc/rmt", (char *) 0);
|
||||
execl("/usr/bsd/rsh", "rsh", system, "-l", login,
|
||||
"/etc/rmt", (char *)0);
|
||||
execl("/usr/bin/nsh", "nsh", system, "-l", login,
|
||||
"/etc/rmt", (char *)0);
|
||||
}
|
||||
else
|
||||
{
|
||||
execl("/usr/ucb/rsh", "rsh", system,
|
||||
"/etc/rmt", (char *) 0);
|
||||
execl("/usr/bin/remsh", "remsh", system,
|
||||
"/etc/rmt", (char *) 0);
|
||||
execl("/usr/bin/rsh", "rsh", system,
|
||||
"/etc/rmt", (char *) 0);
|
||||
execl("/usr/bsd/rsh", "rsh", system,
|
||||
"/etc/rmt", (char *) 0);
|
||||
execl("/usr/bin/nsh", "nsh", system,
|
||||
"/etc/rmt", (char *)0);
|
||||
}
|
||||
|
||||
/*
|
||||
* bad problems if we get here
|
||||
*/
|
||||
|
||||
perror("remote shell exec");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
close(Ptc[i][0]); close(Ctp[i][1]);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* now attempt to open the tape device
|
||||
*/
|
||||
|
||||
sprintf(buffer, "O%s\n%d\n", device, oflag);
|
||||
if (command(i, buffer) == -1 || status(i) == -1)
|
||||
return(-1);
|
||||
|
||||
return(i+bias);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* _rmt_close --- close a remote magtape unit and shut down
|
||||
*/
|
||||
|
||||
int __rmt_close(fildes)
|
||||
int fildes;
|
||||
{
|
||||
int rc;
|
||||
|
||||
if (command(fildes, "C\n") != -1)
|
||||
{
|
||||
rc = status(fildes);
|
||||
|
||||
_rmt_panic(fildes);
|
||||
return(rc);
|
||||
}
|
||||
|
||||
return(-1);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* _rmt_read --- read a buffer from a remote tape
|
||||
*/
|
||||
|
||||
int __rmt_read(fildes, buf, nbyte)
|
||||
int fildes;
|
||||
char *buf;
|
||||
unsigned int nbyte;
|
||||
{
|
||||
int rc, i;
|
||||
char buffer[BUFMAGIC];
|
||||
|
||||
sprintf(buffer, "R%d\n", nbyte);
|
||||
if (command(fildes, buffer) == -1 || (rc = status(fildes)) == -1)
|
||||
return(-1);
|
||||
|
||||
for (i = 0; i < rc; i += nbyte, buf += nbyte)
|
||||
{
|
||||
nbyte = read(READ(fildes), buf, rc);
|
||||
if (nbyte <= 0)
|
||||
{
|
||||
_rmt_panic(fildes);
|
||||
errno = EIO;
|
||||
return(-1);
|
||||
}
|
||||
}
|
||||
|
||||
return(rc);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* _rmt_write --- write a buffer to the remote tape
|
||||
*/
|
||||
|
||||
int __rmt_write(fildes, buf, nbyte)
|
||||
int fildes;
|
||||
char *buf;
|
||||
unsigned int nbyte;
|
||||
{
|
||||
char buffer[BUFMAGIC];
|
||||
#ifdef SIGNAL_VOID
|
||||
void (*pstat)();
|
||||
#else
|
||||
int (*pstat)();
|
||||
#endif
|
||||
|
||||
sprintf(buffer, "W%d\n", nbyte);
|
||||
if (command(fildes, buffer) == -1)
|
||||
return(-1);
|
||||
|
||||
pstat = signal(SIGPIPE, SIG_IGN);
|
||||
if (write(WRITE(fildes), buf, nbyte) == nbyte)
|
||||
{
|
||||
signal (SIGPIPE, pstat);
|
||||
return(status(fildes));
|
||||
}
|
||||
|
||||
signal (SIGPIPE, pstat);
|
||||
_rmt_panic(fildes);
|
||||
errno = EIO;
|
||||
return(-1);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* _rmt_lseek --- perform an imitation lseek operation remotely
|
||||
*/
|
||||
|
||||
long __rmt_lseek(fildes, offset, whence)
|
||||
int fildes;
|
||||
long offset;
|
||||
int whence;
|
||||
{
|
||||
char buffer[BUFMAGIC];
|
||||
|
||||
sprintf(buffer, "L%d\n%d\n", offset, whence);
|
||||
if (command(fildes, buffer) == -1)
|
||||
return(-1);
|
||||
|
||||
return(status(fildes));
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* _rmt_ioctl --- perform raw tape operations remotely
|
||||
*/
|
||||
|
||||
#ifndef NO_RMTIOCTL
|
||||
__rmt_ioctl(fildes, op, arg)
|
||||
int fildes, op;
|
||||
char *arg;
|
||||
{
|
||||
char c;
|
||||
int rc, cnt;
|
||||
char buffer[BUFMAGIC];
|
||||
|
||||
/*
|
||||
* MTIOCOP is the easy one. nothing is transfered in binary
|
||||
*/
|
||||
|
||||
if (op == MTIOCTOP)
|
||||
{
|
||||
sprintf(buffer, "I%d\n%d\n", ((struct mtop *) arg)->mt_op,
|
||||
((struct mtop *) arg)->mt_count);
|
||||
if (command(fildes, buffer) == -1)
|
||||
return(-1);
|
||||
return(status(fildes));
|
||||
}
|
||||
|
||||
/*
|
||||
* we can only handle 2 ops, if not the other one, punt
|
||||
*/
|
||||
|
||||
if (op != MTIOCGET)
|
||||
{
|
||||
errno = EINVAL;
|
||||
return(-1);
|
||||
}
|
||||
|
||||
/*
|
||||
* grab the status and read it directly into the structure
|
||||
* this assumes that the status buffer is (hopefully) not
|
||||
* padded and that 2 shorts fit in a long without any word
|
||||
* alignment problems, ie - the whole struct is contiguous
|
||||
* NOTE - this is probably NOT a good assumption.
|
||||
*/
|
||||
|
||||
if (command(fildes, "S") == -1 || (rc = status(fildes)) == -1)
|
||||
return(-1);
|
||||
|
||||
for (; rc > 0; rc -= cnt, arg += cnt)
|
||||
{
|
||||
cnt = read(READ(fildes), arg, rc);
|
||||
if (cnt <= 0)
|
||||
{
|
||||
_rmt_panic(fildes);
|
||||
errno = EIO;
|
||||
return(-1);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* now we check for byte position. mt_type is a small integer field
|
||||
* (normally) so we will check its magnitude. if it is larger than
|
||||
* 256, we will assume that the bytes are swapped and go through
|
||||
* and reverse all the bytes
|
||||
*/
|
||||
|
||||
if (((struct mtget *) arg)->mt_type < 256)
|
||||
return(0);
|
||||
|
||||
for (cnt = 0; cnt < rc; cnt += 2)
|
||||
{
|
||||
c = arg[cnt];
|
||||
arg[cnt] = arg[cnt+1];
|
||||
arg[cnt+1] = c;
|
||||
}
|
||||
|
||||
return(0);
|
||||
}
|
||||
#endif /* NO_RMTIOCTL */
|
|
@ -1,151 +0,0 @@
|
|||
/* Wildcard matching routines.
|
||||
Copyright (C) 1988 Free Software Foundation
|
||||
|
||||
This file is part of GNU Tar.
|
||||
|
||||
GNU Tar 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 1, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU Tar 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 GNU Tar; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
|
||||
/*
|
||||
* @(#)wildmat.c 1.3 87/11/06
|
||||
*
|
||||
From: rs@mirror.TMC.COM (Rich Salz)
|
||||
Newsgroups: net.sources
|
||||
Subject: Small shell-style pattern matcher
|
||||
Message-ID: <596@mirror.TMC.COM>
|
||||
Date: 27 Nov 86 00:06:40 GMT
|
||||
|
||||
There have been several regular-expression subroutines and one or two
|
||||
filename-globbing routines in mod.sources. They handle lots of
|
||||
complicated patterns. This small piece of code handles the *?[]\
|
||||
wildcard characters the way the standard Unix(tm) shells do, with the
|
||||
addition that "[^.....]" is an inverse character class -- it matches
|
||||
any character not in the range ".....". Read the comments for more
|
||||
info.
|
||||
|
||||
For my application, I had first ripped off a copy of the "glob" routine
|
||||
from within the find source, but that code is bad news: it recurses
|
||||
on every character in the pattern. I'm putting this replacement in the
|
||||
public domain. It's small, tight, and iterative. Compile with -DTEST
|
||||
to get a test driver. After you're convinced it works, install in
|
||||
whatever way is appropriate for you.
|
||||
|
||||
I would like to hear of bugs, but am not interested in additions; if I
|
||||
were, I'd use the code I mentioned above.
|
||||
*/
|
||||
/*
|
||||
** Do shell-style pattern matching for ?, \, [], and * characters.
|
||||
** Might not be robust in face of malformed patterns; e.g., "foo[a-"
|
||||
** could cause a segmentation violation.
|
||||
**
|
||||
** Written by Rich $alz, mirror!rs, Wed Nov 26 19:03:17 EST 1986.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Modified 6Nov87 by John Gilmore (hoptoad!gnu) to return a "match"
|
||||
* if the pattern is immediately followed by a "/", as well as \0.
|
||||
* This matches what "tar" does for matching whole subdirectories.
|
||||
*
|
||||
* The "*" code could be sped up by only recursing one level instead
|
||||
* of two for each trial pattern, perhaps, and not recursing at all
|
||||
* if a literal match of the next 2 chars would fail.
|
||||
*/
|
||||
#define TRUE 1
|
||||
#define FALSE 0
|
||||
|
||||
|
||||
static int
|
||||
Star(s, p)
|
||||
register char *s;
|
||||
register char *p;
|
||||
{
|
||||
while (wildmat(s, p) == FALSE)
|
||||
if (*++s == '\0')
|
||||
return(FALSE);
|
||||
return(TRUE);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
wildmat(s, p)
|
||||
register char *s;
|
||||
register char *p;
|
||||
{
|
||||
register int last;
|
||||
register int matched;
|
||||
register int reverse;
|
||||
|
||||
for ( ; *p; s++, p++)
|
||||
switch (*p) {
|
||||
case '\\':
|
||||
/* Literal match with following character; fall through. */
|
||||
p++;
|
||||
default:
|
||||
if (*s != *p)
|
||||
return(FALSE);
|
||||
continue;
|
||||
case '?':
|
||||
/* Match anything. */
|
||||
if (*s == '\0')
|
||||
return(FALSE);
|
||||
continue;
|
||||
case '*':
|
||||
/* Trailing star matches everything. */
|
||||
return(*++p ? Star(s, p) : TRUE);
|
||||
case '[':
|
||||
/* [^....] means inverse character class. */
|
||||
if (reverse = p[1] == '^')
|
||||
p++;
|
||||
for (last = 0400, matched = FALSE; *++p && *p != ']'; last = *p)
|
||||
/* This next line requires a good C compiler. */
|
||||
if (*p == '-' ? *s <= *++p && *s >= last : *s == *p)
|
||||
matched = TRUE;
|
||||
if (matched == reverse)
|
||||
return(FALSE);
|
||||
continue;
|
||||
}
|
||||
|
||||
/* For "tar" use, matches that end at a slash also work. --hoptoad!gnu */
|
||||
return(*s == '\0' || *s == '/');
|
||||
}
|
||||
|
||||
|
||||
#ifdef TEST
|
||||
#include <stdio.h>
|
||||
|
||||
extern char *gets();
|
||||
|
||||
|
||||
main()
|
||||
{
|
||||
char pattern[80];
|
||||
char text[80];
|
||||
|
||||
while (TRUE) {
|
||||
printf("Enter pattern: ");
|
||||
if (gets(pattern) == NULL)
|
||||
break;
|
||||
while (TRUE) {
|
||||
printf("Enter text: ");
|
||||
if (gets(text) == NULL)
|
||||
exit(0);
|
||||
if (text[0] == '\0')
|
||||
/* Blank line; go back and get a new pattern. */
|
||||
break;
|
||||
printf(" %d\n", wildmat(text, pattern));
|
||||
}
|
||||
}
|
||||
exit(0);
|
||||
}
|
||||
#endif /* TEST */
|
Loading…
Reference in New Issue