aboutsummaryrefslogtreecommitdiffstats
path: root/src/info.c
blob: 6643570fbcff95ff3a7871a2484f05c722da7849 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
/**
 * scrotty — Screenshot program for Linux's TTY
 * 
 * Copyright © 2014, 2015  Mattias Andrée (m@maandree.se)
 * 
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
#include "common.h"
#include "info.h"



/**
 * Print usage information.
 * 
 * @return  Zero on success, -1 on error.
 */
int
print_help (void)
{
  return printf (_("SYNOPSIS\n"
		   "\t%s [OPTIONS...] [--] [FILENAME-PATTERN | > FILE]\n"
		   "\n"
		   "OPTIONS\n"
		   "\t-h, --help         Print usage information.\n"
		   "\t-v, --version      Print program name and version.\n"
		   "\t-c, --copyright    Print copyright information.\n"
		   "\t-d, --device NO    Select framebuffer device.\n"
		   "\t-e, --exec CMD     Command to run for each saved image.\n"
		   "\n"
		   "\tEach option can only be used once."
		   "\n"
		   "SPECIAL STRINGS\n"
		   "\tBoth the --exec and filename-pattern parameters can take format specifiers\n"
		   "\tthat are expanded by scrotty when encountered. There are two types of format\n"
		   "\tspecifier. Characters preceded by a '%%' are interpreted by strftime(3).\n"
		   "\tSee `man strftime` for examples. These options may be used to refer to the\n"
		   "\tcurrent date and time. The second kind are internal to scrotty and are prefixed\n"
		   "\tby '$' or '\\'. The following specifiers are recognised:\n"
		   "\n"
		   "\t$i  framebuffer index\n"
		   "\t$f  image filename/pathname (ignored when used in filename-pattern)\n"
		   "\t$n  image filename          (ignored when used in filename-pattern)\n"
		   "\t$p  image width multiplied by image height\n"
		   "\t$w  image width\n"
		   "\t$h  image height\n"
		   "\t$$  expands to a literal '$'\n"
		   "\t\\n  expands to a new line\n"
		   "\t\\\\  expands to a literal '\\'\n"
		   "\t\\   expands to a literal ' ' (the string is a backslash followed by a space)\n"
		   "\n"
		   "\tA space that is not prefixed by a backslash in --exec is interpreted as an\n"
		   "\targument delimiter. This is the case even at the beginning and end of the\n"
		   "\tstring and if a space was the previous character in the string.\n"
		   "\n"),
		 execname) < 0 ? -1 : 0;
}


/**
 * Print program name and version.
 * 
 * @return  Zero on success, -1 on error.
 */
int
print_version (void)
{
  return printf (_("%s\n"
		   "Copyright (C) %s.\n"
		   "License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.\n"
		   "This is free software: you are free to change and redistribute it.\n"
		   "There is NO WARRANTY, to the extent permitted by law.\n"
		   "\n"
		   "Written by Mattias Andrée.\n"),
		 PROGRAM_NAME " " PROGRAM_VERSION,
		 "2014, 2015 Mattias Andrée") < 0 ? -1 : 0;
}


/**
 * Print copyright information.
 * 
 * @return  Zero on success, -1 on error.
 */
int
print_copyright (void)
{
  return printf (_("scrotty -- Screenshot program for Linux's TTY\n"
		   "Copyright (C) %s\n"
		   "\n"
		   "This program is free software: you can redistribute it and/or modify\n"
		   "it under the terms of the GNU General Public License as published by\n"
		   "the Free Software Foundation, either version 3 of the License, or\n"
		   "(at your option) any later version.\n"
		   "\n"
		   "This program is distributed in the hope that it will be useful,\n"
		   "but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
		   "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n"
		   "GNU General Public License for more details.\n"
		   "\n"
		   "You should have received a copy of the GNU General Public License\n"
		   "along with this program.  If not, see <http://www.gnu.org/licenses/>.\n"),
		 "2014, 2015  Mattias Andrée (m@maandree.se)"
		 ) < 0 ? -1 : 0;
}