This makes the man pages generated by help2man look much nicer.
-COPYRIGHT = Copyright (c) 1997-2007 by Andre Noll
-DISCLAIMER = This is free software with ABSOLUTELY NO WARRANTY. See COPYING for details.
-
prefix = @prefix@
exec_prefix = @exec_prefix@
include Makefile.deps
-V := (@PACKAGE_STRING@, $(codename))\n$(COPYRIGHT)\n$(DISCLAIMER)
module_ggo_opts := --set-version="(@PACKAGE_STRING@, $(codename))"
grab_client.cmdline.h grab_client.cmdline.c: grab_client.ggo
audioc.ggo) O="--unamed-opts=command";; \
esac; \
gengetopt $$O \
+ --no-handle-version \
--conf-parser \
--file-name=$(*F).cmdline \
--func-name $(*F)_cmdline_parser \
--arg-struct-name=$(*F)_args_info \
--set-package="para_$(subst .cmdline,,$(*F))" \
- --set-version="$V" < $<
+ --set-version="@PACKAGE_VERSION@" < $<
%_command_list.c %_command_list.h: %.cmd
./command_util.sh c < $< >$@
help2man -N -i audiod_command_list.man ./para_audiod > $@
man/man1/%.1: %
- help2man -N $< > $@
+ help2man -N ./$< > $@
man/html/%.html: man/man1/%.1
man2html $< > $@
if (audioc_cmdline_parser(argc, argv, &conf))
goto out;
+ HANDLE_VERSION_FLAG("audioc", conf);
cf = configfile_exists();
if (cf) {
if (audioc_cmdline_parser_configfile(cf, &conf, 0, 0, 0)) {
valid_fd_012();
audiod_cmdline_parser(argc, argv, &conf);
+ HANDLE_VERSION_FLAG("audiod", conf);
para_drop_privileges(conf.user_arg, conf.group_arg);
cf = configfile_exists();
if (cf) {
#include "client.h"
#include "error.h"
-void rc4_send(unsigned long len, const unsigned char *indata,
+/*
+ * rc4 encrypt data before sending
+ *
+ * \param len the number of bytes to encrypt
+ * \param indata pointer to the input data of length \a len to be encrypted
+ * \param outdata pointer that holds the encrypted data after return
+ * \param private_data pointer to the private client data containing
+ * the rc4 key
+ * */
+static void rc4_send(unsigned long len, const unsigned char *indata,
unsigned char *outdata, void *private_data)
{
struct private_client_data *pcd = private_data;
RC4(&pcd->rc4_send_key, len, indata, outdata);
}
-void rc4_recv(unsigned long len, const unsigned char *indata,
+/*
+ * rc4 decrypt received data
+ *
+ * \param len the number of bytes to decrypt
+ * \param indata pointer to the input data of length \a len
+ * \param outdata pointer that holds the decrypted data after return
+ * \param private_data pointer to the private client data containing
+ * the rc4 key
+ * */
+static void rc4_recv(unsigned long len, const unsigned char *indata,
unsigned char *outdata, void *private_data)
{
struct private_client_data *pcd = private_data;
RC4(&pcd->rc4_recv_key, len, indata, outdata);
}
-
+/**
+ * close the connection to para_server and free all resources
+ *
+ * \param pcd pointer to the client data
+ *
+ * \sa client_open.
+ * */
void client_close(struct private_client_data *pcd)
{
if (!pcd)
return ret;
}
+/**
+ * open connection to para_server
+ *
+ * \param argc usual argument count
+ * \param argv usual argument vector
+ * \param pcd_ptr points to dynamically allocated and initialized private client data
+ * upon successful return
+ *
+ * Check the command line options given by \a argc and argv, set default values
+ * for user name and rsa key file, read further option from the config file.
+ * Finally, establish a connection to para_server.
+ *
+ * \return Positive on success, negative on errors.
+ */
int client_open(int argc, char *argv[], struct private_client_data **pcd_ptr)
{
char *home = para_homedir();
*pcd_ptr = pcd;
pcd->fd = -1;
ret = client_cmdline_parser(argc, argv, &pcd->conf);
+ HANDLE_VERSION_FLAG("client", pcd->conf);
ret = -E_CLIENT_SYNTAX;
if (!pcd->conf.inputs_num)
goto out;
return ret;
}
+/**
+ * the preselect hook for server commands
+ *
+ * \param s pointer to the scheduler
+ * \param t pointer to the task struct for this command
+ *
+ * The task pointer must contain a pointer to the initialized client data
+ * structure as it is returned by client_open().
+ *
+ * This function checks the state of the connection and adds the file descriptor
+ * of the connection to the read or write fd set of \a s accordingly.
+ *
+ * \sa register_task() client_open(), struct sched, struct task
+ */
void client_pre_select(struct sched *s, struct task *t)
{
struct private_client_data *pcd = t->private_data;
}
+/**
+ * the post select hook for client commands
+ *
+ * \param s pointer to the scheduler
+ * \param t pointer to the task struct for this command
+ *
+ * Depending on the current state of the connection and the status of the read
+ * and write fd sets of \a s, this function performs the neccessary steps to
+ * authenticate the connection, to send the commmand given by \a
+ * t->private_data and to receive para_server's output, if any.
+ *
+ * \sa struct sched, struct task
+ */
void client_post_select(struct sched *s, struct task *t)
{
struct private_client_data *pcd = t->private_data;
t->ret = client_recv_buffer(pcd);
return;
}
-
}
{
if (argc != 1)
return -E_COMMAND_SYNTAX;
- return send_buffer(socket_fd, "para_server-" PACKAGE_VERSION ", \""
- CODENAME "\"\n"
- COPYRIGHT "\n"
- "built: " BUILD_DATE "\n"
- SYSTEM ", " CC_VERSION "\n"
- );
+ return send_buffer(socket_fd, VERSION_TEXT("server")
+ "built: " BUILD_DATE "\n"
+ SYSTEM ", " CC_VERSION "\n"
+ );
}
/* sc */
/*
- * Copyright (C) 1998-2005 Andre Noll <maan@systemlinux.org>
+ * Copyright (C) 1998-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
if (fade_cmdline_parser(argc, argv, &args_info))
exit(EXIT_FAILURE);
+ HANDLE_VERSION_FLAG("fade", args_info);
ret = configfile_exists();
if (!ret && args_info.config_file_given) {
PARA_EMERG_LOG("can not read config file %s\n",
if (filter_cmdline_parser(argc, argv, &conf))
return -E_FILTER_SYNTAX;
+ HANDLE_VERSION_FLAG("filter", conf);
if (!cf) {
char *home = para_homedir();
cf = make_message("%s/.paraslash/filter.conf", home);
/*
- * Copyright (C) 1998-2006 Andre Noll <maan@systemlinux.org>
+ * Copyright (C) 1998-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
fprintf(stderr, "parse error while reading command line\n");
exit(EXIT_FAILURE);
}
+ HANDLE_VERSION_FLAG("gui", conf);
init_theme(0, &theme);
top.lines = theme.top_lines_default;
if (check_key_map_args() < 0) {
}
-#define COPYRIGHT "Copyright (c) 1997-2006 by Andre Noll"
-
+#define VERSION_TEXT(prefix) "para_" prefix " " PACKAGE_VERSION "\n" \
+ "Copyright (C) 2007 Andre Noll\n" \
+ "This is free software with ABSOLUTELY NO WARRANTY." \
+ " See COPYING for details.\n" \
+ "Written by Andre Noll.\n" \
+ "Report bugs to <maan@systemlinux.org>.\n"
+
+#define HANDLE_VERSION_FLAG(_prefix, _args_info_struct) \
+ if (_args_info_struct.version_given) { \
+ printf("%s", VERSION_TEXT(_prefix)); \
+ exit(EXIT_SUCCESS); \
+ }
#define AWAITING_DATA_MSG "\nAwaiting Data."
#define PROCEED_MSG "\nProceed.\n"
if (recv_cmdline_parser(argc, argv, &conf))
return NULL;
+ HANDLE_VERSION_FLAG("recv", conf);
if (conf.list_receivers_given) {
printf("available receivers: ");
for (i = 0; receivers[i].name; i++)
/*
- * Copyright (C) 2003-2006 Andre Noll <maan@systemlinux.org>
+ * Copyright (C) 2003-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
SDLKey sym;
sdl_gui_cmdline_parser(argc, argv, &args_info);
+ HANDLE_VERSION_FLAG("sdl_gui", args_info);
ret = configfile_exists();
// printf("w=%i,h=%i,ret=%i, cf=%s\n", width, height, ret, args_info.config_file_arg);
option "window-id" w "(currently ignored)" string typestr="filename" optional
option "stat_cmd" s "command to read server and audiod status data from" string typestr="command" default="para_audioc stat" optional
option "pic_cmd" p "command to read pic from" string typestr="command" default="para_client pic" optional
+text "Written by Andre Noll"
init_random_seed();
/* parse command line options */
server_cmdline_parser(argc, argv, &conf);
+ HANDLE_VERSION_FLAG("server", conf);
para_drop_privileges(conf.user_arg, conf.group_arg);
/* parse config file, open log and set defaults */
parse_config(0);
struct sched s;
write_cmdline_parser(argc, argv, &conf);
+ HANDLE_VERSION_FLAG("write", conf);
init_supported_writers();
wng = check_args();