Commit Graph

130 Commits

Author SHA1 Message Date
0a30ccce70
Nord theme 2021-01-28 11:23:51 +01:00
3b0e9ae607
Add progress bar 2020-09-13 17:08:07 +02:00
d964adba95
Moved config.def.h to config.h 2020-09-13 17:07:27 +02:00
1aa0cdb3d8
better handling of VERSION 2020-09-13 16:57:05 +02:00
Chris Down
2649e8d533 Avoid out-of-bounds access when a slide input line begins with \0
If we read in a line with \0 at the beginning, blen will be 0. However,
we then try to index our copy of the buffer with
s->lines[s->linecount][blen-1], we'll read (and potentially write if the
data happens to be 0x0A) outside of strdup's allocated memory, and may
crash.

Fix this by just rejecting lines with a leading \0. Lines with nulls
embedded in other places don't invoke similar behaviour, since the
length is still >0.
2020-05-14 11:43:34 +02:00
Markus Teich
72d33d463f update license 2017-09-07 23:40:26 +02:00
Laslo Hunhold
a5f760fa0e Correctly handle files that contain no slides
Otherwise, on reloading sent would segfault. Move the check-logic to
load() rather than doing it in main() to prevent other misuses of it in
the future.
2017-09-07 23:37:00 +02:00
Markus Teich
53541ee1bd update license 2017-09-04 00:23:09 +02:00
Markus Teich
4736a6118d
release v1 2017-09-03 23:57:26 +02:00
Markus Teich
16e4843d05 allow to reload file 2017-09-02 19:30:11 +02:00
Markus Teich
ec431df440 fix some spelling in man page 2017-09-02 19:20:00 +02:00
Markus Teich
f925f567d7 update manpage 2017-09-02 02:17:39 +02:00
Markus Teich
278b8da820 migrate to new arg.h 2017-09-02 01:24:47 +02:00
Markus Teich
6df3d039a0 load all images before starting the preso 2017-09-02 01:09:36 +02:00
Markus Teich
0ff43aaf34 replace malloc() with ecalloc() 2016-11-04 19:50:09 +01:00
Markus Teich
ca7978c59b die() on calloc failure 2016-11-04 19:45:08 +01:00
Hiltjo Posthuma
8185d5eacb check memory allocation for calloc, die on failure 2016-10-10 20:51:15 +02:00
ssd
cd307e3ba0 README: add Xft to dependencies 2016-10-10 20:51:15 +02:00
Markus Teich
dca314e7a9 always redraw images
Previously when covering the sent window with an image slide selected and
exposing it again, the image was lost. This change always redraws the image and
also removes the now redundant bit flag in the state enum.
2016-09-26 12:26:11 +02:00
Hiltjo Posthuma
efea6575ca improve some more error messages
- remove \n in die() messages in drw.c
- add a few more ':' suffix for functions that set errno.
- minor typo.
2016-08-12 14:58:15 +02:00
FRIGN
b737e3e6af Add a manpage 2016-08-12 13:20:49 +02:00
FRIGN
c3a0671f68 Use Plan 9 style for ARGEND 2016-08-12 10:02:19 +02:00
FRIGN
b2daba3390 Fix error-messages 2016-08-12 10:01:06 +02:00
FRIGN
072a318adb Fix memory leak and print a warning on invalid regex
This will minimize the already low memory usage of sent.
2016-08-11 23:42:09 +02:00
FRIGN
e8914d5d4b _exit() instead of exit() after failed exec
die() calls exit(), but actually at this point the program could be in a
state not allowing this. It's better to call _exit to stop the libc from
calling any handlers that might fail at this moment anyway.
2016-08-11 23:42:09 +02:00
FRIGN
cd10166b5e Simplify LICENSE wording
Now, before you call your lawyers, here is some explanation:
The MIT/X Consortium-License and ISC-License are equivalent
according to the Berne-convention. This means that a court
of law presented with either licenses will act the same.

The advantage of the ISC license is that it has a simpler wording
and is recommended by the OpenBSD-project for new projects[0].
And as we at suckless.org love removing cruft, this also includes
removing legal cruft wording that is not needed any more.

[0]: http://www.openbsd.org/policy.html
2016-07-18 16:09:23 +02:00
FRIGN
e75676d9a4 Simplify usage() 2016-07-14 22:23:46 +02:00
Markus Teich
93329c72b5 Update example presentation
- Add a small transparent farbfeld test image
2016-07-14 12:44:05 +02:00
FRIGN
3af7e93324 add ff and ff.bz2 support in config.def.h 2016-07-14 12:23:53 +02:00
Markus Teich
e1a0b51d84 Also call ffload on the current slide in advance()
This fixes a bug where the image would not be loaded if the user setup a
keybinding which advances multiple slides at once. Then the preloading for the
previous/next slide in advance() would not catch that case and instead of an
image the text version (`@filename`) would be rendered on the slide.
2016-06-30 16:57:31 +02:00
Markus Teich
827f3de2e7 clean ffread and rename to ffload
- also remove unneeded memmove in load()
2016-06-30 16:42:34 +02:00
Hiltjo Posthuma
fd303ee9c1 load slide image on-demand
On Sat, Jun 04, 2016 at 05:28:31PM +0200, Markus Teich wrote:
> Hiltjo Posthuma wrote:
> > previously an image file would be opened but only ffread when advancing to
> > the slide, but when the slide was not used it gave an error:
> >
> > 	/usr/local/bin/2ff: failed to convert image/png
>
> Heyho Hiltjo,
>
> thanks for the patch. Unfortunately it does not work if the first slide contains
> an image (ffopen is only called in advance). I think it would be good to merge
> ffopen and ffread instead into a single function ffload. This makes the `LOADED`
> state clearer and also enforces that the fd is closed in the same function where
> it is opened. This ffload function should then be called in advance() replacing
> the ffread() calls if the image is not loaded yet and once in load() for the
> first slide if it is an image.
>

Ah yes, sorry for the oversight.

> If you want to take this new approach, go for it, otherwise I'll look into it
> myself.
>

I have attached a patch that does this, I hope you'll like it.

Also I'm not sure if we need the below code in advance(), I have removed it in
the patch:

        if (slidecount > idx + 1 && slides[idx + 1].img)
                ffread(slides[idx + 1].img);
        if (0 < idx && slides[idx - 1].img)
                ffread(slides[idx - 1].img);

That seems to preload the next and previous slide image right? A minor issue I
notice also is that images seem to flicker, it uses XPutImage directly to
xw.win. Maybe it can be replaced with a backbuffer then XCopyArea? What do you
think?

In advance() it should also not always be needed to rescale the image.

--
Kind regards,
Hiltjo

From 97bebdcab4003f9acdfdd4bdf424449299ffd61d Mon Sep 17 00:00:00 2001
From: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Sat, 4 Jun 2016 21:34:25 +0200
Subject: [PATCH] merge ffread and ffopen into one function
2016-06-06 17:26:50 +02:00
Hiltjo Posthuma
44a50ad948 load slide image on-demand
previously an image file would be opened but only ffread when advancing to
the slide, but when the slide was not used it gave an error:

	/usr/local/bin/2ff: failed to convert image/png

this changes it to load the image on-demand once and "cache" it.
2016-06-04 17:26:50 +02:00
Markus Teich
27a904c1dd import new drw and util from libsl. 2016-05-24 19:28:44 +02:00
Markus Teich
268d1968ea fix include and lib paths for the BSDs 2016-03-15 23:51:30 +01:00
Markus Teich
ceda5d69ac support FreeBSD
On FreeBSD the lib and include directories are in /usr/local rather than /usr.
2016-03-15 20:21:54 +01:00
Markus Teich
c61e9a4b8a Import arg.h OOB fix from Lucas Gabriel Vuotto.
This is a small fix for arg.h where it's possible to perform an out-of-boundary
memory access in argv's internal string.
2016-03-06 20:56:29 +01:00
Markus Teich
b954ed4b9f Fix cmdline argument check
There was a segfault when sent was called without arguments. Now we use stdin
when there's no argument or - is used. Thanks to izabera for the report.
2016-03-06 20:49:18 +01:00
Markus Teich
616aafdcb9 no need to reimplement cat here 2016-02-06 14:12:47 +01:00
Markus Teich
3019229279 improve error handling
- errors are now fatal
- no need to clean up when dying
- no need for status return codes => ffread and ffprepare now return void
2016-02-06 14:08:43 +01:00
Markus Teich
77809fae79 style: move function return types to own line 2016-02-05 16:17:43 +01:00
FRIGN
a95e592992 Use 2ff exclusively in config.def.h 2016-02-05 15:39:24 +01:00
FRIGN
68ac6486b1 Fix alpha blending
- "/ 257", because 255 * 257 = UINT16_MAX
- "/ 255", because that's the maximum possible RGB value
2016-02-05 15:35:59 +01:00
Markus Teich
b0ad67036e readme: update reference to farbfeld 2016-02-05 15:25:29 +01:00
David Phillips
022ae48360 Change an eprintf to a die to stop child from running its own slideshow
The child thread was created because execlp will not return if successful.
The eprintf was placed after the call to execlp to catch any error, but the
child continued to return a (closed) fds[0], resulting in a second slideshow
being run by the child.

This commit fixes the issue by killing the child.
2015-12-24 01:57:50 +01:00
Grant Mathews
54daf38b08 filter via shell pipeline
Instead of requiring an executable, allow building arbitrary shell
pipelines to filter filetypes through.
2015-12-24 01:51:29 +01:00
Markus Teich
11f2c648eb unbreak the build 2015-12-09 00:52:39 +01:00
Markus Teich
008ff1b88b fix 2 uninitialized variables and bin == NULL check 2015-12-09 00:50:05 +01:00
Markus Teich
edb4630564 check for bin == NULL 2015-12-08 22:34:48 +01:00
Markus Teich
24762d0172 minor syntax, style and README fixes 2015-12-08 22:09:26 +01:00