aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile37
-rw-r--r--Makefile.am4
-rw-r--r--configure.ac11
-rw-r--r--rpt.1.in (renamed from rpt.1)4
-rw-r--r--rpt.c6
5 files changed, 19 insertions, 43 deletions
diff --git a/Makefile b/Makefile
deleted file mode 100644
index 1f59519..0000000
--- a/Makefile
+++ /dev/null
@@ -1,37 +0,0 @@
-PREFIX = /usr/local
-
-CFLAGS = -std=c99 -Wall -Wextra -pedantic -O0 -ggdb
-
-BIN = rpt
-SRC = rpt.c
-OBJ = rpt.o
-
-MAN_SRC = rpt.1
-MAN_PAGE = rpt.1.gz
-
-.PHONY: all compile man clean install uninstall
-
-all: compile man
-
-compile: $(BIN)
-
-$(BIN): $(OBJ)
- cc $^ -o $@
-
-%.o: %.c
- cc $(CFLAGS) -c $< -o $@
-
-man: $(MAN_PAGE)
-
-%.1.gz: %.1
- gzip -9 -c $< > $@
-
-clean:
- rm -f $(BIN) $(OBJ) $(MAN_PAGE)
-
-install: compile man
- cp -f $(BIN) $(PREFIX)/bin
- cp -f $(MAN_PAGE) $(PREFIX)/share/man/man1
-
-uninstall:
- rm -f $(PREFIX)/bin/$(BIN) $(PREFIX)/share/man/man1/$(MAN_PAGE)
diff --git a/Makefile.am b/Makefile.am
new file mode 100644
index 0000000..1eb2838
--- /dev/null
+++ b/Makefile.am
@@ -0,0 +1,4 @@
+bin_PROGRAMS = rpt
+rpt_SOURCES = rpt.c
+AM_CFLAGS = -std=c99 -Wall -Wextra -D_GNU_SOURCE
+dist_man1_MANS = rpt.1
diff --git a/configure.ac b/configure.ac
new file mode 100644
index 0000000..5461c4a
--- /dev/null
+++ b/configure.ac
@@ -0,0 +1,11 @@
+AC_INIT([repeat], [1.2.0])
+AM_INIT_AUTOMAKE([-Wall -Werror, foreign])
+: ${CFLAGS=""}
+AC_PROG_CC
+AM_SILENT_RULES([yes])
+AC_CONFIG_HEADERS([config.h])
+AC_CONFIG_FILES([
+ Makefile
+ rpt.1
+])
+AC_OUTPUT
diff --git a/rpt.1 b/rpt.1.in
index e7d4339..b7c70ea 100644
--- a/rpt.1
+++ b/rpt.1.in
@@ -1,9 +1,9 @@
.\" Written by Tristan Riehs.
.\" This file is part of repeat and is licensed under the MIT License.
-.TH rpt 1 2023-09-27
+.TH repeat @VERSION@ 2023-09-27
.SH NAME
-rpt \- repeat a shell command
+repeat \- repeat a shell command
.SH SYNOPSIS
.B rpt
diff --git a/rpt.c b/rpt.c
index d6476ad..46a3de9 100644
--- a/rpt.c
+++ b/rpt.c
@@ -1,4 +1,4 @@
-#define _GNU_SOURCE /* getopt_long */
+#include "config.h"
#include <errno.h>
#include <fcntl.h>
@@ -10,10 +10,8 @@
#include <sys/wait.h>
#include <unistd.h>
-#define VERSION "1.1.3"
-
/* Size of the buffer used to clone stdin. */
-#define BUFSIZE 8000
+#define BUFSIZE (1 << 12)
/* Exit status */
#define EXIT_SUCCESS 0