Git-Url: 
http://git.frugalware.org/gitweb/gitweb.cgi?p=gfwsyscfg.git;a=commitdiff;h=112cb3390b3ee2891c90edb4ee08639907cc62c2

commit 112cb3390b3ee2891c90edb4ee08639907cc62c2
Author: James Buren <r...@frugalware.org>
Date:   Fri Dec 12 08:16:20 2008 -0600

gfwsyscfg-util.lua
* initial import of this file

diff --git a/src/gfwsyscfg-util.lua b/src/gfwsyscfg-util.lua
new file mode 100755
index 0000000..270513a
--- /dev/null
+++ b/src/gfwsyscfg-util.lua
@@ -0,0 +1,19 @@
+#!/usr/bin/lua
+
+-- This contains common utility functions for parts of gfwsyscfg, mainly module
+-- extensions, to make use of.
+
+-- Initializes the file a module will be working with.
+function gfwsyscfg_initfile(file)
+       assert(file,"An argument must be passed.")
+       if not type(file) == "string" then return nil end
+       local destpath = "/tmp/gfwsyscfg/"..string.gsub(file,"^.*/","")
+       local src = io.open(file,"r")
+       local dest = io.open(destpath,"w+")
+       if not src then return nil end
+       if not dest then return nil end
+       dest:write(src:read("*a"))
+       src:close()
+       dest:close()
+end
+
_______________________________________________
Frugalware-git mailing list
Frugalware-git@frugalware.org
http://frugalware.org/mailman/listinfo/frugalware-git

Reply via email to