aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2004-02-27 13:28:40 +0000
committerSergey Poznyakoff <gray@gnu.org.ua>2004-02-27 13:28:40 +0000
commita783e2c18c6b566b2f4c2b06e6c388a9645c826c (patch)
treeae12abc157dee99bd4c67bab25316be06d3519a2 /src
parentcb721df9888a296af824a4acab4916694d6dc35d (diff)
downloadcpio-a783e2c18c6b566b2f4c2b06e6c388a9645c826c.tar.gz
cpio-a783e2c18c6b566b2f4c2b06e6c388a9645c826c.tar.bz2
Added to the repository
Diffstat (limited to 'src')
-rw-r--r--src/.cvsignore11
-rw-r--r--src/Makefile.am81
-rw-r--r--src/alloca.c495
-rw-r--r--src/argmatch.c87
-rw-r--r--src/bcopy.c19
-rw-r--r--src/copyin.c1605
-rw-r--r--src/copyout.c827
-rw-r--r--src/copypass.c482
-rw-r--r--src/cpio.h69
-rw-r--r--src/cpiohdr.h90
-rw-r--r--src/defer.c46
-rw-r--r--src/defer.h25
-rw-r--r--src/dirname.c70
-rw-r--r--src/dstring.c118
-rw-r--r--src/dstring.h49
-rw-r--r--src/error.c109
-rw-r--r--src/extern.h198
-rw-r--r--src/filemode.c255
-rw-r--r--src/filetypes.h84
-rw-r--r--src/fnmatch.c200
-rw-r--r--src/fnmatch.h67
-rw-r--r--src/getopt.c765
-rw-r--r--src/getopt.h129
-rw-r--r--src/getopt1.c180
-rw-r--r--src/gettext.h68
-rw-r--r--src/global.c204
-rw-r--r--src/idcache.c210
-rw-r--r--src/main.c550
-rw-r--r--src/makepath.c311
-rw-r--r--src/mkdir.c100
-rw-r--r--src/mt.c366
-rw-r--r--src/rmt.c473
-rw-r--r--src/rmt.h98
-rw-r--r--src/rtapelib.c601
-rw-r--r--src/safe-stat.h1
-rw-r--r--src/strdup.c43
-rw-r--r--src/strerror.c63
-rw-r--r--src/stripslash.c43
-rw-r--r--src/system.h146
-rw-r--r--src/tar.c528
-rw-r--r--src/tar.h112
-rw-r--r--src/tarhdr.h62
-rw-r--r--src/userspec.c265
-rw-r--r--src/util.c1376
-rw-r--r--src/xmalloc.c103
-rw-r--r--src/xstrdup.c36
46 files changed, 11820 insertions, 0 deletions
diff --git a/src/.cvsignore b/src/.cvsignore
new file mode 100644
index 0000000..729dc3f
--- /dev/null
+++ b/src/.cvsignore
@@ -0,0 +1,11 @@
1Makefile.in
2Makefile
3.deps
4.libs
5cpio
6mt
7rmt
8.gdbinit
9*.tar.gz
10*.tar.bz2
11localedir.h
diff --git a/src/Makefile.am b/src/Makefile.am
new file mode 100644
index 0000000..1e5da40
--- /dev/null
+++ b/src/Makefile.am
@@ -0,0 +1,81 @@
1# This file is part of GNU cpio
2# Copyright (C) 2003, 2004 Free Software Foundation, Inc.
3#
4# This program is free software; you can redistribute it and/or modify
5# it under the terms of the GNU General Public License as published by
6# the Free Software Foundation; either version 2, or (at your option)
7# any later version.
8#
9# This program is distributed in the hope that it will be useful,
10# but WITHOUT ANY WARRANTY; without even the implied warranty of
11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12# GNU General Public License for more details.
13#
14# You should have received a copy of the GNU General Public License along
15# with this program; if not, write to the Free Software Foundation, Inc.,
16# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17
18bin_PROGRAMS=cpio @CPIO_MT_PROG@
19libexec_PROGRAMS=@CPIO_RMT_PROG@
20EXTRA_PROGRAMS=mt rmt
21
22cpio_SOURCES = \
23 copyin.c\
24 copyout.c\
25 copypass.c\
26 defer.c\
27 dstring.c\
28 global.c\
29 main.c\
30 tar.c\
31 util.c\
32 error.c\
33 filemode.c\
34 dirname.c\
35 idcache.c\
36 makepath.c\
37 xmalloc.c\
38 stripslash.c\
39 userspec.c\
40 xstrdup.c
41
42noinst_HEADERS =\
43 cpio.h\
44 cpiohdr.h\
45 tar.h\
46 tarhdr.h\
47 defer.h\
48 dstring.h\
49 extern.h\
50 filetypes.h\
51 gettext.h\
52 system.h\
53 rmt.h\
54 safe-stat.h\
55 fnmatch.h\
56 getopt.h
57
58cpio_LDADD = @LIBOBJS@
59
60mt_SOURCES = \
61 mt.c argmatch.c
62mt_LDADD = @LIBOBJS@
63
64rmt_SOURCES = rmt.c
65rmt_LDADD = @LIBOBJS@
66
67EXTRA_DIST=\
68 getopt.c\
69 getopt1.c\
70 bcopy.c\
71 fnmatch.c\
72 mkdir.c\
73 strdup.c
74
75localedir = $(datadir)/locale
76
77DISTCLEANFILES = localedir.h
78localedir.h : Makefile
79 echo '#define LOCALEDIR "$(localedir)"' >$@
80
81mt.o main.o: localedir.h
diff --git a/src/alloca.c b/src/alloca.c
new file mode 100644
index 0000000..7061cec
--- /dev/null
+++ b/src/alloca.c
@@ -0,0 +1,495 @@
1/* alloca.c -- allocate automatically reclaimed memory
2 (Mostly) portable public-domain implementation -- D A Gwyn
3
4 This implementation of the PWB library alloca function,
5 which is used to allocate space off the run-time stack so
6 that it is automatically reclaimed upon procedure exit,
7 was inspired by discussions with J. Q. Johnson of Cornell.
8 J.Otto Tennant <jot@cray.com> contributed the Cray support.
9
10 There are some preprocessor constants that can
11 be defined when compiling for your specific system, for
12 improved efficiency; however, the defaults should be okay.
13
14 The general concept of this implementation is to keep
15 track of all alloca-allocated blocks, and reclaim any
16 that are found to be deeper in the stack than the current
17 invocation. This heuristic does not reclaim storage as
18 soon as it becomes invalid, but it will do so eventually.
19
20 As a special case, alloca(0) reclaims storage without
21 allocating any. It is a good idea to use alloca(0) in
22 your main control loop, etc. to force garbage collection. */
23
24#ifdef HAVE_CONFIG_H
25#include <config.h>
26#endif
27
28#ifdef emacs
29#include "blockinput.h"
30#endif
31
32/* If compiling with GCC 2, this file's not needed. */
33#if !defined (__GNUC__) || __GNUC__ < 2
34
35/* If someone has defined alloca as a macro,
36 there must be some other way alloca is supposed to work. */
37#ifndef alloca
38
39#ifdef emacs
40#ifdef static
41/* actually, only want this if static is defined as ""
42 -- this is for usg, in which emacs must undefine static
43 in order to make unexec workable
44 */
45#ifndef STACK_DIRECTION
46you
47lose
48-- must know STACK_DIRECTION at compile-time
49#endif /* STACK_DIRECTION undefined */
50#endif /* static */
51#endif /* emacs */
52
53/* If your stack is a linked list of frames, you have to
54 provide an "address metric" ADDRESS_FUNCTION macro. */
55
56#if defined (CRAY) && defined (CRAY_STACKSEG_END)
57long i00afunc ();
58#define ADDRESS_FUNCTION(arg) (char *) i00afunc (&(arg))
59#else
60#define ADDRESS_FUNCTION(arg) &(arg)
61#endif
62
63#if __STDC__
64typedef void *pointer;
65#else
66typedef char *pointer;
67#endif
68
69#define NULL 0
70
71/* Different portions of Emacs need to call different versions of
72 malloc. The Emacs executable needs alloca to call xmalloc, because
73 ordinary malloc isn't protected from input signals. On the other
74 hand, the utilities in lib-src need alloca to call malloc; some of
75 them are very simple, and don't have an xmalloc routine.
76
77 Non-Emacs programs