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
66
67
68
69
70
71
|
diff -wbBur xdiskusage-1.48/makeinclude.in xdiskusage-1.48.my/makeinclude.in
--- xdiskusage-1.48/makeinclude.in 2004-05-05 10:07:57.000000000 +0400
+++ xdiskusage-1.48.my/makeinclude.in 2014-04-23 20:58:15.136751299 +0400
@@ -21,6 +21,6 @@
CXXFLAGS_D =@CXXFLAGS_D@
# libraries to link with:
-LDLIBS =@LIBS@ -lfltk -lXinerama -lGL -lGLU -lX11 -lXext @X_EXTRA_LIBS@ -lm
+LDLIBS =@LIBS@ -lfltk -lXinerama -lXft -lX11 -lXext -lXi @X_EXTRA_LIBS@ -lm
INSTALL =@INSTALL@
diff -wbBur xdiskusage-1.48/xdiskusage.C xdiskusage-1.48.my/xdiskusage.C
--- xdiskusage-1.48/xdiskusage.C 2004-09-21 09:23:14.000000000 +0400
+++ xdiskusage-1.48.my/xdiskusage.C 2014-04-23 21:00:50.696749510 +0400
@@ -223,6 +223,19 @@
return 1;
}
+// returns true if stdin is /dev/null
+// To fix Debian bug #276193
+// Technically could be possible that returns "true" and is not "true",
+// because same device ID is used across file systems. But is the best
+// solutions that I have
+int isstdinnull() {
+ struct stat ststdin,stnull;
+ stat("/dev/null",&stnull);
+ fstat(0,&ststdin);
+
+ return (ststdin.st_rdev==stnull.st_rdev);
+}
+
int main(int argc, char**argv) {
#if FL_MAJOR_VERSION < 2
// Make fltk look more like KDE/Windoze:
@@ -253,7 +266,7 @@
OutputWindow* d = OutputWindow::make(argv[n++]);
if (d) d->show(argc,argv);
}
- } else if (!isatty(0)) {
+ } else if (!isatty(0) && !isstdinnull()) {
// test for pipe, if so read stdin:
OutputWindow* d = OutputWindow::make(0);
if (d) d->show(argc,argv);
@@ -392,8 +405,7 @@
strncpy(pathbuf, path, 1024);
for (int i=0; i<10; i++) {
char *p = (char*)fl_filename_name(pathbuf);
- int i = readlink(pathbuf, p, 1024-(p-pathbuf));
- if (i < 0) {
+ if (readlink(pathbuf, p, 1024-(p-pathbuf)) < 0) {
if (errno != EINVAL) {
strcat(pathbuf, ": no such file");
fl_alert(pathbuf);
@@ -988,7 +1000,7 @@
void OutputWindow::sort_cb(Fl_Widget* o, void*v) {
OutputWindow* d = (OutputWindow*)(o->window());
int (*compare)(const Node*, const Node*);
- switch ((int)v) {
+ switch ((long long)v) {
case 's': compare = largestfirst; break;
case 'r': compare = smallestfirst; break;
case 'a': compare = alphabetical; break;
@@ -1001,7 +1013,7 @@
void OutputWindow::columns_cb(Fl_Widget* o, void*v) {
OutputWindow* d = (OutputWindow*)(o->window());
- int n = (int)v;
+ int n = (long long)v;
::ncols = n;
if (n == d->ncols) return;
if (d->current_depth > d->root_depth+n-1) {
|