Re: [RFR] man://manpages-de/printf.3 4/4
Das Finale: 380 Zeilen PO für 125 Zeilen Ausgabe.
Martin
******************************************************************************
#. type: Plain text
msgid ""
"Linux libc4 knows about the five C standard flags. It knows about the "
"length modifiers B<h>, B<l>, B<L>, and the conversions B<c>, B<d>, B<e>, "
"B<E>, B<f>, B<F>, B<g>, B<G>, B<i>, B<n>, B<o>, B<p>, B<s>, B<u>, B<x>,
and "
"B<X>, where B<F> is a synonym for B<f>. Additionally, it accepts B<D>, "
"B<O>, and B<U> as synonyms for B<ld>, B<lo>, and B<lu>. (This is bad,
and "
"caused serious bugs later, when support for B<%D> disappeared.) No
locale-"
"dependent radix character, no thousands' separator, no NaN or infinity,
no "
"\"%m$\" and \"*m$\"."
msgstr ""
"Linux Libc4 kennt die fünf C-Standardschalter, die Längenmodifikatoren "
"B<h>, B<l>, B<L> und die Umwandlungen B<c>, B<d>, B<e>, B<E>, B<f>, B<F>, "
"B<g>, B<G>, B<i>, B<n>, B<o>, B<p>, B<s>, B<u>, B<x> und B<X>, wobei B<F> "
"ein Synonym für B<f> ist. Zusätzlich akzeptiert sie B<D>, B<O> und B<U> "
"als synonyme für B<ld>, B<lo> und B<lu>. (Das ist schlecht und
verursachte "
"später schwere Fehler, als die Unterstützung für B<%D> auslief.) Sie
kennt "
"kein von der Locale abhängiges Radixzeichen, kein Tausender-Trennzeichen, "
"kein NaN oder Unendlich und schließlich auch nicht »%m$« and »*m$«."
#. type: Plain text
msgid ""
"Linux libc5 knows about the five C standard flags and the \\(aq flag, "
"locale, \"%m$\" and \"*m$\". It knows about the length modifiers B<h>, "
"B<l>, B<L>, B<Z>, and B<q>, but accepts B<L> and B<q> both for I<long "
"double> and for I<long long int> (this is a bug). It no longer
recognizes "
"B<F>, B<D>, B<O>, and B<U>, but adds the conversion character B<m>, which "
"outputs I<strerror(errno)>."
msgstr ""
"Linux Libc5 kennt die fünf C-Standardschalter, den \\(aq-Schalter,
Locale, "
"»%m$« und »*m$«. Sie kennt die Längenmodifikatoren B<h>, B<l>, B<L>, B<Z> "
"und B<q>, akzeptiert aber B<L> und B<q> sowohl für I<long double> als
auch "
"I<long long int> (das ist ein Fehler). Sie erkennt B<F>, B<D>, B<O> und "
"B<U> nicht mehr, fügt aber ein neues Umwandlungssymbol B<m> hinzu,
welches "
"I<strerror(errno)> ausgibt."
#. type: Plain text
msgid "glibc 2.0 adds conversion characters B<C> and B<S>."
msgstr "Glibc 2.0 fügt die Umwandlungszeichen B<C> und B<S> hinzu."
#. type: Plain text
msgid ""
"glibc 2.1 adds length modifiers B<hh>, B<j>, B<t>, and B<z> and
conversion "
"characters B<a> and B<A>."
msgstr ""
"Glibc 2.1 fügt die Längenmodifikatoren B<hh>, B<j>, B<t> und B<z> sowie
die "
"Umwandlungszeichen B<a> und B<A> hinzu."
#. type: Plain text
msgid ""
"glibc 2.2 adds the conversion character B<F> with C99 semantics, and the "
"flag character B<I>."
msgstr ""
"Glibc 2.2 fügt das Umwandlungszeichen B<F> mit C99-Semantik sowie den "
"Schalter B<l> hinzu."
#. type: SH
#, no-wrap
msgid "NOTES"
msgstr "ANMERKUNGEN"
#. type: Plain text
msgid "Some programs imprudently rely on code such as the following"
msgstr "Einige Programme verlassen sich leichtsinnig auf Code wie den
folgenden"
#. type: Plain text
#, no-wrap
msgid " sprintf(buf, \"%s some further text\", buf);\n"
msgstr " sprintf(buf, \"%s etwas mehr Text\", buf);\n"
#. http://sourceware.org/bugzilla/show_bug.cgi?id=7075
#. type: Plain text
msgid ""
"to append text to I<buf>. However, the standards explicitly note that
the "
"results are undefined if source and destination buffers overlap when
calling "
"B<sprintf>(), B<snprintf>(), B<vsprintf>(), and B<vsnprintf>().
Depending "
"on the version of B<gcc>(1) used, and the compiler options employed,
calls "
"such as the above will B<not> produce the expected results."
msgstr ""
"um Text an I<buf> anzuhängen. Jedoch weisen die Standards explizit darauf "
"hin, dass die Ergebnisse undefiniert sind, wenn Quell- und Ziel-Puffer "
"beim Aufruf von B<sprintf>(), B<snprintf>(), B<vsprintf>() und
B<vsnprintf>"
"() überlappen. Abhängig von der verwendeten B<gcc>(1)-Version und den "
"gewählten Compiler-Optionen erzeugen Aufrufe wie das obige Beispiel "
"B<nicht> die erwarteten Ergebnisse."
#. .SH HISTORY
#. UNIX V7 defines the three routines
#. .BR printf (),
#. .BR fprintf (),
#. .BR sprintf (),
#. and has the flag \-, the width or precision *, the length modifier l,
#. and the conversions doxfegcsu, and also D,O,U,X as synonyms for
ld,lo,lu,lx.
#. This is still true for 2.9.1BSD, but 2.10BSD has the flags
#. #, + and <space> and no longer mentions D,O,U,X.
#. 2.11BSD has
#. .BR vprintf (),
#. .BR vfprintf (),
#. .BR vsprintf (),
#. and warns not to use D,O,U,X.
#. 4.3BSD Reno has the flag 0, the length modifiers h and L,
#. and the conversions n, p, E, G, X (with current meaning)
#. and deprecates D,O,U.
#. 4.4BSD introduces the functions
#. .BR snprintf ()
#. and
#. .BR vsnprintf (),
#. and the length modifier q.
#. FreeBSD also has functions
#. .BR asprintf ()
#. and
#. .BR vasprintf (),
#. that allocate a buffer large enough for
#. .BR sprintf ().
#. In glibc there are functions
#. .BR dprintf ()
#. and
#. .BR vdprintf ()
#. that print to a file descriptor instead of a stream.
#. type: Plain text
msgid ""
"The glibc implementation of the functions B<snprintf>() and
B<vsnprintf>() "
"conforms to the C99 standard, that is, behaves as described above, since "
"glibc version 2.1. Until glibc 2.0.6 they would return -1 when the
output "
"was truncated."
msgstr ""
"Seit der Glibc-Version 2.1 ist die Implementierung der Funktionen "
"B<snprintf>() und B<vsnprintf>() konform zu C99, verhält sich also wie "
"oben beschrieben. Bis Glibc 2.0.6 gaben sie im Fall gekürzter Ausgaben -1 "
"zurück."
#. type: SH
#, no-wrap
msgid "BUGS"
msgstr "FEHLER"
#. type: Plain text
msgid ""
"Because B<sprintf>() and B<vsprintf>() assume an arbitrarily long
string, "
"callers must be careful not to overflow the actual space; this is often "
"impossible to assure. Note that the length of the strings produced is "
"locale-dependent and difficult to predict. Use B<snprintf>() and "
"B<vsnprintf>() instead (or B<asprintf>(3) and B<vasprintf>(3))."
msgstr ""
"Da B<sprintf>() und B<vsprintf>() eine beliebig lange Zeichenkette "
"annehmen, müssen Aufrufende darauf achten, nicht den tatsächlich "
"verfügbaren Platz zu überschreiten; dies ist oft unmöglich "
"sicherzustellen. Man beachte, dass die Länge der Zeichenketten oft "
"abhängig von der Locale und schwierig vorherzusagen sind. Benutzen Sie "
"stattdessen B<snprintf>() und B<vsnprintf>() (oder B<asprintf>(3) und "
"B<vasprintf>(3))."
#. type: Plain text
msgid ""
"Linux libc4.[45] does not have a B<snprintf>(), but provides a libbsd
that "
"contains an B<snprintf>() equivalent to B<sprintf>(), that is, one that "
"ignores the I<size> argument. Thus, the use of B<snprintf>() with early "
"libc4 leads to serious security problems."
msgstr ""
"Linux Libc4.[45] verfügt nicht über eine B<snprintf>(), stellt aber eine "
"libbsd bereit, die ein B<snprintf>()-Äquivalent zu B<sprintf>() enthält. "
"Diese Version ignoriert das Argument I<size>. Somit führt die Verwendung "
"von B<snprintf>() mit frühen Libc4-Versionen zu schweren "
"Sicherheitsproblemen."
#. .PP
#. Some floating-point conversions under early libc4
#. caused memory leaks.
#. type: Plain text
msgid ""
"Code such as B<printf(>I<foo>B<);> often indicates a bug, since I<foo>
may "
"contain a % character. If I<foo> comes from untrusted user input, it may "
"contain B<%n>, causing the B<printf>() call to write to memory and
creating "
"a security hole."
msgstr ""
"Code wie beispielsweise B<printf(>I<foo>B<);> weist häufig auf einen "
"Fehler hin, da I<foo> das Zeichen »%« enthalten kann. Stammt I<foo> von "
"ungeprüfter Nutzereingabe, kann es »%n« enthalten und veranlasst B<printf>"
"(), in den Speicher zu schreiben und erzeugt damit ein Sicherheitsloch."
# FIXME: Plural
#. type: SH
#, no-wrap
msgid "EXAMPLE"
msgstr "BEISPIELE"
#. type: Plain text
msgid "To print I<Pi> to five decimal places:"
msgstr "Um I<Pi> mit fünf Dezimalstellen auszugeben:"
#. type: Plain text
#, no-wrap
msgid ""
"#include E<lt>math.hE<gt>\n"
"#include E<lt>stdio.hE<gt>\n"
"fprintf(stdout, \"pi = %.5f\\en\", 4 * atan(1.0));\n"
msgstr ""
"#include E<lt>math.hE<gt>\n"
"#include E<lt>stdio.hE<gt>\n"
"fprintf(stdout, \"pi = %.5f\\en\", 4 * atan(1.0));\n"
#. type: Plain text
msgid ""
"To print a date and time in the form \"Sunday, July 3, 10:02\", where "
"I<weekday> and I<month> are pointers to strings:"
msgstr ""
"Um Datum und Zeit in der Form `Sunday, July 3, 10:02' auszugeben, wobei "
"I<weekday> und I<month> Zeiger auf Zeichenketten sind:"
#. type: Plain text
#, no-wrap
msgid ""
"#include E<lt>stdio.hE<gt>\n"
"fprintf(stdout, \"%s, %s %d, %.2d:%.2d\\en\",\n"
" weekday, month, day, hour, min);\n"
msgstr ""
"#include E<lt>stdio.hE<gt>\n"
"fprintf(stdout, \"%s, %s %d, %.2d:%.2d\\en\",\n"
" weekday, month, day, hour, min);\n"
#. type: Plain text
msgid ""
"Many countries use the day-month-year order. Hence, an internationalized "
"version must be able to print the arguments in an order specified by the "
"format:"
msgstr ""
"Die meisten Länder verwenden die Reihenfolge Tag-Monat-Jahr. Deshalb muss "
"eine internationalisierte Version in der Lage sein, die Argumente in der "
"durch das Format angegebenen Reihenfolge zu drucken:"
#. type: Plain text
#, no-wrap
msgid ""
"#include E<lt>stdio.hE<gt>\n"
"fprintf(stdout, format,\n"
" weekday, month, day, hour, min);\n"
msgstr ""
"#include E<lt>stdio.hE<gt>\n"
"fprintf(stdout, format,\n"
" weekday, month, day, hour, min);\n"
#. type: Plain text
msgid ""
"where I<format> depends on locale, and may permute the arguments. With
the "
"value:"
msgstr ""
"wobei I<format> von der Locale abhängt und möglicherweise die Argumente "
"permutiert. Mit dem Wert"
#. type: Plain text
#, no-wrap
msgid "\"%1$s, %3$d. %2$s, %4$d:%5$.2d\\en\"\n"
msgstr "\"%1$s, %3$d. %2$s, %4$d:%5$.2d\\en\"\n"
#. type: Plain text
msgid "one might obtain \"Sonntag, 3. Juli, 10:02\"."
msgstr "könnte dann »Sonntag, 3. Juli, 10:02« dabei herauskommen."
#. type: Plain text
msgid ""
"To allocate a sufficiently large string and print into it (code correct
for "
"both glibc 2.0 and glibc 2.1):"
msgstr ""
"Um eine genügend große Zeichenkette bereitzustellen und in sie zu
schreiben "
"(der Code ist korrekt sowohl für Glibc 2.0 als auch Glibc 2.1):"
#. type: Plain text
#, no-wrap
msgid ""
"#include E<lt>stdio.hE<gt>\n"
"#include E<lt>stdlib.hE<gt>\n"
"#include E<lt>stdarg.hE<gt>\n"
msgstr ""
"#include E<lt>stdio.hE<gt>\n"
"#include E<lt>stdlib.hE<gt>\n"
"#include E<lt>stdarg.hE<gt>\n"
#. type: Plain text
#, no-wrap
msgid ""
"char *\n"
"make_message(const char *fmt, ...)\n"
"{\n"
" int n;\n"
" int size = 100; /* Guess we need no more than 100 bytes. */\n"
" char *p, *np;\n"
" va_list ap;\n"
msgstr ""
"char *\n"
"make_message(const char *fmt, ...)\n"
"{\n"
" int n;\n"
" int size = 100; /* Annahme: wir brauchen nicht mehr als\n"
" 100 Byte. */\n"
" char *p, *np;\n"
" va_list ap;\n"
#. type: Plain text
#, no-wrap
msgid ""
" if ((p = malloc(size)) == NULL)\n"
" return NULL;\n"
msgstr ""
" if ((p = malloc(size)) == NULL)\n"
" return NULL;\n"
#. type: Plain text
#, no-wrap
msgid " while (1) {\n"
msgstr " while (1) {\n"
#. type: Plain text
#, no-wrap
msgid " /* Try to print in the allocated space. */\n"
msgstr ""
" /* Versuch, in den bereitgestellten Speicherplatz zu schreiben.
*/\n"
#. type: Plain text
#, no-wrap
msgid ""
" va_start(ap, fmt);\n"
" n = vsnprintf(p, size, fmt, ap);\n"
" va_end(ap);\n"
msgstr ""
" va_start(ap, fmt);\n"
" n = vsnprintf(p, size, fmt, ap);\n"
" va_end(ap);\n"
#. type: Plain text
#, no-wrap
msgid " /* If that worked, return the string. */\n"
msgstr " /* Wenn das geklappt hat, die Zeichenkette zurückgeben.
*/\n"
#. type: Plain text
#, no-wrap
msgid ""
" if (n E<gt> -1 && n E<lt> size)\n"
" return p;\n"
msgstr ""
" if (n E<gt> -1 && n E<lt> size)\n"
" return p;\n"
#. type: Plain text
#, no-wrap
msgid " /* Else try again with more space. */\n"
msgstr " /* anderenfalls mit mehr Platz nochmals versuchen */\n"
#. type: Plain text
#, no-wrap
msgid ""
" if (n E<gt> -1) /* glibc 2.1 */\n"
" size = n+1; /* precisely what is needed */\n"
" else /* glibc 2.0 */\n"
" size *= 2; /* twice the old size */\n"
msgstr ""
" if (n E<gt> -1) /* Glibc 2.1 */\n"
" size = n+1; /* genau das Erforderliche */\n"
" else /* Glibc 2.0 */\n"
" size *= 2; /* das doppelte der alten Größe */\n"
#. type: Plain text
#, no-wrap
msgid ""
" if ((np = realloc (p, size)) == NULL) {\n"
" free(p);\n"
" return NULL;\n"
" } else {\n"
" p = np;\n"
" }\n"
" }\n"
"}\n"
msgstr ""
" if ((np = realloc (p, size)) == NULL) {\n"
" free(p);\n"
" return NULL;\n"
" } else {\n"
" p = np;\n"
" }\n"
" }\n"
"}\n"
Reply to: