9588b0d3db
This change imports the ports collection from the former porttix and srctix repositories and converts them to port(5) files with metadata pointing to the upstream release tarballs with patches checked into this repository. Ports are now developed and versioned along with the operating system and are automatically built per the PACKAGES environment variable. The patches are licensed under the same license as the relevant ports. Tix has gained support for the new port(5) format. tix-port(8) is the new high level ports build even point that handles downloading pstream releases into the new mirror cache directory, applying the patches, building the port with the lower-level tix-build(8), and finally installing the binary package. The new tix-vars(8) program parses port(5) files and the new tix-rmdiff(8) program produces input for tix-rmpatch(8). The old doc/ directory is discontinued in favor of manual pages documenting the new ports system. The obsolete porttix-create(8) and srctix-create(8) programs are removed.
101 lines
2.2 KiB
Diff
101 lines
2.2 KiB
Diff
diff -Paur --no-dereference -- cut.upstream/cut.c cut/cut.c
|
|
--- cut.upstream/cut.c
|
|
+++ cut/cut.c
|
|
@@ -34,7 +34,7 @@
|
|
*/
|
|
|
|
#include <ctype.h>
|
|
-#include <err.h>
|
|
+#include <error.h>
|
|
#include <errno.h>
|
|
#include <limits.h>
|
|
#include <locale.h>
|
|
@@ -43,6 +43,13 @@
|
|
#include <string.h>
|
|
#include <unistd.h>
|
|
|
|
+#define err(eval, ...) error(eval, errno, __VA_ARGS__)
|
|
+#define errx(eval, ...) error(eval, 0, __VA_ARGS__)
|
|
+#define warn(...) error(0, errno, __VA_ARGS__)
|
|
+#define warnx(...) error(0, 0, __VA_ARGS__)
|
|
+
|
|
+#define _POSIX2_LINE_MAX 2048
|
|
+
|
|
int cflag;
|
|
char dchar;
|
|
int dflag;
|
|
@@ -65,7 +72,7 @@
|
|
|
|
dchar = '\t'; /* default delimiter is \t */
|
|
|
|
- /* Since we don't support multi-byte characters, the -c and -b
|
|
+ /* Since we don't support multi-byte characters, the -c and -b
|
|
options are equivalent, and the -n option is meaningless. */
|
|
while ((ch = getopt(argc, argv, "b:c:d:f:sn")) != -1)
|
|
switch(ch) {
|
|
@@ -187,6 +194,7 @@
|
|
void
|
|
c_cut(FILE *fp, char *fname)
|
|
{
|
|
+ (void)fname;
|
|
int ch, col;
|
|
char *pos;
|
|
|
|
@@ -215,13 +223,17 @@
|
|
void
|
|
f_cut(FILE *fp, char *fname)
|
|
{
|
|
+ (void)fname;
|
|
int ch, field, isdelim;
|
|
char *pos, *p, sep;
|
|
int output;
|
|
size_t len;
|
|
- char *lbuf, *tbuf;
|
|
+ ssize_t slen;
|
|
+ size_t lbuf_raw_length = 0;
|
|
+ char *lbuf = NULL, *tbuf;
|
|
|
|
- for (sep = dchar, tbuf = NULL; (lbuf = fgetln(fp, &len));) {
|
|
+ for (sep = dchar, tbuf = NULL; 0 <= (slen = getline(&lbuf, &lbuf_raw_length, fp));) {
|
|
+ len = slen;
|
|
output = 0;
|
|
if (lbuf[len - 1] != '\n') {
|
|
/* no newline at the end of the last line so add one */
|
|
@@ -272,6 +284,7 @@
|
|
}
|
|
if (tbuf)
|
|
free(tbuf);
|
|
+ free(lbuf);
|
|
}
|
|
|
|
void
|
|
diff -Paur --no-dereference -- cut.upstream/Makefile cut/Makefile
|
|
--- cut.upstream/Makefile
|
|
+++ cut/Makefile
|
|
@@ -0,0 +1,25 @@
|
|
+include ../../../build-aux/compiler.mak
|
|
+include ../../../build-aux/version.mak
|
|
+include ../../../build-aux/dirs.mak
|
|
+
|
|
+OPTLEVEL?=-g -O2
|
|
+CFLAGS?=$(OPTLEVEL)
|
|
+
|
|
+CFLAGS:=$(CXXFLAGS) -Wall -Wextra
|
|
+CPPFLAGS:=$(CPPFLAGS)
|
|
+
|
|
+BINARY:=cut
|
|
+
|
|
+all: $(BINARY)
|
|
+
|
|
+.PHONY: all install clean
|
|
+
|
|
+%: %.c
|
|
+ $(CC) -std=gnu11 $(CFLAGS) $(CPPFLAGS) $< -o $@ $(LIBS)
|
|
+
|
|
+install: all
|
|
+ mkdir -p $(DESTDIR)$(BINDIR)
|
|
+ install $(BINARY) $(DESTDIR)$(BINDIR)
|
|
+
|
|
+clean:
|
|
+ rm -f $(BINARY)
|