e6efa5c7a2
scrot is a commandline screen capture util like "import", but using imlib2. It has lots of options for autogenerating filenames, and can do fun stuff like taking screenshots of multiple displays and glueing them together. from Victor Sahlstedt <cvss@home.se>; ok naddy@
76 lines
2.4 KiB
Plaintext
76 lines
2.4 KiB
Plaintext
$OpenBSD: patch-src_main_c,v 1.1.1.1 2004/07/01 21:53:16 robert Exp $
|
|
--- src/main.c.orig Thu Jul 1 23:19:39 2004
|
|
+++ src/main.c Thu Jul 1 23:21:16 2004
|
|
@@ -426,28 +426,28 @@
|
|
switch (*c) {
|
|
case 'f':
|
|
if (filename_im)
|
|
- strcat(ret, filename_im);
|
|
+ strlcat(ret, filename_im, sizeof(ret));
|
|
break;
|
|
case 'm': /* t was allready taken, so m as in mini */
|
|
if (filename_thumb)
|
|
- strcat(ret, filename_thumb);
|
|
+ strlcat(ret, filename_thumb, sizeof(ret));
|
|
break;
|
|
case 'n':
|
|
if (filename_im) {
|
|
tmp = strrchr(filename_im, '/');
|
|
if (tmp)
|
|
- strcat(ret, tmp + 1);
|
|
+ strlcat(ret, tmp + 1, sizeof(ret));
|
|
else
|
|
- strcat(ret, filename_im);
|
|
+ strlcat(ret, filename_im, sizeof(ret));
|
|
}
|
|
break;
|
|
case 'w':
|
|
snprintf(buf, sizeof(buf), "%d", gib_imlib_image_get_width(im));
|
|
- strcat(ret, buf);
|
|
+ strlcat(ret, buf, sizeof(ret));
|
|
break;
|
|
case 'h':
|
|
snprintf(buf, sizeof(buf), "%d", gib_imlib_image_get_height(im));
|
|
- strcat(ret, buf);
|
|
+ strlcat(ret, buf, sizeof(ret));
|
|
break;
|
|
case 's':
|
|
if (filename_im) {
|
|
@@ -456,22 +456,22 @@
|
|
|
|
size = st.st_size;
|
|
snprintf(buf, sizeof(buf), "%d", size);
|
|
- strcat(ret, buf);
|
|
+ strlcat(ret, buf, sizeof(ret));
|
|
} else
|
|
- strcat(ret, "[err]");
|
|
+ strlcat(ret, "[err]", sizeof(ret));
|
|
}
|
|
break;
|
|
case 'p':
|
|
snprintf(buf, sizeof(buf), "%d",
|
|
gib_imlib_image_get_width(im) *
|
|
gib_imlib_image_get_height(im));
|
|
- strcat(ret, buf);
|
|
+ strlcat(ret, buf, sizeof(ret));
|
|
break;
|
|
case 't':
|
|
- strcat(ret, gib_imlib_image_format(im));
|
|
+ strlcat(ret, gib_imlib_image_format(im), sizeof(ret));
|
|
break;
|
|
case '$':
|
|
- strcat(ret, "$");
|
|
+ strlcat(ret, "$", sizeof(ret));
|
|
break;
|
|
default:
|
|
strncat(ret, c, 1);
|
|
@@ -482,7 +482,7 @@
|
|
switch (*c) {
|
|
case 'n':
|
|
if (filename_im)
|
|
- strcat(ret, "\n");
|
|
+ strlcat(ret, "\n", sizeof(ret));
|
|
break;
|
|
default:
|
|
strncat(ret, c, 1);
|