From: Felix Fietkau Date: Sun, 5 Feb 2006 17:43:26 +0000 (+0000) Subject: add multi-language support to webif (currently supported: english, german) X-Git-Tag: whiterussian_rc5~180 X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=e1485830a2aed80cef07a7ef5200820da1dbf873;p=openwrt%2Fsvn-archive%2Fopenwrt.git add multi-language support to webif (currently supported: english, german) SVN-Revision: 3140 --- diff --git a/openwrt/package/webif/Makefile b/openwrt/package/webif/Makefile index 4fe756d114..cc6c26ac77 100644 --- a/openwrt/package/webif/Makefile +++ b/openwrt/package/webif/Makefile @@ -8,6 +8,9 @@ PKG_RELEASE:=1 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION) +# for whiterussian only: +NVRAM_OPTS=-DNVRAM -lnvram -I$(STAGING_DIR)/usr/include -L$(STAGING_DIR)/usr/lib + include $(TOPDIR)/package/rules.mk $(eval $(call PKG_template,WEBIF,webif,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH))) @@ -20,10 +23,14 @@ $(PKG_BUILD_DIR)/.configured: touch $@ $(PKG_BUILD_DIR)/.built: + $(TARGET_CC) $(TARGET_CFLAGS) $(NVRAM_OPTS) -o $(PKG_BUILD_DIR)/webif-page src/webif-page.c + $(STRIP) $(PKG_BUILD_DIR)/webif-page touch $@ $(IPKG_WEBIF): cp -a ./files/* $(IDIR_WEBIF)/ + install -d $(IDIR_WEBIF)/usr/bin + install -m0755 $(PKG_BUILD_DIR)/webif-page $(IDIR_WEBIF)/usr/bin/webif-page find $(IDIR_WEBIF) -name CVS | xargs rm -rf find $(IDIR_WEBIF) -name .svn | xargs rm -rf $(IPKG_BUILD) $(IDIR_WEBIF) $(PACKAGE_DIR) diff --git a/openwrt/package/webif/files/usr/lib/webif/apply.sh b/openwrt/package/webif/files/usr/lib/webif/apply.sh index 8cafa4fa92..1a908cd77e 100644 --- a/openwrt/package/webif/files/usr/lib/webif/apply.sh +++ b/openwrt/package/webif/files/usr/lib/webif/apply.sh @@ -16,7 +16,7 @@ HANDLERS_file=' eval "$(cat /usr/lib/webif/apply-*.sh 2>&-)" reload_network() { - echo Reloading networking settings ... + echo '@TR<> @TR<> ...' grep '^wan_' config-network >&- 2>&- && { ifdown wan ifup wan @@ -31,14 +31,14 @@ reload_network() { } reload_wireless() { - echo Reloading wireless settings ... + echo '@TR<> @TR<> ...' killall nas >&- 2>&- && sleep 2 /sbin/wifi [ -f /etc/init.d/S41wpa ] && /etc/init.d/S41wpa } reload_system() { - echo Applying system settings ... + echo '@TR<> @TR<> ...' echo "$(nvram get wan_hostname)" > /proc/sys/kernel/hostname } @@ -47,7 +47,7 @@ cd /tmp/.webif # file-* other config files for config in $(ls file-* 2>&-); do name=${config#file-} - echo "Processing config file: $name" + echo "@TR<> @TR<>: $name" eval 'case "$name" in '"$HANDLERS_file"' esac' @@ -58,7 +58,7 @@ done cd /proc/self cat /tmp/.webif/config-* 2>&- | grep '=' >&- 2>&- && { cat /tmp/.webif/config-* 2>&- | tee fd/1 | xargs -n1 nvram set - echo "Committing NVRAM ..." + echo "@TR<> NVRAM ..." nvram commit } ) diff --git a/openwrt/package/webif/files/usr/lib/webif/categories.awk b/openwrt/package/webif/files/usr/lib/webif/categories.awk index 26dcf39c5b..00312c93da 100644 --- a/openwrt/package/webif/files/usr/lib/webif/categories.awk +++ b/openwrt/package/webif/files/usr/lib/webif/categories.awk @@ -12,15 +12,15 @@ BEGIN { } ($3 == "name") && ((p[$4] == 0) || (p[$4] > int($5))) { gsub(/^.*\//, "", $1); - p[$4] = int($5) + p[$4] = int($5) + 1 f[$4] = rootdir "/" $1 } END { - print "

Categories:

    " + print "

    @TR<>:

    " diff --git a/openwrt/package/webif/files/usr/lib/webif/common.awk b/openwrt/package/webif/files/usr/lib/webif/common.awk index c6f180b729..f8f44207d3 100644 --- a/openwrt/package/webif/files/usr/lib/webif/common.awk +++ b/openwrt/package/webif/files/usr/lib/webif/common.awk @@ -7,6 +7,6 @@ function start_form(title, field_opts) { function end_form(form_help, form_help_link) { print "
" if (form_help != "") form_help = "
" form_help "
" - print "

Short help:

" form_help form_help_link "
" + print "

@TR<>:

" form_help form_help_link "
" print "
 
" } diff --git a/openwrt/package/webif/files/usr/lib/webif/form.awk b/openwrt/package/webif/files/usr/lib/webif/form.awk index 5c5cf52c83..a35a48a31d 100644 --- a/openwrt/package/webif/files/usr/lib/webif/form.awk +++ b/openwrt/package/webif/files/usr/lib/webif/form.awk @@ -58,6 +58,7 @@ $1 ~ /^select/ { opts = "" if (onchange != "") opts = opts " onClick=\"" onchange "()\" onChange=\"" onchange "()\"" print "" + print ">\" />" } $1 ~ /^caption/ { print "" $2 "" } $1 ~ /^string/ { print $2 } $1 ~ /^text/ { print "" $4 } $1 ~ /^password/ { print "" $4 } $1 ~ /^submit/ { print "" } -$1 ~ /^helpitem/ { form_help = form_help "
" $2 ":
" } -$1 ~ /^helptext/ { form_help = form_help "
" $2 "
" } -$1 ~ /^helplink/ { form_help_link = "" } +$1 ~ /^helpitem/ { form_help = form_help "
" $2 ":
" } +$1 ~ /^helptext/ { form_help = form_help "
" $2 "
" } +$1 ~ /^helplink/ { form_help_link = "" } ($1 ~ /^checkbox/) || ($1 ~ /^radio/) { print $5 diff --git a/openwrt/package/webif/files/usr/lib/webif/lang/de/common.txt b/openwrt/package/webif/files/usr/lib/webif/lang/de/common.txt new file mode 100644 index 0000000000..e88028cd73 --- /dev/null +++ b/openwrt/package/webif/files/usr/lib/webif/lang/de/common.txt @@ -0,0 +1,188 @@ +# Common +Settings saved => Einstellungen gespeichert +Settings not saved => Einstellungen nicht gespeichert +Save Changes => Speichern +Apply Changes => Übernehmen +Clear Changes => Verwerfen +Review Changes => Anzeigen +Host Name => Hostname +Uptime => Uptime +Load => Systemlast +Version => Version +Categories => Kategorien +Subcategories => Unterkategorien +more... => mehr... +Add => Hinzufügen +Remove => Entfernen + +# Categories +Info => Info +About => Über +Router Info => Routerinformationen + +Status => Status +Connections => Netzwerkverbindungen +DHCP => DHCP +Wireless => WLAN + +System => System +Password => Passwort +Settings => Einstellungen +Installed Software => Installierte Software +Firmware Upgrade => Firmware aktualisieren + +Network => Netzwerk +LAN => LAN +WAN => Internet +Wireless => WLAN +Advanced Wireless => WLAN (erweitert) +Hosts => Host-Konfiguration + + +# 'About' page +Copyright => Copyright + +GPL_Text => Dieses Programm ist freie Software. Sie können es unter den Bedingungen der GNU General Public License,
wie von der Free Software Foundation veröffentlicht, weitergeben und/oder modifizieren,
entweder gemäß Version 2 der Lizenz oder (nach Ihrer Option) jeder späteren Version. +Contributions by => Mit Beiträgen von +Layout based on => Layout basiert auf +by => von + + +No config change. => Es wurden keine Konfigurationsänderungen vorgenommen. +Config discarded. => Ihre Konfigurationsänderungen wurden verworfen. +Config changes: => Aktuelle Konfigurationsänderungen: +Updating config... => Aktualisiere die Konfiguration... + + +# 'Router Info' page +Firmware Version => Firmwareversion +Kernel Version => Kernelversion +Current Date/Time => Datum/Uhrzeit +MAC Address => MAC-Adresse + + +# 'Connections' page +Connection Status => Verbindungsstatus +Physical Connections => Netzwerkschnittstellen +Router Connections => Netzwerkverbindungen auf dem Router + + +# 'DHCP' page +DHCP leases => DHCP-Leases +IP Address => IP-Adresse +Name => Name +Expires in => Gültigkeitsdauer + + +# 'Wireless Status' page +Wireless Status => WLAN-Status + +# 'Password' page +Password Change => Passwortänderung +New Password => Neues Passwort +Confirm Password => Passwort bestätigen + +# 'System Settings' page +System Settings => Systemeinstellungen +Host Name => Hostname + + +# 'Installed Software' page +Installed Packages => Installierte Pakete +Update package lists => Paketlisten aktualisieren +Uninstall => Deinstallieren +Install => Installieren + + +# 'Firmware Upgrade' page +Firmware format => Firmware-Format +converting... => konvertiere... +Error => Fehler +done => fertig +Invalid_format => Das Dateiformat der Firmware ist ungültig +Open_failed => Konnte die Firmwaredatei nicht öffnen +Erase_JFFS2 => JFFS2-Partition löschen +Erase NVRAM => NVRAM löschen +Options => Optionen +Firmware_image => Firmware-Datei: +Upgrade => Aktualisieren +Upgrading... => Aktualisiere... + +# 'LAN Settings' page +LAN Settings => Netzwerkeinstellungen +LAN Configuration => Netzwerkkonfiguration +Netmask => Subnetzmaske +Default Gateway => Standardgateway +DNS Servers => DNS-Server +DNS Address => DNS-Serveradresse + +Note => Hinweis +Helptext DNS save => Sie müssen Ihre Änderungen an dieser Seite speichern, bevor Sie DNS-Server hinzufügen oder entfernen + + +# 'WAN Settings' page +WAN Settings => Internet-Einstellungen +WAN Configuration => Internet-Konfiguration +PPTP Server IP => PPTP-Serveradresse +Connection Type => Verbindungsart +No WAN => Keine Verbindung +DHCP => DHCP +Static IP => Statische Konfiguration +IP Settings => IP-Konfiguration +PPP Settings => PPP-Einstellungen +Redial Policy => Verbindungsaufbau +Connect on Demand => Bei Bedarf +Keep Alive => Verbindung aufrechterhalten +Maximum Idle Time => Maximale Wartezeit bei Inaktivität +Redial Timeout => Wartezeit bei unterbrochener Verbindung +MTU => Maximale Paketgröße +Username => Benutzername + + +# 'Wireless Configuration' page +Wireless Configuration => WLAN-Konfiguration +Wireless Interface => WLAN-Interface +WEP Key => WEP-Schlüssel +Selected WEP Key => Ausgewählter WEP Schlüssel +WPA PSK => WPA-Schlüssel +ESSID => ESSID +Channel => Kanal +RADIUS IP Address => RADIUS-Serveradresse +RADIUS Server Key => RADIUS-Serverpasswort +Enabled => Aktiviert +Disabled => Deaktiviert +ESSID Broadcast => ESSID-Broadcast +Show => Anzeigen +Hide => Verstecken +WLAN Mode => Betriebsmodus +Access Point => Access Point +Client => Client +Bridge => Bridge +Ad-Hoc => Ad-Hoc +Operation mode => Betriebsmodus des Funknetzwerks +Encryption Settings => Verschlüsselungseinstellungen +Encryption Type => Verschlüsselungsart +PSK => Passwort +WPA Mode => WPA-Modus +WPA Algorithms => WPA-Verschlüsselungsalgorithmen +WEP Keys => WEP-Schlüssel + +Helptext ESSID => Name des Funknetzwerks + +# 'Advanced Wireless Configuration' page +Advanced Wireless Configuration => WLAN-Konfiguration (erweitert) +WDS Connections => WDS-Verbindungen +MAC Filter List => Zugriffsbeschränkung (MAC-Adresse) +Filter Mode => Filtermodus +Allow => Erlauben +Deny => Verweigern +Set => Setzen +Settings => Einstellungen +Automatic WDS => Automatische WDS-Verbindung + +# "Hosts" page + +MAC Address => MAC-Adresse +Configured Hosts => Konfigurierte Hosts +DHCP Static => Statische DHCP-Einträge +Host Names => Host-Einträge diff --git a/openwrt/package/webif/files/usr/lib/webif/subcategories.awk b/openwrt/package/webif/files/usr/lib/webif/subcategories.awk index b748de2cb4..8891ce44db 100644 --- a/openwrt/package/webif/files/usr/lib/webif/subcategories.awk +++ b/openwrt/package/webif/files/usr/lib/webif/subcategories.awk @@ -1,10 +1,10 @@ BEGIN { FS=":" - print "

Sub-Categories:

    " + print "

    @TR<>:

    " diff --git a/openwrt/package/webif/files/usr/lib/webif/validate.awk b/openwrt/package/webif/files/usr/lib/webif/validate.awk index dfbe120287..20501a24e3 100644 --- a/openwrt/package/webif/files/usr/lib/webif/validate.awk +++ b/openwrt/package/webif/files/usr/lib/webif/validate.awk @@ -20,7 +20,7 @@ BEGIN { $1 == "int" { valid_type = 1 - if (value !~ /^[0-9]*$/) { valid = 0; verr = "Invalid value" } + if (value !~ /^[0-9]*$/) { valid = 0; verr = "@TR<>" } } # FIXME: add proper netmask validation @@ -33,14 +33,14 @@ $1 == "int" { if ((ipaddr[i] < 0) || (ipaddr[i] > 255)) valid = 0 } } - if (valid == 0) verr = "Invalid value" + if (valid == 0) verr = "@TR<>" } $1 == "wep" { valid_type = 1 if (value !~ /^[0-9A-Fa-f]*$/) { valid = 0 - verr = "Invalid value" + verr = "@TR<>" } else if ((length(value) != 0) && (length(value) != 10) && (length(value) != 26)) { valid = 0 verr = "Invalid key length" @@ -54,7 +54,7 @@ $1 == "hostname" { valid_type = 1 if (value !~ /^[0-9a-zA-z\.\-]*$/) { valid = 0 - verr = "Invalid value" + verr = "@TR<>" } } @@ -66,7 +66,7 @@ $1 == "mac" { valid_type = 1 if ((value != "") && (value !~ /^[0-9a-fA-F][0-9a-fA-F]:[0-9a-fA-F][0-9a-fA-F]:[0-9a-fA-F][0-9a-fA-F]:[0-9a-fA-F][0-9a-fA-F]:[0-9a-fA-F][0-9a-fA-F]:[0-9a-fA-F][0-9a-fA-F]$/)) { valid = 0 - verr = "Invalid value" + verr = "@TR<>" } } @@ -107,14 +107,14 @@ valid == 1 { sub(/^max=/, "", max) max = int(max) if ($1 == "int") { - if (value > max) { valid = 0; verr = "Value too large" } + if (value > max) { valid = 0; verr = "@TR<> (@TR<>: " max ")" } } else if ($1 == "string") { - if (length(value) > max) { valid = 0; verr = "Value too large" } + if (length(value) > max) { valid = 0; verr = "@TR<> (@TR<>: " max ")" } } } else if ((options[i] == "nodots") && ($1 == "hostname")) { if (value ~ /\./) { valid = 0 - verr = "Invalid value" + verr = "@TR<>" } } } diff --git a/openwrt/package/webif/files/usr/lib/webif/webif.sh b/openwrt/package/webif/files/usr/lib/webif/webif.sh index 619557fe43..033e192768 100644 --- a/openwrt/package/webif/files/usr/lib/webif/webif.sh +++ b/openwrt/package/webif/files/usr/lib/webif/webif.sh @@ -51,11 +51,11 @@ update_changes() { header() { empty "$ERROR" && { - _saved_title="${SAVED:+: Settings saved}" + _saved_title="${SAVED:+: @TR<>}" } || { FORM_submit=""; ERROR="

    $ERROR



    " - _saved_title=": Settings not saved" + _saved_title=": @TR<>" } _category="$1" @@ -68,7 +68,7 @@ header() { _version="${_version%% ---*}" _head="${3:+

    $3$_saved_title

    }" _form="${5:+
    }" - _savebutton="${5:+

    }" + _savebutton="${5:+

    >\" />

    }" _categories=$(categories $1) _subcategories=${2:+$(subcategories "$1" "$2")} @@ -86,7 +86,7 @@ Pragma: no-cache - OpenWrt Administrative Console + @TR<<OpenWrt Administrative Console>>
    @@ -96,10 +96,10 @@ Pragma: no-cache

    Status:

      -
    • Hostname: $_hostname
    • -
    • Uptime: $_uptime
    • -
    • Load: $_loadavg
    • -
    • Version: $_version
    • +
    • @TR<>: $_hostname
    • +
    • @TR<>: $_uptime
    • +
    • @TR<>: $_loadavg
    • +
    • @TR<>: $_version
    @@ -130,7 +130,7 @@ EOF


    -

    Warning: you haven't set a password for the Web interface and SSH access
    +

    TR{Warning}: you haven't set a password for the Web interface and SSH access
    Please enter one now (the user name in your browser will be 'root').



    @@ -176,9 +176,9 @@ footer() {
@@ -286,3 +286,4 @@ is_bcm947xx() { read _systype < /proc/cpuinfo equal "${_systype##* }" "BCM947XX" } + diff --git a/openwrt/package/webif/files/www/cgi-bin/webif/about.sh b/openwrt/package/webif/files/www/cgi-bin/webif/about.sh index 6a0d664186..abaf27b435 100755 --- a/openwrt/package/webif/files/www/cgi-bin/webif/about.sh +++ b/openwrt/package/webif/files/www/cgi-bin/webif/about.sh @@ -1,23 +1,20 @@ -#!/usr/bin/haserl +#!/usr/bin/webif-page >..." ?> -

webif - OpenWrt Administrative Console

+

webif - @TR<>


-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
+@TR<modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
>>
-Copyright © 2005 Felix Fietkau <openwrt@nbd.name>
+@TR<> © 2005 Felix Fietkau <openwrt@nbd.name>

-Contributions by: +@TR<>: diff --git a/openwrt/package/webif/files/www/cgi-bin/webif/config.sh b/openwrt/package/webif/files/www/cgi-bin/webif/config.sh index 373508d09c..0259537aa4 100755 --- a/openwrt/package/webif/files/www/cgi-bin/webif/config.sh +++ b/openwrt/package/webif/files/www/cgi-bin/webif/config.sh @@ -1,4 +1,4 @@ -#!/usr/bin/haserl +#!/usr/bin/webif-page >";; clear) rm -rf /tmp/.webif >&- 2>&- - header $FORM_cat . "Configuration: cleared." + header $FORM_cat . "@TR<>" CHANGES="" echo "${FORM_prev:+}" ;; review) - header $FORM_cat . "Configuration changes:" + header $FORM_cat . "@TR<>" cd /tmp/.webif for configname in config-*; do grep = $configname >&- 2>&- && { @@ -33,10 +33,10 @@ case "$FORM_mode" in echo $CONFIGFILES ;; save) - header $FORM_cat . "Configuration: updating..." + header $FORM_cat . "@TR<>" CHANGES="" echo "
"
-		sh /usr/lib/webif/apply.sh
+		sh /usr/lib/webif/apply.sh 2>&1
 		echo "
${FORM_prev:+}" ;; esac diff --git a/openwrt/package/webif/files/www/cgi-bin/webif/connection.sh b/openwrt/package/webif/files/www/cgi-bin/webif/connection.sh index 79ce59e20e..cab7ebd7c1 100755 --- a/openwrt/package/webif/files/www/cgi-bin/webif/connection.sh +++ b/openwrt/package/webif/files/www/cgi-bin/webif/connection.sh @@ -1,12 +1,12 @@ -#!/usr/bin/haserl +#!/usr/bin/webif-page >" ?> - + @@ -15,10 +15,10 @@ header "Status" "Connections" "Connection status" - + - +
Ethernet/Wireless physical connections@TR<>


Connections to the router@TR<>
&- ?>
&- | awk '$0 ~ /^Active UNIX/ {ignore = 1}; ignore != 1 { print $0 }' ?>
diff --git a/openwrt/package/webif/files/www/cgi-bin/webif/hosts.sh b/openwrt/package/webif/files/www/cgi-bin/webif/hosts.sh index fd268eb9d6..0757b86d6c 100755 --- a/openwrt/package/webif/files/www/cgi-bin/webif/hosts.sh +++ b/openwrt/package/webif/files/www/cgi-bin/webif/hosts.sh @@ -1,4 +1,4 @@ -#!/usr/bin/haserl +#!/usr/bin/webif-page >|required|$FORM_host_ip +hostname|FORM_host_name|@TR<>|required|$FORM_host_name EOF equal "$?" 0 && update_hosts add "$FORM_host_ip" "$FORM_host_name" } empty "$FORM_add_dhcp" || { # add a host to /etc/ethers validate <>|required|$FORM_dhcp_mac +ip|FORM_dhcp_ip|@TR<>|required|$FORM_dhcp_ip EOF equal "$?" 0 && update_ethers add "$FORM_dhcp_mac" "$FORM_dhcp_ip" } @@ -79,7 +79,7 @@ EOF empty "$FORM_remove_host" || update_hosts del "$FORM_remove_ip" "$FORM_remove_name" empty "$FORM_remove_dhcp" || update_ethers del "$FORM_remove_mac" -header "Network" "Hosts" "Configured hosts" '' +header "Network" "Hosts" "@TR<>" '' # Hosts in /etc/hosts awk -v "url=$SCRIPT_NAME" \ @@ -87,9 +87,9 @@ awk -v "url=$SCRIPT_NAME" \ -v "name=$FORM_host_name" -f /usr/lib/webif/common.awk -f - $HOSTS_FILE <>") print "" - print "" + print "" print "" } @@ -103,7 +103,7 @@ BEGIN { for (i = 2; i <= n; i++) { if (names[i] != "") { if (first != 1) output = output "" - output = output "" + output = output "" first = 0 names_found++ } @@ -116,7 +116,7 @@ BEGIN { END { print "" - print "" + print "" print "" print "
IPHostname
@TR<>@TR<>

" names[i] "Remove
" names[i] "@TR<>
>\\" />
" end_form() @@ -131,19 +131,19 @@ awk -v "url=$SCRIPT_NAME" \ BEGIN { FS="[ \\t]" print "
" - start_form("Static IP addresses (for DHCP)") + start_form("@TR<>") print "" - print "" + print "" } # only for valid MAC addresses (\$1 ~ /^[0-9A-Fa-f][0-9A-Fa-f]:[0-9A-Fa-f][0-9A-Fa-f]:[0-9A-Fa-f][0-9A-Fa-f]:[0-9A-Fa-f][0-9A-Fa-f]:[0-9A-Fa-f][0-9A-Fa-f]:[0-9A-Fa-f][0-9A-Fa-f]$/) { gsub(/#.*$/, ""); - print "" + print "" } END { - print "" + print "" print "
MAC addressIP
@TR<>@TR<>
" \$1 "" \$2 "Remove
" \$1 "" \$2 "@TR<>
>\\" />
" print "" end_form(); diff --git a/openwrt/package/webif/files/www/cgi-bin/webif/index.sh b/openwrt/package/webif/files/www/cgi-bin/webif/index.sh index 3ab14d61da..466b34d208 100755 --- a/openwrt/package/webif/files/www/cgi-bin/webif/index.sh +++ b/openwrt/package/webif/files/www/cgi-bin/webif/index.sh @@ -1,4 +1,4 @@ -#!/usr/bin/haserl +#!/usr/bin/webif-page >" ?>

 
 	
-		Firmware Version
+		@TR<>
 		$_version
 	
 	
-		Kernel Version
+		@TR<>
 		$_kversion
 	
 	
-		Current Date/Time
+		@TR<>
 		$_date
 	
 	
-		MAC-Address
+		@TR<>
 		$_mac
 	
 
diff --git a/openwrt/package/webif/files/www/cgi-bin/webif/ipkg.sh b/openwrt/package/webif/files/www/cgi-bin/webif/ipkg.sh
index 8f2e04d580..620b9424ff 100755
--- a/openwrt/package/webif/files/www/cgi-bin/webif/ipkg.sh
+++ b/openwrt/package/webif/files/www/cgi-bin/webif/ipkg.sh
@@ -1,9 +1,9 @@
-#!/usr/bin/haserl
+#!/usr/bin/webif-page
 >"
 ?>
-

Update package lists

+

@TR<>

-

Installed packages

+

@TR<>

" + print "" } ' ?> @@ -39,7 +39,7 @@ $1 ~ /status/ { if (current != $1) print "" link=$3 gsub(/\+/,"%2B",link) - print "" + print "" current=$1 } ' @@ -51,5 +51,5 @@ $1 ~ /status/ { diff --git a/openwrt/package/webif/files/www/cgi-bin/webif/lan.sh b/openwrt/package/webif/files/www/cgi-bin/webif/lan.sh index b853a7b6eb..3ac9a1545e 100755 --- a/openwrt/package/webif/files/www/cgi-bin/webif/lan.sh +++ b/openwrt/package/webif/files/www/cgi-bin/webif/lan.sh @@ -1,11 +1,11 @@ -#!/usr/bin/haserl +#!/usr/bin/webif-page >|required' && { FORM_dns="$LISTVAL" save_setting network lan_dns "$FORM_dns" } @@ -18,9 +18,9 @@ if empty "$FORM_submit"; then else SAVED=1 validate <>|required|$FORM_lan_ipaddr +netmask|FORM_lan_netmask|@TR<>|required|$FORM_lan_netmask +ip|FORM_lan_gateway|@TR<>||$FORM_lan_gateway EOF equal "$?" 0 && { save_setting network lan_ipaddr $FORM_lan_ipaddr @@ -29,21 +29,21 @@ EOF } fi -header "Network" "LAN" "LAN settings" '' "$SCRIPT_NAME" +header "Network" "LAN" "@TR<>" '' "$SCRIPT_NAME" display_form <> +field|@TR<> text|lan_ipaddr|$FORM_lan_ipaddr -field|Netmask +field|@TR<> text|lan_netmask|$FORM_lan_netmask -field|Default Gateway +field|@TR<> text|lan_gateway|$FORM_lan_gateway end_form -start_form|DNS Servers +start_form|@TR<> listedit|dns|$SCRIPT_NAME?|$FORM_dns|$FORM_dnsadd -helpitem|Note -helptext|You should save your settings on this page before adding/removing DNS servers +helpitem|@TR<> +helptext|@TR<> end_form EOF diff --git a/openwrt/package/webif/files/www/cgi-bin/webif/leases.sh b/openwrt/package/webif/files/www/cgi-bin/webif/leases.sh index ddf506591f..48364f300d 100755 --- a/openwrt/package/webif/files/www/cgi-bin/webif/leases.sh +++ b/openwrt/package/webif/files/www/cgi-bin/webif/leases.sh @@ -1,15 +1,15 @@ -#!/usr/bin/haserl +#!/usr/bin/webif-page >" ?>
" $1 "Remove
" $1 "@TR<>
" $1 "
" $3 "Install
" $3 "@TR<>
- - - - + + + + 0 { diff --git a/openwrt/package/webif/files/www/cgi-bin/webif/password.sh b/openwrt/package/webif/files/www/cgi-bin/webif/password.sh index d0b66eb34d..73967a0956 100755 --- a/openwrt/package/webif/files/www/cgi-bin/webif/password.sh +++ b/openwrt/package/webif/files/www/cgi-bin/webif/password.sh @@ -1,4 +1,4 @@ -#!/usr/bin/haserl +#!/usr/bin/webif-page >" '' "$SCRIPT_NAME" display_form <> +field|@TR<>: password|pw1 -field|Confirm Password: +field|@TR<>: password|pw2 end_form EOF diff --git a/openwrt/package/webif/files/www/cgi-bin/webif/system.sh b/openwrt/package/webif/files/www/cgi-bin/webif/system.sh index ffddf19c70..a169a3b480 100755 --- a/openwrt/package/webif/files/www/cgi-bin/webif/system.sh +++ b/openwrt/package/webif/files/www/cgi-bin/webif/system.sh @@ -1,4 +1,4 @@ -#!/usr/bin/haserl +#!/usr/bin/webif-page >" '' "$SCRIPT_NAME" is_bcm947xx && bootwait_form="field|boot_wait -radio|boot_wait|$FORM_boot_wait|on|On
-radio|boot_wait|$FORM_boot_wait|off|Off" +select|boot_wait|$FORM_boot_wait +option|on|@TR<> +option|off|@TR<>" display_form <> +field|@TR<> text|hostname|$FORM_hostname $bootwait_form field diff --git a/openwrt/package/webif/files/www/cgi-bin/webif/upgrade.sh b/openwrt/package/webif/files/www/cgi-bin/webif/upgrade.sh index 32b75e243b..0715daa4ca 100755 --- a/openwrt/package/webif/files/www/cgi-bin/webif/upgrade.sh +++ b/openwrt/package/webif/files/www/cgi-bin/webif/upgrade.sh @@ -1,7 +1,7 @@ -#!/usr/bin/haserl -u +#!/usr/bin/webif-page -u >" strip_cybertan() { ( @@ -17,24 +17,24 @@ empty "$FORM_submit" || empty "$FORM_firmware" || { grep BCM947 /proc/cpuinfo > /dev/null && { case "$HEADER" in 48445230) # TRX - echo "Firmware is in TRX format
" + echo "@TR<>: TRX
" mv $FORM_firmware /tmp/upgrade.bin UPGRADE=1 ;; 57353447|57353453|57353473) # WRT54G(S) - echo "Firmware is in Cybertan BIN format, converting... " + echo "@TR<>: Cybertan BIN =< @TR<> " strip_cybertan - echo "done
" + echo "@TR<>.
" UPGRADE=1 ;; *) rm $FORM_firmware - ERROR="

Error: Invalid firmware file format

" + ERROR="

@TR<>: @TR<>

" ;; esac } } || { - ERROR="

Error: Couldn't open firmware file

" + ERROR="

@TR<>: @TR<>

" } } ?> @@ -43,20 +43,20 @@ empty "$FORM_submit" || empty "$FORM_firmware" || {
MAC AddressIP AddressNameExpires in@TR<>@TR<>@TR<>@TR<>
- + - + +
Options:@TR<>: - Erase JFFS2 partition
- Erase NVRAM + @TR<>
+ @TR<>
Firmware image to upload:@TR<>
-
@@ -66,14 +66,14 @@ empty "$FORM_submit" || empty "$FORM_firmware" || { ERASE="${FORM_erase_fs:+-e linux }" ERASE="$ERASE${FORM_erase_nvram:+-e nvram }" cp /bin/busybox /tmp/ - echo -n 'Upgrading... ' + echo -n '@TR<> ' # FIXME: probably a race condition (with the reboot), but it seems to work - mtd -r $ERASE write /tmp/upgrade.bin linux 2>&- | awk 'END { print "done." }' + mtd -r $ERASE write /tmp/upgrade.bin linux 2>&- | awk 'END { print "@TR<>." }' exit ?> diff --git a/openwrt/package/webif/files/www/cgi-bin/webif/wan.sh b/openwrt/package/webif/files/www/cgi-bin/webif/wan.sh index f506c2ddda..5359b04b33 100755 --- a/openwrt/package/webif/files/www/cgi-bin/webif/wan.sh +++ b/openwrt/package/webif/files/www/cgi-bin/webif/wan.sh @@ -1,4 +1,4 @@ -#!/usr/bin/haserl +#!/usr/bin/webif-page >|required' && { FORM_dns="$LISTVAL" save_setting network wan_dns "$FORM_dns" } @@ -44,7 +44,7 @@ else SAVED=1 empty "$FORM_wan_proto" && { - ERROR="No WAN protocol selected" + ERROR="@TR<>" return 255 } @@ -59,10 +59,10 @@ else esac validate <>|$V_IP|$FORM_wan_ipaddr +netmask|FORM_wan_netmask|@TR<>|$V_NM|$FORM_wan_netmask +ip|FORM_wan_gateway|@TR<>||$FORM_wan_gateway +ip|FORM_pptp_server_ip|@TR<>|$V_PPTP|$FORM_pptp_server_ip EOF equal "$?" 0 && { save_setting network wan_proto $FORM_wan_proto @@ -126,7 +126,7 @@ text|pptp_server_ip|$FORM_pptp_server_ip" } -header "Network" "WAN" "WAN settings" ' onLoad="modechange()" ' "$SCRIPT_NAME" +header "Network" "WAN" "@TR<>" ' onLoad="modechange()" ' "$SCRIPT_NAME" cat < @@ -162,44 +162,44 @@ EOF display_form < -radio|wan_proto|$FORM_wan_proto|dhcp|DHCP
-radio|wan_proto|$FORM_wan_proto|static|Static IP
+start_form|@TR<> +field|@TR<> +radio|wan_proto|$FORM_wan_proto|none|@TR<>
+radio|wan_proto|$FORM_wan_proto|dhcp|@TR<>
+radio|wan_proto|$FORM_wan_proto|static|@TR<>
$PPPOE_OPTION $PPTP_OPTION end_form - -start_form|IP Settings|ip_settings|hidden -field|Internet IP Address|wan_ipaddr|hidden +tatus +start_form|@TR<>|ip_settings|hidden +field|@TR<>|wan_ipaddr|hidden text|wan_ipaddr|$FORM_wan_ipaddr -field|Subnet Mask|wan_netmask|hidden +field|@TR<>|wan_netmask|hidden text|wan_netmask|$FORM_wan_netmask -field|Gateway|wan_gateway|hidden +field|@TR<>|wan_gateway|hidden text|wan_gateway|$FORM_wan_gateway $PPTP_SERVER_OPTION end_form -start_form|DNS Servers|wan_dns|hidden +start_form|@TR<>|wan_dns|hidden listedit|dns|$SCRIPT_NAME?wan_proto=static&|$FORM_dns|$FORM_dnsadd -helpitem|Note -helptext|You should save your settings on this page before adding/removing DNS servers +helpitem|@TR<> +helptext|@TR<> end_form -start_form|PPP Settings|ppp_settings|hidden -field|PPP Redial Policy|ppp_redial|hidden -radio|ppp_redial|$FORM_ppp_redial|demand|Connect on Demand
-radio|ppp_redial|$FORM_ppp_redial|persist|Keep Alive -field|Maximum Idle Time|ppp_demand_idletime|hidden +start_form|@TR<>|ppp_settings|hidden +field|@TR<>|ppp_redial|hidden +radio|ppp_redial|$FORM_ppp_redial|demand|@TR<>
+radio|ppp_redial|$FORM_ppp_redial|persist|@TR<> +field|@TR<>|ppp_demand_idletime|hidden text|ppp_idletime|$FORM_ppp_idletime -field|Redial Timeout|ppp_persist_redialperiod|hidden +field|@TR<>|ppp_persist_redialperiod|hidden text|ppp_redialperiod|$FORM_ppp_redialperiod -field|PPP Username|ppp_username|hidden +field|@TR<>|ppp_username|hidden text|ppp_username|$FORM_ppp_username -field|PPP Password|ppp_passwd|hidden -text|ppp_passwd|$FORM_ppp_passwd -field|PPP MTU|ppp_mtu|hidden +field|@TR<>|ppp_passwd|hidden +password|ppp_passwd|$FORM_ppp_passwd +field|@TR<>|ppp_mtu|hidden text|ppp_mtu|$FORM_ppp_mtu end_form EOF diff --git a/openwrt/package/webif/files/www/cgi-bin/webif/wireless-advanced.sh b/openwrt/package/webif/files/www/cgi-bin/webif/wireless-advanced.sh index 1157bf460b..f8e4a3613d 100755 --- a/openwrt/package/webif/files/www/cgi-bin/webif/wireless-advanced.sh +++ b/openwrt/package/webif/files/www/cgi-bin/webif/wireless-advanced.sh @@ -1,4 +1,4 @@ -#!/usr/bin/haserl +#!/usr/bin/webif-page >" ' onLoad="modechange()"' "$SCRIPT_NAME" cat < @@ -55,32 +50,30 @@ function modechange() { } -
EOF display_form <> listedit|wds|$SCRIPT_NAME?|$FORM_wds|$FORM_wdsadd end_form -start_form|MAC filter list +start_form|@TR<> listedit|maclist|$SCRIPT_NAME?|$FORM_maclist|$FORM_maclistadd -field -caption|Filter mode: +end_form +start_form|@TR<> +field|@TR<> +select|lazywds|$FORM_lazywds +option|1|@TR<> +option|0|@TR<> +field|@TR<>: select|macmode|$FORM_macmode -option|disabled -option|allow -option|deny -submit|macmode_set|Set -field|Lazy WDS -radio|lazywds|$FORM_lazywds|1|Enabled
-radio|lazywds|$FORM_lazywds|0|Disabled +option|disabled|@TR<> +option|allow|@TR<> +option|deny|@TR<> end_form EOF -?> - - +footer ?> diff --git a/openwrt/package/webif/files/www/cgi-bin/webif/wireless-config.sh b/openwrt/package/webif/files/www/cgi-bin/webif/wireless-config.sh index e1e5e21f0f..f069b74f1e 100755 --- a/openwrt/package/webif/files/www/cgi-bin/webif/wireless-config.sh +++ b/openwrt/package/webif/files/www/cgi-bin/webif/wireless-config.sh @@ -1,4 +1,4 @@ -#!/usr/bin/haserl +#!/usr/bin/webif-page >|min=4 max=63 required|$FORM_radius_key +ip|FORM_radius_ipaddr|@TR<>|required|$FORM_radius_ipaddr";; + psk) V_PSK="wpapsk|FORM_wpa_psk|@TR<>|required|$FORM_wpa_psk";; wep) V_WEP=" -int|FORM_key|WEP key number|min=1 max=4|$FORM_key -wep|FORM_key1|WEP key 1||$FORM_key1 -wep|FORM_key2|WEP key 2||$FORM_key2 -wep|FORM_key3|WEP key 3||$FORM_key3 -wep|FORM_key4|WEP key 4||$FORM_key4";; +int|FORM_key|@TR<>|min=1 max=4|$FORM_key +wep|FORM_key1|@TR<> 1||$FORM_key1 +wep|FORM_key2|@TR<> 2||$FORM_key2 +wep|FORM_key3|@TR<> 3||$FORM_key3 +wep|FORM_key4|@TR<> 4||$FORM_key4";; esac validate <>|required|$FORM_ssid +int|FORM_channel|@TR<>|required min=1 max=$CHANNEL_MAX|$FORM_channel $V_WEP $V_RADIUS $V_PSK @@ -175,7 +175,7 @@ EOF } fi -header "Network" "Wireless" "Wireless settings" ' onLoad="modechange()" ' "$SCRIPT_NAME" +header "Network" "Wireless" "@TR<>" ' onLoad="modechange()" ' "$SCRIPT_NAME" cat < @@ -183,35 +183,32 @@ cat < -radio|radio|$FORM_radio|0|Disabled -field|Broadcast -radio|broadcast|$FORM_broadcast|0|Enabled
-radio|broadcast|$FORM_broadcast|1|Disabled -field|ESSID +start_form|@TR<> +field|@TR<> +select|radio|$FORM_radio +option|1|@TR<> +option|0|@TR<> +field|@TR<> +select|broadcast|$FORM_broadcast +option|0|@TR<> +option|1|@TR<> +field|@TR<> text|ssid|$FORM_ssid -helpitem|ESSID -helptext|Name of your Wireless Network -field|Channel +helpitem|@TR<> +helptext|@TR<> +field|@TR<> select|channel|$FORM_channel $F_CHANNELS -field|Mode -radio|mode|$FORM_mode|ap|Access Point
-radio|mode|$FORM_mode|sta|Client
-radio|mode|$FORM_mode|wet|Bridge
-radio|mode|$FORM_mode|adhoc|Ad-Hoc -helpitem|Mode -helptext|Operation mode +field|@TR<> +select|mode|$FORM_mode +option|ap|@TR<> +option|sta|@TR<> +option|wet|@TR<> (@TR<>) +option|adhoc|@TR<> +helpitem|@TR<> +helptext|@TR<> helplink|http://wiki.openwrt.org/OpenWrtDocs/Configuration#head-7126c5958e237d603674b3a9739c9d23bdfdb293 end_form -start_form|Encryption settings -field|Encryption type -radio|encryption|$FORM_encryption|off|Disabled
-radio|encryption|$FORM_encryption|wep|WEP
-radio|encryption|$FORM_encryption|psk|WPA (preshared key)
-radio|encryption|$FORM_encryption|wpa|WPA (RADIUS) -field|WPA support|wpa_support|hidden +start_form|@TR<> +field|@TR<> +select|encryption|$FORM_encryption +option|off|@TR<> +option|wep|WEP +option|psk|WPA (@TR<>) +option|wpa|WPA (RADIUS) +field|@TR<>|wpa_support|hidden checkbox|wpa1|$FORM_wpa1|wpa1|WPA1 checkbox|wpa2|$FORM_wpa2|wpa2|WPA2 -field|WPA encryption type|wpa_crypto|hidden +field|@TR<>|wpa_crypto|hidden checkbox|tkip|$FORM_tkip|tkip|RC4 (TKIP) checkbox|aes|$FORM_aes|aes|AES -field|WPA preshared key|wpapsk|hidden +field|WPA @TR<>|wpapsk|hidden text|wpa_psk|$FORM_wpa_psk -field|RADIUS Server IP|radius_ip|hidden +field|@TR<>|radius_ip|hidden text|radius_ipaddr|$FORM_radius_ipaddr -field|RADIUS Server Key|radiuskey|hidden +field|@TR<>|radiuskey|hidden text|radius_key|$FORM_radius_key -field|WEP keys|wep_keys|hidden +field|@TR<>|wep_keys|hidden radio|key|$FORM_key|1 text|key1|$FORM_key1|
radio|key|$FORM_key|2 diff --git a/openwrt/package/webif/files/www/cgi-bin/webif/wireless-status.sh b/openwrt/package/webif/files/www/cgi-bin/webif/wireless-status.sh index b718a6eeb7..47c044efaf 100755 --- a/openwrt/package/webif/files/www/cgi-bin/webif/wireless-status.sh +++ b/openwrt/package/webif/files/www/cgi-bin/webif/wireless-status.sh @@ -1,7 +1,7 @@ -#!/usr/bin/haserl +#!/usr/bin/webif-page >" ?>
&1 | grep -v 'no wireless' | grep '\w' ?>
diff --git a/openwrt/package/webif/files/www/webif.js b/openwrt/package/webif/files/www/webif.js index 8bdef4dd66..64d26cd8b5 100644 --- a/openwrt/package/webif/files/www/webif.js +++ b/openwrt/package/webif/files/www/webif.js @@ -3,6 +3,10 @@ function value(name) var item = document.getElementById(name); return (item ? item.value : ""); } +function isset(name, val) +{ + return (value(name) == val); +} function checked(name) { var item = document.getElementById(name); diff --git a/openwrt/package/webif/src/webif-page.c b/openwrt/package/webif/src/webif-page.c new file mode 100644 index 0000000000..f06071ffad --- /dev/null +++ b/openwrt/package/webif/src/webif-page.c @@ -0,0 +1,246 @@ +/* + * Webif page translator + * + * Copyright (C) 2005 Felix Fietkau + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + + +#include +#include +#include +#include +#include +#ifdef NVRAM +#include +#endif + +#define HASH_MAX 100 +#define LINE_BUF 1024 /* max. buffer allocated for one line */ +#define MAX_TR 32 /* max. translations done on one line */ +#define TR_START "@TR<<" +#define TR_END ">>" + +struct lstr { + char *name; + char *value; + struct lstr *next; +}; +typedef struct lstr lstr; + +static lstr *ltable[HASH_MAX]; +static char buf[LINE_BUF], buf2[LINE_BUF]; + +/* djb2 hash function */ +static inline unsigned long hash(char *str) +{ + unsigned long hash = 5381; + int c; + + while ((c = *str++)) + hash = ((hash << 5) + hash) + c; /* hash * 33 + c */ + + return hash; +} + +static inline char *translate_lookup(char *str) +{ + char *name, *def, *p, *res = NULL; + lstr *i; + int h; + + def = name = str; + if (((p = strchr(str, '|')) != NULL) + || ((p = strchr(str, '#')) != NULL)) { + def = p + 1; + *p = 0; + } + + h = hash(name) % HASH_MAX; + i = ltable[h]; + while ((res == NULL) && (i != NULL)) { + if (strcmp(name, i->name) == 0) + res = i->value; + i = i->next; + } + + if (res == NULL) + res = def; + + return res; +} + +static inline void add_line(char *name, char *value) +{ + int h = hash(name) % HASH_MAX; + lstr *s = malloc(sizeof(lstr)); + lstr *p; + + s->name = strdup(name); + s->value = strdup(value); + s->next = NULL; + + if (ltable[h] == NULL) + ltable[h] = s; + else { + for(p = ltable[h]; p->next != NULL; p = p->next); + p->next = s; + } +} + +static char *translate_line(char *line) +{ + static char *tok[MAX_TR * 3]; + char *l, *p, *p2, *res; + int len = 0, pos = 0, i; + + l = line; + while (l != NULL) { + if ((p = strstr(l, TR_START)) == NULL) { + len += strlen((tok[pos++] = l)); + break; + } + + p2 = strstr(p, TR_END); + if (p2 == NULL) + break; + + *p = 0; + *p2 = 0; + len += strlen((tok[pos++] = l)); + len += strlen((tok[pos++] = translate_lookup(p + strlen(TR_START)))); + + l = p2; + l += strlen(TR_END); + } + len++; + + if (len > LINE_BUF) + p = malloc(len); + else + p = buf2; + + p[0] = 0; + res = p; + for (i = 0; i < pos; i++) { + strcat(p, tok[i]); + p += strlen(tok[i]); + } + + return res; +} + +/* load and parse language file */ +static void load_lang(char *file) +{ + FILE *f; + char *b, *name, *value; + + f = fopen(file, "r"); + while (!feof(f) && (fgets(buf, LINE_BUF - 1, f) != NULL)) { + b = buf; + while (isspace(*b)) + b++; /* skip leading spaces */ + if (!*b) + continue; + + name = b; + if ((b = strstr(name, "=>")) == NULL) + continue; /* separator not found */ + + value = b + 2; + if (!*value) + continue; + + *b = 0; + for (b--; isspace(*b); b--) + *b = 0; /* remove trailing spaces */ + + while (isspace(*value)) + value++; /* skip leading spaces */ + + for (b = value + strlen(value) - 1; isspace(*b); b--) + *b = 0; /* remove trailing spaces */ + + if (!*value) + continue; + + add_line(name, value); + } +} + +int main (int argc, char **argv) +{ + FILE *f; + int len, i; + char line[LINE_BUF]; + glob_t langfiles; + char *lang = NULL; + + memset(ltable, 0, HASH_MAX * sizeof(lstr *)); +#ifdef NVRAM + if ((lang = nvram_get("language")) != NULL) { +#else + if ((f = fopen("/etc/config/webif", "r")) != NULL) { + int n, i; + + while (!feof(f) && (lang == NULL)) { + fgets(line, LINE_BUF - 1, f); + + if (strncasecmp(line, "lang", 4) != 0) + goto nomatch; + + lang = line + 4; + while (isspace(*lang)) + lang++; + + if (*lang != '=') + goto nomatch; + + lang++; + + while (isspace(*lang)) + lang++; + + for (i = 0; isalpha(lang[i]) && (i < 32); i++); + lang[i] = 0; + continue; +nomatch: + lang = NULL; + } + fclose(f); +#endif + + sprintf(buf, "/usr/lib/webif/lang/%s/*.txt", lang); + i = glob(buf, GLOB_ERR | GLOB_MARK, NULL, &langfiles); + if (i == GLOB_NOSPACE || i == GLOB_ABORTED || i == GLOB_NOMATCH) { + // no language files found + } else { + for (i = 0; i < langfiles.gl_pathc; --i) { + load_lang(langfiles.gl_pathv[i]); + } + } + } + + i = 1; + strcpy(buf, "/usr/bin/haserl"); + while (argv[i]) { + sprintf(buf + strlen(buf), " %s", argv[i++]); + } + f = popen(buf, "r"); + + while (!feof(f) && (fgets(buf, LINE_BUF - 1, f)) != NULL) { + fprintf(stdout, "%s", translate_line(buf)); + } + + return 0; +}