From d38388f40be157b35b8be4a8e85f54a9ed785317 Mon Sep 17 00:00:00 2001 From: nick Date: Fri, 14 Mar 2008 23:54:39 +0000 Subject: [PATCH] Release 0.6 git-svn-id: http://svn.nickg.me.uk/work/xcowsay@297 a97b1542-0b21-0410-a459-e47997c36f34 --- Makefile.am | 3 ++- src/Makefile.am | 2 ++ src/xcowsay.c | 30 +++++++++++++++++++++++++++--- xcowsay.6 | 37 +++++++++++++++++++++++++++++++++++-- 4 files changed, 66 insertions(+), 6 deletions(-) diff --git a/Makefile.am b/Makefile.am index e3ce7d0..7832167 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,4 +1,5 @@ SUBDIRS = src dist_pkgdata_DATA = cow_small.png cow_med.png cow_large.png -EXTRA_DIST = cow.svg xcowat xcowfortune +EXTRA_DIST = cow.svg xcowsay.6 +man_MANS = xcowsay.6 \ No newline at end of file diff --git a/src/Makefile.am b/src/Makefile.am index 4de232d..aa82402 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -7,3 +7,5 @@ LDADD = $(XCOWSAY_LIBS) xcowsay_SOURCES = xcowsay.c display_cow.c display_cow.h floating_shape.h \ floating_shape.c settings.h settings.c Cowsay_glue.h xcowsayd.h \ xcowsayd.c + +EXTRA_DIST = xcowat xcowfortune \ No newline at end of file diff --git a/src/xcowsay.c b/src/xcowsay.c index 7020de0..1967376 100644 --- a/src/xcowsay.c +++ b/src/xcowsay.c @@ -1,4 +1,4 @@ -/* xcowsay.c -- Cute talking cow for GTK+ +/* xcowsay.c -- Cute talking cow for GTK+. * Copyright (C) 2008 Nick Gasson * * This program is free software: you can redistribute it and/or modify @@ -24,6 +24,10 @@ #include "settings.h" #include "xcowsayd.h" +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + // Default settings #define DEF_LEAD_IN_TIME 250 #define DEF_DISPLAY_TIME CALCULATE_DISPLAY_TIME @@ -42,6 +46,7 @@ static int debug = 0; static struct option long_options[] = { {"help", no_argument, 0, 'h'}, + {"version", no_argument, 0, 'v'}, {"time", required_argument, 0, 't'}, {"font", required_argument, 0, 'f'}, {"cow-size", required_argument, 0, 'c'}, @@ -72,6 +77,7 @@ static void usage() "Display a cow on your desktop with MESSAGE or standard input.\n\n" "Options:\n" " -h, --help\t\tDisplay this message and exit.\n" + " -v, --version\t\tPrint version information.\n" " -t, --time=SECONDS\tDisplay message for SECONDS seconds.\n" " -r, --reading-speed=N\tNumber of milliseconds to delay per word.\n" " -f, --font=FONT\tSet message font (Pango format).\n" @@ -79,13 +85,28 @@ static void usage() " --cow-size=SIZE\tSize of the cow (small, med, large).\n" " --debug\t\tKeep daemon attached to terminal.\n\n" "Default values for these options can be specified in the xcowsay config\n" - "file. See the manpage for more information [Or not... ;-)]\n\n" + "file. See the man page for more information.\n\n" "If the display_time option is not set the display time will be calcuated\n" "from the reading_speed parameter multiplied by the word count.\n\n" "Report bugs to nick@cakesniffer.co.uk"; puts(usage_message); } +static void version() +{ + static const char *copy = + "Copyright (C) 2008 Nick Gasson\n" + "This program comes with ABSOLUTELY NO WARRANTY. This is free software, and\n" + "you are welcome to redistribute it under certain conditions. See the GNU\n" + "General Public Licence for details."; + +#ifdef HAVE_CONFIG_H + puts(PACKAGE_STRING); +#endif + + puts(copy); +} + static int parse_int_option(const char *optarg) { char *endptr; @@ -111,7 +132,7 @@ int main(int argc, char **argv) add_string_option("image_base", DEF_IMAGE_BASE); int c, index = 0, failure = 0; - const char *spec = "hdrt:f:"; + const char *spec = "hvdrt:f:"; while ((c = getopt_long(argc, argv, spec, long_options, &index)) != -1) { switch (c) { case 0: @@ -126,6 +147,9 @@ int main(int argc, char **argv) case 'h': usage(); exit(EXIT_SUCCESS); + case 'v': + version(); + exit(EXIT_SUCCESS); case 't': set_int_option("display_time", parse_int_option(optarg)*1000); break; diff --git a/xcowsay.6 b/xcowsay.6 index b1162a5..51ee239 100644 --- a/xcowsay.6 +++ b/xcowsay.6 @@ -14,7 +14,35 @@ xcowsay \- Display a cute cow and speech bubble. .RI \| font \|] .RI [\| text \|] .SH DESCRIPTION -TODO: Description here +Display a cow with a speech bubble containing some text. If +.I text +is speficied it will be displayed in the bubble. Otherwise the text +will be read from the standard input and displayed when end of file +is encountered. + +The cow is displayed for either a fixed amount of time, or an amount +of time calculated from the size of the text. Click on the cow to +dismiss it immediately. + +If +.B xcowsay +is started with +.B "--daemon" +it will fork away from the terminal and run in daemon mode. The +daemon provides a DBus service +.B uk.me.doof.Cowsay +that responds to +.B ShowCow +requests. The daemon can queue up any number of requests and displays +them in order. + +When +.B xcowsay +starts it checks to see if a daemon is running, and if it is, sends a +.B ShowCow +request and returns immediately. Otherwise +.B xcowsay +will block until the cow has disappeared. .SH OPTIONS Note that these options override any settings in the config file. .TP @@ -51,11 +79,16 @@ description for more information. .BI "--cow-size=" size Size of the cow image. Current choices are .BR small ", " med ", or " large . +The corresponding config file option is +.IR cow_size . .TP -.BI "--debug" +.B "--debug" Print messages about what .B xcowsay is doing. Useful for finding out why the daemon fails. +.TP +.B "-v, --version" +Print version information. .SH "SEE ALSO" .BR cowsay (6) .SH BUGS -- 2.39.2