diff options
author | Mattias Andrée <maandree@member.fsf.org> | 2015-12-07 21:59:34 +0100 |
---|---|---|
committer | Mattias Andrée <maandree@member.fsf.org> | 2015-12-07 21:59:34 +0100 |
commit | 2aa3a2cbe7667ade5903c18d6719cf54cfaceb9e (patch) | |
tree | a2eee84eb8248ff9705be547225c6d895bd6100f | |
parent | deps: alloca (diff) | |
download | scrotty-2aa3a2cbe7667ade5903c18d6719cf54cfaceb9e.tar.gz scrotty-2aa3a2cbe7667ade5903c18d6719cf54cfaceb9e.tar.bz2 scrotty-2aa3a2cbe7667ade5903c18d6719cf54cfaceb9e.tar.xz |
small fixes
Signed-off-by: Mattias Andrée <maandree@member.fsf.org>
-rw-r--r-- | DEPENDENCIES | 2 | ||||
-rw-r--r-- | Makefile | 4 | ||||
-rw-r--r-- | po/sv.po | 18 | ||||
-rw-r--r-- | src/scrotty.c | 14 |
4 files changed, 22 insertions, 16 deletions
diff --git a/DEPENDENCIES b/DEPENDENCIES index 04fce66..ba9a00b 100644 --- a/DEPENDENCIES +++ b/DEPENDENCIES @@ -10,7 +10,7 @@ BUILD DEPENDENCIES: make coreutils libc - gcc (any cc can be used if WARN in Makefile is edited) + gcc (any c99 can be used if WARN in Makefile is edited) gettext (opt-out, for internationalisation) texinfo (opt-out, for info, pdf, dvi, ps, and html manuals) texlive-plainextra (opt-in, for pdf, dvi, and ps manuals) @@ -85,7 +85,7 @@ WARN = -Wall -Wextra -pedantic -Wdouble-promotion -Wformat=2 -Winit-self -Wmissi -Wstrict-aliasing=1 -fstrict-overflow -Wfloat-equal -Wpadded -Waggregate-return \ -Wtraditional-conversion # The C standard for C code compilation -STD = -std=gnu99 +STD = -std=c99 # CPP flags DEFS = -D'DEVDIR="$(DEVDIR)"' -D'SYSDIR="$(SYSDIR)"' -D'PACKAGE="$(PKGNAME)"' \ -D'LOCALEDIR="$(LOCALEDIR)"' -D'PROGRAM_VERSION="$(VERSION)"' @@ -173,7 +173,7 @@ bin/mo/%/messages.mo: po/%.po obj/scrotty.pot: src/scrotty.c @$(MKDIR) -p obj - $(CPP) -DUSE_GETTEXT=1 < src/scrotty.c | \ + $(CPP) -DUSE_GETTEXT=1 src/scrotty.c | \ $(XGETTEXT) -o "$@" -Lc --from-code utf-8 --package-name scrotty \ --package-version 1.1 --no-wrap --force-po \ --copyright-holder 'Mattias Andrée (maandree@member.fsf.org)' - @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: scrotty 1.1\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2015-12-07 20:12+0100\n" +"POT-Creation-Date: 2015-12-07 21:59+0100\n" "PO-Revision-Date: 2015-12-07 18:50+0100\n" "Last-Translator: Mattias Andrée <maandree@member.fsf.org>\n" "Language-Team: none\n" @@ -17,12 +17,12 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" -#: <stdin>:598 +#: src/scrotty.c:604 #, c-format msgid "Saved framebuffer %i to %s,\n" msgstr "Bildrutebuffert %i sparad till %s.\n" -#: <stdin>:640 +#: src/scrotty.c:646 #, c-format msgid "" "SYNOPSIS\n" @@ -93,7 +93,7 @@ msgstr "" "\tslutet av strängen, och om ett sådant även förekom direkt framför.\n" "\n" -#: <stdin>:685 +#: src/scrotty.c:691 #, fuzzy, c-format msgid "" "%s\n" @@ -112,7 +112,7 @@ msgstr "" "\n" "Skriven av Mattias Andrée.\n" -#: <stdin>:705 +#: src/scrotty.c:711 #, c-format msgid "" "scrotty -- Screenshot program for Linux's TTY\n" @@ -147,20 +147,20 @@ msgstr "" "Du skall ha fått en kopia av GNU General Public License tillsammans\n" "med det här programmet. Om inte, se <http://www.gnu.org/licenses/>.\n" -#: <stdin>:767 <stdin>:774 +#: src/scrotty.c:773 src/scrotty.c:780 #, c-format msgid "%s: %s. Type '%s --help' for help.\n" msgstr "%s: %s. Kör '%s --help' för hjälp.\n" -#: <stdin>:767 +#: src/scrotty.c:773 msgid "Unrecognised option." msgstr "Val känns inte igen." -#: <stdin>:774 +#: src/scrotty.c:780 msgid "--exec has no argument." msgstr "--exec har inget argument." -#: <stdin>:811 +#: src/scrotty.c:817 #, c-format msgid "%s: %s: %s\n" msgstr "%s: %s: %s\n" diff --git a/src/scrotty.c b/src/scrotty.c index 1005cff..7b621f4 100644 --- a/src/scrotty.c +++ b/src/scrotty.c @@ -23,6 +23,7 @@ #endif +#define _POSIX_SOURCE #include <stdio.h> #include <unistd.h> #include <errno.h> @@ -416,9 +417,9 @@ static int evaluate (char *restrict buf, size_t n, const char *restrict pattern, ssize_t j = 0; int percent = 0, backslash = 0, dollar = 0, r; char c; - char* fmt; + char *fmt; time_t t; - struct tm tm; + struct tm *tm; /* Expand '$' and '\'. */ while ((c = *pattern++)) @@ -468,12 +469,14 @@ static int evaluate (char *restrict buf, size_t n, const char *restrict pattern, /* Expand '%'. */ t = time (NULL); - localtime_r (&t, &tm); + tm = localtime (&t); + if (tm == NULL) + goto fail; #ifdef __GNUC__ # pragma GCC diagnostic push # pragma GCC diagnostic ignored "-Wformat-nonliteral" #endif - if (strftime (buf, n, fmt, &tm) == 0) + if (strftime (buf, n, fmt, tm) == 0) goto enametoolong; /* No errors are defined for `strftime`. */ #ifdef __GNUC__ # pragma GCC diagnostic pop @@ -484,6 +487,9 @@ static int evaluate (char *restrict buf, size_t n, const char *restrict pattern, enametoolong: return errno = ENAMETOOLONG, -1; + fail: + return -1; + #undef P } |