#! /bin/sh #set -x if [ $# -lt 1 ]; then echo "Too few arguments." exit fi if [ "$1" = "--help" -o "$1" = "-h" ]; then cat<$sedcmd s/Jan/Januar/g s/Feb/Februar/g s/Mar/März/g s/Apr/April/g s/May/Mai/g s/Jun/Juni/g s/Jul/Juli/g s/Aug/August/g s/Sep/September/g s/Oct/Oktober/g s/Nov/November/g s/Dec/Dezember/g EOT } gen_seccvt() { cat<$sedcmd /.SH/ { s/"//g s/.SH NAME/.SH BEZEICHNUNG/ s/.SH SYNOPSIS/.SH "ÜBERSICHT"/ s/.SH DESCRIPTION/.SH BESCHREIBUNG/ s/.SH OPTIONS/.SH OPTIONEN/ s/.SH "?RETURN VALUES"?/.SH "RÜCKGABEWERTE"/ s/.SH "?RETURN VALUE"?/.SH "RÜCKGABEWERT"/ s/.SH CONFIG/.SH KONFIGURATION/ s/.SH "?CONFORMING TO"?/.SH "KONFORM ZU"/ s/.SH DIAGNOSTICS/.SH DIAGNOSE/ s/.SH ENVIRONMENT/.SH UMGEBUNGSVARIABLEN/ s/.SH ERRORS/.SH FEHLER/ s/.SH EXAMPLE/.SH BEISPIEL/ s/.SH EXAMPLES/.SH BEISPIELE/ s/.SH FILES/.SH DATEIEN/ s/.SH HISTORY/.SH GESCHICHTE/ s/.SH NOTES/.SH ANMERKUNGEN/ s/.SH REMARKS/.SH BEMERKUNGEN/ s/.SH RESTRICTIONS/.SH EINSCHRÄNKUNGEN/ s/.SH WARNING/.SH WARNUNG/ s/.SH WARNINGS/.SH WARNUNGEN/ s/.SH CAVEAT/.SH WARNUNG/ s/.SH CEAVEATS/.SH WARNUNGEN/ s/.SH BUGS/.SH BUGS/ s/.SH "?SEE ALSO"?/.SH "SIEHE AUCH"/ s/.SH AUTHORS/.SH AUTOREN/ s/.SH AUTHOR/.SH AUTOR/ } EOT } realname=`grep "^$LOGNAME:" /etc/passwd|cut -d: -f5|cut -d, -f1` for file in $*; do sec=`echo $file|sed 's/.*\.\([1-9]\)$/\1/g'` page=`echo $file|sed 's/^\(.*\)\.[1-9]$/\1/g'` if [ -f $file ]; then mv $file $file.en filename=$file.en else filename=$libdir/man$sec/$file fi #filename=/tmp/readv.3 out=$page.$sec if [ -f $filename ]; then if [ "`head -1 $filename|sed 's/^\.so/yes/g'`" = "yes" ]; then echo "$page($sec) is a link" continue fi ( line=`grep -n '^\.TH' $filename` ln=`echo $line|cut -d: -f1` ln=`expr $ln - 2` line=`echo $line|cut -d: -f2-` sed '/\.TH/,$d' $filename|head -$ln lastline=`sed '/\.TH/,$d' $filename|tail -1` if [ "$lastline" = ".\\\"" ]; then echo ".\\\" Translated into German by $realname ($LOGNAME@`hostname -f`)" echo $lastline else echo $lastline echo ".\\\" Translated into German by $realname ($LOGNAME@`hostname -f`)" echo ".\\\"" fi th_title=`echo $line |awk '{print $2}'` th_section=`echo $line |awk '{print $3}'` line=`echo $line|sed "s/.*"$th_title" *"$th_section" *\"[^\"]*\" *\(.*\)$/\1/g"` if [ "`echo $line|cut -c1 `" = "\"" ]; then th_source=`echo $line|cut -d'"' -f2` else th_section=`echo $line |awk '{print $4}'` fi gen_monthcvt date=`date +"%d. %b %Y"|sed -e 's/^0//g' -f $sedcmd` case $sec in 1) manual="Dienstprogramme für Benutzer";; 2) manual="Systemaufrufe";; 3) manual="Bibliotheksfunktionen";; 4) manual="Gerätedateien";; 5) manual="Dateiformate";; 6) manual="Spiele und Demonstrationen";; 7) manual="Verschiedenes";; 8) manual="Dienstprogramme zur Systemverwaltung";; 9) manual="Kernelfunktionen";; *) manual="$th_manual";; esac printf ".TH %s %d \"%s\" \"%s\" \"%s\"\n" \ $th_title $th_section "$date" "$th_source" "$manual" gen_seccvt ( sed -e '1,/^\.TH/d' -e '/^\.SH "SEE ALSO"/,$d' $filename ln=`sed -e '1,/^\.SH "SEE ALSO"/d' -e '/^\.SH/,$d' $filename|wc -l|tr -d ' '` sed -e '1,/^\.SH "SEE ALSO"/d' $filename |sed 1,${ln}d echo ".SH \"SEE ALSO\"" sed -e '1,/^\.SH "SEE ALSO"/d' -e '/^\.SH/,$d' $filename \ | sed -e 's/\"//g' -e 's/,//g' -e 's/^\.BR //g' -e 's/^\.B //g' \ | tr '\n' ' '| tr -s ' ' \ | sed 's/\([^ ]* ([^)]*)\)/.BR \1,\ /g' | sed 's/^ *//g' ) | sed -f $sedcmd ) > $out fi done rm -f $sedcmd