summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDirk Engling <erdgeist@erdgeist.org>2014-02-23 20:39:54 +0100
committerDirk Engling <erdgeist@erdgeist.org>2014-02-23 20:39:54 +0100
commit10d7fe4252cf795c72e0d718db3f0836afa4888f (patch)
tree2d4fbee278101606af3cda83224c60154960396b
parenteda2f093c8e4696b46c40f4f0fc47f6f230923a0 (diff)
Add handling Telefonbuch version 1 in main script
-rwxr-xr-xsrc/makecolumns.sh39
1 files changed, 33 insertions, 6 deletions
diff --git a/src/makecolumns.sh b/src/makecolumns.sh
index 28dd0a8..0f9c5ba 100755
--- a/src/makecolumns.sh
+++ b/src/makecolumns.sh
@@ -23,15 +23,17 @@ main() {
23 make binaries 23 make binaries
24 24
25 printf "Cleaning up old working directory ... " 25 printf "Cleaning up old working directory ... "
26 rm -rf ../work_`basename ${1#white_}` 26 rm -rf ../work_`basename "${1#white_}"`
27 printf "done.\n" 27 printf "done.\n"
28 mkdir -p ../work_`basename ${1#white_}` 28 mkdir -p ../work_`basename "${1#white_}"`
29 cd ../work_`basename ${1#white_}` || exit 1 29 cd ../work_`basename "${1#white_}"` || exit 1
30 30
31 if [ -f "$1/phonebook.db" ]; then 31 if [ -f "$1/phonebook.db" ]; then
32 handle_format_version_3 $1 32 handle_format_version_3 "${1}"
33 elif [ -f $1/[Dd][Aa][Tt]/[Tt][Ee][Ii][Ll][Nn].[Dd][Aa][Tt] ]; then 33 elif [ -f "${1}/[Dd][Aa][Tt]/[Tt][Ee][Ii][Ll][Nn].[Dd][Aa][Tt]" ]; then
34 handle_format_version_2 $1 34 handle_format_version_2 "${1}"
35 elif [ -n "`find "${1}" -name dpr00000.005 -ls -quit`" ]; then
36 handle_format_version_1 "${1}"
35 else 37 else
36 echo "Not a recognized Telefonbuch folder" 38 echo "Not a recognized Telefonbuch folder"
37 fi 39 fi
@@ -81,6 +83,31 @@ get_dword() {
81 hexdump -n 4 -v -e '" " 1/4 "%u"' `printf %0${filename_len}d ${1}` 83 hexdump -n 4 -v -e '" " 1/4 "%u"' `printf %0${filename_len}d ${1}`
82} 84}
83 85
86handle_format_version_1() {
87 echo "Working on $1. Detected pre-02/1996 Telefonbuch version."
88 # Extract all dpr database files
89 printf "Extracting dpr databases ... "
90 find "$1" -name dpr\*.001 | extract_version_1
91 printf "done.\n"
92
93 # rename our extracted columns
94 mv 01_unknown 01_Flags
95 mv 02_unknown 02_Nachname
96 mv 03_unknown 03_Vorname
97 mv 04_unknown 05_Adresszusatz
98 mv 05_unknown 06_Ortszusatz
99 mv 06_unknown 10_Zustellamt_PLZOst
100 mv 07_unknown 07_Strasse
101 mv 08_unknown 08_Hausnummer
102 mv 09_unknown 04_Namenszusatz
103 mv 10_unknown 09_Fax_Verweise
104 mv 11_unknown 12_Vorwahl
105 mv 12_unknown 13_Rufnummer
106 mv 13_unknown 11_Ort
107 mv 14_unknown 10_Postleitzahl
108}
109
110
84handle_format_version_2() { 111handle_format_version_2() {
85 echo "Working on $1. Detected pre-2004 Telefonbuch version." 112 echo "Working on $1. Detected pre-2004 Telefonbuch version."
86 # Extract teiln.dat 113 # Extract teiln.dat