sysutils/xdu: Switch repo and improved fix for filenames with spaces

The new git repo has a fix for filenames with spaces. Their approach
replaces our ten line patch with a four line patch.

PR:		286197
This commit is contained in:
Cy Schubert 2025-04-28 11:47:15 -07:00
parent f8b54eb79b
commit 4d456b3a83
3 changed files with 19 additions and 39 deletions

View File

@ -1,6 +1,6 @@
PORTNAME= xdu PORTNAME= xdu
PORTVERSION= 3.0 PORTVERSION= 3.0
PORTREVISION= 5 PORTREVISION= 6
CATEGORIES= sysutils CATEGORIES= sysutils
MAINTAINER= cy@FreeBSD.org MAINTAINER= cy@FreeBSD.org
@ -8,7 +8,8 @@ COMMENT= Graphically display output of du
WWW= https://sd.wareonearth.com/~phil/xdu/ WWW= https://sd.wareonearth.com/~phil/xdu/
USE_GITHUB= yes USE_GITHUB= yes
GH_ACCOUNT= vlasovskikh GH_ACCOUNT= msvticket
GH_TAGNAME= c15d80e
USES= imake xorg USES= imake xorg
USE_XORG= ice sm x11 xaw xext xmu xpm xt USE_XORG= ice sm x11 xaw xext xmu xpm xt

View File

@ -1,2 +1,3 @@
SHA256 (vlasovskikh-xdu-3.0_GH0.tar.gz) = cb11257888997357dacaf385564fef11c58297128cd2046049c0989802f6a0dc TIMESTAMP = 1745866007
SIZE (vlasovskikh-xdu-3.0_GH0.tar.gz) = 12522 SHA256 (msvticket-xdu-3.0-c15d80e_GH0.tar.gz) = 142ae064098c53e3288bd073ff97cffed2b596adc2e411d151e1a873d3691404
SIZE (msvticket-xdu-3.0-c15d80e_GH0.tar.gz) = 12563

View File

@ -1,5 +1,5 @@
--- xdu.c.orig Sun Jun 5 21:29:23 1994 --- xdu.c.orig 2014-10-14 03:21:53.000000000 -0700
+++ xdu.c Sun Aug 15 19:31:01 2004 +++ xdu.c 2025-04-28 11:49:41.485062000 -0700
@@ -20,9 +20,12 @@ @@ -20,9 +20,12 @@
* the party supplying this software to the X Consortium. * the party supplying this software to the X Consortium.
*/ */
@ -14,39 +14,16 @@
#define MAXDEPTH 80 /* max elements in a path */ #define MAXDEPTH 80 /* max elements in a path */
#define MAXNAME 1024 /* max pathname element length */ #define MAXNAME 1024 /* max pathname element length */
@@ -235,6 +238,7 @@ @@ -234,6 +237,7 @@
char name[4096]; char buf[4096];
int size; int size;
FILE *fp; FILE *fp;
+ char *p, *n; + char *p, *n;
if (strcmp(filename, "-") == 0) { if (strcmp(filename, "-") == 0) {
fp = stdin; fp = stdin;
@@ -244,11 +248,21 @@ @@ -271,7 +275,7 @@
exit(1); name[length] = 0;
}
}
+
while (fgets(buf,sizeof(buf),fp) != NULL) {
- sscanf(buf, "%d %s\n", &size, name);
+ p = buf;
+ while (*p && isspace(*p)) p++;
+ size = atoi(p);
+ while (*p && !isspace(*p)) p++;
+ while (*p && isspace(*p)) p++;
+ n = name;
+ while (*p && *p != '\n' && *p != '\r')
+ *n++ = *p++;
+ *n++ = '\0';
/*printf("%d %s\n", size, name);*/
parse_entry(name,size);
}
+
fclose(fp);
}
@@ -269,7 +283,7 @@
length = strlen(name);
if ((length > 0) && (name[length-1] == '/')) { if ((length > 0) && (name[length-1] == '/')) {
/* strip off trailing / (e.g. GNU du) */ /* strip off trailing / (e.g. GNU du) */
- name[length-1] = 0; - name[length-1] = 0;
@ -54,7 +31,7 @@
} }
arg = 0; indx = 0; arg = 0; indx = 0;
@@ -289,8 +303,10 @@ @@ -291,8 +295,10 @@
} }
name++; name++;
} }
@ -67,16 +44,17 @@
path[arg] = NULL; path[arg] = NULL;
addtree(&top,path,size); addtree(&top,path,size);
@@ -399,15 +415,15 @@ @@ -400,16 +406,16 @@
struct node *np;
/*printf("addtree(\"%s\",\"%s\",%d)\n", top->name, path[0], size);*/ /*printf("addtree(\"%s\",\"%s\",%d)\n", top->name, path[0], size);*/
+
+ if (path[0] == NULL) { + if (path[0] == NULL) {
+ /* end of the chain, save size */ + /* end of the chain, save size */
+ top->size = size; + top->size = size;
+ return; + return;
+ } + }
+
/* check all children for a match */ /* check all children for a match */
for (np = top->child; np != NULL; np = np->peer) { for (np = top->child; np != NULL; np = np->peer) {
if (strcmp(path[0],np->name) == 0) { if (strcmp(path[0],np->name) == 0) {
@ -89,7 +67,7 @@
/* recurse */ /* recurse */
addtree(np,&path[1],size); addtree(np,&path[1],size);
return; return;
@@ -621,7 +637,7 @@ @@ -623,7 +629,7 @@
printf("%s %d (%.2f%%)\n", path, topp->size, printf("%s %d (%.2f%%)\n", path, topp->size,
100.0*topp->size/rootp->size); 100.0*topp->size/rootp->size);
} }
@ -98,7 +76,7 @@
char * char *
strdup(s) strdup(s)
char *s; char *s;
@@ -635,7 +651,7 @@ @@ -637,7 +643,7 @@
return cp; return cp;
} }