Pārlūkot izejas kodu

* Wrote manual pages for img2irc, cacaplay and cacaserver.

tags/v0.99.beta14
Sam Hocevar sam pirms 18 gadiem
vecāks
revīzija
21856cf414
6 mainītis faili ar 105 papildinājumiem un 3 dzēšanām
  1. +1
    -1
      doc/Makefile.am
  2. +26
    -0
      doc/cacaplay.1
  3. +30
    -0
      doc/cacaserver.1
  4. +2
    -0
      doc/cacaview.1
  5. +27
    -0
      doc/img2irc.1
  6. +19
    -2
      src/img2irc.c

+ 1
- 1
doc/Makefile.am Parādīt failu

@@ -3,7 +3,7 @@
EXTRA_DIST = doxygen.cfg.in footer.html header.html $(man_MANS) $(doxygen_DOX)

doxygen_DOX = libcaca.dox user.dox migrating.dox tutorial.dox style.dox
man_MANS = caca-config.1 cacafire.1 cacaview.1
man_MANS = caca-config.1 cacafire.1 cacaview.1 cacaserver.1 img2irc.1 cacaplay.1

if BUILD_DOCUMENTATION
htmldoc_DATA = html/doxygen.css


+ 26
- 0
doc/cacaplay.1 Parādīt failu

@@ -0,0 +1,26 @@
.TH cacaplay 1 "2006-11-10" "libcaca"
.SH NAME
cacaplay \- play libcaca files
.SH SYNOPSIS
.B cacaplay [FILE]
.RI
.SH DESCRIPTION
.B cacaplay
plays libcaca animation files. These files can be created by any libcaca
program by setting the
.B CACA_DRIVER
environment variable to
.B "raw"
and storing the program's standard output.
.SH EXAMPLE
cacaplay file.caca
.SH BUGS
As of now,
.B cacaplay
can only play single-image canvases, rendering it pretty useless. See
.B cacaserver
for a more usable alternative.
.SH SEE ALSO
cacaserver(1)
.SH AUTHOR
This manual page was written by Sam Hocevar <sam@zoy.org>.

+ 30
- 0
doc/cacaserver.1 Parādīt failu

@@ -0,0 +1,30 @@
.TH cacaserver 1 "2006-11-10" "libcaca"
.SH NAME
cacaserver \- telnet server for libcaca
.SH SYNOPSIS
.B cacaserver
.RI
.SH DESCRIPTION
.B cacaserver
reads libcaca animation files in its standard input and serves them as ANSI
art on network port 51914. These animations can be created by any libcaca
program by setting the
.B CACA_DRIVER
environment variable to
.B "raw"
and piping the program's standard output to
.B cacaserver.

Clients can then connect to port 51914 using
.B telnet
or
.B netcat
to see the output.
.SH EXAMPLE
CACA_DRIVER=raw cacademo | cacaserver

telnet localhost 51914
.SH SEE ALSO
cacaplay(1)
.SH AUTHOR
This manual page was written by Sam Hocevar <sam@zoy.org>.

+ 2
- 0
doc/cacaview.1 Parādīt failu

@@ -50,5 +50,7 @@ There is no support for aspect ratio yet. Also, since there is no way
yet to load an image from
.B cacaview
it is completely useless when run without an argument.
.SH SEE ALSO
img2irc(1)
.SH AUTHOR
This manual page was written by Sam Hocevar <sam@zoy.org>.

+ 27
- 0
doc/img2irc.1 Parādīt failu

@@ -0,0 +1,27 @@
.TH img2irc 1 "2006-11-10" "libcaca"
.SH NAME
img2irc \- convert images to IRC coloured files
.SH SYNOPSIS
.B img2irc IMAGE [COLUMNS]
.RI
.SH DESCRIPTION
.B img2irc
convert images to colour ASCII characters and outputs them to text using
mIRC colour codes.
.PP
.B img2irc
can load the most widespread image formats: PNG, JPEG, GIF, PNG, BMP etc.
By default the output text is 60 columns wide; this value can be changed
by appending a second argument to the commandline.
.SH EXAMPLES
img2irc hello.jpg > hello.txt

img2irc hello.jpg 40 > tinyhello.txt
.SH BUGS
This program could be merged into
.B cacaview
or expanded to support multiple output formats.
.SH SEE ALSO
cacaview(1)
.SH AUTHOR
This manual page was written by Sam Hocevar <sam@zoy.org>.

+ 19
- 2
src/img2irc.c Parādīt failu

@@ -23,6 +23,13 @@
#include "cucul.h"
#include "common-image.h"

static void usage(int argc, char **argv)
{
fprintf(stderr, "Usage: %s <image>\n", argv[0]);
fprintf(stderr, " %s <image> <columns>\n", argv[0]);
fprintf(stderr, " %s [-h|--help]\n", argv[0]);
}

int main(int argc, char **argv)
{
/* libcucul context */
@@ -30,14 +37,22 @@ int main(int argc, char **argv)
void *export;
unsigned long int len;
struct image *i;
int cols = 56, lines;
int cols, lines;

if(argc != 2)
if(argc < 2 || argc > 3)
{
fprintf(stderr, "%s: wrong argument count\n", argv[0]);
usage(argc, argv);
return 1;
}

if(!strcmp(argv[1], "-h") || !strcmp(argv[1], "--help"))
{
fprintf(stderr, "%s: convert images to IRC file data\n", argv[0]);
usage(argc, argv);
return 0;
}

cv = cucul_create_canvas(0, 0);
if(!cv)
{
@@ -54,6 +69,8 @@ int main(int argc, char **argv)
}

/* Assume a 6×10 font */
cols = argc == 3 ? atoi(argv[2]) : 0;
cols = cols ? cols : 60;
lines = cols * i->h * 6 / i->w / 10;

cucul_set_canvas_size(cv, cols, lines);


Notiek ielāde…
Atcelt
Saglabāt