plan9port: update to 20180726.

This commit is contained in:
Leah Neukirchen 2018-07-30 14:46:04 +02:00
parent d0a2167c05
commit 8017aaa092
2 changed files with 5 additions and 293 deletions

View File

@ -1,290 +0,0 @@
--- man/man1/xd.1 2013-03-12 10:00:08.000000000 +0100
+++ man/man1/xd.1 2015-04-10 14:06:30.110162757 +0200
@@ -66,6 +66,13 @@
.SM ASCII
representations or C escape sequences where possible.
.TP
+.B -R
+Format as
+.B 1x
+but print
+.B Rune
+representations or C escape sequences where possible.
+.TP
.BI -a style
Print file addresses in the given style (and size 4).
.TP
--- src/cmd/xd.c 2013-09-27 11:00:14.000000000 +0200
+++ src/cmd/xd.c 2015-02-11 14:03:14.000000000 +0100
@@ -5,6 +5,7 @@
unsigned char odata[16];
-unsigned char data[16];
+unsigned char data[32];
int ndata;
+int nread;
unsigned long addr;
int repeats;
int swizzle;
@@ -12,16 +13,20 @@
int flush;
int abase=2;
int xd(char *, int);
-void xprint(char *, ulong);
+void xprint(char *, ...);
void initarg(void), swizz(void), swizz8(void);
enum{
- Narg=10
+ Narg=10,
+
+ TNone=0,
+ TAscii,
+ TRune,
};
typedef struct Arg Arg;
typedef void fmtfn(char *);
struct Arg
{
- int ascii; /* 0==none, 1==ascii */
+ int chartype; /* TNone, TAscii, TRunes */
int loglen; /* 0==1, 1==2, 2==4, 3==8 */
int base; /* 0==8, 1==10, 2==16 */
fmtfn *fn; /* function to call with data */
@@ -30,7 +35,7 @@
}arg[Narg];
int narg;
-fmtfn fmt0, fmt1, fmt2, fmt3, fmtc;
+fmtfn fmt0, fmt1, fmt2, fmt3, fmtc, fmtr;
fmtfn *fmt[4] = {
fmt0,
fmt1,
@@ -46,11 +51,15 @@
};
char *cfmt[3][3] = {
- " %c", " %c", " %c",
+ " %c", " %c", " %c",
" %.3s", " %.3s", " %.2s",
" %.3uo", " %.3ud", " %.2ux",
};
+char *rfmt[1][1] = {
+ " %2.2C",
+};
+
char *afmt[2][3] = {
"%.7luo ", "%.7lud ", "%.7lux ",
"%7luo ", "%7lud ", "%7lux ",
@@ -120,7 +129,13 @@
while(argv[0][0]){
switch(argv[0][0]){
case 'c':
- ap->ascii = 1;
+ ap->chartype = TAscii;
+ ap->loglen = 0;
+ if(argv[0][1] || argv[0][-1]!='-')
+ goto Usage;
+ break;
+ case 'R':
+ ap->chartype = TRune;
ap->loglen = 0;
if(argv[0][1] || argv[0][-1]!='-')
goto Usage;
@@ -157,7 +172,9 @@
}
argv[0]++;
}
- if(ap->ascii)
+ if(ap->chartype == TRune)
+ ap->fn = fmtr;
+ else if(ap->chartype == TAscii)
ap->fn = fmtc;
else
ap->fn = fmt[ap->loglen];
@@ -185,7 +202,7 @@
fprint(2, "xd: too many formats (max %d)\n", Narg);
exits("usage");
}
- ap->ascii = 0;
+ ap->chartype = TNone;
ap->loglen = 2;
ap->base = 2;
ap->fn = fmt2;
@@ -197,7 +214,7 @@
xd(char *name, int title)
{
int fd;
- int i, star;
+ int i, star, nsee, nleft;
Arg *ap;
Biobuf *bp;
@@ -216,21 +233,29 @@
xprint("%s\n", (long)name);
addr = 0;
star = 0;
- while((ndata=Bread(bp, data, 16)) >= 0){
- if(ndata < 16)
- for(i=ndata; i<16; i++)
+ nsee = 16;
+ nleft = 0;
+ /* read 32 but see only 16 so that runes are happy */
+ while((ndata=Bread(bp, data + nleft, 32 - nleft)) >= 0){
+ ndata += nleft;
+ nleft = 0;
+ nread = ndata;
+ if(ndata>nsee)
+ ndata = nsee;
+ else if(ndata<nsee)
+ for(i=ndata; i<nsee; i++)
data[i] = 0;
if(swizzle)
swizz();
if(swizzle8)
swizz8();
- if(ndata==16 && repeats){
+ if(ndata==nsee && repeats){
if(addr>0 && data[0]==odata[0]){
- for(i=1; i<16; i++)
+ for(i=1; i<nsee; i++)
if(data[i] != odata[i])
break;
- if(i == 16){
- addr += 16;
+ if(i == nsee){
+ addr += nsee;
if(star == 0){
star++;
xprint("*\n", 0);
@@ -238,7 +263,7 @@
continue;
}
}
- for(i=0; i<16; i++)
+ for(i=0; i<nsee; i++)
odata[i] = data[i];
star = 0;
}
@@ -250,13 +275,17 @@
Bflush(&bout);
}
addr += ndata;
- if(ndata<16){
+ if(ndata<nsee){
xprint(afmt[0][abase], addr);
xprint("\n", 0);
if(flush)
Bflush(&bout);
break;
}
+ if(nread>nsee){
+ nleft = nread - nsee;
+ memmove(data, data + nsee, nleft);
+ }
}
Bterm(bp);
return 0;
@@ -353,39 +382,81 @@
}
void
+onefmtc(uchar c)
+{
+ switch(c){
+ case '\t':
+ xprint(cfmt[1][2], (long)"\\t");
+ break;
+ case '\r':
+ xprint(cfmt[1][2], (long)"\\r");
+ break;
+ case '\n':
+ xprint(cfmt[1][2], (long)"\\n");
+ break;
+ case '\b':
+ xprint(cfmt[1][2], (long)"\\b");
+ break;
+ default:
+ if(c>=0x7F || ' '>c)
+ xprint(cfmt[2][2], c);
+ else
+ xprint(cfmt[0][2], c);
+ break;
+ }
+}
+
+void
fmtc(char *f)
{
int i;
USED(f);
for(i=0; i<ndata; i++)
- switch(data[i]){
- case '\t':
- xprint(cfmt[1][2], (long)"\\t");
- break;
- case '\r':
- xprint(cfmt[1][2], (long)"\\r");
- break;
- case '\n':
- xprint(cfmt[1][2], (long)"\\n");
- break;
- case '\b':
- xprint(cfmt[1][2], (long)"\\b");
- break;
- default:
- if(data[i]>=0x7F || ' '>data[i])
- xprint(cfmt[2][2], data[i]);
- else
- xprint(cfmt[0][2], data[i]);
- break;
- }
+ onefmtc(data[i]);
}
void
-xprint(char *fmt, ulong d)
+fmtr(char *f)
{
- if(Bprint(&bout, fmt, d)<0){
+ int i, w, cw;
+ Rune r;
+ static int nstart;
+
+ USED(f);
+ if(nstart)
+ xprint("%*c", 3*nstart, ' ');
+ for(i=nstart; i<ndata; )
+ if(data[i] < Runeself)
+ onefmtc(data[i++]);
+ else{
+ w = chartorune(&r, (char *)data+i);
+ if(w == 1 || i + w>nread)
+ onefmtc(data[i++]);
+ else{
+ cw = w;
+ if(i + w>ndata)
+ cw = ndata - i;
+ xprint(rfmt[0][0], r);
+ xprint("%*c", 3*cw-3, ' ');
+ i += w;
+ }
+ }
+ if(i > ndata)
+ nstart = i - ndata;
+ else
+ nstart = 0;
+}
+
+void
+xprint(char *fmt, ...)
+{
+ va_list arglist;
+
+ va_start(arglist, fmt);
+ if(Bvprint(&bout, fmt, arglist)<0){
fprint(2, "xd: i/o error\n");
exits("i/o error");
}
+ va_end(arglist);
}

View File

@ -1,8 +1,8 @@
# Template file for 'plan9port' # Template file for 'plan9port'
pkgname=plan9port pkgname=plan9port
version=20170922 version=20180726
revision=1 revision=1
_githash=3f8ac29339ad67f05d32064fcc810035d55a3985 _githash=df2d9ec9d169626cdc2a23829bb2831738215722
wrksrc="${pkgname}-${_githash}" wrksrc="${pkgname}-${_githash}"
hostmakedepends="perl" hostmakedepends="perl"
makedepends="libX11-devel libXt-devel libXext-devel freetype-devel fontconfig-devel" makedepends="libX11-devel libXt-devel libXext-devel freetype-devel fontconfig-devel"
@ -11,8 +11,9 @@ maintainer="Leah Neukirchen <leah@vuxu.org>"
license="custom" license="custom"
homepage="https://9fans.github.io/plan9port/" homepage="https://9fans.github.io/plan9port/"
distfiles="https://github.com/9fans/plan9port/archive/${_githash}.tar.gz" distfiles="https://github.com/9fans/plan9port/archive/${_githash}.tar.gz"
checksum=15b6e943c48bc926c700bf446c4ca1f454d9b56a3987cc7d76b020c92068084b checksum=100c13895d75911e2f9c2d136b705f34a854fbeb38a5a38d239497fbd5611738
nocross=yes nocross=yes
only_for_archs="i686 x86_64" # swapcontext
post_extract() { post_extract() {
# add missing LDFLAGS for some rules # add missing LDFLAGS for some rules
@ -23,6 +24,7 @@ post_extract() {
src/cmd/faces/mkfile \ src/cmd/faces/mkfile \
src/cmd/mkfile src/cmd/mkfile
sed -i 's/-lX11$/& $LDFLAGS/g' src/cmd/rio/mkfile sed -i 's/-lX11$/& $LDFLAGS/g' src/cmd/rio/mkfile
sed -i '1i#include <sys/types.h>' lib/linux-isnptl.c
} }
do_build() { do_build() {
CFLAGS+=' -D_DEFAULT_SOURCE' CFLAGS+=' -D_DEFAULT_SOURCE'