From 6a7cbe87fa611e290741c47267b3900707021e5c Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Wed, 29 Dec 2010 03:08:07 +0000 Subject: removed trailing whitespaces git-svn-id: https://svn.spreadspace.org/gcsd/trunk@87 ac14a137-c7f1-4531-abe0-07747231d213 --- ChangeLog | 2 +- LICENSE | 6 +++--- README | 8 ++++---- doc/Makefile | 8 ++++---- doc/gcsd.8 | 19 ++++++++++++++----- doc/gcsd.8.txt | 26 +++++++++++++------------- examples/dynamic_dispatch_table.lua | 2 +- src/Makefile | 6 +++--- src/client_list.lua | 6 +++--- src/command_queue.lua | 12 ++++++------ src/command_table.lua | 8 ++++---- src/configure | 28 ++++++++++++++-------------- src/daemon.h | 6 +++--- src/datatypes.h | 6 +++--- src/dispatch_tables.lua | 6 +++--- src/gcsd.c | 14 +++++++------- src/l_log.c | 16 ++++++++-------- src/l_log.h | 6 +++--- src/l_rawio.c | 20 ++++++++++---------- src/l_rawio.h | 6 +++--- src/l_sig_handler.c | 12 ++++++------ src/l_sig_handler.h | 6 +++--- src/l_tcp.c | 26 +++++++++++++------------- src/l_tcp.h | 6 +++--- src/l_timer.c | 8 ++++---- src/l_timer.h | 6 +++--- src/l_util.c | 18 +++++++++--------- src/l_util.h | 6 +++--- src/log.c | 14 +++++++------- src/log.h | 8 ++++---- src/log_targets.h | 22 +++++++++++----------- src/main_loop.lua | 10 +++++----- src/module_list.lua | 16 ++++++++-------- src/modules/debug_shell.lua | 28 ++++++++++++++-------------- src/modules/dummy.lua | 8 ++++---- src/modules/exec.lua | 18 +++++++++--------- src/modules/stdio.lua | 14 +++++++------- src/modules/stdout.lua | 12 ++++++------ src/modules/tcp_connect.lua | 12 ++++++------ src/modules/tcp_listen.lua | 14 +++++++------- src/options.c | 12 ++++++------ src/options.h | 6 +++--- src/response_table.lua | 8 ++++---- src/sig_handler.c | 16 ++++++++-------- src/sig_handler.h | 6 +++--- src/string_list.c | 10 +++++----- src/string_list.h | 6 +++--- 47 files changed, 274 insertions(+), 265 deletions(-) diff --git a/ChangeLog b/ChangeLog index cd22b2a..bc1569e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,4 @@ 200?.??.?? -- Version ? * initial release - + diff --git a/LICENSE b/LICENSE index 72fa72e..101072c 100644 --- a/LICENSE +++ b/LICENSE @@ -1,15 +1,15 @@ /* * gcsd * - * gcsd the generic command sequencer daemon can be used to serialize + * gcsd the generic command sequencer daemon can be used to serialize * commands sent over various paralell communication channels to a * single command output. It can be seen as a multiplexer for any * kind of communication between a single resource and various clients * which want to submit commands to it or query information from it. - * gcsd is written in C and Lua. The goal is to provide an easy to + * gcsd is written in C and Lua. The goal is to provide an easy to * understand high level API based on Lua which can be used to * implement the business logic of the so formed multiplexer daemon. - * + * * * Copyright (C) 2009-2010 Markus Grueneis * Christian Pointner diff --git a/README b/README index cc812b3..5b26943 100644 --- a/README +++ b/README @@ -1,12 +1,12 @@ Introduction ============ -gcsd the generic command sequencer daemon can be used to serialize +gcsd the generic command sequencer daemon can be used to serialize commands sent over various paralell communication channels to a single command output. It can be seen as a multiplexer for any kind of communication between a single resource and various clients which want to submit commands to it or query information from it. -gcsd is written in C and Lua. The goal is to provide an easy to +gcsd is written in C and Lua. The goal is to provide an easy to understand high level API based on Lua which can be used to implement the business logic of the so formed multiplexer daemon. @@ -35,7 +35,7 @@ FreeBSD core: devel/gmake lang/lua - + modules: @@ -65,7 +65,7 @@ Building from source # ./configure # make -Notes: +Notes: - try './configure --help' for further information - on FreeBSD you have to use gmake instead of make diff --git a/doc/Makefile b/doc/Makefile index 3ffb3b8..4cb2226 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -1,15 +1,15 @@ ## ## gcsd ## -## gcsd the generic command sequencer daemon can be used to serialize +## gcsd the generic command sequencer daemon can be used to serialize ## commands sent over various paralell communication channels to a ## single command output. It can be seen as a multiplexer for any ## kind of communication between a single resource and various clients ## which want to submit commands to it or query information from it. -## gcsd is written in C and Lua. The goal is to provide an easy to +## gcsd is written in C and Lua. The goal is to provide an easy to ## understand high level API based on Lua which can be used to ## implement the business logic of the so formed multiplexer daemon. -## +## ## ## Copyright (C) 2009-2010 Markus Grueneis ## Christian Pointner @@ -32,7 +32,7 @@ VERSION=$(shell cat ../version) -.PHONY: clean +.PHONY: clean all: manpage diff --git a/doc/gcsd.8 b/doc/gcsd.8 index d1241e6..0f9246c 100644 --- a/doc/gcsd.8 +++ b/doc/gcsd.8 @@ -1,13 +1,22 @@ '\" t .\" Title: gcsd .\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.75.1 -.\" Date: 12/14/2010 -.\" Manual: gcsd user manual -.\" Source: gcsd trunk +.\" Generator: DocBook XSL Stylesheets v1.75.2 +.\" Date: 12/29/2010 +.\" Manual: \ \& +.\" Source: \ \& .\" Language: English .\" -.TH "GCSD" "8" "12/14/2010" "gcsd trunk" "gcsd user manual" +.TH "GCSD" "8" "12/29/2010" "\ \&" "\ \&" +.\" ----------------------------------------------------------------- +.\" * Define some portability stuff +.\" ----------------------------------------------------------------- +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.\" http://bugs.debian.org/507673 +.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- diff --git a/doc/gcsd.8.txt b/doc/gcsd.8.txt index e752dfe..523a2a9 100644 --- a/doc/gcsd.8.txt +++ b/doc/gcsd.8.txt @@ -30,12 +30,12 @@ gcsd DESCRIPTION ----------- -*gcsd* the generic command sequencer daemon can be used to serialize +*gcsd* the generic command sequencer daemon can be used to serialize commands sent over various paralell communication channels to a single command output. It can be seen as a multiplexer for any kind of communication between a single resource and various clients which want to submit commands to it or query information from it. -*gcsd* is written in C and Lua. The goal is to provide an easy to +*gcsd* is written in C and Lua. The goal is to provide an easy to understand high level API based on Lua which can be used to implement the business logic of the so formed multiplexer daemon. @@ -50,7 +50,7 @@ The following options can be passed to the *gcsd* daemon: instead of becoming a daemon which is the default. *-u, --username *:: - run as this user. If no group is specified (*-g*) the default group of + run as this user. If no group is specified (*-g*) the default group of the user is used. The default is to not drop privileges. *-g, --groupname *:: @@ -58,20 +58,20 @@ The following options can be passed to the *gcsd* daemon: The default is to not drop privileges. *-C, --chroot *:: - Instruct *gcsd* to run in a chroot jail. The default is + Instruct *gcsd* to run in a chroot jail. The default is to not run in chroot. *-P, --write-pid *:: - Instruct *gcsd* to write it's pid to this file. The default is + Instruct *gcsd* to write it's pid to this file. The default is to not create a pid file. *-L, --log :[,[,[..]]]*:: add log target to logging system. This can be invoked several times - in order to log to different targets at the same time. Every target + in order to log to different targets at the same time. Every target has its own log level which is a number between 0 and 5. Where 0 means disabling log and 5 means debug messages are enabled. + The file target can be used more than once with different levels. - If no target is provided at the command line a single target with the + If no target is provided at the command line a single target with the config *syslog:3,gcsd,daemon* is added. + The following targets are supported: @@ -81,13 +81,13 @@ The following options can be passed to the *gcsd* daemon: *stderr*;; log to standard error, parameters *-U, --debug*:: - This option instructs *gcsd* to run in debug mode. It implicits *-D* + This option instructs *gcsd* to run in debug mode. It implicits *-D* (don't daemonize) and adds a log target with the configuration *stdout:5* (logging with maximum level). In future releases there might be additional output when this option is supplied. *-l, --lua-code *:: - Load the dispatch table and callback functions from this file. If no file is + Load the dispatch table and callback functions from this file. If no file is specified *gcsd* will run in basic mode and just sends any command submitted by a client to the output und broadcasts any response to all connected clients. @@ -100,7 +100,7 @@ The following options can be passed to the *gcsd* daemon: set and configure command input modules. This can be invoked several times. gcsd will use all input modules in paralell. See Modules section for further information on which modules exist and how they can be configured. By default - a single input module with the config *unix:file=/var/run/gcsd.sock,mode=660* + a single input module with the config *unix:file=/var/run/gcsd.sock,mode=660* is used. @@ -142,7 +142,7 @@ Main web site: http://www.spreadspace.org/gcsd/ COPYING ------- -Copyright \(C) 2010 Markus Grueneis and Christian Pointner. 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 +Copyright \(C) 2010 Markus Grueneis and Christian Pointner. 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 3 of the License, or any later version. diff --git a/examples/dynamic_dispatch_table.lua b/examples/dynamic_dispatch_table.lua index 38b8bae..61995b2 100644 --- a/examples/dynamic_dispatch_table.lua +++ b/examples/dynamic_dispatch_table.lua @@ -8,7 +8,7 @@ local get_length_table = { dispatch_table:register_handler_table(get_length_table) end } - + dispatch_table:register_handler_table(get_binary_data_table) end } diff --git a/src/Makefile b/src/Makefile index 9ba9c9c..7cb569e 100644 --- a/src/Makefile +++ b/src/Makefile @@ -1,15 +1,15 @@ ## ## gcsd ## -## gcsd the generic command sequencer daemon can be used to serialize +## gcsd the generic command sequencer daemon can be used to serialize ## commands sent over various paralell communication channels to a ## single command output. It can be seen as a multiplexer for any ## kind of communication between a single resource and various clients ## which want to submit commands to it or query information from it. -## gcsd is written in C and Lua. The goal is to provide an easy to +## gcsd is written in C and Lua. The goal is to provide an easy to ## understand high level API based on Lua which can be used to ## implement the business logic of the so formed multiplexer daemon. -## +## ## ## Copyright (C) 2009-2010 Markus Grueneis ## Christian Pointner diff --git a/src/client_list.lua b/src/client_list.lua index cb4ed8d..533b4f5 100644 --- a/src/client_list.lua +++ b/src/client_list.lua @@ -1,15 +1,15 @@ -- -- gcsd -- --- gcsd the generic command sequencer daemon can be used to serialize +-- gcsd the generic command sequencer daemon can be used to serialize -- commands sent over various paralell communication channels to a -- single command output. It can be seen as a multiplexer for any -- kind of communication between a single resource and various clients -- which want to submit commands to it or query information from it. --- gcsd is written in C and Lua. The goal is to provide an easy to +-- gcsd is written in C and Lua. The goal is to provide an easy to -- understand high level API based on Lua which can be used to -- implement the business logic of the so formed multiplexer daemon. --- +-- -- -- Copyright (C) 2009-2010 Markus Grueneis -- Christian Pointner diff --git a/src/command_queue.lua b/src/command_queue.lua index 041e63a..7f95d9b 100644 --- a/src/command_queue.lua +++ b/src/command_queue.lua @@ -1,15 +1,15 @@ -- -- gcsd -- --- gcsd the generic command sequencer daemon can be used to serialize +-- gcsd the generic command sequencer daemon can be used to serialize -- commands sent over various paralell communication channels to a -- single command output. It can be seen as a multiplexer for any -- kind of communication between a single resource and various clients -- which want to submit commands to it or query information from it. --- gcsd is written in C and Lua. The goal is to provide an easy to +-- gcsd is written in C and Lua. The goal is to provide an easy to -- understand high level API based on Lua which can be used to -- implement the business logic of the so formed multiplexer daemon. --- +-- -- -- Copyright (C) 2009-2010 Markus Grueneis -- Christian Pointner @@ -76,7 +76,7 @@ end function command_queue:command_sent() if(self.current == nil) then return end - + self.current.sent = true if(self.current.timeout) then self.current.expiration_time = timer.now() + self.current.timeout @@ -93,7 +93,7 @@ end function command_queue:check_timeout() if(self.current == nil or not self.current.sent) then return end if(not self.current.expiration_time) then return end - + if(timer.cmp(timer.now(), self.current.expiration_time) == 1) then log.printf(log.NOTICE, "command timed out") self:command_completed() @@ -102,7 +102,7 @@ end function command_queue:command_completed() if(self.current == nil) then return end - + table.remove(self.commands, 1) self.current = nil end diff --git a/src/command_table.lua b/src/command_table.lua index e3e6b42..e747729 100644 --- a/src/command_table.lua +++ b/src/command_table.lua @@ -1,15 +1,15 @@ -- -- gcsd -- --- gcsd the generic command sequencer daemon can be used to serialize +-- gcsd the generic command sequencer daemon can be used to serialize -- commands sent over various paralell communication channels to a -- single command output. It can be seen as a multiplexer for any -- kind of communication between a single resource and various clients -- which want to submit commands to it or query information from it. --- gcsd is written in C and Lua. The goal is to provide an easy to +-- gcsd is written in C and Lua. The goal is to provide an easy to -- understand high level API based on Lua which can be used to -- implement the business logic of the so formed multiplexer daemon. --- +-- -- -- Copyright (C) 2009-2010 Markus Grueneis -- Christian Pointner @@ -60,6 +60,6 @@ function command_table:dispatch(command_buffer) end end until (not had_match) - + return string.sub(command_buffer, init + 1) end diff --git a/src/configure b/src/configure index 9b834ab..e0a2411 100755 --- a/src/configure +++ b/src/configure @@ -1,35 +1,35 @@ #!/bin/sh -# +# # gcsd -# -# gcsd the generic command sequencer daemon can be used to serialize +# +# gcsd the generic command sequencer daemon can be used to serialize # commands sent over various paralell communication channels to a # single command output. It can be seen as a multiplexer for any # kind of communication between a single resource and various clients # which want to submit commands to it or query information from it. -# gcsd is written in C and Lua. The goal is to provide an easy to +# gcsd is written in C and Lua. The goal is to provide an easy to # understand high level API based on Lua which can be used to # implement the business logic of the so formed multiplexer daemon. -# -# +# +# # Copyright (C) 2009-2010 Markus Grueneis # Christian Pointner -# +# # This file is part of gcsd. -# +# # gcsd 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 3 of the License, or # any later version. -# +# # gcsd 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 gcsd. If not, see . -# +# TARGET=`uname -s` EBUILD_COMPAT=0 @@ -121,7 +121,7 @@ fi rm -f version.h rm -f include.mk -case $TARGET in +case $TARGET in Linux) LDFLAGS=$LDFLAGS' -ldl' ;; @@ -234,7 +234,7 @@ fi cat >> include.mk < config.h < * Christian Pointner diff --git a/src/datatypes.h b/src/datatypes.h index 43bcd7e..dca12b1 100644 --- a/src/datatypes.h +++ b/src/datatypes.h @@ -1,15 +1,15 @@ /* * gcsd * - * gcsd the generic command sequencer daemon can be used to serialize + * gcsd the generic command sequencer daemon can be used to serialize * commands sent over various paralell communication channels to a * single command output. It can be seen as a multiplexer for any * kind of communication between a single resource and various clients * which want to submit commands to it or query information from it. - * gcsd is written in C and Lua. The goal is to provide an easy to + * gcsd is written in C and Lua. The goal is to provide an easy to * understand high level API based on Lua which can be used to * implement the business logic of the so formed multiplexer daemon. - * + * * * Copyright (C) 2009-2010 Markus Grueneis * Christian Pointner diff --git a/src/dispatch_tables.lua b/src/dispatch_tables.lua index 1f7b5e5..49c09d9 100644 --- a/src/dispatch_tables.lua +++ b/src/dispatch_tables.lua @@ -1,15 +1,15 @@ -- -- gcsd -- --- gcsd the generic command sequencer daemon can be used to serialize +-- gcsd the generic command sequencer daemon can be used to serialize -- commands sent over various paralell communication channels to a -- single command output. It can be seen as a multiplexer for any -- kind of communication between a single resource and various clients -- which want to submit commands to it or query information from it. --- gcsd is written in C and Lua. The goal is to provide an easy to +-- gcsd is written in C and Lua. The goal is to provide an easy to -- understand high level API based on Lua which can be used to -- implement the business logic of the so formed multiplexer daemon. --- +-- -- -- Copyright (C) 2009-2010 Markus Grueneis -- Christian Pointner diff --git a/src/gcsd.c b/src/gcsd.c index b2200b6..b4beef9 100644 --- a/src/gcsd.c +++ b/src/gcsd.c @@ -1,15 +1,15 @@ /* * gcsd * - * gcsd the generic command sequencer daemon can be used to serialize + * gcsd the generic command sequencer daemon can be used to serialize * commands sent over various paralell communication channels to a * single command output. It can be seen as a multiplexer for any * kind of communication between a single resource and various clients * which want to submit commands to it or query information from it. - * gcsd is written in C and Lua. The goal is to provide an easy to + * gcsd is written in C and Lua. The goal is to provide an easy to * understand high level API based on Lua which can be used to * implement the business logic of the so formed multiplexer daemon. - * + * * * Copyright (C) 2009-2010 Markus Grueneis * Christian Pointner @@ -192,7 +192,7 @@ int main_loop(options_t* opt) int ret = init_main_loop(L); if(!ret) ret = call_main_loop(L, opt); - + lua_close(L); return ret; } @@ -214,7 +214,7 @@ int main(int argc, char* argv[]) options_print_version(); } - if(ret != -2 && ret != -3) + if(ret != -2 && ret != -3) options_print_usage(); if(ret == -1 || ret == -3) @@ -234,7 +234,7 @@ int main(int argc, char* argv[]) case -4: fprintf(stderr, "this log target is only allowed once: '%s', exitting\n", tmp->string_); break; default: fprintf(stderr, "syntax error near: '%s', exitting\n", tmp->string_); break; } - + options_clear(&opt); log_close(); exit(ret); @@ -275,7 +275,7 @@ int main(int argc, char* argv[]) options_clear(&opt); log_close(); exit(-1); - } + } if(opt.daemonize_) { pid_t oldpid = getpid(); diff --git a/src/l_log.c b/src/l_log.c index ea9d1a3..7fb4e79 100644 --- a/src/l_log.c +++ b/src/l_log.c @@ -1,15 +1,15 @@ /* * gcsd * - * gcsd the generic command sequencer daemon can be used to serialize + * gcsd the generic command sequencer daemon can be used to serialize * commands sent over various paralell communication channels to a * single command output. It can be seen as a multiplexer for any * kind of communication between a single resource and various clients * which want to submit commands to it or query information from it. - * gcsd is written in C and Lua. The goal is to provide an easy to + * gcsd is written in C and Lua. The goal is to provide an easy to * understand high level API based on Lua which can be used to * implement the business logic of the so formed multiplexer daemon. - * + * * * Copyright (C) 2009-2010 Markus Grueneis * Christian Pointner @@ -64,7 +64,7 @@ static int l_log_add_target(lua_State *L) default: lua_pushstring(L, "syntax error"); break; } return 2; - } + } lua_pushboolean(L, 1); return 1; @@ -84,22 +84,22 @@ static int l_log_printf(lua_State *L) lua_remove(L, -1); lua_call(L, numargs - 1, 1); } - + log_prio_t prio = luaL_checkint(L,1); log_printf(prio, "%s", luaL_checkstring(L, 2)); return 0; } static const struct luaL_reg log_funcs [] = { - { "init", l_log_init }, - { "close", l_log_close }, + { "init", l_log_init }, + { "close", l_log_close }, { "add_target", l_log_add_target }, { "printf", l_log_printf }, { NULL, NULL } }; -LUALIB_API int luaopen_log(lua_State *L) +LUALIB_API int luaopen_log(lua_State *L) { luaL_register(L, LUA_LOGLIBNAME, log_funcs); lua_pushliteral(L, "ERROR"); diff --git a/src/l_log.h b/src/l_log.h index c80614a..3f65f21 100644 --- a/src/l_log.h +++ b/src/l_log.h @@ -1,15 +1,15 @@ /* * gcsd * - * gcsd the generic command sequencer daemon can be used to serialize + * gcsd the generic command sequencer daemon can be used to serialize * commands sent over various paralell communication channels to a * single command output. It can be seen as a multiplexer for any * kind of communication between a single resource and various clients * which want to submit commands to it or query information from it. - * gcsd is written in C and Lua. The goal is to provide an easy to + * gcsd is written in C and Lua. The goal is to provide an easy to * understand high level API based on Lua which can be used to * implement the business logic of the so formed multiplexer daemon. - * + * * * Copyright (C) 2009-2010 Markus Grueneis * Christian Pointner diff --git a/src/l_rawio.c b/src/l_rawio.c index 779d6ae..3ba2851 100644 --- a/src/l_rawio.c +++ b/src/l_rawio.c @@ -1,15 +1,15 @@ /* * gcsd * - * gcsd the generic command sequencer daemon can be used to serialize + * gcsd the generic command sequencer daemon can be used to serialize * commands sent over various paralell communication channels to a * single command output. It can be seen as a multiplexer for any * kind of communication between a single resource and various clients * which want to submit commands to it or query information from it. - * gcsd is written in C and Lua. The goal is to provide an easy to + * gcsd is written in C and Lua. The goal is to provide an easy to * understand high level API based on Lua which can be used to * implement the business logic of the so formed multiplexer daemon. - * + * * * Copyright (C) 2009-2010 Markus Grueneis * Christian Pointner @@ -53,7 +53,7 @@ static int l_rawio_open(lua_State *L) if(strstr(mode_str, "O_RDONLY")) mode |= O_RDONLY; if(strstr(mode_str, "O_WRONLY")) mode |= O_WRONLY; - if(strstr(mode_str, "O_RDWR")) mode |= O_RDWR; + if(strstr(mode_str, "O_RDWR")) mode |= O_RDWR; int fd = open(filename, mode); lua_pushinteger(L, fd); @@ -62,7 +62,7 @@ static int l_rawio_open(lua_State *L) static int l_rawio_setnonblock(lua_State *L) { - int fd = luaL_checkint(L,1); + int fd = luaL_checkint(L,1); int ret = fcntl(fd, F_SETFL, O_NONBLOCK); if(ret == -1) { @@ -80,9 +80,9 @@ static int l_rawio_write(lua_State *L) int fd = luaL_checkint(L,1); size_t len = 0; const char* data = luaL_checklstring(L, 2, &len); - + int ret = write(fd, data, len); - + if(ret == -1) { lua_pushnil(L); // FIXXXXXME: strerror is not threadsafe!!! @@ -103,9 +103,9 @@ static int l_rawio_read(lua_State *L) lua_pushstring(L, "bad alloc"); return 2; } - + int ret = read(fd, data, len); - + if(ret == -1) { lua_pushnil(L); // FIXXXXXME: strerror is not threadsafe!!! @@ -134,7 +134,7 @@ static const struct luaL_reg rawio_funcs [] = { }; -LUALIB_API int luaopen_rawio(lua_State *L) +LUALIB_API int luaopen_rawio(lua_State *L) { luaL_register(L, LUA_RAWIOLIBNAME, rawio_funcs); return 1; diff --git a/src/l_rawio.h b/src/l_rawio.h index 9fa8713..328dca2 100644 --- a/src/l_rawio.h +++ b/src/l_rawio.h @@ -1,15 +1,15 @@ /* * gcsd * - * gcsd the generic command sequencer daemon can be used to serialize + * gcsd the generic command sequencer daemon can be used to serialize * commands sent over various paralell communication channels to a * single command output. It can be seen as a multiplexer for any * kind of communication between a single resource and various clients * which want to submit commands to it or query information from it. - * gcsd is written in C and Lua. The goal is to provide an easy to + * gcsd is written in C and Lua. The goal is to provide an easy to * understand high level API based on Lua which can be used to * implement the business logic of the so formed multiplexer daemon. - * + * * * Copyright (C) 2009-2010 Markus Grueneis * Christian Pointner diff --git a/src/l_sig_handler.c b/src/l_sig_handler.c index 01e9662..35d8c14 100644 --- a/src/l_sig_handler.c +++ b/src/l_sig_handler.c @@ -1,15 +1,15 @@ /* * gcsd * - * gcsd the generic command sequencer daemon can be used to serialize + * gcsd the generic command sequencer daemon can be used to serialize * commands sent over various paralell communication channels to a * single command output. It can be seen as a multiplexer for any * kind of communication between a single resource and various clients * which want to submit commands to it or query information from it. - * gcsd is written in C and Lua. The goal is to provide an easy to + * gcsd is written in C and Lua. The goal is to provide an easy to * understand high level API based on Lua which can be used to * implement the business logic of the so formed multiplexer daemon. - * + * * * Copyright (C) 2009-2010 Markus Grueneis * Christian Pointner @@ -64,14 +64,14 @@ static int l_signal_handle(lua_State *L) } static const struct luaL_reg signal_funcs [] = { - { "init", l_signal_init }, - { "stop", l_signal_stop }, + { "init", l_signal_init }, + { "stop", l_signal_stop }, { "handle", l_signal_handle }, { NULL, NULL } }; -LUALIB_API int luaopen_signal(lua_State *L) +LUALIB_API int luaopen_signal(lua_State *L) { luaL_register(L, LUA_SIGNALLIBNAME, signal_funcs); return 1; diff --git a/src/l_sig_handler.h b/src/l_sig_handler.h index 5730659..e7af745 100644 --- a/src/l_sig_handler.h +++ b/src/l_sig_handler.h @@ -1,15 +1,15 @@ /* * gcsd * - * gcsd the generic command sequencer daemon can be used to serialize + * gcsd the generic command sequencer daemon can be used to serialize * commands sent over various paralell communication channels to a * single command output. It can be seen as a multiplexer for any * kind of communication between a single resource and various clients * which want to submit commands to it or query information from it. - * gcsd is written in C and Lua. The goal is to provide an easy to + * gcsd is written in C and Lua. The goal is to provide an easy to * understand high level API based on Lua which can be used to * implement the business logic of the so formed multiplexer daemon. - * + * * * Copyright (C) 2009-2010 Markus Grueneis * Christian Pointner diff --git a/src/l_tcp.c b/src/l_tcp.c index c00921e..9418ea5 100644 --- a/src/l_tcp.c +++ b/src/l_tcp.c @@ -1,15 +1,15 @@ /* * gcsd * - * gcsd the generic command sequencer daemon can be used to serialize + * gcsd the generic command sequencer daemon can be used to serialize * commands sent over various paralell communication channels to a * single command output. It can be seen as a multiplexer for any * kind of communication between a single resource and various clients * which want to submit commands to it or query information from it. - * gcsd is written in C and Lua. The goal is to provide an easy to + * gcsd is written in C and Lua. The goal is to provide an easy to * understand high level API based on Lua which can be used to * implement the business logic of the so formed multiplexer daemon. - * + * * * Copyright (C) 2009-2010 Markus Grueneis * Christian Pointner @@ -70,7 +70,7 @@ static char* tcp_endpoint_to_string(tcp_endpoint_t* e) size_t addrstr_len = 0; char addrstr[INET6_ADDRSTRLEN + 1], portstr[6], *ret; char addrport_sep = ':'; - + switch(e->addr_.ss_family) { case AF_INET: addrport_sep = ':'; break; @@ -152,7 +152,7 @@ static int l_tcp_server(lua_State *L) if(!strcmp(addr, "*") || !strlen(addr)) addr = NULL; const char* port = luaL_checkstring(L, 2); int af = luaL_optint(L, 3, 0); - + struct addrinfo *res = tcp_resolve_endpoint(addr, port, af, 1); if(!res) { lua_pushnil(L); @@ -299,11 +299,11 @@ static int l_tcp_client(lua_State *L) memcpy(se, &source, sizeof(tcp_endpoint_t)); lua_settable(L, -3); } - + lua_pushliteral(L, "fd"); lua_pushinteger(L, fd); lua_settable(L, -3); - + if(connect(fd, (struct sockaddr *)&(remote.addr_), remote.len_)==-1) { if(errno == EINPROGRESS) { lua_pushboolean(L, 0); @@ -316,7 +316,7 @@ static int l_tcp_client(lua_State *L) lua_pushstring(L, "connect() failed"); return 2; } - + lua_pushboolean(L, 1); return 2; } @@ -353,9 +353,9 @@ static int l_tcp_recv(lua_State *L) lua_pushstring(L, "bad alloc"); return 2; } - + int ret = recv(fd, data, len, 0); - + if(ret == -1) { lua_pushnil(L); // FIXXXXXME: strerror is not threadsafe!!! @@ -373,9 +373,9 @@ static int l_tcp_send(lua_State *L) int fd = luaL_checkint(L,1); size_t len = 0; const char* data = luaL_checklstring(L, 2, &len); - + int ret = send(fd, data, len, 0); - + if(ret == -1) { lua_pushnil(L); // FIXXXXXME: strerror is not threadsafe!!! @@ -409,7 +409,7 @@ static const struct luaL_reg tcp_funcs [] = { { NULL, NULL } }; -LUALIB_API int luaopen_tcp(lua_State *L) +LUALIB_API int luaopen_tcp(lua_State *L) { luaL_register(L, LUA_TCPLIBNAME, tcp_funcs); return 1; diff --git a/src/l_tcp.h b/src/l_tcp.h index 8e3c78e..e9bf7e5 100644 --- a/src/l_tcp.h +++ b/src/l_tcp.h @@ -1,15 +1,15 @@ /* * gcsd * - * gcsd the generic command sequencer daemon can be used to serialize + * gcsd the generic command sequencer daemon can be used to serialize * commands sent over various paralell communication channels to a * single command output. It can be seen as a multiplexer for any * kind of communication between a single resource and various clients * which want to submit commands to it or query information from it. - * gcsd is written in C and Lua. The goal is to provide an easy to + * gcsd is written in C and Lua. The goal is to provide an easy to * understand high level API based on Lua which can be used to * implement the business logic of the so formed multiplexer daemon. - * + * * * Copyright (C) 2009-2010 Markus Grueneis * Christian Pointner diff --git a/src/l_timer.c b/src/l_timer.c index f510e22..dfe3135 100644 --- a/src/l_timer.c +++ b/src/l_timer.c @@ -1,15 +1,15 @@ /* * gcsd * - * gcsd the generic command sequencer daemon can be used to serialize + * gcsd the generic command sequencer daemon can be used to serialize * commands sent over various paralell communication channels to a * single command output. It can be seen as a multiplexer for any * kind of communication between a single resource and various clients * which want to submit commands to it or query information from it. - * gcsd is written in C and Lua. The goal is to provide an easy to + * gcsd is written in C and Lua. The goal is to provide an easy to * understand high level API based on Lua which can be used to * implement the business logic of the so formed multiplexer daemon. - * + * * * Copyright (C) 2009-2010 Markus Grueneis * Christian Pointner @@ -122,7 +122,7 @@ static const struct luaL_reg timer_funcs [] = { { NULL, NULL } }; -LUALIB_API int luaopen_timer(lua_State *L) +LUALIB_API int luaopen_timer(lua_State *L) { luaL_register(L, LUA_TIMERLIBNAME, timer_funcs); return 1; diff --git a/src/l_timer.h b/src/l_timer.h index d814920..bfea670 100644 --- a/src/l_timer.h +++ b/src/l_timer.h @@ -1,15 +1,15 @@ /* * gcsd * - * gcsd the generic command sequencer daemon can be used to serialize + * gcsd the generic command sequencer daemon can be used to serialize * commands sent over various paralell communication channels to a * single command output. It can be seen as a multiplexer for any * kind of communication between a single resource and various clients * which want to submit commands to it or query information from it. - * gcsd is written in C and Lua. The goal is to provide an easy to + * gcsd is written in C and Lua. The goal is to provide an easy to * understand high level API based on Lua which can be used to * implement the business logic of the so formed multiplexer daemon. - * + * * * Copyright (C) 2009-2010 Markus Grueneis * Christian Pointner diff --git a/src/l_util.c b/src/l_util.c index 93c2aec..3b174b6 100644 --- a/src/l_util.c +++ b/src/l_util.c @@ -1,15 +1,15 @@ /* * gcsd * - * gcsd the generic command sequencer daemon can be used to serialize + * gcsd the generic command sequencer daemon can be used to serialize * commands sent over various paralell communication channels to a * single command output. It can be seen as a multiplexer for any * kind of communication between a single resource and various clients * which want to submit commands to it or query information from it. - * gcsd is written in C and Lua. The goal is to provide an easy to + * gcsd is written in C and Lua. The goal is to provide an easy to * understand high level API based on Lua which can be used to * implement the business logic of the so formed multiplexer daemon. - * + * * * Copyright (C) 2009-2010 Markus Grueneis * Christian Pointner @@ -112,7 +112,7 @@ static int l_util_select(lua_State *L) fd_set readables, writeables; int max_fd = collect_fds(L, 1, &readables, 0); max_fd = collect_fds(L, 2, &writeables, max_fd); - + struct timeval tv; struct timeval* timeout = NULL; if(ms >= 0) { @@ -164,7 +164,7 @@ static char** table_to_argv(lua_State *L, const char* script, int index) i--; for(; i >= 0; --i) free(my_ptrptr[i]); - + free(my_ptrptr); return NULL; } @@ -193,7 +193,7 @@ static char** table_to_evp(lua_State *L, int index) i--; for(; i >= 0; --i) free(my_ptrptr[i]); - + free(my_ptrptr); return NULL; } @@ -210,7 +210,7 @@ void free_ptrptr(char** ptrptr) int i; for(i = 0; ptrptr[i]; ++i) free(ptrptr[i]); - + free(ptrptr); } @@ -264,7 +264,7 @@ static void prepare_fds(lua_State *L, int *child_stdio, int pipefd) for (fd=getdtablesize();fd>=0;--fd) // close all file descriptors if(fd != pipefd && fd != child_stdio[0] && fd != child_stdio[1] && fd != child_stdio[2]) close(fd); fcntl(pipefd, F_SETFD, FD_CLOEXEC); - + int i, ret; for(i = 0; i<3; ++i) { if(child_stdio[i] >= 0) { @@ -454,7 +454,7 @@ static const struct luaL_reg util_funcs [] = { { NULL, NULL } }; -LUALIB_API int luaopen_util(lua_State *L) +LUALIB_API int luaopen_util(lua_State *L) { luaL_register(L, LUA_UTILLIBNAME, util_funcs); lua_newtable(L); diff --git a/src/l_util.h b/src/l_util.h index 14422b8..931d621 100644 --- a/src/l_util.h +++ b/src/l_util.h @@ -1,15 +1,15 @@ /* * gcsd * - * gcsd the generic command sequencer daemon can be used to serialize + * gcsd the generic command sequencer daemon can be used to serialize * commands sent over various paralell communication channels to a * single command output. It can be seen as a multiplexer for any * kind of communication between a single resource and various clients * which want to submit commands to it or query information from it. - * gcsd is written in C and Lua. The goal is to provide an easy to + * gcsd is written in C and Lua. The goal is to provide an easy to * understand high level API based on Lua which can be used to * implement the business logic of the so formed multiplexer daemon. - * + * * * Copyright (C) 2009-2010 Markus Grueneis * Christian Pointner diff --git a/src/log.c b/src/log.c index 9811a46..772d4ca 100644 --- a/src/log.c +++ b/src/log.c @@ -1,15 +1,15 @@ /* * gcsd * - * gcsd the generic command sequencer daemon can be used to serialize + * gcsd the generic command sequencer daemon can be used to serialize * commands sent over various paralell communication channels to a * single command output. It can be seen as a multiplexer for any * kind of communication between a single resource and various clients * which want to submit commands to it or query information from it. - * gcsd is written in C and Lua. The goal is to provide an easy to + * gcsd is written in C and Lua. The goal is to provide an easy to * understand high level API based on Lua which can be used to * implement the business logic of the so formed multiplexer daemon. - * + * * * Copyright (C) 2009-2010 Markus Grueneis * Christian Pointner @@ -86,7 +86,7 @@ int log_targets_target_exists(log_targets_t* targets, log_target_type_t type) if(tmp->type_ == type) return 1; tmp = tmp->next_; - } + } return 0; } @@ -98,7 +98,7 @@ int log_targets_add(log_targets_t* targets, const char* conf) log_target_t* new_target = NULL; int duplicates_allowed = 0; switch(log_target_parse_type(conf)) { -#ifndef WINVER +#ifndef WINVER case TARGET_SYSLOG: new_target = log_target_syslog_new(); break; #endif case TARGET_FILE: new_target = log_target_file_new(); duplicates_allowed = 1; break; @@ -151,7 +151,7 @@ int log_targets_add(log_targets_t* targets, const char* conf) log_target_t* tmp = targets->first_; while(tmp->next_) tmp = tmp->next_; - + tmp->next_ = new_target; } return 0; @@ -251,7 +251,7 @@ void log_print_hex_dump(log_prio_t prio, const uint8_t* buf, uint32_t len) if(offset < 0) return; uint8_t* ptr = &msg[offset]; - + for(i=0; i < len; i++) { if(((i+1)*3) >= (MSG_LENGTH_MAX - offset)) break; diff --git a/src/log.h b/src/log.h index 331a3fd..a56db9f 100644 --- a/src/log.h +++ b/src/log.h @@ -1,15 +1,15 @@ -/* +Installation/* * gcsd * - * gcsd the generic command sequencer daemon can be used to serialize + * gcsd the generic command sequencer daemon can be used to serialize * commands sent over various paralell communication channels to a * single command output. It can be seen as a multiplexer for any * kind of communication between a single resource and various clients * which want to submit commands to it or query information from it. - * gcsd is written in C and Lua. The goal is to provide an easy to + * gcsd is written in C and Lua. The goal is to provide an easy to * understand high level API based on Lua which can be used to * implement the business logic of the so formed multiplexer daemon. - * + * * * Copyright (C) 2009-2010 Markus Grueneis * Christian Pointner diff --git a/src/log_targets.h b/src/log_targets.h index 3a12331..10d3edb 100644 --- a/src/log_targets.h +++ b/src/log_targets.h @@ -1,15 +1,15 @@ /* * gcsd * - * gcsd the generic command sequencer daemon can be used to serialize + * gcsd the generic command sequencer daemon can be used to serialize * commands sent over various paralell communication channels to a * single command output. It can be seen as a multiplexer for any * kind of communication between a single resource and various clients * which want to submit commands to it or query information from it. - * gcsd is written in C and Lua. The goal is to provide an easy to + * gcsd is written in C and Lua. The goal is to provide an easy to * understand high level API based on Lua which can be used to * implement the business logic of the so formed multiplexer daemon. - * + * * * Copyright (C) 2009-2010 Markus Grueneis * Christian Pointner @@ -39,7 +39,7 @@ static char* get_time_formatted() { char* time_string; time_t t = time(NULL); - if(t < 0) + if(t < 0) time_string = "