commit ncdu for openSUSE:Factory
Hello community, here is the log from the commit of package ncdu for openSUSE:Factory checked in at 2016-05-05 08:12:42 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/ncdu (Old) and /work/SRC/openSUSE:Factory/.ncdu.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "ncdu" Changes: -------- --- /work/SRC/openSUSE:Factory/ncdu/ncdu.changes 2013-09-04 14:02:13.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.ncdu.new/ncdu.changes 2016-05-05 08:12:44.000000000 +0200 @@ -1,0 +2,15 @@ +Thu Apr 28 18:28:00 UTC 2016 - toddrme2178@gmail.com + +- Update to 1.11 + * Added 'b' key to spawn shell in the current directory + * Support scanning (and refreshing) of empty directories + * Added --si flag for base 10 prefixes + * Fix toggle dirs before files +- Spec file cleanups +- Add include_sys_wait.patch. Fixes building on earlier distros. + The patch is includes upstream and should be in the next release. + Please see: + + https://dev.yorhel.nl/ncdu/bug/70 + + https://g.blicky.net/ncdu.git/commit/?id=29f347c19cb7ad17c4b401e1d984fce8eaf... + +------------------------------------------------------------------- Old: ---- ncdu-1.10.tar.gz ncdu-1.10.tar.gz.asc New: ---- include_sys_wait.patch ncdu-1.11.tar.gz ncdu-1.11.tar.gz.asc ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ ncdu.spec ++++++ --- /var/tmp/diff_new_pack.YdyprE/_old 2016-05-05 08:12:45.000000000 +0200 +++ /var/tmp/diff_new_pack.YdyprE/_new 2016-05-05 08:12:45.000000000 +0200 @@ -1,8 +1,7 @@ -# vim: set sw=4 ts=4 et: # # spec file for package ncdu # -# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany. +# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -18,7 +17,7 @@ Name: ncdu -Version: 1.10 +Version: 1.11 Release: 0 Summary: NCurses Disk Usage License: MIT @@ -26,6 +25,8 @@ Url: http://dev.yorhel.nl/ncdu/ Source0: http://dev.yorhel.nl/download/ncdu-%{version}.tar.gz Source1: http://dev.yorhel.nl/download/ncdu-%{version}.tar.gz.asc +# PATCH-FIX-UPSTREAM include_sys_wait.patch https://dev.yorhel.nl/ncdu/bug/70 +Patch0: include_sys_wait.patch Source2: %{name}.keyring BuildRequires: ncurses-devel BuildRoot: %{_tmppath}/%{name}-%{version}-build @@ -37,21 +38,19 @@ %prep %setup -q +%patch0 -p1 %build %configure -%__make %{?_smp_flags} +make %{?_smp_flags} %install -%makeinstall - -%clean -%{?buildroot:%__rm -rf "%{buildroot}"} +%make_install %files -%defattr(-,root,root,0755) +%defattr(-,root,root,-) %doc ChangeLog README COPYING -%doc %{_mandir}/man1/%{name}.1* %{_bindir}/%{name} +%{_mandir}/man1/%{name}.1* %changelog ++++++ include_sys_wait.patch ++++++
From 29f347c19cb7ad17c4b401e1d984fce8eafaaafa Mon Sep 17 00:00:00 2001 From: Yorhel <git@yorhel.nl> Date: Tue, 7 Apr 2015 10:39:46 +0200 Subject: shell.c: Include sys/wait.h
Required for the W* macros on OpenBSD. Reported by Brian Callahan. --- src/shell.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/shell.c b/src/shell.c index d601b5a..eb275cd 100644 --- a/src/shell.c +++ b/src/shell.c @@ -32,6 +32,7 @@ #include <ncurses.h> #include <stdlib.h> #include <unistd.h> +#include <sys/wait.h> void shell_draw() { char *full_path; -- cgit v0.12 ++++++ ncdu-1.10.tar.gz -> ncdu-1.11.tar.gz ++++++ ++++ 1622 lines of diff (skipped) ++++ retrying with extended exclude list diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/ncdu-1.10/COPYING new/ncdu-1.11/COPYING --- old/ncdu-1.10/COPYING 2012-09-27 11:00:09.000000000 +0200 +++ new/ncdu-1.11/COPYING 2014-01-22 15:26:36.000000000 +0100 @@ -1,4 +1,4 @@ -Copyright (c) 2007-2012 Yoran Heling +Copyright (c) 2007-2014 Yoran Heling Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/ncdu-1.10/ChangeLog new/ncdu-1.11/ChangeLog --- old/ncdu-1.10/ChangeLog 2013-05-09 16:29:06.000000000 +0200 +++ new/ncdu-1.11/ChangeLog 2015-04-05 10:00:43.000000000 +0200 @@ -1,3 +1,9 @@ +1.11 - 2014-04-05 + - Added 'b' key to spawn shell in the current directory + - Support scanning (and refreshing) of empty directories + - Added --si flag for base 10 prefixes + - Fix toggle dirs before files + 1.10 - 2013-05-09 - Added 'c' key to display item counts - Added 'C' key to order by item counts diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/ncdu-1.10/Makefile.am new/ncdu-1.11/Makefile.am --- old/ncdu-1.10/Makefile.am 2013-04-25 08:14:55.000000000 +0200 +++ new/ncdu-1.11/Makefile.am 2014-12-14 09:16:27.000000000 +0100 @@ -12,6 +12,7 @@ src/dir_scan.c\ src/exclude.c\ src/help.c\ + src/shell.c\ src/main.c\ src/path.c\ src/util.c @@ -26,6 +27,7 @@ src/exclude.h\ src/global.h\ src/help.h\ + src/shell.h\ src/path.h\ src/util.h diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/ncdu-1.10/README new/ncdu-1.11/README --- old/ncdu-1.10/README 2013-05-09 16:39:43.000000000 +0200 +++ new/ncdu-1.11/README 2015-04-05 10:05:08.000000000 +0200 @@ -1,4 +1,4 @@ -ncdu 1.10 +ncdu 1.11 ========= DESCRIPTION @@ -33,7 +33,7 @@ COPYING - Copyright (c) 2007-2013 Yoran Heling + Copyright (c) 2007-2014 Yoran Heling Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/ncdu-1.10/config.h.in new/ncdu-1.11/config.h.in --- old/ncdu-1.10/config.h.in 2013-05-09 16:39:56.000000000 +0200 +++ new/ncdu-1.11/config.h.in 2015-04-05 10:05:27.000000000 +0200 @@ -1,5 +1,8 @@ /* config.h.in. Generated from configure.ac by autoheader. */ +/* Used default shell interpreter */ +#undef DEFAULT_SHELL + /* Define to 1 if you have the `chdir' function. */ #undef HAVE_CHDIR @@ -15,6 +18,9 @@ /* Define to 1 if you have the `getcwd' function. */ #undef HAVE_GETCWD +/* Define to 1 if you have the `getenv' function. */ +#undef HAVE_GETENV + /* Define to 1 if you have the `gettimeofday' function. */ #undef HAVE_GETTIMEOFDAY @@ -39,9 +45,6 @@ /* Define to 1 if you have the `rmdir' function. */ #undef HAVE_RMDIR -/* Define to 1 if you have the `setlocale' function. */ -#undef HAVE_SETLOCALE - /* Define to 1 if you have the <stdint.h> header file. */ #undef HAVE_STDINT_H @@ -61,6 +64,9 @@ `HAVE_STRUCT_STAT_ST_BLOCKS' instead. */ #undef HAVE_ST_BLOCKS +/* Define to 1 if you have the `system' function. */ +#undef HAVE_SYSTEM + /* Define to 1 if you have the <sys/stat.h> header file. */ #undef HAVE_SYS_STAT_H diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/ncdu-1.10/configure.ac new/ncdu-1.11/configure.ac --- old/ncdu-1.10/configure.ac 2013-05-09 16:39:38.000000000 +0200 +++ new/ncdu-1.11/configure.ac 2015-04-05 10:05:15.000000000 +0200 @@ -1,5 +1,5 @@ -AC_INIT(ncdu, 1.10, projects@yorhel.nl) +AC_INIT(ncdu, 1.11, projects@yorhel.nl) AC_CONFIG_SRCDIR([src/global.h]) AC_CONFIG_HEADER([config.h]) AM_INIT_AUTOMAKE([foreign subdir-objects]) @@ -12,9 +12,11 @@ # Check for header files. AC_CHECK_HEADERS( - [limits.h sys/time.h sys/types.h sys/stat.h dirent.h unistd.h fnmatch.h ncurses.h locale.h],[], + [limits.h sys/time.h sys/types.h sys/stat.h dirent.h unistd.h fnmatch.h ncurses.h],[], AC_MSG_ERROR([required header file not found])) +AC_CHECK_HEADERS(locale.h) + # Check for typedefs, structures, and compiler characteristics. AC_TYPE_INT64_T AC_TYPE_UINT64_T @@ -23,7 +25,7 @@ # Check for library functions. AC_CHECK_FUNCS( - [getcwd gettimeofday fnmatch chdir rmdir unlink lstat setlocale],[], + [getcwd gettimeofday fnmatch chdir rmdir unlink lstat system getenv],[], AC_MSG_ERROR([required function missing])) @@ -53,7 +55,14 @@ ]) fi +# Configure default shell for spawning shell when $SHELL is not set +AC_ARG_WITH([shell], + [AS_HELP_STRING([--with-shell], + [used interpreter as default shell (default is /bin/sh)])], + [DEFAULT_SHELL=$withval], + [DEFAULT_SHELL=/bin/sh]) +AC_MSG_NOTICE([Using $DEFAULT_SHELL as the default shell if \$SHELL is not set]) +AC_DEFINE_UNQUOTED(DEFAULT_SHELL, "$DEFAULT_SHELL", [Used default shell interpreter]) AC_OUTPUT([Makefile]) - diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/ncdu-1.10/doc/ncdu.pod new/ncdu-1.11/doc/ncdu.pod --- old/ncdu-1.10/doc/ncdu.pod 2013-04-12 19:27:38.000000000 +0200 +++ new/ncdu-1.11/doc/ncdu.pod 2014-12-14 09:16:27.000000000 +0100 @@ -97,6 +97,12 @@ interface in that case. It has no effect when C<-f> is used, either, because the deletion feature is disabled in that case anyway. +=item --si + +List sizes using base 10 prefixes, that is, powers of 1000 (KB, MB, etc), as +defined in the International System of Units (SI), instead of the usual base 2 +prefixes, that is, powers of 1024 (KiB, MiB, etc). + =back =head2 Scan Options @@ -204,6 +210,14 @@ Refresh/recalculate the current directory. +=item b + +Spawn shell in current directory. + +We first check the $SHELL environment variable of the user for the preferred +shell interpreter. If it's not set, we fall back to the compile time +configured default shell (usually /bin/bash). + =item q Quit diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/ncdu-1.10/ncdu.1 new/ncdu-1.11/ncdu.1 --- old/ncdu-1.10/ncdu.1 2013-05-09 16:39:56.000000000 +0200 +++ new/ncdu-1.11/ncdu.1 2015-04-05 09:53:06.000000000 +0200 @@ -1,4 +1,4 @@ -.\" Automatically generated by Pod::Man 2.25 (Pod::Simple 3.20) +.\" Automatically generated by Pod::Man 2.28 (Pod::Simple 3.28) .\" .\" Standard preamble: .\" ======================================================================== @@ -38,6 +38,8 @@ . ds PI \(*p . ds L" `` . ds R" '' +. ds C` +. ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. @@ -48,17 +50,24 @@ .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. -.ie \nF \{\ -. de IX -. tm Index:\\$1\t\\n%\t"\\$2" +.\" +.\" Avoid warning from groff about undefined register 'F'. +.de IX .. -. nr % 0 -. rr F -.\} -.el \{\ -. de IX +.nr rF 0 +.if \n(.g .if rF .nr rF 1 +.if (\n(rF:(\n(.g==0)) \{ +. if \nF \{ +. de IX +. tm Index:\\$1\t\\n%\t"\\$2" .. +. if !\nF==2 \{ +. nr % 0 +. nr F 2 +. \} +. \} .\} +.rr rF .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. @@ -124,7 +133,7 @@ .\" ======================================================================== .\" .IX Title "NCDU 1" -.TH NCDU 1 "2013-04-12" "ncdu-1.10" "ncdu manual" +.TH NCDU 1 "2014-12-14" "ncdu-1.10g" "ncdu manual" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l @@ -205,6 +214,11 @@ option has no effect when \f(CW\*(C`\-o\*(C'\fR is used, because there will not be a browser interface in that case. It has no effect when \f(CW\*(C`\-f\*(C'\fR is used, either, because the deletion feature is disabled in that case anyway. +.IP "\-\-si" 4 +.IX Item "--si" +List sizes using base 10 prefixes, that is, powers of 1000 (\s-1KB, MB,\s0 etc), as +defined in the International System of Units (\s-1SI\s0), instead of the usual base 2 +prefixes, that is, powers of 1024 (KiB, MiB, etc). .SS "Scan Options" .IX Subsection "Scan Options" These options affect the scanning progress, and have no effect when importing @@ -224,7 +238,7 @@ by a newline. .IP "\-\-exclude\-caches" 4 .IX Item "--exclude-caches" -Exclude directories containing \s-1CACHEDIR\s0.TAG. The directories will still be +Exclude directories containing \s-1CACHEDIR.TAG. \s0 The directories will still be displayed, but not their content, and they are not counted towards the disk usage statistics. See http://www.brynosaurus.com/cachedir/ @@ -282,6 +296,13 @@ .IP "r" 4 .IX Item "r" Refresh/recalculate the current directory. +.IP "b" 4 +.IX Item "b" +Spawn shell in current directory. +.Sp +We first check the \f(CW$SHELL\fR environment variable of the user for the preferred +shell interpreter. If it's not set, we fall back to the compile time +configured default shell (usually /bin/bash). .IP "q" 4 .IX Item "q" Quit diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/ncdu-1.10/src/browser.c new/ncdu-1.11/src/browser.c --- old/ncdu-1.10/src/browser.c 2013-05-09 16:23:58.000000000 +0200 +++ new/ncdu-1.11/src/browser.c 2015-04-05 10:01:50.000000000 +0200 @@ -1,6 +1,6 @@ /* ncdu - NCurses Disk Usage - Copyright (c) 2007-2012 Yoran Heling + Copyright (c) 2007-2014 Yoran Heling Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the @@ -98,13 +98,12 @@ /* reference to parent dir has a different format */ if(n == dirlist_parent) { mvhline(row, 0, ' ', wincols); - o = graph == 0 ? 12 : - graph == 1 ? 24 : - graph == 2 ? 20 : - 31 ; - if (show_items) { + o = graph == 0 ? 13 : + graph == 1 ? 25 : + graph == 2 ? 21 : + 32 ; + if(show_items) o += 7; - } mvaddstr(row, o, "/.."); if(n->flags & FF_BSEL) attroff(A_REVERSE); @@ -142,8 +141,8 @@ x = 0; - mvprintw(row, x, "%c %8s ", ct, size); - x += 11; + mvprintw(row, x, "%c %9s ", ct, size); + x += 12; if (show_items) { if (n->items > 99999) @@ -169,7 +168,7 @@ void browse_draw() { struct dir *t; - char fmtsize[9], *tmp; + char fmtsize[10], *tmp; int selected = 0, i; erase(); @@ -188,9 +187,9 @@ /* second line - the path */ mvhline(1, 0, '-', wincols); - if(t) { + if(dirlist_par) { mvaddch(1, 3, ' '); - tmp = getpath(t->parent); + tmp = getpath(dirlist_par); mvaddstr(1, 4, cropstr(tmp, wincols-8)); mvaddch(1, 4+((int)strlen(tmp) > wincols-8 ? wincols-8 : (int)strlen(tmp)), ' '); } @@ -350,7 +349,7 @@ info_show = 0; break; case 't': - dirlist_set_sort(DL_NOCHANGE, DL_NOCHANGE, dirlist_sort_df); + dirlist_set_sort(DL_NOCHANGE, DL_NOCHANGE, !dirlist_sort_df); info_show = 0; break; case 'a': @@ -364,8 +363,8 @@ case 10: case KEY_RIGHT: case 'l': - if(sel != NULL && sel->sub != NULL) { - dirlist_open(sel->sub); + if(sel != NULL && sel->flags & FF_DIR) { + dirlist_open(sel == dirlist_parent ? dirlist_par->parent : sel); dirlist_top(-3); } info_show = 0; @@ -373,8 +372,8 @@ case KEY_LEFT: case 'h': case '<': - if(sel != NULL && sel->parent->parent != NULL) { - dirlist_open(sel->parent); + if(dirlist_par && dirlist_par->parent != NULL) { + dirlist_open(dirlist_par->parent); dirlist_top(-3); } info_show = 0; @@ -386,10 +385,10 @@ message = "Directory imported from file, won't refresh."; break; } - if(sel != NULL) { + if(dirlist_par) { dir_ui = 2; - dir_mem_init(sel->parent); - dir_scan_init(getpath(sel->parent)); + dir_mem_init(dirlist_par); + dir_scan_init(getpath(dirlist_par)); } info_show = 0; break; @@ -426,9 +425,16 @@ info_show = 0; if((t = dirlist_get(1)) == sel) if((t = dirlist_get(-1)) == sel || t == dirlist_parent) - t = sel->parent; + t = NULL; delete_init(sel, t); break; + case 'b': + if(dir_import_active) { + message = "Shell feature not available for imported directories."; + break; + } + shell_init(); + break; } /* make sure the info_* options are correct */ @@ -442,9 +448,9 @@ } -void browse_init(struct dir *cur) { +void browse_init(struct dir *par) { pstate = ST_BROWSE; message = NULL; - dirlist_open(cur); + dirlist_open(par); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/ncdu-1.10/src/browser.h new/ncdu-1.11/src/browser.h --- old/ncdu-1.10/src/browser.h 2012-09-27 11:00:09.000000000 +0200 +++ new/ncdu-1.11/src/browser.h 2014-01-22 15:24:08.000000000 +0100 @@ -1,6 +1,6 @@ /* ncdu - NCurses Disk Usage - Copyright (c) 2007-2012 Yoran Heling + Copyright (c) 2007-2014 Yoran Heling Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/ncdu-1.10/src/delete.c new/ncdu-1.11/src/delete.c --- old/ncdu-1.10/src/delete.c 2012-09-27 11:00:09.000000000 +0200 +++ new/ncdu-1.11/src/delete.c 2014-08-03 15:08:27.000000000 +0200 @@ -1,6 +1,6 @@ /* ncdu - NCurses Disk Usage - Copyright (c) 2007-2012 Yoran Heling + Copyright (c) 2007-2014 Yoran Heling Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the @@ -209,11 +209,13 @@ void delete_process() { + struct dir *par; + /* confirm */ seloption = 1; while(state == DS_CONFIRM && !noconfirm) if(input_handle(0)) { - browse_init(root); + browse_init(root->parent); return; } @@ -229,13 +231,13 @@ /* delete */ seloption = 0; state = DS_PROGRESS; - if(delete_dir(root)) - browse_init(root); - else { + par = root->parent; + delete_dir(root); + if(nextsel) nextsel->flags |= FF_BSEL; - browse_init(nextsel); + browse_init(par); + if(nextsel) dirlist_top(-4); - } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/ncdu-1.10/src/delete.h new/ncdu-1.11/src/delete.h --- old/ncdu-1.10/src/delete.h 2012-09-27 11:00:09.000000000 +0200 +++ new/ncdu-1.11/src/delete.h 2014-08-03 15:08:27.000000000 +0200 @@ -1,6 +1,6 @@ /* ncdu - NCurses Disk Usage - Copyright (c) 2007-2012 Yoran Heling + Copyright (c) 2007-2014 Yoran Heling Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/ncdu-1.10/src/dir.h new/ncdu-1.11/src/dir.h --- old/ncdu-1.10/src/dir.h 2012-09-27 11:00:10.000000000 +0200 +++ new/ncdu-1.11/src/dir.h 2014-01-22 15:24:24.000000000 +0100 @@ -1,6 +1,6 @@ /* ncdu - NCurses Disk Usage - Copyright (c) 2007-2012 Yoran Heling + Copyright (c) 2007-2014 Yoran Heling Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/ncdu-1.10/src/dir_common.c new/ncdu-1.11/src/dir_common.c --- old/ncdu-1.10/src/dir_common.c 2012-09-27 11:00:10.000000000 +0200 +++ new/ncdu-1.11/src/dir_common.c 2014-01-22 15:24:29.000000000 +0100 @@ -1,6 +1,6 @@ /* ncdu - NCurses Disk Usage - Copyright (c) 2007-2012 Yoran Heling + Copyright (c) 2007-2014 Yoran Heling Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/ncdu-1.10/src/dir_export.c new/ncdu-1.11/src/dir_export.c --- old/ncdu-1.10/src/dir_export.c 2012-09-27 11:00:10.000000000 +0200 +++ new/ncdu-1.11/src/dir_export.c 2014-01-22 15:24:33.000000000 +0100 @@ -1,6 +1,6 @@ /* ncdu - NCurses Disk Usage - Copyright (c) 2007-2012 Yoran Heling + Copyright (c) 2007-2014 Yoran Heling Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/ncdu-1.10/src/dir_import.c new/ncdu-1.11/src/dir_import.c --- old/ncdu-1.10/src/dir_import.c 2013-04-12 19:35:27.000000000 +0200 +++ new/ncdu-1.11/src/dir_import.c 2014-01-22 15:24:37.000000000 +0100 @@ -1,6 +1,6 @@ /* ncdu - NCurses Disk Usage - Copyright (c) 2007-2012 Yoran Heling + Copyright (c) 2007-2014 Yoran Heling Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the @@ -547,8 +547,6 @@ if(!isroot) dir_curpath_leave(); - else /* The root item must not be empty. */ - E(ctx->items <= 1, "Empty directory"); return 0; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/ncdu-1.10/src/dir_mem.c new/ncdu-1.11/src/dir_mem.c --- old/ncdu-1.10/src/dir_mem.c 2013-04-25 08:10:45.000000000 +0200 +++ new/ncdu-1.11/src/dir_mem.c 2014-01-22 15:24:43.000000000 +0100 @@ -1,6 +1,6 @@ /* ncdu - NCurses Disk Usage - Copyright (c) 2007-2012 Yoran Heling + Copyright (c) 2007-2014 Yoran Heling Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the @@ -198,7 +198,7 @@ freedir(orig); } - browse_init(root->sub); + browse_init(root); dirlist_top(-3); return 0; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/ncdu-1.10/src/dir_scan.c new/ncdu-1.11/src/dir_scan.c --- old/ncdu-1.10/src/dir_scan.c 2013-04-12 19:42:25.000000000 +0200 +++ new/ncdu-1.11/src/dir_scan.c 2014-01-24 11:28:09.000000000 +0100 @@ -1,6 +1,6 @@ /* ncdu - NCurses Disk Usage - Copyright (c) 2007-2012 Yoran Heling + Copyright (c) 2007-2014 Yoran Heling Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the @@ -266,12 +266,6 @@ if(!dir_fatalerr && !(dir = dir_read(&fail))) dir_seterr("Error reading directory: %s", strerror(errno)); - /* Special case: empty directory = error */ - if(!dir_fatalerr && !*dir) { - dir_seterr("Directory empty"); - free(dir); - } - if(!dir_fatalerr) { curdev = (uint64_t)fs.st_dev; d = dir_createstruct(dir_curpath); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/ncdu-1.10/src/dirlist.c new/ncdu-1.11/src/dirlist.c --- old/ncdu-1.10/src/dirlist.c 2013-01-18 10:12:16.000000000 +0100 +++ new/ncdu-1.11/src/dirlist.c 2014-01-22 15:24:52.000000000 +0100 @@ -1,6 +1,6 @@ /* ncdu - NCurses Disk Usage - Copyright (c) 2007-2012 Yoran Heling + Copyright (c) 2007-2014 Yoran Heling Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the @@ -29,7 +29,8 @@ /* public variables */ -struct dir *dirlist_parent = NULL; +struct dir *dirlist_parent = NULL, + *dirlist_par = NULL; int64_t dirlist_maxs = 0, dirlist_maxa = 0; @@ -186,29 +187,33 @@ void dirlist_open(struct dir *d) { + dirlist_par = d; + /* set the head of the list */ - head_real = head = d == NULL ? NULL : d->parent == NULL ? d->sub : d->parent->sub; + head_real = head = d == NULL ? NULL : d->sub; /* reset internal status */ dirlist_maxs = dirlist_maxa = 0; /* stop if this is not a directory list we can work with */ - if(head == NULL) { + if(d == NULL) { dirlist_parent = NULL; return; } /* sort the dir listing */ - head_real = head = dirlist_sort(head); + if(head) + head_real = head = dirlist_sort(head); /* set the reference to the parent dir */ dirlist_parent_alloc.flags &= ~FF_BSEL; - if(head->parent->parent) { + dirlist_parent_alloc.flags |= FF_DIR; + if(d->parent) { dirlist_parent = &dirlist_parent_alloc; strcpy(dirlist_parent->name, ".."); dirlist_parent->next = head; - dirlist_parent->parent = head->parent; - dirlist_parent->sub = head->parent; + dirlist_parent->parent = d; + dirlist_parent->sub = d; head = dirlist_parent; } else dirlist_parent = NULL; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/ncdu-1.10/src/dirlist.h new/ncdu-1.11/src/dirlist.h --- old/ncdu-1.10/src/dirlist.h 2013-01-18 10:12:16.000000000 +0100 +++ new/ncdu-1.11/src/dirlist.h 2014-01-22 15:24:56.000000000 +0100 @@ -1,6 +1,6 @@ /* ncdu - NCurses Disk Usage - Copyright (c) 2007-2012 Yoran Heling + Copyright (c) 2007-2014 Yoran Heling Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the @@ -68,6 +68,9 @@ /* The 'reference to parent dir' */ extern struct dir *dirlist_parent; +/* The actual parent dir */ +extern struct dir *dirlist_par; + /* current sorting configuration (set with dirlist_set_sort()) */ extern int dirlist_sort_desc, dirlist_sort_col, dirlist_sort_df; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/ncdu-1.10/src/exclude.c new/ncdu-1.11/src/exclude.c --- old/ncdu-1.10/src/exclude.c 2013-05-09 16:22:04.000000000 +0200 +++ new/ncdu-1.11/src/exclude.c 2014-01-22 15:25:00.000000000 +0100 @@ -1,6 +1,6 @@ /* ncdu - NCurses Disk Usage - Copyright (c) 2007-2012 Yoran Heling + Copyright (c) 2007-2014 Yoran Heling Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/ncdu-1.10/src/exclude.h new/ncdu-1.11/src/exclude.h --- old/ncdu-1.10/src/exclude.h 2013-04-12 19:27:38.000000000 +0200 +++ new/ncdu-1.11/src/exclude.h 2014-01-22 15:25:04.000000000 +0100 @@ -1,6 +1,6 @@ /* ncdu - NCurses Disk Usage - Copyright (c) 2007-2012 Yoran Heling + Copyright (c) 2007-2014 Yoran Heling Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/ncdu-1.10/src/global.h new/ncdu-1.11/src/global.h --- old/ncdu-1.10/src/global.h 2013-04-12 19:27:38.000000000 +0200 +++ new/ncdu-1.11/src/global.h 2014-12-14 09:21:26.000000000 +0100 @@ -1,6 +1,6 @@ /* ncdu - NCurses Disk Usage - Copyright (c) 2007-2012 Yoran Heling + Copyright (c) 2007-2014 Yoran Heling Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the @@ -55,6 +55,7 @@ #define ST_BROWSE 1 #define ST_DEL 2 #define ST_HELP 3 +#define ST_SHELL 4 /* structure representing a file or directory */ @@ -102,5 +103,6 @@ #include "help.h" #include "path.h" #include "util.h" +#include "shell.h" #endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/ncdu-1.10/src/help.c new/ncdu-1.11/src/help.c --- old/ncdu-1.10/src/help.c 2013-01-18 10:12:16.000000000 +0100 +++ new/ncdu-1.11/src/help.c 2014-12-14 09:19:20.000000000 +0100 @@ -1,6 +1,6 @@ /* ncdu - NCurses Disk Usage - Copyright (c) 2007-2012 Yoran Heling + Copyright (c) 2007-2014 Yoran Heling Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the @@ -32,7 +32,7 @@ int page, start; -#define KEYS 16 +#define KEYS 17 char *keys[KEYS*2] = { /*|----key----| |----------------description----------------|*/ "up, k", "Move cursor up", @@ -50,6 +50,7 @@ "e", "Show/hide hidden or excluded files", "i", "Show information about selected item", "r", "Recalculate the current directory", + "b", "Spawn shell in current directory", "q", "Quit ncdu" }; @@ -60,7 +61,7 @@ browse_draw(); nccreate(15, 60, "ncdu help"); - ncaddstr(13, 38, "Press q to continue"); + ncaddstr(13, 42, "Press q to close"); if(page == 1) attron(A_REVERSE); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/ncdu-1.10/src/help.h new/ncdu-1.11/src/help.h --- old/ncdu-1.10/src/help.h 2012-09-27 11:00:10.000000000 +0200 +++ new/ncdu-1.11/src/help.h 2014-01-22 15:25:19.000000000 +0100 @@ -1,6 +1,6 @@ /* ncdu - NCurses Disk Usage - Copyright (c) 2007-2012 Yoran Heling + Copyright (c) 2007-2014 Yoran Heling Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/ncdu-1.10/src/main.c new/ncdu-1.11/src/main.c --- old/ncdu-1.10/src/main.c 2013-04-25 08:10:12.000000000 +0200 +++ new/ncdu-1.11/src/main.c 2014-12-14 09:16:27.000000000 +0100 @@ -1,6 +1,6 @@ /* ncdu - NCurses Disk Usage - Copyright (c) 2007-2012 Yoran Heling + Copyright (c) 2007-2014 Yoran Heling Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the @@ -32,7 +32,6 @@ #include <unistd.h> #include <sys/time.h> -#include <locale.h> #include <yopt.h> @@ -53,6 +52,7 @@ case ST_CALC: dir_draw(); break; case ST_BROWSE: browse_draw(); break; case ST_HELP: help_draw(); break; + case ST_SHELL: shell_draw(); break; case ST_DEL: delete_draw(); break; } } @@ -127,10 +127,12 @@ { 1, 1, "--exclude" }, { 'X', 1, "-X,--exclude-from" }, { 'C', 0, "--exclude-caches" }, + { 's', 0, "--si" }, {0,0,NULL} }; dir_ui = -1; + si = 0; yopt_init(&yopt, argc, argv, opts); while((v = yopt_next(&yopt, &val)) != -1) { @@ -146,6 +148,7 @@ printf(" -o FILE Export scanned directory to FILE\n"); printf(" -f FILE Import scanned directory from FILE\n"); printf(" -0,-1,-2 UI to use when scanning (0=none,2=full ncurses)\n"); + printf(" --si Use base 10 (SI) prefixes instead of base 2\n"); printf(" --exclude PATTERN Exclude files that match PATTERN\n"); printf(" -X, --exclude-from FILE Exclude files that match any pattern in FILE\n"); printf(" --exclude-caches Exclude directories containing CACHEDIR.TAG\n"); @@ -156,6 +159,7 @@ exit(0); case 'x': dir_scan_smfs = 1; break; case 'r': read_only = 1; break; + case 's': si = 1; break; case 'o': export = val; break; case 'f': import = val; break; case '0': dir_ui = 0; break; @@ -251,7 +255,6 @@ /* main program */ int main(int argc, char **argv) { - setlocale(LC_ALL, ""); read_locale(); argv_parse(argc, argv); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/ncdu-1.10/src/path.c new/ncdu-1.11/src/path.c --- old/ncdu-1.10/src/path.c 2012-09-27 11:00:10.000000000 +0200 +++ new/ncdu-1.11/src/path.c 2014-01-22 15:25:27.000000000 +0100 @@ -1,6 +1,6 @@ /* ncdu - NCurses Disk Usage - Copyright (c) 2007-2012 Yoran Heling + Copyright (c) 2007-2014 Yoran Heling Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/ncdu-1.10/src/path.h new/ncdu-1.11/src/path.h --- old/ncdu-1.10/src/path.h 2012-09-27 11:00:10.000000000 +0200 +++ new/ncdu-1.11/src/path.h 2014-01-22 15:25:42.000000000 +0100 @@ -1,6 +1,6 @@ /* ncdu - NCurses Disk Usage - Copyright (c) 2007-2012 Yoran Heling + Copyright (c) 2007-2014 Yoran Heling Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/ncdu-1.10/src/shell.c new/ncdu-1.11/src/shell.c --- old/ncdu-1.10/src/shell.c 1970-01-01 01:00:00.000000000 +0100 +++ new/ncdu-1.11/src/shell.c 2014-12-14 15:13:08.000000000 +0100 @@ -0,0 +1,78 @@ +/* ncdu - NCurses Disk Usage + + Copyright (c) 2007-2014 Yoran Heling + Shell support: Copyright (c) 2014 Thomas Jarosch + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +*/ + +#include "config.h" +#include "global.h" +#include "dirlist.h" +#include "util.h" + +#include <ncurses.h> +#include <stdlib.h> +#include <unistd.h> + +void shell_draw() { + char *full_path; + int res; + + /* suspend ncurses mode */ + def_prog_mode(); + endwin(); + + full_path = getpath(dirlist_par); + res = chdir(full_path); + if (res != 0) { + reset_prog_mode(); + clear(); + printw("ERROR: Can't change directory: %s (errcode: %d)\n" + "\n" + "Press any key to continue.", + full_path, res); + } else { + char *shell = getenv("SHELL"); + if (shell == NULL) + shell = DEFAULT_SHELL; + + res = system(shell); + + /* resume ncurses mode */ + reset_prog_mode(); + + if (res == -1 || !WIFEXITED(res) || WEXITSTATUS(res) == 127) { + clear(); + printw("ERROR: Can't execute shell interpreter: %s\n" + "\n" + "Press any key to continue.", + shell); + } + } + + refresh(); + pstate = ST_BROWSE; +} + +void shell_init() { + pstate = ST_SHELL; +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/ncdu-1.10/src/shell.h new/ncdu-1.11/src/shell.h --- old/ncdu-1.10/src/shell.h 1970-01-01 01:00:00.000000000 +0100 +++ new/ncdu-1.11/src/shell.h 2014-12-14 09:22:01.000000000 +0100 @@ -0,0 +1,35 @@ +/* ncdu - NCurses Disk Usage + + Copyright (c) 2007-2014 Yoran Heling + Shell support: Copyright (c) 2014 Thomas Jarosch + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +*/ + +#ifndef _shell_h +#define _shell_h + +#include "global.h" + +void shell_draw(void); +void shell_init(); + +#endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/ncdu-1.10/src/util.c new/ncdu-1.11/src/util.c --- old/ncdu-1.10/src/util.c 2013-01-18 10:12:16.000000000 +0100 +++ new/ncdu-1.11/src/util.c 2014-04-30 12:25:48.000000000 +0200 @@ -1,6 +1,6 @@ /* ncdu - NCurses Disk Usage - Copyright (c) 2007-2012 Yoran Heling + Copyright (c) 2007-2014 Yoran Heling Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the @@ -28,10 +28,14 @@ #include <string.h> #include <stdlib.h> #include <ncurses.h> +#include <stdarg.h> +#ifdef HAVE_LOCALE_H #include <locale.h> +#endif int winrows, wincols; int subwinr, subwinc; +int si; char thou_sep; @@ -57,17 +61,29 @@ char *formatsize(int64_t from) { - static char dat[9]; /* "xxx.xMiB" */ + static char dat[10]; /* "xxx.x MiB" */ float r = from; char c = ' '; - if(r < 1000.0f) { } - else if(r < 1023e3f) { c = 'K'; r/=1024.0f; } - else if(r < 1023e6f) { c = 'M'; r/=1048576.0f; } - else if(r < 1023e9f) { c = 'G'; r/=1073741824.0f; } - else if(r < 1023e12f){ c = 'T'; r/=1099511627776.0f; } - else if(r < 1023e15f){ c = 'P'; r/=1125899906842624.0f; } - else { c = 'E'; r/=1152921504606846976.0f; } - sprintf(dat, "%5.1f%c%cB", r, c, c == ' ' ? ' ' : 'i'); + if (si) { + if(r < 1000.0f) { } + else if(r < 1e6f) { c = 'K'; r/=1e3f; } + else if(r < 1e9f) { c = 'M'; r/=1e6f; } + else if(r < 1e12f){ c = 'G'; r/=1e9f; } + else if(r < 1e15f){ c = 'T'; r/=1e12f; } + else if(r < 1e18f){ c = 'P'; r/=1e15f; } + else { c = 'E'; r/=1e18f; } + sprintf(dat, "%5.1f %cB", r, c); + } + else { + if(r < 1000.0f) { } + else if(r < 1023e3f) { c = 'K'; r/=1024.0f; } + else if(r < 1023e6f) { c = 'M'; r/=1048576.0f; } + else if(r < 1023e9f) { c = 'G'; r/=1073741824.0f; } + else if(r < 1023e12f){ c = 'T'; r/=1099511627776.0f; } + else if(r < 1023e15f){ c = 'P'; r/=1125899906842624.0f; } + else { c = 'E'; r/=1152921504606846976.0f; } + sprintf(dat, "%5.1f %c%cB", r, c, c == ' ' ? ' ' : 'i'); + } return dat; } @@ -99,12 +115,13 @@ void read_locale() { + thou_sep = '.'; +#ifdef HAVE_LOCALE_H + setlocale(LC_ALL, ""); char *locale_thou_sep = localeconv()->thousands_sep; - if (locale_thou_sep && 1 == strlen(locale_thou_sep)) { + if(locale_thou_sep && 1 == strlen(locale_thou_sep)) thou_sep = locale_thou_sep[0]; - } else { - thou_sep = '.'; - } +#endif } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/ncdu-1.10/src/util.h new/ncdu-1.11/src/util.h --- old/ncdu-1.10/src/util.h 2013-01-18 10:12:16.000000000 +0100 +++ new/ncdu-1.11/src/util.h 2014-01-22 15:25:53.000000000 +0100 @@ -1,6 +1,6 @@ /* ncdu - NCurses Disk Usage - Copyright (c) 2007-2012 Yoran Heling + Copyright (c) 2007-2014 Yoran Heling Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the @@ -35,6 +35,9 @@ /* used by the nc* functions and macros */ extern int subwinr, subwinc; +/* used by formatsize to choose between base 2 or 10 prefixes */ +extern int si; + /* Instead of using several ncurses windows, we only draw to stdscr. * the functions nccreate, ncprint and the macros ncaddstr and ncaddch
participants (1)
-
root@hilbert.suse.de