net.c: Fix a doxygen warning and trivial coding style cleanups.
[paraslash.git] / write.c
diff --git a/write.c b/write.c
index 89831a2e448f40129e5ed6d51f8bebd863d9123b..512f8fcca23dce7e809ad19ed6c9784f45199993 100644 (file)
--- a/write.c
+++ b/write.c
@@ -1,22 +1,13 @@
 /*
  * Copyright (C) 2005-2007 Andre Noll <maan@systemlinux.org>
  *
- *     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 2 of the License, or
- *     (at your option) any later version.
- *
- *     This program 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 this program; if not, write to the Free Software
- *     Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
+ * Licensed under the GPL v2. For licencing details see COPYING.
  */
 
-/** \file write.c Paraslash's standalone wav/raw player */
+/** \file write.c Paraslash's standalone wav/raw player. */
+
+#include <sys/types.h>
+#include <dirent.h>
 
 #include "para.h"
 #include "string.h"
 
 INIT_WRITE_ERRLISTS;
 
-/**
- * check if given buffer contains a valid wave header
- */
+/** Check if given buffer contains a valid wave header. */
 struct check_wav_task {
-       /** the buffer to check */
+       /** The buffer to check. */
        char *buf;
-       /** number of bytes loaded in \a buf */
+       /** Number of bytes loaded in \a buf. */
        size_t *loaded;
-       /** non-zero if end of file was reached */
+       /** Non-zero if end of file was reached. */
        int *eof;
-       /** number of channels specified in wav header given by \a buf */
+       /** Number of channels specified in wav header given by \a buf. */
        unsigned channels;
-       /** samplerate specified in wav header given by \a buf */
+       /** Samplerate specified in wav header given by \a buf. */
        unsigned samplerate;
-       /** the task structure for this task */
+       /** The task structure for this task. */
        struct task task;
 };
 
-/**
- * delay writing until given time
- */
+/** Delay writing until given time. */
 struct initial_delay_task {
-       /** the time the first data should be written out */
+       /** The time the first data should be written out. */
        struct timeval start_time;
-       /** the task structure for this task */
+       /** The task structure for this task. */
        struct task task;
 };
 
@@ -65,11 +52,11 @@ static struct check_wav_task cwt;
 static struct initial_delay_task idt;
 static struct writer_node_group *wng;
 
-/** length of a standard wav header */
+/** Length of a standard wav header. */
 #define WAV_HEADER_LEN 44
 
 /**
- * test if audio buffer contains a valid wave header
+ * Test if audio buffer contains a valid wave header.
  *
  * \return If not, return -E_NO_WAV_HEADER, otherwise, return zero. If
  * there is less than WAV_HEADER_LEN bytes awailable, return one.
@@ -214,11 +201,15 @@ static void cwt_event_handler(struct task *t)
 }
 
 /**
- * para_write's main function
+ * Para_write's main function.
+ *
+ * \param argc The usual argument counter.
+ * \param argv The usual argument vector.
  *
  * It registers the stdin task, the check_wav_task, the task for initial delay
  * and all tasks for actually writing out the stream.
  *
+ * \return \p EXIT_SUCCESS or EXIT_FAILURE
  */
 int main(int argc, char *argv[])
 {
@@ -226,6 +217,7 @@ int main(int argc, char *argv[])
        struct sched s;
 
        write_cmdline_parser(argc, argv, &conf);
+       HANDLE_VERSION_FLAG("write", conf);
        init_supported_writers();
 
        wng = check_args();
@@ -248,7 +240,7 @@ int main(int argc, char *argv[])
 
        s.default_timeout.tv_sec = 1;
        s.default_timeout.tv_usec = 0;
-       ret = sched(&s);
+       ret = schedule(&s);
 
 out:
        if (ret < 0) {