diff --git a/configure b/configure
index a0c4ccae5c33c0d25c8e7c644077fbde3b993c2f..50e40830c0957fd9b161112f9995fba9a4906963 100755
--- a/configure
+++ b/configure
@@ -26965,7 +26965,7 @@ _ACEOF
 
 
 
-ac_config_files="$ac_config_files Makefile config.xml auxdir/Makefile contribs/Makefile contribs/perlapi/Makefile contribs/perlapi/libslurm-perl/Makefile.PL contribs/torque/Makefile contribs/phpext/Makefile contribs/phpext/slurm_php/config.m4 src/Makefile src/api/Makefile src/common/Makefile src/database/Makefile src/sacct/Makefile src/sacctmgr/Makefile src/salloc/Makefile src/sbatch/Makefile src/sattach/Makefile src/srun/Makefile src/slurmd/Makefile src/slurmd/slurmd/Makefile src/slurmd/slurmstepd/Makefile src/slurmdbd/Makefile src/slurmctld/Makefile src/sbcast/Makefile src/scontrol/Makefile src/scancel/Makefile src/squeue/Makefile src/sinfo/Makefile src/smap/Makefile src/strigger/Makefile src/sview/Makefile src/plugins/Makefile src/plugins/accounting_storage/Makefile src/plugins/accounting_storage/filetxt/Makefile src/plugins/accounting_storage/gold/Makefile src/plugins/accounting_storage/mysql/Makefile src/plugins/accounting_storage/pgsql/Makefile src/plugins/accounting_storage/none/Makefile src/plugins/accounting_storage/slurmdbd/Makefile src/plugins/auth/Makefile src/plugins/auth/authd/Makefile src/plugins/auth/munge/Makefile src/plugins/auth/none/Makefile src/plugins/checkpoint/Makefile src/plugins/checkpoint/aix/Makefile src/plugins/checkpoint/none/Makefile src/plugins/checkpoint/ompi/Makefile src/plugins/checkpoint/xlch/Makefile src/plugins/crypto/Makefile src/plugins/crypto/munge/Makefile src/plugins/crypto/openssl/Makefile src/plugins/jobacct_gather/Makefile src/plugins/jobacct_gather/linux/Makefile src/plugins/jobacct_gather/aix/Makefile src/plugins/jobacct_gather/none/Makefile src/plugins/jobcomp/Makefile src/plugins/jobcomp/filetxt/Makefile src/plugins/jobcomp/none/Makefile src/plugins/jobcomp/script/Makefile src/plugins/jobcomp/mysql/Makefile src/plugins/jobcomp/pgsql/Makefile src/plugins/jobcomp/slurmdbd/Makefile src/plugins/proctrack/Makefile src/plugins/proctrack/aix/Makefile src/plugins/proctrack/pgid/Makefile src/plugins/proctrack/linuxproc/Makefile src/plugins/proctrack/rms/Makefile src/plugins/proctrack/sgi_job/Makefile src/plugins/sched/Makefile src/plugins/sched/backfill/Makefile src/plugins/sched/builtin/Makefile src/plugins/sched/gang/Makefile src/plugins/sched/hold/Makefile src/plugins/sched/wiki/Makefile src/plugins/sched/wiki2/Makefile src/plugins/select/Makefile src/plugins/select/bluegene/Makefile src/plugins/select/bluegene/block_allocator/Makefile src/plugins/select/bluegene/plugin/Makefile src/plugins/select/linear/Makefile src/plugins/select/cons_res/Makefile src/plugins/switch/Makefile src/plugins/switch/elan/Makefile src/plugins/switch/none/Makefile src/plugins/switch/federation/Makefile src/plugins/mpi/Makefile src/plugins/mpi/mpich1_p4/Makefile src/plugins/mpi/mpich1_shmem/Makefile src/plugins/mpi/mpichgm/Makefile src/plugins/mpi/mpichmx/Makefile src/plugins/mpi/mvapich/Makefile src/plugins/mpi/lam/Makefile src/plugins/mpi/none/Makefile src/plugins/mpi/openmpi/Makefile src/plugins/task/Makefile src/plugins/task/affinity/Makefile src/plugins/task/none/Makefile doc/Makefile doc/man/Makefile doc/html/Makefile doc/html/configurator.html testsuite/Makefile testsuite/expect/Makefile testsuite/slurm_unit/Makefile testsuite/slurm_unit/common/Makefile testsuite/slurm_unit/slurmctld/Makefile testsuite/slurm_unit/slurmd/Makefile testsuite/slurm_unit/api/Makefile testsuite/slurm_unit/api/manual/Makefile"
+ac_config_files="$ac_config_files Makefile config.xml auxdir/Makefile contribs/Makefile contribs/perlapi/Makefile contribs/perlapi/libslurm-perl/Makefile.PL contribs/torque/Makefile contribs/phpext/Makefile contribs/phpext/slurm_php/config.m4 src/Makefile src/api/Makefile src/common/Makefile src/database/Makefile src/sacct/Makefile src/sacctmgr/Makefile src/sreport/Makefile src/salloc/Makefile src/sbatch/Makefile src/sattach/Makefile src/srun/Makefile src/slurmd/Makefile src/slurmd/slurmd/Makefile src/slurmd/slurmstepd/Makefile src/slurmdbd/Makefile src/slurmctld/Makefile src/sbcast/Makefile src/scontrol/Makefile src/scancel/Makefile src/squeue/Makefile src/sinfo/Makefile src/smap/Makefile src/strigger/Makefile src/sview/Makefile src/plugins/Makefile src/plugins/accounting_storage/Makefile src/plugins/accounting_storage/filetxt/Makefile src/plugins/accounting_storage/gold/Makefile src/plugins/accounting_storage/mysql/Makefile src/plugins/accounting_storage/pgsql/Makefile src/plugins/accounting_storage/none/Makefile src/plugins/accounting_storage/slurmdbd/Makefile src/plugins/auth/Makefile src/plugins/auth/authd/Makefile src/plugins/auth/munge/Makefile src/plugins/auth/none/Makefile src/plugins/checkpoint/Makefile src/plugins/checkpoint/aix/Makefile src/plugins/checkpoint/none/Makefile src/plugins/checkpoint/ompi/Makefile src/plugins/checkpoint/xlch/Makefile src/plugins/crypto/Makefile src/plugins/crypto/munge/Makefile src/plugins/crypto/openssl/Makefile src/plugins/jobacct_gather/Makefile src/plugins/jobacct_gather/linux/Makefile src/plugins/jobacct_gather/aix/Makefile src/plugins/jobacct_gather/none/Makefile src/plugins/jobcomp/Makefile src/plugins/jobcomp/filetxt/Makefile src/plugins/jobcomp/none/Makefile src/plugins/jobcomp/script/Makefile src/plugins/jobcomp/mysql/Makefile src/plugins/jobcomp/pgsql/Makefile src/plugins/jobcomp/slurmdbd/Makefile src/plugins/proctrack/Makefile src/plugins/proctrack/aix/Makefile src/plugins/proctrack/pgid/Makefile src/plugins/proctrack/linuxproc/Makefile src/plugins/proctrack/rms/Makefile src/plugins/proctrack/sgi_job/Makefile src/plugins/sched/Makefile src/plugins/sched/backfill/Makefile src/plugins/sched/builtin/Makefile src/plugins/sched/gang/Makefile src/plugins/sched/hold/Makefile src/plugins/sched/wiki/Makefile src/plugins/sched/wiki2/Makefile src/plugins/select/Makefile src/plugins/select/bluegene/Makefile src/plugins/select/bluegene/block_allocator/Makefile src/plugins/select/bluegene/plugin/Makefile src/plugins/select/linear/Makefile src/plugins/select/cons_res/Makefile src/plugins/switch/Makefile src/plugins/switch/elan/Makefile src/plugins/switch/none/Makefile src/plugins/switch/federation/Makefile src/plugins/mpi/Makefile src/plugins/mpi/mpich1_p4/Makefile src/plugins/mpi/mpich1_shmem/Makefile src/plugins/mpi/mpichgm/Makefile src/plugins/mpi/mpichmx/Makefile src/plugins/mpi/mvapich/Makefile src/plugins/mpi/lam/Makefile src/plugins/mpi/none/Makefile src/plugins/mpi/openmpi/Makefile src/plugins/task/Makefile src/plugins/task/affinity/Makefile src/plugins/task/none/Makefile doc/Makefile doc/man/Makefile doc/html/Makefile doc/html/configurator.html testsuite/Makefile testsuite/expect/Makefile testsuite/slurm_unit/Makefile testsuite/slurm_unit/common/Makefile testsuite/slurm_unit/slurmctld/Makefile testsuite/slurm_unit/slurmd/Makefile testsuite/slurm_unit/api/Makefile testsuite/slurm_unit/api/manual/Makefile"
 
 
 cat >confcache <<\_ACEOF
@@ -27696,6 +27696,7 @@ do
     "src/database/Makefile") CONFIG_FILES="$CONFIG_FILES src/database/Makefile" ;;
     "src/sacct/Makefile") CONFIG_FILES="$CONFIG_FILES src/sacct/Makefile" ;;
     "src/sacctmgr/Makefile") CONFIG_FILES="$CONFIG_FILES src/sacctmgr/Makefile" ;;
+    "src/sreport/Makefile") CONFIG_FILES="$CONFIG_FILES src/sreport/Makefile" ;;
     "src/salloc/Makefile") CONFIG_FILES="$CONFIG_FILES src/salloc/Makefile" ;;
     "src/sbatch/Makefile") CONFIG_FILES="$CONFIG_FILES src/sbatch/Makefile" ;;
     "src/sattach/Makefile") CONFIG_FILES="$CONFIG_FILES src/sattach/Makefile" ;;
diff --git a/configure.ac b/configure.ac
index 9389c68aa0f04d66562e1a52da5f5e77b8b4a805..385a69f9bdf3ff6bc676eb29e2351e0517662f78 100644
--- a/configure.ac
+++ b/configure.ac
@@ -284,6 +284,7 @@ AC_CONFIG_FILES([Makefile
 		 src/database/Makefile
 		 src/sacct/Makefile
 		 src/sacctmgr/Makefile
+		 src/sreport/Makefile
 		 src/salloc/Makefile 
 		 src/sbatch/Makefile 
 		 src/sattach/Makefile
diff --git a/doc/man/Makefile.am b/doc/man/Makefile.am
index 4a5d0c1768dca810d18f8abc837990c5dab9d032..6f26a535585f6015085811d28ba2272c2406528b 100644
--- a/doc/man/Makefile.am
+++ b/doc/man/Makefile.am
@@ -14,6 +14,7 @@ man1_MANS =            \
 	man1/slurm.1 \
 	man1/smap.1 \
 	man1/squeue.1 \
+	man1/sreport.1 \
 	man1/srun.1 \
 	man1/strigger.1 \
 	man1/sview.1
diff --git a/doc/man/man1/sreport.1 b/doc/man/man1/sreport.1
new file mode 100644
index 0000000000000000000000000000000000000000..e67311c9fec92a1a9ef82d517af9f06f70d23860
--- /dev/null
+++ b/doc/man/man1/sreport.1
@@ -0,0 +1,111 @@
+.TH SREPORT "1" "May 2008" "sreport 1.3" "Slurm components"
+
+.SH "NAME"
+sreport \- Used to generate reports from the slurm accounting data.
+
+.SH "SYNOPSIS"
+\fBssreport\fR [\fIOPTIONS\fR...] [\fICOMMAND\fR...]
+
+.SH "DESCRIPTION"
+\fBssreport\fR is used to generator certain reports.  Right now
+sreport is a template that does not really do anything.  In the future
+it will provide a view into accounting data gathered from slurm via
+the account information maintained within a database with the interface 
+being provided by \fBslurmdbd\fR (Slurm Database daemon).
+
+.SH "OPTIONS"
+
+.TP
+\fB\-h\fR, \fB\-\-help\fR
+Print a help message describing the usage of \fBssreport\fR.
+This is equivalent to the \fBhelp\fR command.
+
+.TP
+\fB\-o\fR, \fB\-\-oneliner\fR
+Print information one line per record.
+This is equivalent to the \fBoneliner\fR command.
+
+.TP
+\fB\-q\fR, \fB\-\-quiet\fR
+Print no warning or informational messages, only error messages.
+This is equivalent to the \fBquiet\fR command.
+
+.TP
+\fB\-v\fR, \fB\-\-verbose\fR
+Print detailed event logging. 
+This is equivalent to the \fBverbose\fR command.
+
+.TP
+\fB\-V\fR , \fB\-\-version\fR
+Print version information and exit.
+This is equivalent to the \fBversion\fR command.
+
+.TP
+\fBCOMMANDS\fR
+
+.TP
+\fBexit\fP
+Terminate the execution of sreport.
+Identical to the \fBquit\fR command.
+
+.TP
+\fBhelp\fP
+Display a description of sreport options and commands.
+
+.TP
+\fBhide\fP
+Do not display information about hidden or deleted entities. 
+
+.TP
+\fBoneliner\fP
+Print information one line per record.
+
+.TP
+\fBquiet\fP
+Print no warning or informational messages, only fatal error messages.
+
+.TP
+\fBquit\fP
+Terminate the execution of sreport.
+Identical to the \fBexit\fR command.
+
+.TP
+\fBverbose\fP
+Print detailed event logging. 
+This includes time\-stamps on data structures, record counts, etc.
+This is an independent command with no options meant for use in interactive mode.
+
+.TP
+\fBversion\fP
+Display the version number of sreport being executed.
+
+.TP
+\fB!!\fP
+Repeat the last command executed.
+
+.SH "EXAMPLES"
+.eo
+.br
+.ec
+
+.SH "COPYING"
+Copyright (C) 2008 Lawrence Livermore National Security.
+Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
+LLNL\-CODE\-402394.
+.LP
+This file is part of SLURM, a resource management program.
+For details, see <https://computing.llnl.gov/linux/slurm/>.
+.LP
+SLURM 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.
+.LP
+SLURM 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.
+
+.SH "SEE ALSO"
+\fBslurm.conf\fR(5)
+\fBslurmdbd\fR(8)
diff --git a/src/Makefile.am b/src/Makefile.am
index 27bc3799315accc8411326e7525e0a1249d00c36..9790924e041f6635f9fe95fbbd0d9e19913fa235 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,6 +1,6 @@
 
 SUBDIRS = common api database \
-	slurmctld slurmd plugins srun sbcast \
+	slurmctld slurmd slurmdbd plugins srun sbcast \
 	scontrol scancel squeue sinfo smap sview salloc \
-	sbatch sattach strigger slurmdbd sacct sacctmgr
+	sbatch sattach strigger sacct sacctmgr sreport
 
diff --git a/src/Makefile.in b/src/Makefile.in
index 42a5d704ac3ad95efc9b93f66fdc1b621af9927c..d1d05ce6f212fc5ec25f3866a7f0083457f21fb9 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -246,9 +246,9 @@ target_vendor = @target_vendor@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
 SUBDIRS = common api database \
-	slurmctld slurmd plugins srun sbcast \
+	slurmctld slurmd slurmdbd plugins srun sbcast \
 	scontrol scancel squeue sinfo smap sview salloc \
-	sbatch sattach strigger slurmdbd sacct sacctmgr
+	sbatch sattach strigger sacct sacctmgr sreport
 
 all: all-recursive
 
diff --git a/src/sacctmgr/sacctmgr.c b/src/sacctmgr/sacctmgr.c
index d0fd50566f7aafa4acaa30e2ee78152d5ad00e97..c56e76ddec202171cf7f422f58a166b0ca8a738e 100644
--- a/src/sacctmgr/sacctmgr.c
+++ b/src/sacctmgr/sacctmgr.c
@@ -61,11 +61,6 @@ typedef struct {
 } sacctmgr_file_opts_t;
 
 
-FILE *history_fp = NULL;
-int history_pos = 0;
-int history_count = 0;
-char **history = NULL;
-
 char *command_name;
 int all_flag;		/* display even hidden partitions */
 int exit_code;		/* sacctmgr's exit code, =1 on any error at any time */
@@ -75,11 +70,6 @@ int one_liner;		/* one record per line if =1 */
 int quiet_flag;		/* quiet=1, verbose=-1, normal=0 */
 int rollback_flag;       /* immediate execute=1, else = 0 */
 int with_assoc_flag = 0;
-List sacctmgr_action_list = NULL;
-List sacctmgr_user_list = NULL;
-List sacctmgr_association_list = NULL;
-List sacctmgr_account_list = NULL;
-List sacctmgr_cluster_list = NULL;
 void *db_conn = NULL;
 uint32_t my_uid = 0;
 
diff --git a/src/sreport/Makefile.am b/src/sreport/Makefile.am
new file mode 100644
index 0000000000000000000000000000000000000000..a4bf7fccb98431dd184120e564b1488a31b00ba5
--- /dev/null
+++ b/src/sreport/Makefile.am
@@ -0,0 +1,21 @@
+# Makefile for sreport
+
+AUTOMAKE_OPTIONS = foreign
+
+INCLUDES = -I$(top_srcdir)
+
+bin_PROGRAMS = sreport
+
+sreport_SOURCES =	\
+	sreport.c sreport.h	
+
+sreport_LDADD =  \
+	$(top_builddir)/src/common/libcommon.o -ldl \
+	$(top_builddir)/src/api/libslurmhelper.la \
+	$(READLINE_LIBS)
+
+sreport_LDFLAGS = -export-dynamic $(CMD_LDFLAGS)
+
+force:
+$(convenience_libs) : force
+	@cd `dirname $@` && $(MAKE) `basename $@`
diff --git a/src/sreport/Makefile.in b/src/sreport/Makefile.in
new file mode 100644
index 0000000000000000000000000000000000000000..e15b13e502bae9d78558c4073f0395a214b7f964
--- /dev/null
+++ b/src/sreport/Makefile.in
@@ -0,0 +1,561 @@
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008  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@
+
+# Makefile for sreport
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@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@
+bin_PROGRAMS = sreport$(EXEEXT)
+subdir = src/sreport
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/auxdir/acx_pthread.m4 \
+	$(top_srcdir)/auxdir/slurm.m4 \
+	$(top_srcdir)/auxdir/x_ac__system_configuration.m4 \
+	$(top_srcdir)/auxdir/x_ac_affinity.m4 \
+	$(top_srcdir)/auxdir/x_ac_aix.m4 \
+	$(top_srcdir)/auxdir/x_ac_bluegene.m4 \
+	$(top_srcdir)/auxdir/x_ac_cflags.m4 \
+	$(top_srcdir)/auxdir/x_ac_databases.m4 \
+	$(top_srcdir)/auxdir/x_ac_debug.m4 \
+	$(top_srcdir)/auxdir/x_ac_elan.m4 \
+	$(top_srcdir)/auxdir/x_ac_federation.m4 \
+	$(top_srcdir)/auxdir/x_ac_gpl_licensed.m4 \
+	$(top_srcdir)/auxdir/x_ac_gtk.m4 \
+	$(top_srcdir)/auxdir/x_ac_munge.m4 \
+	$(top_srcdir)/auxdir/x_ac_ncurses.m4 \
+	$(top_srcdir)/auxdir/x_ac_pam.m4 \
+	$(top_srcdir)/auxdir/x_ac_ptrace.m4 \
+	$(top_srcdir)/auxdir/x_ac_readline.m4 \
+	$(top_srcdir)/auxdir/x_ac_setpgrp.m4 \
+	$(top_srcdir)/auxdir/x_ac_setproctitle.m4 \
+	$(top_srcdir)/auxdir/x_ac_sgi_job.m4 \
+	$(top_srcdir)/auxdir/x_ac_slurm_ssl.m4 \
+	$(top_srcdir)/auxdir/x_ac_xcpu.m4 $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+	$(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h $(top_builddir)/slurm/slurm.h
+CONFIG_CLEAN_FILES =
+am__installdirs = "$(DESTDIR)$(bindir)"
+binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
+PROGRAMS = $(bin_PROGRAMS)
+am_sreport_OBJECTS = sreport.$(OBJEXT)
+sreport_OBJECTS = $(am_sreport_OBJECTS)
+am__DEPENDENCIES_1 =
+sreport_DEPENDENCIES = $(top_builddir)/src/common/libcommon.o \
+	$(top_builddir)/src/api/libslurmhelper.la \
+	$(am__DEPENDENCIES_1)
+sreport_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+	--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(sreport_LDFLAGS) \
+	$(LDFLAGS) -o $@
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) -I$(top_builddir)/slurm
+depcomp = $(SHELL) $(top_srcdir)/auxdir/depcomp
+am__depfiles_maybe = depfiles
+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 = $(sreport_SOURCES)
+DIST_SOURCES = $(sreport_SOURCES)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTHD_CFLAGS = @AUTHD_CFLAGS@
+AUTHD_LIBS = @AUTHD_LIBS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BG_INCLUDES = @BG_INCLUDES@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CMD_LDFLAGS = @CMD_LDFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DSYMUTIL = @DSYMUTIL@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+ELAN_LIBS = @ELAN_LIBS@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FEDERATION_LDFLAGS = @FEDERATION_LDFLAGS@
+FFLAGS = @FFLAGS@
+GREP = @GREP@
+GTK2_CFLAGS = @GTK2_CFLAGS@
+GTK2_LIBS = @GTK2_LIBS@
+HAVEMYSQLCONFIG = @HAVEMYSQLCONFIG@
+HAVEPGCONFIG = @HAVEPGCONFIG@
+HAVEPKGCONFIG = @HAVEPKGCONFIG@
+HAVE_AIX = @HAVE_AIX@
+HAVE_ELAN = @HAVE_ELAN@
+HAVE_FEDERATION = @HAVE_FEDERATION@
+HAVE_OPENSSL = @HAVE_OPENSSL@
+HAVE_SOME_CURSES = @HAVE_SOME_CURSES@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIB_LDFLAGS = @LIB_LDFLAGS@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+MUNGE_CPPFLAGS = @MUNGE_CPPFLAGS@
+MUNGE_LDFLAGS = @MUNGE_LDFLAGS@
+MUNGE_LIBS = @MUNGE_LIBS@
+MYSQL_CFLAGS = @MYSQL_CFLAGS@
+MYSQL_LIBS = @MYSQL_LIBS@
+NCURSES = @NCURSES@
+NMEDIT = @NMEDIT@
+NUMA_LIBS = @NUMA_LIBS@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PAM_LIBS = @PAM_LIBS@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PGSQL_CFLAGS = @PGSQL_CFLAGS@
+PGSQL_LIBS = @PGSQL_LIBS@
+PLPA_LIBS = @PLPA_LIBS@
+PROCTRACKDIR = @PROCTRACKDIR@
+PROJECT = @PROJECT@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
+RANLIB = @RANLIB@
+READLINE_LIBS = @READLINE_LIBS@
+RELEASE = @RELEASE@
+SED = @SED@
+SEMAPHORE_LIBS = @SEMAPHORE_LIBS@
+SEMAPHORE_SOURCES = @SEMAPHORE_SOURCES@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SLURMCTLD_PORT = @SLURMCTLD_PORT@
+SLURMDBD_PORT = @SLURMDBD_PORT@
+SLURMD_PORT = @SLURMD_PORT@
+SLURM_API_AGE = @SLURM_API_AGE@
+SLURM_API_CURRENT = @SLURM_API_CURRENT@
+SLURM_API_MAJOR = @SLURM_API_MAJOR@
+SLURM_API_REVISION = @SLURM_API_REVISION@
+SLURM_API_VERSION = @SLURM_API_VERSION@
+SLURM_MAJOR = @SLURM_MAJOR@
+SLURM_MICRO = @SLURM_MICRO@
+SLURM_MINOR = @SLURM_MINOR@
+SLURM_VERSION = @SLURM_VERSION@
+SO_LDFLAGS = @SO_LDFLAGS@
+SSL_CPPFLAGS = @SSL_CPPFLAGS@
+SSL_LDFLAGS = @SSL_LDFLAGS@
+SSL_LIBS = @SSL_LIBS@
+STRIP = @STRIP@
+UTIL_LIBS = @UTIL_LIBS@
+VERSION = @VERSION@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+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_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+AUTOMAKE_OPTIONS = foreign
+INCLUDES = -I$(top_srcdir)
+sreport_SOURCES = \
+	sreport.c sreport.h	
+
+sreport_LDADD = \
+	$(top_builddir)/src/common/libcommon.o -ldl \
+	$(top_builddir)/src/api/libslurmhelper.la \
+	$(READLINE_LIBS)
+
+sreport_LDFLAGS = -export-dynamic $(CMD_LDFLAGS)
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+		&& exit 0; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  src/sreport/Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --foreign  src/sreport/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: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+install-binPROGRAMS: $(bin_PROGRAMS)
+	@$(NORMAL_INSTALL)
+	test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
+	@list='$(bin_PROGRAMS)'; for p in $$list; do \
+	  p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+	  if test -f $$p \
+	     || test -f $$p1 \
+	  ; then \
+	    f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
+	   echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \
+	   $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \
+	  else :; fi; \
+	done
+
+uninstall-binPROGRAMS:
+	@$(NORMAL_UNINSTALL)
+	@list='$(bin_PROGRAMS)'; for p in $$list; do \
+	  f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
+	  echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \
+	  rm -f "$(DESTDIR)$(bindir)/$$f"; \
+	done
+
+clean-binPROGRAMS:
+	@list='$(bin_PROGRAMS)'; for p in $$list; do \
+	  f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+	  echo " rm -f $$p $$f"; \
+	  rm -f $$p $$f ; \
+	done
+sreport$(EXEEXT): $(sreport_OBJECTS) $(sreport_DEPENDENCIES) 
+	@rm -f sreport$(EXEEXT)
+	$(sreport_LINK) $(sreport_OBJECTS) $(sreport_LDADD) $(LIBS)
+
+mostlyclean-compile:
+	-rm -f *.$(OBJEXT)
+
+distclean-compile:
+	-rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sreport.Po@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@	$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@	mv -f $(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@	mv -f $(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@	mv -f $(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 $@ $<
+
+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; nonemtpy = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
+	mkid -fID $$unique
+tags: TAGS
+
+TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	tags=; \
+	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; }; }'`; \
+	if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+	  test -n "$$unique" || unique=$$empty_fix; \
+	  $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	    $$tags $$unique; \
+	fi
+ctags: CTAGS
+CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	tags=; \
+	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)$$tags$$unique" \
+	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+	     $$tags $$unique
+
+GTAGS:
+	here=`$(am__cd) $(top_builddir) && pwd` \
+	  && 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 $(srcdir)/$$file && test $$d != $(srcdir); then \
+	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+	    fi; \
+	    cp -pR $$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:
+	for dir in "$(DESTDIR)$(bindir)"; do \
+	  test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+	done
+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)
+
+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-binPROGRAMS clean-generic clean-libtool 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
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-exec-am: install-binPROGRAMS
+
+install-html: install-html-am
+
+install-info: install-info-am
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-ps: 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: uninstall-binPROGRAMS
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
+	clean-generic clean-libtool ctags distclean distclean-compile \
+	distclean-generic distclean-libtool distclean-tags distdir dvi \
+	dvi-am html html-am info info-am install install-am \
+	install-binPROGRAMS 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 \
+	uninstall-binPROGRAMS
+
+
+force:
+$(convenience_libs) : force
+	@cd `dirname $@` && $(MAKE) `basename $@`
+# 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/src/sreport/sreport.c b/src/sreport/sreport.c
new file mode 100644
index 0000000000000000000000000000000000000000..c3dfb8223eaf579769e4c88352147e9bd382ddf9
--- /dev/null
+++ b/src/sreport/sreport.c
@@ -0,0 +1,379 @@
+/*****************************************************************************\
+ *  sreport.c - report generating tool for slurm accounting.
+ *****************************************************************************
+ *  Copyright (C) 2008 Lawrence Livermore National Security.
+ *  Copyright (C) 2002-2007 The Regents of the University of California.
+ *  Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
+ *  Written by Danny Auble <da@llnl.gov>
+ *  LLNL-CODE-402394.
+ *  
+ *  This file is part of SLURM, a resource management program.
+ *  For details, see <http://www.llnl.gov/linux/slurm/>.
+ *  
+ *  SLURM 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.
+ *
+ *  In addition, as a special exception, the copyright holders give permission 
+ *  to link the code of portions of this program with the OpenSSL library under
+ *  certain conditions as described in each individual source file, and 
+ *  distribute linked combinations including the two. You must obey the GNU 
+ *  General Public License in all respects for all of the code used other than 
+ *  OpenSSL. If you modify file(s) with this exception, you may extend this 
+ *  exception to your version of the file(s), but you are not obligated to do 
+ *  so. If you do not wish to do so, delete this exception statement from your
+ *  version.  If you delete this exception statement from all source files in 
+ *  the program, then also delete it here.
+ *  
+ *  SLURM 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 SLURM; if not, write to the Free Software Foundation, Inc.,
+ *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA.
+\*****************************************************************************/
+
+#include "src/sreport/sreport.h"
+#include "src/common/xsignal.h"
+
+#define OPT_LONG_HIDE   0x102
+#define BUFFER_SIZE 4096
+
+char *command_name;
+int exit_code;		/* sreport's exit code, =1 on any error at any time */
+int exit_flag;		/* program to terminate if =1 */
+int input_words;	/* number of words of input permitted */
+int one_liner;		/* one record per line if =1 */
+int quiet_flag;		/* quiet=1, verbose=-1, normal=0 */
+int rollback_flag;       /* immediate execute=1, else = 0 */
+int with_assoc_flag = 0;
+void *db_conn = NULL;
+uint32_t my_uid = 0;
+
+static int	_get_command (int *argc, char *argv[]);
+static void     _print_version( void );
+static int	_process_command (int argc, char *argv[]);
+static void	_usage ();
+
+int 
+main (int argc, char *argv[]) 
+{
+	int error_code = SLURM_SUCCESS, i, opt_char, input_field_count;
+	char **input_fields;
+	log_options_t opts = LOG_OPTS_STDERR_ONLY ;
+
+	int option_index;
+	static struct option long_options[] = {
+		{"help",     0, 0, 'h'},
+		{"immediate",0, 0, 'i'},
+		{"oneliner", 0, 0, 'o'},
+		{"no_header", 0, 0, 'n'},
+		{"parsable", 0, 0, 'p'},
+		{"quiet",    0, 0, 'q'},
+		{"usage",    0, 0, 'h'},
+		{"verbose",  0, 0, 'v'},
+		{"version",  0, 0, 'V'},
+		{NULL,       0, 0, 0}
+	};
+
+	command_name      = argv[0];
+	rollback_flag     = 1;
+	exit_code         = 0;
+	exit_flag         = 0;
+	input_field_count = 0;
+	quiet_flag        = 0;
+	log_init("sacctmgr", opts, SYSLOG_FACILITY_DAEMON, NULL);
+
+	while((opt_char = getopt_long(argc, argv, "hionpqsvV",
+			long_options, &option_index)) != -1) {
+		switch (opt_char) {
+		case (int)'?':
+			fprintf(stderr, "Try \"sacctmgr --help\" "
+				"for more information\n");
+			exit(1);
+			break;
+		case (int)'h':
+			_usage ();
+			exit(exit_code);
+			break;
+		case (int)'i':
+			rollback_flag = 0;
+			break;
+		case (int)'o':
+			one_liner = 1;
+			break;
+/* 		case (int)'n': */
+/* 			have_header = 0; */
+/* 			break; */
+/* 		case (int)'p': */
+/* 			parsable_print = 1; */
+/* 			break; */
+		case (int)'q':
+			quiet_flag = 1;
+			break;
+		case (int)'s':
+			with_assoc_flag = 1;
+			break;
+		case (int)'v':
+			quiet_flag = -1;
+			break;
+		case (int)'V':
+			_print_version();
+			exit(exit_code);
+			break;
+		default:
+			exit_code = 1;
+			fprintf(stderr, "getopt error, returned %c\n", 
+				opt_char);
+			exit(exit_code);
+		}
+	}
+
+	if (argc > MAX_INPUT_FIELDS)	/* bogus input, but continue anyway */
+		input_words = argc;
+	else
+		input_words = 128;
+	input_fields = (char **) xmalloc (sizeof (char *) * input_words);
+	if (optind < argc) {
+		for (i = optind; i < argc; i++) {
+			input_fields[input_field_count++] = argv[i];
+		}	
+	}
+
+	db_conn = acct_storage_g_get_connection(false, rollback_flag);
+	my_uid = getuid();
+
+	if (input_field_count)
+		exit_flag = 1;
+	else
+		error_code = _get_command (&input_field_count, input_fields);
+	while (error_code == SLURM_SUCCESS) {
+		error_code = _process_command (input_field_count, 
+					       input_fields);
+		if (error_code || exit_flag)
+			break;
+		error_code = _get_command (&input_field_count, input_fields);
+	}
+
+	acct_storage_g_close_connection(&db_conn);
+	slurm_acct_storage_fini();
+	printf("\n");
+	exit(exit_code);
+}
+
+#if !HAVE_READLINE
+/*
+ * Alternative to readline if readline is not available
+ */
+static char *
+getline(const char *prompt)
+{
+	char buf[4096];
+	char *line;
+	int len;
+	printf("%s", prompt);
+
+	fgets(buf, 4096, stdin);
+	len = strlen(buf);
+	if ((len > 0) && (buf[len-1] == '\n'))
+		buf[len-1] = '\0';
+	else
+		len++;
+	line = malloc (len * sizeof(char));
+	return strncpy(line, buf, len);
+}
+#endif
+
+/*
+ * _get_command - get a command from the user
+ * OUT argc - location to store count of arguments
+ * OUT argv - location to store the argument list
+ */
+static int 
+_get_command (int *argc, char **argv) 
+{
+	char *in_line;
+	static char *last_in_line = NULL;
+	int i, in_line_size;
+	static int last_in_line_size = 0;
+
+	*argc = 0;
+
+#if HAVE_READLINE
+	in_line = readline ("sreport: ");
+#else
+	in_line = getline("sreport: ");
+#endif
+	if (in_line == NULL)
+		return 0;
+	else if (strcmp (in_line, "!!") == 0) {
+		free (in_line);
+		in_line = last_in_line;
+		in_line_size = last_in_line_size;
+	} else {
+		if (last_in_line)
+			free (last_in_line);
+		last_in_line = in_line;
+		last_in_line_size = in_line_size = strlen (in_line);
+	}
+
+#if HAVE_READLINE
+	add_history(in_line);
+#endif
+
+	/* break in_line into tokens */
+	for (i = 0; i < in_line_size; i++) {
+		bool double_quote = false, single_quote = false;
+		if (in_line[i] == '\0')
+			break;
+		if (isspace ((int) in_line[i]))
+			continue;
+		if (((*argc) + 1) > MAX_INPUT_FIELDS) {	/* bogus input line */
+			exit_code = 1;
+			fprintf (stderr, 
+				 "%s: can not process over %d words\n",
+				 command_name, input_words);
+			return E2BIG;
+		}		
+		argv[(*argc)++] = &in_line[i];
+		for (i++; i < in_line_size; i++) {
+			if (in_line[i] == '\042') {
+				double_quote = !double_quote;
+				continue;
+			}
+			if (in_line[i] == '\047') {
+				single_quote = !single_quote;
+				continue;
+			}
+			if (in_line[i] == '\0')
+				break;
+			if (double_quote || single_quote)
+				continue;
+			if (isspace ((int) in_line[i])) {
+				in_line[i] = '\0';
+				break;
+			}
+		}		
+	}
+	return 0;		
+}
+
+
+static void _print_version(void)
+{
+	printf("%s %s\n", PACKAGE, SLURM_VERSION);
+	if (quiet_flag == -1) {
+		long version = slurm_api_version();
+		printf("slurm_api_version: %ld, %ld.%ld.%ld\n", version,
+			SLURM_VERSION_MAJOR(version), 
+			SLURM_VERSION_MINOR(version),
+			SLURM_VERSION_MICRO(version));
+	}
+}
+
+/*
+ * _process_command - process the user's command
+ * IN argc - count of arguments
+ * IN argv - the arguments
+ * RET 0 or errno (only for errors fatal to sreport)
+ */
+static int
+_process_command (int argc, char *argv[]) 
+{
+	if (argc < 1) {
+		exit_code = 1;
+		if (quiet_flag == -1)
+			fprintf(stderr, "no input");
+	} else if (strncasecmp (argv[0], "help", 2) == 0) {
+		if (argc > 1) {
+			exit_code = 1;
+			fprintf (stderr, 
+				 "too many arguments for keyword:%s\n",
+				 argv[0]);
+		}
+		_usage ();
+	} else if (strncasecmp (argv[0], "oneliner", 1) == 0) {
+		if (argc > 1) {
+			exit_code = 1;
+			fprintf (stderr, 
+				 "too many arguments for keyword:%s\n",
+				 argv[0]);
+		}
+		one_liner = 1;
+	} else if (strncasecmp (argv[0], "quiet", 4) == 0) {
+		if (argc > 1) {
+			exit_code = 1;
+			fprintf (stderr, "too many arguments for keyword:%s\n",
+				 argv[0]);
+		}
+		quiet_flag = 1;
+	} else if ((strncasecmp (argv[0], "exit", 4) == 0) ||
+		   (strncasecmp (argv[0], "quit", 4) == 0)) {
+		if (argc > 1) {
+			exit_code = 1;
+			fprintf (stderr, 
+				 "too many arguments for keyword:%s\n", 
+				 argv[0]);
+		}
+		exit_flag = 1;
+	} else if (strncasecmp (argv[0], "verbose", 4) == 0) {
+		if (argc > 1) {
+			exit_code = 1;
+			fprintf (stderr,
+				 "too many arguments for %s keyword\n",
+				 argv[0]);
+		}		
+		quiet_flag = -1;
+	} else if (strncasecmp (argv[0], "version", 4) == 0) {
+		if (argc > 1) {
+			exit_code = 1;
+			fprintf (stderr,
+				 "too many arguments for %s keyword\n",
+				 argv[0]);
+		}		
+		_print_version();
+	} else {
+		exit_code = 1;
+		fprintf (stderr, "invalid keyword: %s\n", argv[0]);
+	}
+		
+	return 0;
+}
+
+/* _usage - show the valid sreport commands */
+void _usage () {
+	printf ("\
+sreport [<OPTION>] [<COMMAND>]                                             \n\
+    Valid <OPTION> values are:                                             \n\
+     -h or --help: equivalent to \"help\" command                          \n\
+     -o or --oneliner: equivalent to \"oneliner\" command                  \n\
+     -q or --quiet: equivalent to \"quiet\" command                        \n\
+     -s or --associations: equivalent to \"associations\" command          \n\
+     -v or --verbose: equivalent to \"verbose\" command                    \n\
+     -V or --version: equivalent to \"version\" command                    \n\
+                                                                           \n\
+  <keyword> may be omitted from the execute line and sreport will execute  \n\
+  in interactive mode. It will process commands as entered until explicitly\n\
+  terminated.                                                              \n\
+                                                                           \n\
+    Valid <COMMAND> values are:                                            \n\
+     exit                     terminate sreport                            \n\
+     help                     print this description of use.               \n\
+     no_header                no header will be added to the beginning of  \n\
+                              output.                                      \n\
+     oneliner                 report output one record per line.           \n\
+     quiet                    print no messages other than error messages. \n\
+     quit                     terminate this command.                      \n\
+     parsable                 output will be | delimited                   \n\
+     verbose                  enable detailed logging.                     \n\
+     version                  display tool version number.                 \n\
+     !!                       Repeat the last command entered.             \n\
+                                                                           \n\
+                                                                           \n\
+  All commands entitys, and options are case-insensitive.               \n\n");
+	
+}
+
diff --git a/src/sreport/sreport.h b/src/sreport/sreport.h
new file mode 100644
index 0000000000000000000000000000000000000000..034f03e5cd37c11cf96bf3ee69cecb355b862824
--- /dev/null
+++ b/src/sreport/sreport.h
@@ -0,0 +1,88 @@
+/*****************************************************************************\
+ *  sreport.h - report generating tool for slurm accounting header file.
+ *****************************************************************************
+ *  Copyright (C) 2008 Lawrence Livermore National Security.
+ *  Copyright (C) 2002-2007 The Regents of the University of California.
+ *  Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
+ *  Written by Danny Auble <da@llnl.gov>
+ *  LLNL-CODE-402394.
+ *  
+ *  This file is part of SLURM, a resource management program.
+ *  For details, see <http://www.llnl.gov/linux/slurm/>.
+ *  
+ *  SLURM 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.
+ *
+ *  In addition, as a special exception, the copyright holders give permission 
+ *  to link the code of portions of this program with the OpenSSL library under
+ *  certain conditions as described in each individual source file, and 
+ *  distribute linked combinations including the two. You must obey the GNU 
+ *  General Public License in all respects for all of the code used other than 
+ *  OpenSSL. If you modify file(s) with this exception, you may extend this 
+ *  exception to your version of the file(s), but you are not obligated to do 
+ *  so. If you do not wish to do so, delete this exception statement from your
+ *  version.  If you delete this exception statement from all source files in 
+ *  the program, then also delete it here.
+ *  
+ *  SLURM 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 SLURM; if not, write to the Free Software Foundation, Inc.,
+ *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA.
+\*****************************************************************************/
+
+#ifndef __SREPORT_H__
+#define __SREPORT_H__
+
+#if HAVE_CONFIG_H
+#  include "config.h"
+#endif
+
+#if HAVE_GETOPT_H
+#  include <getopt.h>
+#else
+#  include "src/common/getopt.h"
+#endif
+
+#include <ctype.h>
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#ifdef HAVE_STRING_H
+#  include <string.h>
+#endif
+#ifdef HAVE_STRINGS_H
+#  include <strings.h>
+#endif
+#include <time.h>
+#include <unistd.h>
+
+#if HAVE_READLINE
+#  include <readline/readline.h>
+#  include <readline/history.h>
+#endif
+
+#if HAVE_INTTYPES_H
+#  include <inttypes.h>
+#else  /* !HAVE_INTTYPES_H */
+#  if HAVE_STDINT_H
+#    include <stdint.h>
+#  endif
+#endif  /* HAVE_INTTYPES_H */
+
+#include <slurm/slurm.h>
+
+#include "src/common/jobacct_common.h"
+#include "src/common/parse_time.h"
+#include "src/common/slurm_accounting_storage.h"
+#include "src/common/xstring.h"
+
+#define CKPT_WAIT	10
+#define	MAX_INPUT_FIELDS 128
+
+#endif /* HAVE_SREPORT_H */