summaryrefslogtreecommitdiffstats
path: root/sysutils/xdu
diff options
context:
space:
mode:
authorkuriyama <kuriyama@FreeBSD.org>2001-03-23 14:32:28 +0000
committerkuriyama <kuriyama@FreeBSD.org>2001-03-23 14:32:28 +0000
commit11c2f09e060a57239b625971f8f52aa1ef852cb4 (patch)
tree429e5b73a6f5f2d4de1fba5bddc8593141011095 /sysutils/xdu
parent2f4c682e11e21f656ed0272d9904794f7f86695e (diff)
downloadFreeBSD-ports-11c2f09e060a57239b625971f8f52aa1ef852cb4.zip
FreeBSD-ports-11c2f09e060a57239b625971f8f52aa1ef852cb4.tar.gz
o Fix $MASTER_SITES.
o Add WWW: line. o Add patch from OpenBSD. Submitted by: KATO Tsuguru <tkato@prontomail.ne.jp> PR: ports/25871
Diffstat (limited to 'sysutils/xdu')
-rw-r--r--sysutils/xdu/files/patch-aa77
1 files changed, 77 insertions, 0 deletions
diff --git a/sysutils/xdu/files/patch-aa b/sysutils/xdu/files/patch-aa
new file mode 100644
index 0000000..84a5062
--- /dev/null
+++ b/sysutils/xdu/files/patch-aa
@@ -0,0 +1,77 @@
+--- xdu.c.orig Mon Jun 6 04:29:23 1994
++++ xdu.c Fri Mar 16 07:20:49 2001
+@@ -235,6 +235,7 @@
+ char name[4096];
+ int size;
+ FILE *fp;
++ char *p, *n;
+
+ if (strcmp(filename, "-") == 0) {
+ fp = stdin;
+@@ -244,11 +245,21 @@
+ exit(1);
+ }
+ }
++
+ 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 +280,7 @@
+ length = strlen(name);
+ if ((length > 0) && (name[length-1] == '/')) {
+ /* strip off trailing / (e.g. GNU du) */
+- name[length-1] = 0;
++ name[--length] = 0;
+ }
+
+ arg = 0; indx = 0;
+@@ -289,8 +300,10 @@
+ }
+ name++;
+ }
+- buf[indx] = 0;
+- path[arg++] = strdup(buf);
++ if (length) {
++ buf[indx] = 0;
++ path[arg++] = strdup(buf);
++ }
+ path[arg] = NULL;
+
+ addtree(&top,path,size);
+@@ -399,15 +412,15 @@
+
+ /*printf("addtree(\"%s\",\"%s\",%d)\n", top->name, path[0], size);*/
+
++ if (path[0] == NULL) {
++ /* end of the chain, save size */
++ top->size = size;
++ return;
++ }
++
+ /* check all children for a match */
+ for (np = top->child; np != NULL; np = np->peer) {
+ if (strcmp(path[0],np->name) == 0) {
+- /* name matches */
+- if (path[1] == NULL) {
+- /* end of the chain, save size */
+- np->size = size;
+- return;
+- }
+ /* recurse */
+ addtree(np,&path[1],size);
+ return;
OpenPOWER on IntegriCloud