[PATCH evemu 1/3] tools: play: externalize usage() call

Benjamin Tissoires benjamin.tissoires at gmail.com
Thu Jan 9 11:34:07 PST 2014


Signed-off-by: Benjamin Tissoires <benjamin.tissoires at gmail.com>
---
 tools/evemu-play.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/tools/evemu-play.c b/tools/evemu-play.c
index 4e7bb75..8d14618 100644
--- a/tools/evemu-play.c
+++ b/tools/evemu-play.c
@@ -38,6 +38,7 @@
  * DEALINGS IN THE SOFTWARE.
  *
  ****************************************************************************/
+#define _GNU_SOURCE
 
 #include "evemu.h"
 #include <stdio.h>
@@ -45,13 +46,18 @@
 #include <string.h>
 #include <unistd.h>
 
+static void usage(void)
+{
+	fprintf(stderr, "Usage: %s <device>\n", program_invocation_short_name);
+	fprintf(stderr, "\n");
+	fprintf(stderr, "Event data is read from standard input.\n");
+}
+
 int main(int argc, char *argv[])
 {
 	int fd;
 	if (argc != 2) {
-		fprintf(stderr, "Usage: %s <device>\n", argv[0]);
-		fprintf(stderr, "\n");
-		fprintf(stderr, "Event data is read from standard input.\n");
+		usage();
 		return -1;
 	}
 	fd = open(argv[1], O_WRONLY);
-- 
1.8.3.1



More information about the Input-tools mailing list