Initial revision

This commit is contained in:
slidedraw
2002-03-20 15:31:36 +00:00
commit 89c4cdb2d7
148 changed files with 40909 additions and 0 deletions

7
cole/utils/Makefile.am Normal file
View File

@@ -0,0 +1,7 @@
## Process this file with automake to produce Makefile.in
INCLUDES = -I$(top_srcdir)
LDADD = $(top_builddir)/libcole.la
noinst_PROGRAMS = cole_tree cole_isfs cole_isfs_fast cole_extract

328
cole/utils/Makefile.in Normal file
View File

@@ -0,0 +1,328 @@
# Makefile.in generated automatically by automake 1.4 from Makefile.am
# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
SHELL = @SHELL@
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
sbindir = @sbindir@
libexecdir = @libexecdir@
datadir = @datadir@
sysconfdir = @sysconfdir@
sharedstatedir = @sharedstatedir@
localstatedir = @localstatedir@
libdir = @libdir@
infodir = @infodir@
mandir = @mandir@
includedir = @includedir@
oldincludedir = /usr/include
DESTDIR =
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
top_builddir = ..
ACLOCAL = @ACLOCAL@
AUTOCONF = @AUTOCONF@
AUTOMAKE = @AUTOMAKE@
AUTOHEADER = @AUTOHEADER@
INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS)
INSTALL_DATA = @INSTALL_DATA@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
transform = @program_transform_name@
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
host_alias = @host_alias@
host_triplet = @host@
AS = @AS@
CC = @CC@
COLE_MAJOR = @COLE_MAJOR@
COLE_MICRO = @COLE_MICRO@
COLE_MINOR = @COLE_MINOR@
DLLTOOL = @DLLTOOL@
HOST_ALIAS_NAME = @HOST_ALIAS_NAME@
HOST_CANONICAL_NAME = @HOST_CANONICAL_NAME@
HOST_CPU = @HOST_CPU@
HOST_OS = @HOST_OS@
HOST_VENDOR = @HOST_VENDOR@
LD = @LD@
LIBTOOL = @LIBTOOL@
LN_S = @LN_S@
MAKEINFO = @MAKEINFO@
NM = @NM@
PACKAGE = @PACKAGE@
RANLIB = @RANLIB@
USE_SYMBOL_UNDERSCORE = @USE_SYMBOL_UNDERSCORE@
VERSION = @VERSION@
VERSION_INFO = @VERSION_INFO@
INCLUDES = -I$(top_srcdir)
LDADD = $(top_builddir)/libcole.la
noinst_PROGRAMS = cole_tree cole_isfs cole_isfs_fast cole_extract
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = ../config.h
CONFIG_CLEAN_FILES =
PROGRAMS = $(noinst_PROGRAMS)
DEFS = @DEFS@ -I. -I$(srcdir) -I..
CPPFLAGS = @CPPFLAGS@
LDFLAGS = @LDFLAGS@
LIBS = @LIBS@
cole_tree_SOURCES = cole_tree.c
cole_tree_OBJECTS = cole_tree.o
cole_tree_LDADD = $(LDADD)
cole_tree_DEPENDENCIES = $(top_builddir)/libcole.la
cole_tree_LDFLAGS =
cole_isfs_SOURCES = cole_isfs.c
cole_isfs_OBJECTS = cole_isfs.o
cole_isfs_LDADD = $(LDADD)
cole_isfs_DEPENDENCIES = $(top_builddir)/libcole.la
cole_isfs_LDFLAGS =
cole_isfs_fast_SOURCES = cole_isfs_fast.c
cole_isfs_fast_OBJECTS = cole_isfs_fast.o
cole_isfs_fast_LDADD = $(LDADD)
cole_isfs_fast_DEPENDENCIES = $(top_builddir)/libcole.la
cole_isfs_fast_LDFLAGS =
cole_extract_SOURCES = cole_extract.c
cole_extract_OBJECTS = cole_extract.o
cole_extract_LDADD = $(LDADD)
cole_extract_DEPENDENCIES = $(top_builddir)/libcole.la
cole_extract_LDFLAGS =
CFLAGS = @CFLAGS@
COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@
DIST_COMMON = Makefile.am Makefile.in
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
TAR = gtar
GZIP_ENV = --best
SOURCES = cole_tree.c cole_isfs.c cole_isfs_fast.c cole_extract.c
OBJECTS = cole_tree.o cole_isfs.o cole_isfs_fast.o cole_extract.o
all: all-redirect
.SUFFIXES:
.SUFFIXES: .S .c .lo .o .s
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
cd $(top_srcdir) && $(AUTOMAKE) --gnu --include-deps utils/Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
cd $(top_builddir) \
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
mostlyclean-noinstPROGRAMS:
clean-noinstPROGRAMS:
-test -z "$(noinst_PROGRAMS)" || rm -f $(noinst_PROGRAMS)
distclean-noinstPROGRAMS:
maintainer-clean-noinstPROGRAMS:
.c.o:
$(COMPILE) -c $<
.s.o:
$(COMPILE) -c $<
.S.o:
$(COMPILE) -c $<
mostlyclean-compile:
-rm -f *.o core *.core
clean-compile:
distclean-compile:
-rm -f *.tab.c
maintainer-clean-compile:
.c.lo:
$(LIBTOOL) --mode=compile $(COMPILE) -c $<
.s.lo:
$(LIBTOOL) --mode=compile $(COMPILE) -c $<
.S.lo:
$(LIBTOOL) --mode=compile $(COMPILE) -c $<
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
distclean-libtool:
maintainer-clean-libtool:
cole_tree: $(cole_tree_OBJECTS) $(cole_tree_DEPENDENCIES)
@rm -f cole_tree
$(LINK) $(cole_tree_LDFLAGS) $(cole_tree_OBJECTS) $(cole_tree_LDADD) $(LIBS)
cole_isfs: $(cole_isfs_OBJECTS) $(cole_isfs_DEPENDENCIES)
@rm -f cole_isfs
$(LINK) $(cole_isfs_LDFLAGS) $(cole_isfs_OBJECTS) $(cole_isfs_LDADD) $(LIBS)
cole_isfs_fast: $(cole_isfs_fast_OBJECTS) $(cole_isfs_fast_DEPENDENCIES)
@rm -f cole_isfs_fast
$(LINK) $(cole_isfs_fast_LDFLAGS) $(cole_isfs_fast_OBJECTS) $(cole_isfs_fast_LDADD) $(LIBS)
cole_extract: $(cole_extract_OBJECTS) $(cole_extract_DEPENDENCIES)
@rm -f cole_extract
$(LINK) $(cole_extract_LDFLAGS) $(cole_extract_OBJECTS) $(cole_extract_LDADD) $(LIBS)
tags: TAGS
ID: $(HEADERS) $(SOURCES) $(LISP)
list='$(SOURCES) $(HEADERS)'; \
unique=`for i in $$list; do echo $$i; done | \
awk ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
here=`pwd` && cd $(srcdir) \
&& mkid -f$$here/ID $$unique $(LISP)
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS)'; \
unique=`for i in $$list; do echo $$i; done | \
awk ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \
|| (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS)
mostlyclean-tags:
clean-tags:
distclean-tags:
-rm -f TAGS ID
maintainer-clean-tags:
distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
subdir = utils
distdir: $(DISTFILES)
@for file in $(DISTFILES); do \
d=$(srcdir); \
if test -d $$d/$$file; then \
cp -pr $$d/$$file $(distdir)/$$file; \
else \
test -f $(distdir)/$$file \
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \
|| cp -p $$d/$$file $(distdir)/$$file || :; \
fi; \
done
info-am:
info: info-am
dvi-am:
dvi: dvi-am
check-am: all-am
check: check-am
installcheck-am:
installcheck: installcheck-am
install-exec-am:
install-exec: install-exec-am
install-data-am:
install-data: install-data-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
install: install-am
uninstall-am:
uninstall: uninstall-am
all-am: Makefile $(PROGRAMS)
all-redirect: all-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install
installdirs:
mostlyclean-generic:
clean-generic:
distclean-generic:
-rm -f Makefile $(CONFIG_CLEAN_FILES)
-rm -f config.cache config.log stamp-h stamp-h[0-9]*
maintainer-clean-generic:
mostlyclean-am: mostlyclean-noinstPROGRAMS mostlyclean-compile \
mostlyclean-libtool mostlyclean-tags \
mostlyclean-generic
mostlyclean: mostlyclean-am
clean-am: clean-noinstPROGRAMS clean-compile clean-libtool clean-tags \
clean-generic mostlyclean-am
clean: clean-am
distclean-am: distclean-noinstPROGRAMS distclean-compile \
distclean-libtool distclean-tags distclean-generic \
clean-am
-rm -f libtool
distclean: distclean-am
maintainer-clean-am: maintainer-clean-noinstPROGRAMS \
maintainer-clean-compile maintainer-clean-libtool \
maintainer-clean-tags maintainer-clean-generic \
distclean-am
@echo "This command is intended for maintainers to use;"
@echo "it deletes files that may require special tools to rebuild."
maintainer-clean: maintainer-clean-am
.PHONY: mostlyclean-noinstPROGRAMS distclean-noinstPROGRAMS \
clean-noinstPROGRAMS maintainer-clean-noinstPROGRAMS \
mostlyclean-compile distclean-compile clean-compile \
maintainer-clean-compile mostlyclean-libtool distclean-libtool \
clean-libtool maintainer-clean-libtool tags mostlyclean-tags \
distclean-tags clean-tags maintainer-clean-tags distdir info-am info \
dvi-am dvi check check-am installcheck-am installcheck install-exec-am \
install-exec install-data-am install-data install-am install \
uninstall-am uninstall all-redirect all-am all installdirs \
mostlyclean-generic distclean-generic clean-generic \
maintainer-clean-generic clean mostlyclean distclean maintainer-clean
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

95
cole/utils/cole_extract.c Normal file
View File

@@ -0,0 +1,95 @@
/*
cole - A free C OLE library.
cole_extract - Extract a file from a filesystem.
Copyright 1998, 1999 Roberto Arturo Tena Sanchez
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/*
Arturo Tena <arturo@directmail.org>
*/
#include <stdio.h>
/* To compile this file outside cole source tree,
you must include here <cole/cole.h> instead <cole.h> */
#include <cole.h>
#define PRGNAME "cole_extract"
#define BUFFER_SIZE 128
int
main (int argc, char **argv)
{
COLEFS *cfs;
COLEFILE *cf;
COLERRNO colerrno;
char buffer[BUFFER_SIZE];
size_t char_read;
if (argc != 3) {
fprintf (stderr, "cole_extract. Extract a file from a "
"filesystem to the standard output.\n"
"Usage: "PRGNAME" <FILE> <INFILE>\n"
" FILE - File with the filesystem.\n"
" INFILE - Filename of the file to extract.\n");
exit (1);
}
cfs = cole_mount (argv[1], &colerrno);
if (cfs == NULL) {
cole_perror (PRGNAME, colerrno);
exit (1);
}
cf = cole_fopen (cfs, argv[2], &colerrno);
if (cf == NULL) {
cole_perror (PRGNAME, colerrno);
cole_umount (cfs, NULL);
exit (1);
}
while ((char_read = cole_fread (cf, buffer, BUFFER_SIZE, &colerrno))) {
if (fwrite (buffer, 1, char_read, stdout) != char_read) {
break;
}
}
if (!cole_feof (cf)) {
cole_perror (PRGNAME, colerrno);
cole_umount (cfs, NULL);
exit (1);
}
if (cole_fclose (cf, &colerrno)) {
cole_perror (PRGNAME, colerrno);
cole_umount (cfs, NULL);
exit (1);
}
if (cole_umount (cfs, &colerrno)) {
cole_perror (PRGNAME, colerrno);
exit (1);
}
exit (0);
}

75
cole/utils/cole_isfs.c Normal file
View File

@@ -0,0 +1,75 @@
/*
cole - A free C OLE library.
cole_isfs - Guess if a file is a valid filesystem.
Copyright 1998, 1999 Roberto Arturo Tena Sanchez
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/*
Arturo Tena <arturo@directmail.org>
*/
#include <stdio.h>
/* To compile this file outside cole source tree,
you must include here <cole/cole.h> instead <cole.h> */
#include <cole.h>
#define PRGNAME "cole_isfs"
int
main (int argc, char **argv)
{
COLEFS * cfs;
COLERRNO colerrno;
if (argc != 2) {
fprintf (stderr, PRGNAME". Prints `yes' if the file is a "
"valid filesystem, otherwise it prints `no'.\n"
"Usage: "PRGNAME" <FILE>\n");
exit (1);
}
cfs = cole_mount (argv[1], &colerrno);
if (cfs == NULL) {
switch (colerrno) {
case COLE_ENOFILESYSTEM:
case COLE_EINVALIDFILESYSTEM:
printf ("no\n");
break;
case COLE_EMEMORY:
case COLE_EOPENFILE:
case COLE_EUNKNOWN:
default:
cole_perror (PRGNAME, colerrno);
break;
}
exit (1);
}
if (cole_umount (cfs, &colerrno)) {
cole_perror (PRGNAME, colerrno);
exit (1);
}
printf ("yes\n");
exit (0);
}

View File

@@ -0,0 +1,77 @@
/*
cole - A free C OLE library.
cole_isfs_fast - Fast guess if a file is a valid filesystem.
Copyright 1998, 1999 Roberto Arturo Tena Sanchez
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/*
Arturo Tena <arturo@directmail.org>
*/
#include <stdio.h>
/* To compile this file outside cole source tree,
you must include here <cole/cole.h> instead <cole.h> */
#include <cole.h>
#define PRGNAME "cole_isfs_fast"
int
main (int argc, char **argv)
{
FILE *file;
unsigned char sign[8];
if (argc != 2) {
fprintf (stderr, PRGNAME". Prints `yes' if the file is a "
"valid filesystem, otherwise it prints `no'. "
"The test is not much accurate.\n"
"Usage: "PRGNAME" <FILE>\n");
exit (1);
}
file = fopen (argv[1], "rb");
if (file == NULL) {
perror (PRGNAME);
exit (1);
}
fread (sign, 1, 8, file);
if ( sign[0] != 0xd0
|| sign[1] != 0xcf
|| sign[2] != 0x11
|| sign[3] != 0xe0
|| sign[4] != 0xa1
|| sign[5] != 0xb1
|| sign[6] != 0x1a
|| sign[7] != 0xe1) {
printf ("no\n");
fclose (file);
exit (1);
}
fclose (file);
printf ("yes\n");
exit (0);
}

68
cole/utils/cole_tree.c Normal file
View File

@@ -0,0 +1,68 @@
/*
cole - A free C OLE library.
cole_tree - Prints the tree of a filesystem.
Copyright 1998, 1999 Roberto Arturo Tena Sanchez
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/*
Arturo Tena <arturo@directmail.org>
*/
#include <stdio.h>
/* To compile this file outside cole source tree,
you must include here <cole/cole.h> instead <cole.h> */
#include <cole.h>
#define PRGNAME "cole_tree"
int
main (int argc, char **argv)
{
COLEFS * cfs;
COLERRNO colerrno;
if (argc != 2) {
fprintf (stderr, "cole_tree. Prints the tree of a filesystem.\n"
"Usage: "PRGNAME" <FILE>\n");
exit (1);
}
cfs = cole_mount (argv[1], &colerrno);
if (cfs == NULL) {
cole_perror (PRGNAME, colerrno);
exit (1);
}
if (cole_print_tree (cfs, &colerrno)) {
cole_perror (PRGNAME, colerrno);
cole_umount (cfs, NULL);
exit (1);
}
if (cole_umount (cfs, &colerrno)) {
cole_perror (PRGNAME, colerrno);
exit (1);
}
exit (0);
}