summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Pointner <equinox@helsinki.at>2013-12-27 10:44:17 (GMT)
committerChristian Pointner <equinox@helsinki.at>2013-12-27 10:44:17 (GMT)
commitb46d601c70c6a2f39ca1cd1de83b0aa561ce5204 (patch)
treea7e9703c0463b1ad7e5837e81fbc0d84dd751395
parenta505cffcdd9645e1a4c3be302941e8a4a7d16037 (diff)
whitespace cleanups
header update (copyright notice)
-rw-r--r--LICENSE4
-rw-r--r--doc/Makefile8
-rw-r--r--doc/rharchive.821
-rw-r--r--doc/rharchive.8.txt22
-rw-r--r--src/Makefile6
-rwxr-xr-xsrc/configure2
-rw-r--r--src/daemon.h7
-rw-r--r--src/datatypes.h6
-rw-r--r--src/file_list.c6
-rw-r--r--src/file_list.h6
-rw-r--r--src/log.c6
-rw-r--r--src/log.h6
-rw-r--r--src/log_targets.h22
-rw-r--r--src/options.c10
-rw-r--r--src/options.h6
-rw-r--r--src/rharchive.c4
-rw-r--r--src/sig_handler.c20
-rw-r--r--src/sig_handler.h6
-rw-r--r--src/slist.c22
-rw-r--r--src/slist.h6
-rw-r--r--src/string_list.c10
-rw-r--r--src/string_list.h6
-rw-r--r--src/sysexec.c24
-rw-r--r--src/sysexec.h6
-rw-r--r--src/writer.c30
-rw-r--r--src/writer.h8
26 files changed, 144 insertions, 136 deletions
diff --git a/LICENSE b/LICENSE
index 33c4c14..c73bd4a 100644
--- a/LICENSE
+++ b/LICENSE
@@ -4,8 +4,8 @@
* The Radio Helsinki Archive Daemon
*
*
- * Copyright (C) 2010-2011 Christian Pointner <equinox@helsinki.at>
- *
+ * Copyright (C) 2010-2014 Christian Pointner <equinox@helsinki.at>
+ *
* This file is part of rharchive.
*
* rharchive is free software: you can redistribute it and/or modify
diff --git a/doc/Makefile b/doc/Makefile
index 3b8c361..afb48aa 100644
--- a/doc/Makefile
+++ b/doc/Makefile
@@ -2,10 +2,10 @@
## rharchive
##
## The Radio Helsinki Archive Daemon
-##
##
-## Copyright (C) 2010-2011 Christian Pointner <equinox@helsinki.at>
-##
+##
+## Copyright (C) 2010-2014 Christian Pointner <equinox@helsinki.at>
+##
## This file is part of rharchive.
##
## rharchive is free software: you can redistribute it and/or modify
@@ -24,7 +24,7 @@
VERSION=$(shell cat ../version)
-.PHONY: clean
+.PHONY: clean
all: manpage
diff --git a/doc/rharchive.8 b/doc/rharchive.8
index 74cc0ea..e54fc51 100644
--- a/doc/rharchive.8
+++ b/doc/rharchive.8
@@ -1,13 +1,22 @@
'\" t
.\" Title: rharchive
.\" Author: [see the "AUTHORS" section]
-.\" Generator: DocBook XSL Stylesheets v1.75.1 <http://docbook.sf.net/>
-.\" Date: 04/28/2011
-.\" Manual: rharchive user manual
-.\" Source: rharchive trunk
+.\" Generator: DocBook XSL Stylesheets v1.78.1 <http://docbook.sf.net/>
+.\" Date: 12/27/2013
+.\" Manual: \ \&
+.\" Source: \ \&
.\" Language: English
.\"
-.TH "RHARCHIVE" "8" "04/28/2011" "rharchive trunk" "rharchive user manual"
+.TH "RHARCHIVE" "8" "12/27/2013" "\ \&" "\ \&"
+.\" -----------------------------------------------------------------
+.\" * 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
.\" -----------------------------------------------------------------
@@ -171,4 +180,4 @@ Christian Pointner <equinox@helsinki\&.at>
Radio Helsinki Website: http://www\&.helsinki\&.at
.SH "COPYING"
.sp
-Copyright (C) 2011 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\&.
+Copyright (C) 2010\-2014 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/doc/rharchive.8.txt b/doc/rharchive.8.txt
index 60dc83a..ed63374 100644
--- a/doc/rharchive.8.txt
+++ b/doc/rharchive.8.txt
@@ -47,7 +47,7 @@ The following options can be passed to the *rharchive* daemon:
instead of becoming a daemon which is the default.
*-u, --username <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 <groupname>*::
@@ -55,20 +55,20 @@ The following options can be passed to the *rharchive* daemon:
The default is to not drop privileges.
*-C, --chroot <path>*::
- Instruct *rharchive* to run in a chroot jail. The default is
+ Instruct *rharchive* to run in a chroot jail. The default is
to not run in chroot.
*-P, --write-pid <filename>*::
- Instruct *rharchive* to write it's pid to this file. The default is
+ Instruct *rharchive* to write it's pid to this file. The default is
to not create a pid file.
*-L, --log <target>:<level>[,<param1>[,<param2>[..]]]*::
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,rharchive,daemon* is added. +
The following targets are supported:
@@ -78,13 +78,13 @@ The following options can be passed to the *rharchive* daemon:
*stderr*;; log to standard error, parameters <level>
*-U, --debug*::
- This option instructs *rharchive* to run in debug mode. It implicits *-D*
+ This option instructs *rharchive* 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.
*-s, --source <description>*::
- a gstreamer-style pipeline description which is used as a source.
+ a gstreamer-style pipeline description which is used as a source.
i.e.: *'pulsesrc ! audioconvert ! vorbisenc ! oggmux'*
this pipeline gets directly connected to the writer element (multifdsink).
@@ -105,7 +105,7 @@ The following options can be passed to the *rharchive* daemon:
*-o, --offset <value>*::
the offset in ms between the real boundary and the time the file actually starts/stops.
A positive number means that the file starts too late. The default is no offset (0ms).
-
+
*-x, --post-process <script>*::
this script gets called for every finished file. By default no script gets called.
@@ -136,7 +136,7 @@ Radio Helsinki Website: http://www.helsinki.at
COPYING
-------
-Copyright \(C) 2011 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-2014 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/src/Makefile b/src/Makefile
index a2f101a..e55eb53 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -2,10 +2,10 @@
## rharchive
##
## The Radio Helsinki Archive Daemon
-##
##
-## Copyright (C) 2010-2011 Christian Pointner <equinox@helsinki.at>
-##
+##
+## Copyright (C) 2010-2014 Christian Pointner <equinox@helsinki.at>
+##
## This file is part of rharchive.
##
## rharchive is free software: you can redistribute it and/or modify
diff --git a/src/configure b/src/configure
index feb9123..c9fcbad 100755
--- a/src/configure
+++ b/src/configure
@@ -5,7 +5,7 @@
# The Radio Helsinki Archive Daemon
#
#
-# Copyright (C) 2010-2011 Christian Pointner <equinox@helsinki.at>
+# Copyright (C) 2010-2014 Christian Pointner <equinox@helsinki.at>
#
# This file is part of rharchive.
#
diff --git a/src/daemon.h b/src/daemon.h
index 0657d75..291e837 100644
--- a/src/daemon.h
+++ b/src/daemon.h
@@ -2,10 +2,10 @@
* rharchive
*
* The Radio Helsinki Archive Daemon
- *
*
- * Copyright (C) 2010-2011 Christian Pointner <equinox@helsinki.at>
- *
+ *
+ * Copyright (C) 2010-2014 Christian Pointner <equinox@helsinki.at>
+ *
* This file is part of rharchive.
*
* rharchive is free software: you can redistribute it and/or modify
@@ -161,4 +161,3 @@ void daemonize()
}
#endif
-
diff --git a/src/datatypes.h b/src/datatypes.h
index 9a9b04e..500cd00 100644
--- a/src/datatypes.h
+++ b/src/datatypes.h
@@ -2,10 +2,10 @@
* rharchive
*
* The Radio Helsinki Archive Daemon
- *
*
- * Copyright (C) 2010-2011 Christian Pointner <equinox@helsinki.at>
- *
+ *
+ * Copyright (C) 2010-2014 Christian Pointner <equinox@helsinki.at>
+ *
* This file is part of rharchive.
*
* rharchive is free software: you can redistribute it and/or modify
diff --git a/src/file_list.c b/src/file_list.c
index c1e7263..44a4949 100644
--- a/src/file_list.c
+++ b/src/file_list.c
@@ -2,10 +2,10 @@
* rharchive
*
* The Radio Helsinki Archive Daemon
- *
*
- * Copyright (C) 2010-2011 Christian Pointner <equinox@helsinki.at>
- *
+ *
+ * Copyright (C) 2010-2014 Christian Pointner <equinox@helsinki.at>
+ *
* This file is part of rharchive.
*
* rharchive is free software: you can redistribute it and/or modify
diff --git a/src/file_list.h b/src/file_list.h
index 1e84266..1132327 100644
--- a/src/file_list.h
+++ b/src/file_list.h
@@ -2,10 +2,10 @@
* rharchive
*
* The Radio Helsinki Archive Daemon
- *
*
- * Copyright (C) 2010-2011 Christian Pointner <equinox@helsinki.at>
- *
+ *
+ * Copyright (C) 2010-2014 Christian Pointner <equinox@helsinki.at>
+ *
* This file is part of rharchive.
*
* rharchive is free software: you can redistribute it and/or modify
diff --git a/src/log.c b/src/log.c
index 59a6f9f..1fc73a8 100644
--- a/src/log.c
+++ b/src/log.c
@@ -2,10 +2,10 @@
* rharchive
*
* The Radio Helsinki Archive Daemon
- *
*
- * Copyright (C) 2010-2011 Christian Pointner <equinox@helsinki.at>
- *
+ *
+ * Copyright (C) 2010-2014 Christian Pointner <equinox@helsinki.at>
+ *
* This file is part of rharchive.
*
* rharchive is free software: you can redistribute it and/or modify
diff --git a/src/log.h b/src/log.h
index c0f210c..f06b352 100644
--- a/src/log.h
+++ b/src/log.h
@@ -2,10 +2,10 @@
* rharchive
*
* The Radio Helsinki Archive Daemon
- *
*
- * Copyright (C) 2010-2011 Christian Pointner <equinox@helsinki.at>
- *
+ *
+ * Copyright (C) 2010-2014 Christian Pointner <equinox@helsinki.at>
+ *
* This file is part of rharchive.
*
* rharchive is free software: you can redistribute it and/or modify
diff --git a/src/log_targets.h b/src/log_targets.h
index 7f4346c..5efd4c0 100644
--- a/src/log_targets.h
+++ b/src/log_targets.h
@@ -2,10 +2,10 @@
* rharchive
*
* The Radio Helsinki Archive Daemon
- *
*
- * Copyright (C) 2010-2011 Christian Pointner <equinox@helsinki.at>
- *
+ *
+ * Copyright (C) 2010-2014 Christian Pointner <equinox@helsinki.at>
+ *
* This file is part of rharchive.
*
* rharchive is free software: you can redistribute it and/or modify
@@ -31,7 +31,7 @@ static char* get_time_formatted()
{
char* time_string;
time_t t = time(NULL);
- if(t < 0)
+ if(t < 0)
time_string = "<time read error>";
else {
time_string = ctime(&t);
@@ -69,7 +69,7 @@ int log_target_syslog_init(log_target_t* self, const char* conf)
{
if(!self || (conf && conf[0] == 0))
return -1;
-
+
self->param_ = malloc(sizeof(log_target_syslog_param_t));
if(!self->param_)
return -2;
@@ -85,7 +85,7 @@ int log_target_syslog_init(log_target_t* self, const char* conf)
if(!len) {
free(self->param_);
return -1;
- }
+ }
logname = malloc(len+1);
if(logname) {
strncpy(logname, conf, len);
@@ -106,13 +106,13 @@ int log_target_syslog_init(log_target_t* self, const char* conf)
((log_target_syslog_param_t*)(self->param_))->facility_ = DAEMON;
return 0;
}
-
+
if(end[1] == 0 || end[1] == ',') {
free(logname);
free(self->param_);
return -1;
}
-
+
const char* start = end + 1;
end = strchr(start, ',');
int i;
@@ -147,7 +147,7 @@ void log_target_syslog_log(log_target_t* self, log_prio_t prio, const char* msg)
if(!self || !self->param_ || !self->opened_)
return;
- syslog((prio + 2) | ((log_target_syslog_param_t*)(self->param_))->facility_, "%s", msg);
+ syslog((prio + 2) | ((log_target_syslog_param_t*)(self->param_))->facility_, "%s", msg);
}
void log_target_syslog_close(log_target_t* self)
@@ -199,7 +199,7 @@ int log_target_file_init(log_target_t* self, const char* conf)
{
if(!self || (conf && conf[0] == 0))
return -1;
-
+
self->param_ = malloc(sizeof(log_target_file_param_t));
if(!self->param_)
return -2;
@@ -214,7 +214,7 @@ int log_target_file_init(log_target_t* self, const char* conf)
if(!len) {
free(self->param_);
return -1;
- }
+ }
logfilename = malloc(len+1);
if(logfilename) {
strncpy(logfilename, conf, len);
diff --git a/src/options.c b/src/options.c
index 00e52bf..f8a42d8 100644
--- a/src/options.c
+++ b/src/options.c
@@ -2,10 +2,10 @@
* rharchive
*
* The Radio Helsinki Archive Daemon
- *
*
- * Copyright (C) 2010-2011 Christian Pointner <equinox@helsinki.at>
- *
+ *
+ * Copyright (C) 2010-2014 Christian Pointner <equinox@helsinki.at>
+ *
* This file is part of rharchive.
*
* rharchive is free software: you can redistribute it and/or modify
@@ -138,9 +138,9 @@ int options_parse_hex_string(const char* hex, buffer_t* buffer)
if(hex_len%2)
return 1;
- if(buffer->buf_)
+ if(buffer->buf_)
free(buffer->buf_);
-
+
buffer->length_ = hex_len/2;
buffer->buf_ = malloc(buffer->length_);
if(!buffer->buf_) {
diff --git a/src/options.h b/src/options.h
index 7b08c55..a91cd86 100644
--- a/src/options.h
+++ b/src/options.h
@@ -2,10 +2,10 @@
* rharchive
*
* The Radio Helsinki Archive Daemon
- *
*
- * Copyright (C) 2010-2011 Christian Pointner <equinox@helsinki.at>
- *
+ *
+ * Copyright (C) 2010-2014 Christian Pointner <equinox@helsinki.at>
+ *
* This file is part of rharchive.
*
* rharchive is free software: you can redistribute it and/or modify
diff --git a/src/rharchive.c b/src/rharchive.c
index 3401047..6d6bb7d 100644
--- a/src/rharchive.c
+++ b/src/rharchive.c
@@ -4,7 +4,7 @@
* The Radio Helsinki Archive Daemon
*
*
- * Copyright (C) 2010-2011 Christian Pointner <equinox@helsinki.at>
+ * Copyright (C) 2010-2014 Christian Pointner <equinox@helsinki.at>
*
* This file is part of rharchive.
*
@@ -246,5 +246,5 @@ int main(int argc, char* argv[])
gst_deinit();
log_close();
- return ret;
+ return ret;
}
diff --git a/src/sig_handler.c b/src/sig_handler.c
index ce793b2..59fc461 100644
--- a/src/sig_handler.c
+++ b/src/sig_handler.c
@@ -2,10 +2,10 @@
* rharchive
*
* The Radio Helsinki Archive Daemon
- *
*
- * Copyright (C) 2010-2011 Christian Pointner <equinox@helsinki.at>
- *
+ *
+ * Copyright (C) 2010-2014 Christian Pointner <equinox@helsinki.at>
+ *
* This file is part of rharchive.
*
* rharchive is free software: you can redistribute it and/or modify
@@ -87,18 +87,18 @@ static gpointer signal_thread_func(gpointer data)
}
}
}
-
- return NULL;
+
+ return NULL;
}
int signal_start(GMainLoop *loop)
{
- g_assert(!signal_thread);
+ g_assert(!signal_thread);
+
+ signal_thread = g_thread_create_full(signal_thread_func, loop, 8192, FALSE, TRUE, G_THREAD_PRIORITY_HIGH, NULL);
+ if(!signal_thread)
+ return -1;
- signal_thread = g_thread_create_full(signal_thread_func, loop, 8192, FALSE, TRUE, G_THREAD_PRIORITY_HIGH, NULL);
- if(!signal_thread)
- return -1;
-
return 0;
}
diff --git a/src/sig_handler.h b/src/sig_handler.h
index b8f7bd8..180369d 100644
--- a/src/sig_handler.h
+++ b/src/sig_handler.h
@@ -2,10 +2,10 @@
* rharchive
*
* The Radio Helsinki Archive Daemon
- *
*
- * Copyright (C) 2010-2011 Christian Pointner <equinox@helsinki.at>
- *
+ *
+ * Copyright (C) 2010-2014 Christian Pointner <equinox@helsinki.at>
+ *
* This file is part of rharchive.
*
* rharchive is free software: you can redistribute it and/or modify
diff --git a/src/slist.c b/src/slist.c
index 262f243..bc9d7c3 100644
--- a/src/slist.c
+++ b/src/slist.c
@@ -2,10 +2,10 @@
* rharchive
*
* The Radio Helsinki Archive Daemon
- *
*
- * Copyright (C) 2010-2011 Christian Pointner <equinox@helsinki.at>
- *
+ *
+ * Copyright (C) 2010-2014 Christian Pointner <equinox@helsinki.at>
+ *
* This file is part of rharchive.
*
* rharchive is free software: you can redistribute it and/or modify
@@ -33,10 +33,10 @@ slist_element_t* slist_get_last(slist_element_t* first)
{
if(!first)
return NULL;
-
+
while(first->next_)
first = first->next_;
-
+
return first;
}
@@ -59,7 +59,7 @@ slist_element_t* slist_add(slist_t* lst, void* data)
slist_element_t* new_element = malloc(sizeof(slist_element_t));
if(!new_element)
return NULL;
-
+
new_element->data_ = data;
new_element->next_ = NULL;
@@ -67,7 +67,7 @@ slist_element_t* slist_add(slist_t* lst, void* data)
lst->first_ = new_element;
else
slist_get_last(lst->first_)->next_ = new_element;
-
+
return new_element;
}
@@ -101,7 +101,7 @@ void slist_clear(slist_t* lst)
{
if(!lst || !lst->first_)
return;
-
+
do {
slist_element_t* deletee = lst->first_;
lst->first_ = lst->first_->next_;
@@ -109,7 +109,7 @@ void slist_clear(slist_t* lst)
free(deletee);
}
while(lst->first_);
-
+
lst->first_ = NULL;
}
@@ -117,11 +117,11 @@ int slist_length(slist_t* lst)
{
if(!lst || !lst->first_)
return 0;
-
+
int len = 0;
slist_element_t* tmp;
for(tmp = lst->first_; tmp; tmp = tmp->next_)
len++;
-
+
return len;
}
diff --git a/src/slist.h b/src/slist.h
index 077ae92..d25831a 100644
--- a/src/slist.h
+++ b/src/slist.h
@@ -2,10 +2,10 @@
* rharchive
*
* The Radio Helsinki Archive Daemon
- *
*
- * Copyright (C) 2010-2011 Christian Pointner <equinox@helsinki.at>
- *
+ *
+ * Copyright (C) 2010-2014 Christian Pointner <equinox@helsinki.at>
+ *
* This file is part of rharchive.
*
* rharchive is free software: you can redistribute it and/or modify
diff --git a/src/string_list.c b/src/string_list.c
index ffea526..f5de488 100644
--- a/src/string_list.c
+++ b/src/string_list.c
@@ -2,10 +2,10 @@
* rharchive
*
* The Radio Helsinki Archive Daemon
- *
*
- * Copyright (C) 2010-2011 Christian Pointner <equinox@helsinki.at>
- *
+ *
+ * Copyright (C) 2010-2014 Christian Pointner <equinox@helsinki.at>
+ *
* This file is part of rharchive.
*
* rharchive is free software: you can redistribute it and/or modify
@@ -43,7 +43,7 @@ int string_list_add(string_list_t* list, const char* string)
{
if(!list)
return -1;
-
+
char* tmp = strdup(string);
if(slist_add(list, tmp) == NULL) {
free(tmp);
@@ -57,7 +57,7 @@ void string_list_print(string_list_t* list, const char* head, const char* tail)
{
if(!list)
return;
-
+
slist_element_t* tmp = list->first_;
while(tmp) {
printf("%s%s%s", head, (char*)(tmp->data_), tail);
diff --git a/src/string_list.h b/src/string_list.h
index 7179b8d..54552b5 100644
--- a/src/string_list.h
+++ b/src/string_list.h
@@ -2,10 +2,10 @@
* rharchive
*
* The Radio Helsinki Archive Daemon
- *
*
- * Copyright (C) 2010-2011 Christian Pointner <equinox@helsinki.at>
- *
+ *
+ * Copyright (C) 2010-2014 Christian Pointner <equinox@helsinki.at>
+ *
* This file is part of rharchive.
*
* rharchive is free software: you can redistribute it and/or modify
diff --git a/src/sysexec.c b/src/sysexec.c
index d4edc4b..490a3f9 100644
--- a/src/sysexec.c
+++ b/src/sysexec.c
@@ -2,10 +2,10 @@
* rharchive
*
* The Radio Helsinki Archive Daemon
- *
*
- * Copyright (C) 2010-2011 Christian Pointner <equinox@helsinki.at>
- *
+ *
+ * Copyright (C) 2010-2014 Christian Pointner <equinox@helsinki.at>
+ *
* This file is part of rharchive.
*
* rharchive is free software: you can redistribute it and/or modify
@@ -53,12 +53,12 @@ char** dup_ptrptr(char* const ptrptr[])
int i;
for(i = 0; i < n; ++i) {
- my_ptrptr[i] = strdup(ptrptr[i]);
+ my_ptrptr[i] = strdup(ptrptr[i]);
if(!my_ptrptr[i]) {
i--;
for(; i >= 0; --i)
free(my_ptrptr[i]);
-
+
free(my_ptrptr);
return NULL;
}
@@ -77,7 +77,7 @@ void free_ptrptr(char** ptrptr)
int i;
for(i = 0; ptrptr[i]; ++i)
free(ptrptr[i]);
-
+
free(ptrptr);
}
@@ -88,7 +88,7 @@ child_t* new_child(const char* script, char* const argv[], char* const evp[])
new_child = malloc(sizeof(child_t));
if(!new_child)
return NULL;
-
+
new_child->pid_ = -1;
new_child->err_fd_ = -1;
new_child->script_ = strdup(script);
@@ -96,15 +96,15 @@ child_t* new_child(const char* script, char* const argv[], char* const evp[])
free(new_child);
return NULL;
}
-
+
new_child->argv_ = dup_ptrptr(argv);
if(!new_child->argv_) {
free(new_child->script_);
free(new_child);
return NULL;
-
+
}
-
+
new_child->evp_ = dup_ptrptr(evp);
if(!new_child->evp_) {
free_ptrptr(new_child->argv_);
@@ -169,7 +169,7 @@ child_t* rh_exec(const char* script, char* const argv[], char* const evp[])
log_printf(WARNING, "can't open stderr");
}
execve(child->script_, child->argv_, child->evp_);
- // if execve returns, an error occurred, but logging doesn't work
+ // if execve returns, an error occurred, but logging doesn't work
// because we closed all file descriptors, so just write errno to
// pipe and call exit
int len = write(pipefd[1], (void*)(&errno), sizeof(errno));
@@ -194,7 +194,7 @@ int rh_waitpid(child_t* child, int* status_return)
return 0;
if(pid < 0) {
log_printf(ERROR, "waitpid returned with error: %s", strerror(errno)); // TODO: thread safe strerror
- return pid;
+ return pid;
}
fd_set rfds;
diff --git a/src/sysexec.h b/src/sysexec.h
index 0ec9829..3c8908d 100644
--- a/src/sysexec.h
+++ b/src/sysexec.h
@@ -2,10 +2,10 @@
* rharchive
*
* The Radio Helsinki Archive Daemon
- *
*
- * Copyright (C) 2010-2011 Christian Pointner <equinox@helsinki.at>
- *
+ *
+ * Copyright (C) 2010-2014 Christian Pointner <equinox@helsinki.at>
+ *
* This file is part of rharchive.
*
* rharchive is free software: you can redistribute it and/or modify
diff --git a/src/writer.c b/src/writer.c
index 1355125..192dea9 100644
--- a/src/writer.c
+++ b/src/writer.c
@@ -2,10 +2,10 @@
* rharchive
*
* The Radio Helsinki Archive Daemon
- *
*
- * Copyright (C) 2010-2011 Christian Pointner <equinox@helsinki.at>
- *
+ *
+ * Copyright (C) 2010-2014 Christian Pointner <equinox@helsinki.at>
+ *
* This file is part of rharchive.
*
* rharchive is free software: you can redistribute it and/or modify
@@ -43,10 +43,10 @@ static int init_time_boundaries(writer_t* writer)
struct timespec now;
clock_gettime(CLOCK_REALTIME, &now);
-
+
struct tm bd_time;
localtime_r(&(now.tv_sec), &bd_time);
-
+
writer->current_ = file_list_add(&(writer->files_), &bd_time, "current", writer->name_format_, writer->output_dir_, writer->mode_);
if(writer->current_ == NULL) return -2;
@@ -75,14 +75,14 @@ static void added_cb(GstElement* sink, gint fd, gpointer data)
static void removed_cb(GstElement* sink, gint fd, gpointer data)
{
gint num_fds;
- g_object_get(G_OBJECT(sink), "num_fds", &num_fds, NULL);
+ g_object_get(G_OBJECT(sink), "num_fds", &num_fds, NULL);
log_printf(INFO, "fdsink: successfully removed client %d (sink has now %d fds)", fd, num_fds);
}
static void fdremoved_cb(GstElement* sink, gint fd, gpointer data)
{
gint num_fds;
- g_object_get(G_OBJECT(sink), "num_fds", &num_fds, NULL);
+ g_object_get(G_OBJECT(sink), "num_fds", &num_fds, NULL);
log_printf(INFO, "fdsink: successfully removed fd %d (sink has now %d fds)", fd, num_fds);
writer_t *writer = (writer_t*)data;
@@ -144,18 +144,18 @@ static int check_boundaries(writer_t* writer)
{
struct timespec now;
clock_gettime(CLOCK_REALTIME, &now);
-
- GstClockTime tmp = GST_TIMESPEC_TO_TIME(now);
+
+ GstClockTime tmp = GST_TIMESPEC_TO_TIME(now);
GstClockTime boundary = GST_TIMESPEC_TO_TIME(writer->next_boundary_);
tmp -= writer->offset_;
if(tmp >= boundary) {
struct tm now_bd;
localtime_r(&(now.tv_sec), &now_bd);
log_printf(INFO, "boundary reached! it's now: %02d:%02d:%02d.%06d on %d.%d.%d%s (%d ms offset)", now_bd.tm_hour, now_bd.tm_min, now_bd.tm_sec, now.tv_nsec/1000, now_bd.tm_mday, now_bd.tm_mon+1, now_bd.tm_year+1900, now_bd.tm_isdst > 0 ? " (DST)": "", GST_TIME_AS_MSECONDS(writer->offset_));
-
+
int ret = open_file(writer->next_);
if(ret) return ret; // TODO: stop writer on open_file error ???
-
+
add_fd(writer, writer->next_->fd_);
remove_fd(writer, writer->current_->fd_);
writer->current_ = writer->next_;
@@ -163,19 +163,19 @@ static int check_boundaries(writer_t* writer)
writer->next_boundary_.tv_sec += 3600;
struct tm bd_time;
localtime_r(&(writer->next_boundary_.tv_sec), &bd_time);
-
+
writer->next_ = file_list_add(&(writer->files_), &bd_time, "next", writer->name_format_, writer->output_dir_, writer->mode_);
if(writer->next_ == NULL) return -2;
}
return 0;
}
-
+
static gpointer writer_thread_func(gpointer data)
{
writer_t *writer = (writer_t*)data;
log_printf(NOTICE, "writer thread started");
-
+
for(;;) {
GstClockReturn wret = gst_clock_id_wait(writer->clock_id_, NULL);
if(GST_CLOCK_UNSCHEDULED == wret)
@@ -189,7 +189,7 @@ static gpointer writer_thread_func(gpointer data)
ret = file_list_waitpid(&(writer->files_));
if(ret) break;
}
-
+
log_printf(NOTICE, "writer thread stopped");
g_main_loop_quit(writer->loop_);
return NULL;
diff --git a/src/writer.h b/src/writer.h
index 353e909..8e012a9 100644
--- a/src/writer.h
+++ b/src/writer.h
@@ -2,10 +2,10 @@
* rharchive
*
* The Radio Helsinki Archive Daemon
- *
*
- * Copyright (C) 2010-2011 Christian Pointner <equinox@helsinki.at>
- *
+ *
+ * Copyright (C) 2010-2014 Christian Pointner <equinox@helsinki.at>
+ *
* This file is part of rharchive.
*
* rharchive is free software: you can redistribute it and/or modify
@@ -47,7 +47,7 @@ struct writer_struct {
file_list_t files_;
file_t* current_;
file_t* next_;
- struct timespec next_boundary_;
+ struct timespec next_boundary_;
};
typedef struct writer_struct writer_t;