diff options
Diffstat (limited to 'tools')
-rw-r--r-- | tools/Makefile.am | 9 | ||||
-rw-r--r-- | tools/Makefile.in | 526 | ||||
-rw-r--r-- | tools/ps_convert.c | 261 | ||||
-rw-r--r-- | tools/ps_inspect.c | 349 |
4 files changed, 1145 insertions, 0 deletions
diff --git a/tools/Makefile.am b/tools/Makefile.am new file mode 100644 index 0000000..41c87ba --- /dev/null +++ b/tools/Makefile.am @@ -0,0 +1,9 @@ +noinst_PROGRAMS=ps_inspect ps_convert + +ps_inspect_SOURCES=ps_inspect.c +ps_inspect_LDADD=${top_builddir}/src/tspi/libtspi.la +ps_inspect_CFLAGS=-I${top_srcdir}/src/include + +ps_convert_SOURCES=ps_convert.c +ps_convert_LDADD=${top_builddir}/src/tspi/libtspi.la +ps_convert_CFLAGS=-I${top_srcdir}/src/include diff --git a/tools/Makefile.in b/tools/Makefile.in new file mode 100644 index 0000000..6fc6b26 --- /dev/null +++ b/tools/Makefile.in @@ -0,0 +1,526 @@ +# Makefile.in generated by automake 1.11.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009 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. + +@SET_MAKE@ + +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +target_triplet = @target@ +noinst_PROGRAMS = ps_inspect$(EXEEXT) ps_convert$(EXEEXT) +subdir = tools +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/configure.in +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +PROGRAMS = $(noinst_PROGRAMS) +am_ps_convert_OBJECTS = ps_convert-ps_convert.$(OBJEXT) +ps_convert_OBJECTS = $(am_ps_convert_OBJECTS) +ps_convert_DEPENDENCIES = ${top_builddir}/src/tspi/libtspi.la +ps_convert_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(ps_convert_CFLAGS) \ + $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +am_ps_inspect_OBJECTS = ps_inspect-ps_inspect.$(OBJEXT) +ps_inspect_OBJECTS = $(am_ps_inspect_OBJECTS) +ps_inspect_DEPENDENCIES = ${top_builddir}/src/tspi/libtspi.la +ps_inspect_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(ps_inspect_CFLAGS) \ + $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +DEFAULT_INCLUDES = -I.@am__isrc@ +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ +SOURCES = $(ps_convert_SOURCES) $(ps_inspect_SOURCES) +DIST_SOURCES = $(ps_convert_SOURCES) $(ps_inspect_SOURCES) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CRYPTOLIB = @CRYPTOLIB@ +CRYPTO_PACKAGE = @CRYPTO_PACKAGE@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GREP = @GREP@ +GTK_CFLAGS = @GTK_CFLAGS@ +GTK_LIBS = @GTK_LIBS@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OPENSSL_LIB_DIR = @OPENSSL_LIB_DIR@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +RANLIB = @RANLIB@ +RPC = @RPC@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +TCSD_DEFAULT_PORT = @TCSD_DEFAULT_PORT@ +VERSION = @VERSION@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target = @target@ +target_alias = @target_alias@ +target_cpu = @target_cpu@ +target_os = @target_os@ +target_vendor = @target_vendor@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +ps_inspect_SOURCES = ps_inspect.c +ps_inspect_LDADD = ${top_builddir}/src/tspi/libtspi.la +ps_inspect_CFLAGS = -I${top_srcdir}/src/include +ps_convert_SOURCES = ps_convert.c +ps_convert_LDADD = ${top_builddir}/src/tspi/libtspi.la +ps_convert_CFLAGS = -I${top_srcdir}/src/include +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign tools/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign tools/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +clean-noinstPROGRAMS: + @list='$(noinst_PROGRAMS)'; test -n "$$list" || exit 0; \ + echo " rm -f" $$list; \ + rm -f $$list || exit $$?; \ + test -n "$(EXEEXT)" || exit 0; \ + list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f" $$list; \ + rm -f $$list +ps_convert$(EXEEXT): $(ps_convert_OBJECTS) $(ps_convert_DEPENDENCIES) + @rm -f ps_convert$(EXEEXT) + $(ps_convert_LINK) $(ps_convert_OBJECTS) $(ps_convert_LDADD) $(LIBS) +ps_inspect$(EXEEXT): $(ps_inspect_OBJECTS) $(ps_inspect_DEPENDENCIES) + @rm -f ps_inspect$(EXEEXT) + $(ps_inspect_LINK) $(ps_inspect_OBJECTS) $(ps_inspect_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ps_convert-ps_convert.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ps_inspect-ps_inspect.Po@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< + +ps_convert-ps_convert.o: ps_convert.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ps_convert_CFLAGS) $(CFLAGS) -MT ps_convert-ps_convert.o -MD -MP -MF $(DEPDIR)/ps_convert-ps_convert.Tpo -c -o ps_convert-ps_convert.o `test -f 'ps_convert.c' || echo '$(srcdir)/'`ps_convert.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/ps_convert-ps_convert.Tpo $(DEPDIR)/ps_convert-ps_convert.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ps_convert.c' object='ps_convert-ps_convert.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ps_convert_CFLAGS) $(CFLAGS) -c -o ps_convert-ps_convert.o `test -f 'ps_convert.c' || echo '$(srcdir)/'`ps_convert.c + +ps_convert-ps_convert.obj: ps_convert.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ps_convert_CFLAGS) $(CFLAGS) -MT ps_convert-ps_convert.obj -MD -MP -MF $(DEPDIR)/ps_convert-ps_convert.Tpo -c -o ps_convert-ps_convert.obj `if test -f 'ps_convert.c'; then $(CYGPATH_W) 'ps_convert.c'; else $(CYGPATH_W) '$(srcdir)/ps_convert.c'; fi` +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/ps_convert-ps_convert.Tpo $(DEPDIR)/ps_convert-ps_convert.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ps_convert.c' object='ps_convert-ps_convert.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ps_convert_CFLAGS) $(CFLAGS) -c -o ps_convert-ps_convert.obj `if test -f 'ps_convert.c'; then $(CYGPATH_W) 'ps_convert.c'; else $(CYGPATH_W) '$(srcdir)/ps_convert.c'; fi` + +ps_inspect-ps_inspect.o: ps_inspect.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ps_inspect_CFLAGS) $(CFLAGS) -MT ps_inspect-ps_inspect.o -MD -MP -MF $(DEPDIR)/ps_inspect-ps_inspect.Tpo -c -o ps_inspect-ps_inspect.o `test -f 'ps_inspect.c' || echo '$(srcdir)/'`ps_inspect.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/ps_inspect-ps_inspect.Tpo $(DEPDIR)/ps_inspect-ps_inspect.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ps_inspect.c' object='ps_inspect-ps_inspect.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ps_inspect_CFLAGS) $(CFLAGS) -c -o ps_inspect-ps_inspect.o `test -f 'ps_inspect.c' || echo '$(srcdir)/'`ps_inspect.c + +ps_inspect-ps_inspect.obj: ps_inspect.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ps_inspect_CFLAGS) $(CFLAGS) -MT ps_inspect-ps_inspect.obj -MD -MP -MF $(DEPDIR)/ps_inspect-ps_inspect.Tpo -c -o ps_inspect-ps_inspect.obj `if test -f 'ps_inspect.c'; then $(CYGPATH_W) 'ps_inspect.c'; else $(CYGPATH_W) '$(srcdir)/ps_inspect.c'; fi` +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/ps_inspect-ps_inspect.Tpo $(DEPDIR)/ps_inspect-ps_inspect.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ps_inspect.c' object='ps_inspect-ps_inspect.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ps_inspect_CFLAGS) $(CFLAGS) -c -o ps_inspect-ps_inspect.obj `if test -f 'ps_inspect.c'; then $(CYGPATH_W) 'ps_inspect.c'; else $(CYGPATH_W) '$(srcdir)/ps_inspect.c'; fi` + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(PROGRAMS) +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool clean-noinstPROGRAMS \ + mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libtool clean-noinstPROGRAMS ctags distclean \ + distclean-compile distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-pdf install-pdf-am install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ + pdf pdf-am ps ps-am tags uninstall uninstall-am + + +# 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: diff --git a/tools/ps_convert.c b/tools/ps_convert.c new file mode 100644 index 0000000..2a2d85a --- /dev/null +++ b/tools/ps_convert.c @@ -0,0 +1,261 @@ +/* + * + * Copyright (C) International Business Machines Corp., 2005 + * + * 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 + */ + +/* + * ps_convert.c + * + * Convert a persistent storage file from one version to another. + * + * There are 2 different types of persistent storage files: + * + * A) + * + * [UINT32 num_keys_on_disk] + * [TSS_UUID uuid0 ] + * [TSS_UUID uuid_parent0 ] + * [UINT16 pub_data_size0 ] + * [UINT16 blob_size0 ] + * [UINT16 cache_flags0 ] + * [BYTE[] pub_data0 ] + * [BYTE[] blob0 ] + * [...] + * + * B) + * + * [BYTE TrouSerS PS version='1'] + * [UINT32 num_keys_on_disk ] + * [TSS_UUID uuid0 ] + * [TSS_UUID uuid_parent0 ] + * [UINT16 pub_data_size0 ] + * [UINT16 blob_size0 ] + * [UINT32 vendor_data_size0 ] + * [UINT16 cache_flags0 ] + * [BYTE[] pub_data0 ] + * [BYTE[] blob0 ] + * [BYTE[] vendor_data0 ] + * [...] + * + */ + + +#include <stdio.h> +#include <stdlib.h> +#include <errno.h> +#include <string.h> + +#include <trousers/tss.h> + +#define PRINTERR(...) fprintf(stderr, ##__VA_ARGS__) +#define PRINT(...) printf("PS " __VA_ARGS__) + +#define OUT(stream, buf, size) \ + do { \ + if (fwrite(buf, size, 1, stream) != 1) { \ + PRINTERR("fwrite error: %s\n", strerror(errno)); \ + return -1; \ + } \ + } while (0) + +/* one global buffer we read into from the PS file */ +unsigned char buf[1024]; + +void +usage(char *argv0) +{ + PRINTERR("usage: %s filename\n" + "\nBrings a persistent storage file up to date with the latest " + "version of trousers.\nOutput will be to \"filename.new\".\n", argv0); + exit(-1); +} + +void +print_hex(BYTE *buf, UINT32 len) +{ + UINT32 i = 0, j; + + while (i < len) { + for (j=0; (j < 4) && (i < len); j++, i+=4) + printf("%02x%02x%02x%02x ", + buf[i] & 0xff, buf[i+1] & 0xff, + buf[i+2] & 0xff, buf[i+3] & 0xff); + printf("\n"); + } +} + + +int +convertkey_0(FILE *in, FILE *out) +{ + UINT16 pub_data_size, blob_size, cache_flags; + UINT32 vendor_data_size = 0; + int members; + + /* output the key's UUID and parent UUID */ + OUT(out, buf, sizeof(TSS_UUID)); + OUT(out, &buf[sizeof(TSS_UUID)], sizeof(TSS_UUID)); + + pub_data_size = *(UINT16 *)&buf[(2 * sizeof(TSS_UUID))]; + blob_size = *(UINT16 *)&buf[(2 * sizeof(TSS_UUID)) + sizeof(UINT16)]; + cache_flags = *(UINT16 *)&buf[2*sizeof(TSS_UUID) + 2*sizeof(UINT16)]; + + OUT(out, &pub_data_size, sizeof(UINT16)); + OUT(out, &blob_size, sizeof(UINT16)); + OUT(out, &vendor_data_size, sizeof(UINT32)); + OUT(out, &cache_flags, sizeof(UINT16)); + + /* trash buf, we've got what we needed from it */ + if ((members = fread(buf, pub_data_size + blob_size, + 1, in)) != 1) { + PRINTERR("fread: %s: %d members read\n", strerror(errno), members); + return -1; + } + + OUT(out, buf, pub_data_size); + OUT(out, &buf[pub_data_size], blob_size); + + return 0; +} + +int +version_0_convert(FILE *in, FILE *out) +{ + int rc, members = 0; + UINT32 i; + UINT32 *u32 = (UINT32 *) &buf; + + /* output the PS version */ + OUT(out, "\1", 1); + + /* number of keys */ + OUT(out, u32, sizeof(UINT32)); + + /* The +- 1's below account for the byte we read in to determine + * if the PS file had a version byte at the beginning */ + + /* align the beginning of the buffer with the beginning of the key */ + memcpy(buf, &buf[4], sizeof(TSS_UUID) + 1); + + /* read in the rest of the first key's header */ + if ((members = fread(&buf[sizeof(TSS_UUID) + 1], + sizeof(TSS_UUID) + (3 * sizeof(UINT16)) - 1, + 1, in)) != 1) { + PRINTERR("fread: %s\n", strerror(errno)); + return -1; + } + + if (convertkey_0(in, out)) { + PRINTERR("printkey_0 failed.\n"); + return -1; + } + + for (i = 1; i < *u32; i++) { + /* read in subsequent key's headers */ + if ((members = fread(buf, 2*sizeof(TSS_UUID) + 3*sizeof(UINT16), + 1, in)) != 1) { + PRINTERR("fread: %s\n", strerror(errno)); + return -1; + } + + if ((rc = convertkey_0(in, out))) + return rc; + } + + return 0; +} + +int +inspect(char *filename, FILE *in) +{ + int members = 0, rc, namelen; + FILE *out = NULL; + char outfile[256]; + UINT32 *num_keys; + TSS_UUID SRK_UUID = TSS_UUID_SRK; + + /* do the initial read, which should include sizeof(TSS_UUID) + * + sizeof(UINT32) + 1 bytes */ + if ((members = fread(buf, + sizeof(TSS_UUID) + sizeof(UINT32) + 1, + 1, in)) != 1) { + PRINTERR("fread: %s\n", strerror(errno)); + return -1; + } + + if (buf[0] == '\1') { + num_keys = (UINT32 *)&buf[1]; + if (*num_keys == 0) + goto version0; + + if (memcmp(&buf[5], &SRK_UUID, sizeof(TSS_UUID))) + goto version0; + + printf("%s is already up to date.\n", filename); + + return -2; + } + +version0: + if (memcmp(&buf[4], &SRK_UUID, sizeof(TSS_UUID))) { + printf("This file does not appear to be a valid PS file.\n"); + return -2; + } + + printf("%s appears to be a version 0 PS file. Updating to version 1... ", + filename); + + namelen = strlen(filename); + memcpy(outfile, filename, namelen); + memcpy(&outfile[namelen], ".new", 5); + + if ((out = fopen(outfile, "w+")) == NULL) { + PRINTERR("fopen(%s, \"w+\"): %s\n", outfile, strerror(errno)); + return -1; + } + + rc = version_0_convert(in, out); + + fclose(out); + + return rc; +} + +int +main(int argc, char ** argv) +{ + FILE *in = NULL; + int rc; + + if (argc != 2) + usage(argv[0]); + + if ((in = fopen(argv[1], "r")) == NULL) { + PRINTERR("fopen(%s, \"r\"): %s\n", argv[1], strerror(errno)); + return -1; + } + + if ((rc = inspect(argv[1], in)) == 0) { + printf("Success.\n"); + } else if (rc != -2) { + printf("Failure.\n"); + } + + fclose(in); + + return rc; +} diff --git a/tools/ps_inspect.c b/tools/ps_inspect.c new file mode 100644 index 0000000..3c2437c --- /dev/null +++ b/tools/ps_inspect.c @@ -0,0 +1,349 @@ +/* + * + * Copyright (C) International Business Machines Corp., 2005 + * + * 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 + */ + +/* + * ps_inspect.c + * + * Inspect a persistent storage file, printing information about it based + * on best guesses. + * + * There are 2 different types of persistent storage files: + * + * A) + * + * [UINT32 num_keys_on_disk] + * [TSS_UUID uuid0 ] + * [TSS_UUID uuid_parent0 ] + * [UINT16 pub_data_size0 ] + * [UINT16 blob_size0 ] + * [UINT16 cache_flags0 ] + * [BYTE[] pub_data0 ] + * [BYTE[] blob0 ] + * [...] + * + * B) + * + * [BYTE TrouSerS PS version='1'] + * [UINT32 num_keys_on_disk ] + * [TSS_UUID uuid0 ] + * [TSS_UUID uuid_parent0 ] + * [UINT16 pub_data_size0 ] + * [UINT16 blob_size0 ] + * [UINT32 vendor_data_size0 ] + * [UINT16 cache_flags0 ] + * [BYTE[] pub_data0 ] + * [BYTE[] blob0 ] + * [BYTE[] vendor_data0 ] + * [...] + * + */ + + +#include <stdio.h> +#include <stdlib.h> +#include <errno.h> +#include <string.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <sys/unistd.h> + +#include <trousers/tss.h> + +#define PRINTERR(...) fprintf(stderr, ##__VA_ARGS__) +#define PRINT(...) printf("PS " __VA_ARGS__) + +#if (defined (__FreeBSD__) || defined (__OpenBSD__)) +#define OFF_T_PRINTF "lld" +#else +#define OFF_T_PRINTF "ld" +#endif + +/* one global buffer we read into from the PS file */ +unsigned char buf[1024]; + +void +usage(char *argv0) +{ + PRINTERR("usage: %s filename\n", argv0); + exit(-1); +} + +void +print_hex(BYTE *buf, UINT32 len) +{ + UINT32 i, j; + + for (i=0, j=1; (i+4) < len; j++, i+=4) { + printf("%02x%02x%02x%02x ", + buf[i] & 0xff, buf[i+1] & 0xff, + buf[i+2] & 0xff, buf[i+3] & 0xff); + if (!(j % 4)) + printf("\n"); + } + + while (i < len) + printf("%02x", buf[i++] & 0xff); + printf("\n"); +} + +int +printkey_0(int i, FILE *f) +{ + UINT16 pub_data_size, blob_size, cache_flags; + int members; + + PRINT("uuid%d: ", i); + print_hex(buf, sizeof(TSS_UUID)); + + PRINT("parent uuid%d: ", i); + print_hex(&buf[sizeof(TSS_UUID)], sizeof(TSS_UUID)); + + pub_data_size = *(UINT16 *)&buf[(2 * sizeof(TSS_UUID))]; + blob_size = *(UINT16 *)&buf[(2 * sizeof(TSS_UUID)) + sizeof(UINT16)]; + cache_flags = *(UINT16 *)&buf[2*sizeof(TSS_UUID) + 2*sizeof(UINT16)]; + + PRINT("pub_data_size%d: %hu\n", i, pub_data_size); + PRINT("blob_size%d: %hu\n", i, blob_size); + PRINT("cache_flags%d: %02hx\n", i, cache_flags); + + /* trash buf, we've got what we needed from it */ + if ((members = fread(buf, pub_data_size + blob_size, + 1, f)) != 1) { + PRINTERR("fread: %s: %d members read\n", strerror(errno), members); + return -1; + } + + PRINT("pub_data%d:\n", i); + print_hex(buf, pub_data_size); + + PRINT("blob%d:\n", i); + print_hex(&buf[pub_data_size], blob_size); + + return 0; +} + +int +printkey_1(int i, FILE *f) +{ + UINT16 pub_data_size, blob_size, cache_flags; + UINT32 vendor_data_size; + int members; + + PRINT("uuid%d: ", i); + print_hex(buf, sizeof(TSS_UUID)); + + PRINT("parent uuid%d: ", i); + print_hex(&buf[sizeof(TSS_UUID)], sizeof(TSS_UUID)); + + pub_data_size = *(UINT16 *)&buf[(2 * sizeof(TSS_UUID))]; + blob_size = *(UINT16 *)&buf[(2 * sizeof(TSS_UUID)) + sizeof(UINT16)]; + vendor_data_size = *(UINT32 *)&buf[(2 * sizeof(TSS_UUID)) + 2*sizeof(UINT16)]; + cache_flags = *(UINT16 *)&buf[2*sizeof(TSS_UUID) + sizeof(UINT16) + sizeof(UINT32)]; + + PRINT("pub_data_size%d: %hu\n", i, pub_data_size); + PRINT("blob_size%d: %hu\n", i, blob_size); + PRINT("vendor_data_size%d: %u\n", i, vendor_data_size); + PRINT("cache_flags%d: %02hx\n", i, cache_flags); + + /* trash buf, we've got what we needed from it */ + if ((members = fread(buf, pub_data_size + blob_size + vendor_data_size, + 1, f)) != 1) { + PRINTERR("fread: %s: %d members read\n", strerror(errno), members); + return -1; + } + + PRINT("pub_data%d:\n", i); + print_hex(buf, pub_data_size); + + PRINT("blob%d:\n", i); + print_hex(&buf[pub_data_size], blob_size); + + PRINT("vendor_data%d:\n", i); + if (vendor_data_size > 0) + print_hex(&buf[pub_data_size + blob_size], vendor_data_size); + + return 0; +} + +int +version_0_print(FILE *f) +{ + int rc, members = 0; + UINT32 i; + UINT32 *u32 = (UINT32 *) &buf; + + PRINT("version: 0\n"); + PRINT("number of keys: %u\n", *u32); + + /* The +- 1's below account for the byte we read in to determine + * if the PS file had a version byte at the beginning */ + + /* align the beginning of the buffer with the beginning of the key */ + memcpy(buf, &buf[4], sizeof(TSS_UUID) + 1); + + /* read in the rest of the first key's header */ + if ((members = fread(&buf[sizeof(TSS_UUID) + 1], + sizeof(TSS_UUID) + (3 * sizeof(UINT16)) - 1, + 1, f)) != 1) { + PRINTERR("fread: %s\n", strerror(errno)); + return -1; + } + + if (printkey_0(0, f)) { + PRINTERR("printkey_0 failed.\n"); + return -1; + } + + for (i = 1; i < *u32; i++) { + /* read in subsequent key's headers */ + if ((members = fread(buf, 2*sizeof(TSS_UUID) + 3*sizeof(UINT16), + 1, f)) != 1) { + PRINTERR("fread: %s\n", strerror(errno)); + return -1; + } + + if ((rc = printkey_0(i, f))) + return rc; + } + + return 0; +} + +int +version_1_print(FILE *f) +{ + int rc, members = 0; + UINT32 i, u32 = *(UINT32 *)&buf[1]; + + PRINT("version: 1\n"); + PRINT("number of keys: %u\n", u32); + + /* align the beginning of the buffer with the beginning of the key */ + memcpy(buf, &buf[5], sizeof(TSS_UUID)); + + /* read in the rest of the first key's header */ + if ((members = fread(&buf[sizeof(TSS_UUID)], + sizeof(TSS_UUID) + (3 * sizeof(UINT16)) + sizeof(UINT32), + 1, f)) != 1) { + PRINTERR("fread: %s\n", strerror(errno)); + return -1; + } + + if (printkey_1(0, f)) { + PRINTERR("printkey_1 failed.\n"); + return -1; + } + + for (i = 1; i < u32; i++) { + /* read in subsequent key's headers */ + if ((members = fread(buf, 2*sizeof(TSS_UUID) + 3*sizeof(UINT16) + + sizeof(UINT32), 1, f)) != 1) { + PRINTERR("fread: %s\n", strerror(errno)); + return -1; + } + + if ((rc = printkey_1(i, f))) + return rc; + } + + return 0; +} + +/* the smallest key on disk should be around 360 bytes total + * and the largest should be about 560 bytes, so if the number + * of keys is not in this ballpark, this is probably not a PS + * file + */ +int +bad_file_size(UINT32 num_keys, off_t file_size) +{ + if ((num_keys * 360) > (unsigned long)file_size) + return 1; + + if ((num_keys * 560) < (unsigned long)file_size) + return 1; + + return 0; +} + +int +inspect(FILE *f, off_t file_size) +{ + int members = 0; + UINT32 *num_keys; + + /* do the initial read, which should include sizeof(TSS_UUID) + * + sizeof(UINT32) + 1 bytes */ + if ((members = fread(buf, + sizeof(TSS_UUID) + sizeof(UINT32) + 1, + 1, f)) != 1) { + printf("File is empty.\n"); + return -1; + } + + if (buf[0] == '\1') { + num_keys = (UINT32 *)&buf[1]; + if (*num_keys == 0 || bad_file_size(*num_keys, file_size)) + goto version0; + + return version_1_print(f); + } + +version0: + num_keys = (UINT32 *)&buf[0]; + if (*num_keys == 0 || bad_file_size(*num_keys, file_size)) { + printf("This file does not appear to be a valid PS file.\n"); + return -1; + } + + return version_0_print(f); +} + +int +main(int argc, char ** argv) +{ + FILE *f = NULL; + int rc; + struct stat stat_buf; + off_t file_size; + + if (argc != 2) + usage(argv[0]); + + if ((f = fopen(argv[1], "r")) == NULL) { + PRINTERR("fopen(%s): %s\n", argv[1], strerror(errno)); + return -1; + } + + if ((rc = fstat(fileno(f), &stat_buf))) { + PRINTERR("fstat(%s): %s\n", argv[1], strerror(errno)); + fclose(f); + return -1; + } + + file_size = stat_buf.st_size; + + PRINT("filename: %s (%lld bytes)\n", argv[1], (long long) file_size); + + rc = inspect(f, file_size); + + fclose(f); + + return rc; +} |