augeas 0.4.0 → 0.5.0
raw patch · 8 files changed
+184/−13 lines, 8 files
Files
- ChangeLog +6/−0
- Config.h.in +3/−0
- HUnitAug.hs +49/−1
- System/Augeas.hs +45/−0
- System/AugeasHsc.hsc +4/−0
- augeas.cabal +2/−2
- configure +73/−9
- configure.ac +2/−1
ChangeLog view
@@ -1,3 +1,9 @@+2011-09-11 Jude Nagurney <jude@pwan.org>++ * Released version 0.5.0+ * Added aug_srun API support+ * Added AUG_EMVDESC and AUG_ECMDRUN support for aug_errcode+ 2011-04-07 Jude Nagurney <jude@pwan.org> * Released version 0.4.0
Config.h.in view
@@ -54,6 +54,9 @@ /* Augeas library has the aug_span function. */ #undef HAS_AUGEAS_SPAN +/* Augeas library has the aug_srun function. */+#undef HAS_AUGEAS_SRUN+ /* Define to 1 if you have the <augeas.h> header file. */ #undef HAVE_AUGEAS_H
HUnitAug.hs view
@@ -223,7 +223,8 @@ assertEqual "set OK" System.Augeas.error ret_set ret_error <- aug_error aug_ptr- assertEqual "testSetMultiMatch error" no_error ret_error+ -- assertEqual "testSetMultiMatch error" no_error ret_error+ assertEqual "testSetMultiMatch error" err_multi_matches ret_error ) #endif@@ -537,6 +538,48 @@ ) #endif +-- --------------+-- aug_srun tests+-- --------------+#ifdef HAS_AUGEAS_SRUN+testSrunHelp :: Test+testSrunHelp = TestCase ( with_augptr $ \aug_ptr -> do + + cwd <- getCurrentDirectory+ fptr_Output <- openFile (cwd++"/HUnitAug.txt") WriteMode+ ret_srun <- aug_srun aug_ptr fptr_Output (Data.ByteString.Char8.pack "help\n")+ assertEqual "testSrun ret_srun" (AugRet 1) ret_srun+ + hFlush fptr_Output+ hClose fptr_Output+ + contents <- IO.readFile (cwd++"/HUnitAug.txt")+ assertEqual "check aug_srun_help" (Data.List.isInfixOf "Commands:" contents) True+ assertEqual "check aug_srun_help" (Data.List.isInfixOf "Type 'help <command>' for more information on a command" contents) True+ + removeFile (cwd++"/HUnitAug.txt")++ )+ +testSrunQuit :: Test+testSrunQuit = TestCase ( with_augptr $ \aug_ptr -> do + + cwd <- getCurrentDirectory+ fptr_Output <- openFile (cwd++"/HUnitAug.txt") WriteMode+ ret_srun <- aug_srun aug_ptr fptr_Output (Data.ByteString.Char8.pack "quit\n")+ assertEqual "testSrun ret_srun_quit" (AugRet (-2)) ret_srun+ + hFlush fptr_Output+ hClose fptr_Output+ + contents <- IO.readFile (cwd++"/HUnitAug.txt")+ assertEqual "check aug_srun_quit_contents" (contents == "") True+ + -- removeFile (cwd++"/HUnitAug.txt")++ )+#endif+ -- --------------- -- aug_error tests -- ---------------@@ -664,6 +707,11 @@ #ifdef HAS_AUGEAS_PRINT ,testPrint+#endif++#ifdef HAS_AUGEAS_SRUN+ ,testSrunHelp+ ,testSrunQuit #endif
System/Augeas.hs view
@@ -54,6 +54,12 @@ #ifdef HAS_AUGEAS_SPAN , err_no_span #endif+#ifdef HAS_AUGEAS_MV+ , err_mv_desc+#endif+#ifdef HAS_AUGEAS_SUN+ , err_cmd_run+#endif -- * Functions , aug_init@@ -70,6 +76,7 @@ , aug_save , aug_load , aug_print+ , aug_srun , aug_error , aug_error_message , aug_error_minor_message@@ -836,6 +843,44 @@ return(ret) #endif +-- --------+-- aug_srun+-- --------+#ifdef HAS_AUGEAS_SRUN+foreign import ccall safe "augeas.h aug_srun"+ c_aug_srun :: Ptr Augeas -- aug+ -> Ptr CFile -- out+ -> CString -- text+ -> IO (AugRet) -- error code+#endif+{-|+ Function: aug_srun+ + Run one or more newline-separated commands. The output of the commands+ will be printed to OUT. Running just 'help' will print what commands are+ available. Commands accepted by this are identical to what augtool+ accepts.+ + Returns:+ the number of executed commands on success, -1 on failure, and -2 if a+ 'quit' command was encountered+-}++aug_srun :: Ptr Augeas -- ^ Augeas pointer+ -> Handle -- ^ OUT Already opened file handle+ -> ByteString -- ^ TEXT+ -> IO (AugRet) -- ^ return value+aug_srun aug_ptr fptr_out bs_text =+#ifndef HAS_AUGEAS_SRUN+ Prelude.error "aug_srun requires at least augeas version 0.9.0"+#else+ useAsCString bs_text $ \text -> do+ out <- handleToCFile fptr_out "w"+ ret <- c_aug_srun aug_ptr out text+ _ <- fflush out+ _ <- fclose out+ return(ret)+#endif -- --------- -- aug_error
System/AugeasHsc.hsc view
@@ -76,4 +76,8 @@ #ifdef HAS_AUGEAS_SPAN , err_no_span = AUG_ENOSPAN #endif+#ifdef HAS_AUGEAS_SRUN+ , err_mv_desc = AUG_EMVDESC+ , err_cmd_run = AUG_ECMDRUN+#endif }
augeas.cabal view
@@ -1,5 +1,5 @@ Name: augeas-Version: 0.4.0+Version: 0.5.0 Synopsis: A Haskell FFI wrapper for the Augeas API Description: A Haskell FFI wrapper for the Augeas API Author: Jude Nagurney@@ -12,7 +12,7 @@ Category: System Stability: Alpha HomePage: http://trac.haskell.org/augeas-Package-URL: http://hackage.haskell.org/packages/archive/augeas/0.4.0/augeas-0.4.0.tar.gz+Package-URL: http://hackage.haskell.org/packages/archive/augeas/0.5.0/augeas-0.5.0.tar.gz Extra-Source-Files: Makefile, configure.ac, configure, Config.h.in library
configure view
@@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles.-# Generated by GNU Autoconf 2.67 for haskell-augeas 0.3.5.+# Generated by GNU Autoconf 2.67 for haskell-augeas 0.5.0. # # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,@@ -549,8 +549,8 @@ # Identity of this package. PACKAGE_NAME='haskell-augeas' PACKAGE_TARNAME='haskell-augeas'-PACKAGE_VERSION='0.3.5'-PACKAGE_STRING='haskell-augeas 0.3.5'+PACKAGE_VERSION='0.5.0'+PACKAGE_STRING='haskell-augeas 0.5.0' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -1197,7 +1197,7 @@ # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF-\`configure' configures haskell-augeas 0.3.5 to adapt to many kinds of systems.+\`configure' configures haskell-augeas 0.5.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1258,7 +1258,7 @@ if test -n "$ac_init_help"; then case $ac_init_help in- short | recursive ) echo "Configuration of haskell-augeas 0.3.5:";;+ short | recursive ) echo "Configuration of haskell-augeas 0.5.0:";; esac cat <<\_ACEOF @@ -1343,7 +1343,7 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF-haskell-augeas configure 0.3.5+haskell-augeas configure 0.5.0 generated by GNU Autoconf 2.67 Copyright (C) 2010 Free Software Foundation, Inc.@@ -1641,7 +1641,7 @@ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by haskell-augeas $as_me 0.3.5, which was+It was created by haskell-augeas $as_me 0.5.0, which was generated by GNU Autoconf 2.67. Invocation command line was $ $0 $@@@ -4238,6 +4238,70 @@ fi +has_aug_srun=no+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing aug_srun" >&5+$as_echo_n "checking for library containing aug_srun... " >&6; }+if test "${ac_cv_search_aug_srun+set}" = set; then :+ $as_echo_n "(cached) " >&6+else+ ac_func_search_save_LIBS=$LIBS+cat confdefs.h - <<_ACEOF >conftest.$ac_ext+/* end confdefs.h. */++/* Override any GCC internal prototype to avoid an error.+ Use char because int might match the return type of a GCC+ builtin and then its argument prototype would still apply. */+#ifdef __cplusplus+extern "C"+#endif+char aug_srun ();+int+main ()+{+return aug_srun ();+ ;+ return 0;+}+_ACEOF+for ac_lib in '' augeas; do+ if test -z "$ac_lib"; then+ ac_res="none required"+ else+ ac_res=-l$ac_lib+ LIBS="-l$ac_lib $ac_func_search_save_LIBS"+ fi+ if ac_fn_c_try_link "$LINENO"; then :+ ac_cv_search_aug_srun=$ac_res+fi+rm -f core conftest.err conftest.$ac_objext \+ conftest$ac_exeext+ if test "${ac_cv_search_aug_srun+set}" = set; then :+ break+fi+done+if test "${ac_cv_search_aug_srun+set}" = set; then :++else+ ac_cv_search_aug_srun=no+fi+rm conftest.$ac_ext+LIBS=$ac_func_search_save_LIBS+fi+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_aug_srun" >&5+$as_echo "$ac_cv_search_aug_srun" >&6; }+ac_res=$ac_cv_search_aug_srun+if test "$ac_res" != no; then :+ test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"+ has_aug_srun=yes+fi++if test "x${has_aug_srun}" = "xyes"; then++$as_echo "#define HAS_AUGEAS_SRUN /**/" >>confdefs.h++fi++ has_aug_error=no { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing aug_error" >&5 $as_echo_n "checking for library containing aug_error... " >&6; }@@ -5004,7 +5068,7 @@ # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log="-This file was extended by haskell-augeas $as_me 0.3.5, which was+This file was extended by haskell-augeas $as_me 0.5.0, which was generated by GNU Autoconf 2.67. Invocation command line was CONFIG_FILES = $CONFIG_FILES@@ -5057,7 +5121,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\-haskell-augeas config.status 0.3.5+haskell-augeas config.status 0.5.0 configured by $0, generated by GNU Autoconf 2.67, with options \\"\$ac_cs_config\\"
configure.ac view
@@ -1,5 +1,5 @@ AC_PREREQ(2.65)-AC_INIT([haskell-augeas],[0.4.0])+AC_INIT([haskell-augeas],[0.5.0]) AC_CONFIG_SRCDIR(Setup.hs) AC_CONFIG_HEADERS([Config.h]) @@ -54,6 +54,7 @@ HAS_AUGEAS_FUNC(aug_save,HAS_AUGEAS_SAVE) HAS_AUGEAS_FUNC(aug_load,HAS_AUGEAS_LOAD) HAS_AUGEAS_FUNC(aug_print,HAS_AUGEAS_PRINT)+HAS_AUGEAS_FUNC(aug_srun,HAS_AUGEAS_SRUN) HAS_AUGEAS_FUNC(aug_error,HAS_AUGEAS_ERROR) HAS_AUGEAS_FUNC(aug_error_message,HAS_AUGEAS_ERROR_MESSAGE) HAS_AUGEAS_FUNC(aug_error_minor_message,HAS_AUGEAS_ERROR_MINOR_MESSAGE)