From 79c402cacf38d6e59d1872c42c569672e3796396 Mon Sep 17 00:00:00 2001 From: PHO Date: Sun, 7 Dec 2008 01:57:58 +0900 Subject: [PATCH] Still in early development... --- GNUmakefile | 3 ++- dot-files/_screenrc | 10 ++++++++++ tools/find-missing.pl | 9 ++------- tools/find-outdated.pl | 28 ++++++++++++++++++++++++++++ tools/utils.pl | 11 +++++++++++ 5 files changed, 53 insertions(+), 8 deletions(-) create mode 100644 dot-files/_screenrc create mode 100644 tools/find-outdated.pl create mode 100644 tools/utils.pl diff --git a/GNUmakefile b/GNUmakefile index 42f1663..325e68e 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -1,4 +1,5 @@ lint: - perl ./tools/list-files.pl | perl ./tools/find-missing.pl + @perl ./tools/list-files.pl | perl ./tools/find-missing.pl + @perl ./tools/list-files.pl | perl ./tools/find-outdated.pl .PHONY: lint \ No newline at end of file diff --git a/dot-files/_screenrc b/dot-files/_screenrc new file mode 100644 index 0000000..573e24a --- /dev/null +++ b/dot-files/_screenrc @@ -0,0 +1,10 @@ +escape ^Z^Z +vbell off + +defscrollback 50000 +defutf8 on +defflow off + +shelltitle '% |zsh' + +hardstatus alwayslastline "[%02c] %`%-w%{=b rw}%n %t%{-}%+w" diff --git a/tools/find-missing.pl b/tools/find-missing.pl index 552b77b..829af27 100644 --- a/tools/find-missing.pl +++ b/tools/find-missing.pl @@ -1,6 +1,8 @@ use strict; use warnings; use Smart::Comments; +use lib 'tools'; +require 'utils.pl'; sub main { while (defined(my $rel = <>)) { @@ -13,11 +15,4 @@ sub main { } } -sub rel2saved { - my $rel = shift; - - $rel =~ tr/./_/; - return "./dot-files/$rel"; -} - main(); diff --git a/tools/find-outdated.pl b/tools/find-outdated.pl new file mode 100644 index 0000000..b7e1c8e --- /dev/null +++ b/tools/find-outdated.pl @@ -0,0 +1,28 @@ +use strict; +use warnings; +use Smart::Comments; +use lib 'tools'; +require 'utils.pl'; +use File::stat; +use File::Spec; +use File::Compare; + +sub main { + while (defined(my $rel = <>)) { + chomp $rel; + my $saved = rel2saved($rel); + next if !-e $saved; + + my $abs = File::Spec->rel2abs($rel, $ENV{HOME}); + + my $current_st = stat($abs); + my $saved_st = stat($saved); + + if ($current_st->mtime < $saved_st->mtime && + compare($abs, $saved) != 0) { + print "U $rel\n"; + } + } +} + +main(); diff --git a/tools/utils.pl b/tools/utils.pl new file mode 100644 index 0000000..02cd1fb --- /dev/null +++ b/tools/utils.pl @@ -0,0 +1,11 @@ +use strict; +use warnings; + +sub rel2saved { + my $rel = shift; + + $rel =~ tr/./_/; + return "./dot-files/$rel"; +} + +1; -- 2.40.0