Skip to content

Commit

Permalink
Release 0.6
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.nickg.me.uk/work/xcowsay@297 a97b1542-0b21-0410-a459-e47997c36f34
  • Loading branch information
nick committed Mar 14, 2008
1 parent e0883ba commit d38388f
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 6 deletions.
3 changes: 2 additions & 1 deletion Makefile.am
Original file line number Diff line number Diff line change
@@ -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
2 changes: 2 additions & 0 deletions src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -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
30 changes: 27 additions & 3 deletions src/xcowsay.c
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand All @@ -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'},
Expand Down Expand Up @@ -72,20 +77,36 @@ 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"
" -d, --daemon\t\tRun xcowsay in daemon mode.\n"
" --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;
Expand All @@ -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:
Expand All @@ -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;
Expand Down
37 changes: 35 additions & 2 deletions xcowsay.6
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit d38388f

Please sign in to comment.