From owner-svn-soc-all@FreeBSD.ORG Tue Jun 3 15:28:28 2014 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 073BE105 for ; Tue, 3 Jun 2014 15:28:28 +0000 (UTC) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DCEAD271F for ; Tue, 3 Jun 2014 15:28:27 +0000 (UTC) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.14.8/8.14.8) with ESMTP id s53FSRAk072653 for ; Tue, 3 Jun 2014 15:28:27 GMT (envelope-from pedrosouza@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.14.8/8.14.8/Submit) id s53FSRjl072396 for svn-soc-all@FreeBSD.org; Tue, 3 Jun 2014 15:28:27 GMT (envelope-from pedrosouza@FreeBSD.org) Date: Tue, 3 Jun 2014 15:28:27 GMT Message-Id: <201406031528.s53FSRjl072396@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to pedrosouza@FreeBSD.org using -f From: pedrosouza@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r269011 - soc2014/pedrosouza/lua_loader/head/sys/boot/common MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Jun 2014 15:28:28 -0000 Author: pedrosouza Date: Tue Jun 3 15:28:27 2014 New Revision: 269011 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=269011 Log: Add copyright, fix comment & check formatting Modified: soc2014/pedrosouza/lua_loader/head/sys/boot/common/interp_lua.c Modified: soc2014/pedrosouza/lua_loader/head/sys/boot/common/interp_lua.c ============================================================================== --- soc2014/pedrosouza/lua_loader/head/sys/boot/common/interp_lua.c Tue Jun 3 14:50:51 2014 (r269010) +++ soc2014/pedrosouza/lua_loader/head/sys/boot/common/interp_lua.c Tue Jun 3 15:28:27 2014 (r269011) @@ -1,3 +1,30 @@ +/*- +* Copyright (c) 2014 Pedro Souza +* All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* 1. Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* 2. Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* +* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +* SUCH DAMAGE. +* +*/ + #include __FBSDID("$FreeBSD$"); @@ -38,7 +65,6 @@ int lua_perform(lua_State *L) { - int argc, ret; char **argv; int res = -1; @@ -90,7 +116,7 @@ data_chunk ds; ds.data = (void*)str; ds.size = size; - res = lua_load(L, read_chunk, &ds, "do_string___", 0); + res = lua_load(L, read_chunk, &ds, "do_string", 0); res = lua_pcall(L, 0, LUA_MULTRET, 0); return res; } @@ -137,6 +163,7 @@ int interp_lua_incl(void *ctx, const char *filename) { +#if 0 lua_State *luap; struct interp_lua_softc *softc; struct stat st; @@ -144,7 +171,7 @@ int fd, filebufoff, i, rleft, rread; printf("[Lua] Including file %s.\n", filename); - /* + if ((strcmp(filename, "/boot/loader.rc") == 0) || (strcmp(filename, "/boot/boot.conf") == 0)) { printf("Skipping loader.rc and boot.conf"); @@ -165,13 +192,13 @@ filebuf = malloc(st.st_size); assert(filebuf != NULL); memset(filebuf, 0, st.st_size); - */ + /* * XX: Investigate stat() vs logic problem. I'm getting * more bytes that the file really has. */ - /* + rleft = st.st_size - 1; filebufoff = 0; for (;;) { @@ -195,7 +222,7 @@ printf("\t'%s'\n\n", errstr); lua_pop(luap, 1); } - */ +#endif return (0); }