~ubuntu-branches/ubuntu/saucy/manpages/saucy

« back to all changes in this revision

Viewing changes to man3/printf.3

  • Committer: Package Import Robot
  • Author(s): Loïc Minier
  • Date: 2011-10-17 13:06:22 UTC
  • mfrom: (1.1.46 upstream) (2.2.11 sid)
  • Revision ID: package-import@ubuntu.com-20111017130622-rbdw3julnma2baqu
Tags: 3.32-0.2ubuntu1
* Merge from Debian testing/unstable; remaining changes:
  - ptrace.2, prctl.2: document Ubuntu-specific PTRACE_ATTACH,
    PR_SET_PTRACER behavior.
* Keep Debian's glibc-doc version in the Replaces as it's satisfactory for
  upgrades from natty and lucid.

Show diffs side-by-side

added added

removed removed

Lines of Context:
225
225
The second style allows repeated references to the
226
226
same argument.
227
227
The C99 standard does not include the style using \(aq$\(aq,
228
 
which comes from the Single Unix Specification.
 
228
which comes from the Single UNIX Specification.
229
229
If the style using
230
230
\(aq$\(aq is used, it must be used throughout for all conversions taking an
231
231
argument and all width and precision arguments, but it may be mixed
896
896
Until glibc 2.0.6 they would return \-1
897
897
when the output was truncated.
898
898
.\" .SH HISTORY
899
 
.\" Unix V7 defines the three routines
 
899
.\" UNIX V7 defines the three routines
900
900
.\" .BR printf (),
901
901
.\" .BR fprintf (),
902
902
.\" .BR sprintf (),
1035
1035
char *
1036
1036
make_message(const char *fmt, ...)
1037
1037
{
1038
 
    /* Guess we need no more than 100 bytes. */
1039
 
    int n, size = 100;
 
1038
    int n;
 
1039
    int size = 100;     /* Guess we need no more than 100 bytes. */
1040
1040
    char *p, *np;
1041
1041
    va_list ap;
1042
1042
 
1044
1044
        return NULL;
1045
1045
 
1046
1046
    while (1) {
 
1047
 
1047
1048
        /* Try to print in the allocated space. */
 
1049
 
1048
1050
        va_start(ap, fmt);
1049
1051
        n = vsnprintf(p, size, fmt, ap);
1050
1052
        va_end(ap);
 
1053
 
1051
1054
        /* If that worked, return the string. */
 
1055
 
1052
1056
        if (n > \-1 && n < size)
1053
1057
            return p;
 
1058
 
1054
1059
        /* Else try again with more space. */
 
1060
 
1055
1061
        if (n > \-1)    /* glibc 2.1 */
1056
1062
            size = n+1; /* precisely what is needed */
1057
1063
        else           /* glibc 2.0 */
1058
1064
            size *= 2;  /* twice the old size */
 
1065
 
1059
1066
        if ((np = realloc (p, size)) == NULL) {
1060
1067
            free(p);
1061
1068
            return NULL;
1075
1082
.BR wprintf (3),
1076
1083
.BR locale (5)
1077
1084
.SH COLOPHON
1078
 
This page is part of release 3.27 of the Linux
 
1085
This page is part of release 3.32 of the Linux
1079
1086
.I man-pages
1080
1087
project.
1081
1088
A description of the project,