summaryrefslogtreecommitdiff
blob: 09a1ac60f71770ebefa1d0d276de1b2a0359eb7d (plain)
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
diff -Nur util-linux-2.12r.orig/text-utils/Makefile util-linux-2.12r/text-utils/Makefile
--- util-linux-2.12r.orig/text-utils/Makefile	2007-06-14 13:37:07 -0600
+++ util-linux-2.12r/text-utils/Makefile	2007-06-14 15:11:01 -0600
@@ -30,13 +30,19 @@
 CFLAGS:=$(CFLAGS) -DPGNOBELL
 endif
 
+# On FreeBSD, we need to include libcompat (more uses re_comp & re_exec)
+OS=$(shell uname)
+ifeq "$(OS)" "FreeBSD"
+  LIBCOMPAT=-lcompat
+endif
+
 all: $(BIN) $(USRBIN)
 
 # more and pg and ul use curses - maybe we can't compile them
 ifeq "$(HAVE_NCURSES)" "yes"
 # Have ncurses - make more and pg and ul
 more pg ul:
-	$(CC) $(CFLAGS) $(LDFLAGS) $^ -o $@ $(LIBCURSES)
+	$(CC) $(CFLAGS) $(LDFLAGS) $^ -o $@ $(LIBCURSES) $(LIBCOMPAT)
 more: more.o $(LIB)/xstrncpy.o
 pg: pg.o
 ul: ul.o
diff -Nur util-linux-2.12r.orig/text-utils/more.c util-linux-2.12r/text-utils/more.c
--- util-linux-2.12r.orig/text-utils/more.c	2007-06-14 13:37:07 -0600
+++ util-linux-2.12r/text-utils/more.c	2007-06-14 13:28:34 -0600
@@ -63,6 +63,16 @@
 #include <regex.h>
 #undef _REGEX_RE_COMP
 
+/* Include limits.h on FreeBSD */
+#ifdef __FreeBSD__
+#include <limits.h>
+#endif
+
+/* Define CBAUD for FreeBSD */
+#ifndef CBAUD
+#define CBAUD  0010017
+#endif
+
 #define VI		"vi"	/* found on the user's path */
 
 #define Fopen(s,m)	(Currline = 0,file_pos=0,fopen(s,m))
@@ -1560,7 +1570,7 @@
     }
     if (feof (file)) {
 	if (!no_intty) {
-#ifndef __linux__
+#if !defined(__linux__) && !defined(__FreeBSD__)
 				/* No longer in libc 4.5.8. . . */
 	    file->_flags &= ~STDIO_S_EOF_SEEN; /* why doesn't fseek do this ??!!??! */
 #endif
@@ -1805,7 +1815,11 @@
     tcgetattr(fileno(stderr), &otty);
     savetty0 = otty;
     slow_tty = (otty.c_cflag & CBAUD) < B1200;
+#ifdef __FreeBSD__
+    hardtabs = 1;
+#else
     hardtabs = (otty.c_oflag & TABDLY) != XTABS;
+#endif
     if (!no_tty) {
 	otty.c_lflag &= ~(ICANON|ECHO);
 	otty.c_cc[VMIN] = 1;