Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
emacs
emacs
Commits
35a65fce
Commit
35a65fce
authored
Jul 05, 1994
by
Richard M. Stallman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(doprnt): Handle padding on %c.
parent
a522e5bf
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
3 deletions
+8
-3
src/doprnt.c
src/doprnt.c
+8
-3
No files found.
src/doprnt.c
View file @
35a65fce
...
...
@@ -62,6 +62,7 @@ doprnt (buffer, bufsize, format, format_end, nargs, args)
char
*
fmtcpy
;
int
minlen
;
int
size
;
/* Field width factor; e.g., %90d */
char
charbuf
[
2
];
/* Used for %c. */
if
(
format_end
==
0
)
format_end
=
format
+
strlen
(
format
);
...
...
@@ -154,6 +155,7 @@ doprnt (buffer, bufsize, format, format_end, nargs, args)
/* Copy string into final output, truncating if no room. */
doit:
tem
=
strlen
(
string
);
doit1:
if
(
minlen
>
0
)
{
while
(
minlen
>
tem
&&
bufsize
>
0
)
...
...
@@ -184,9 +186,12 @@ doprnt (buffer, bufsize, format, format_end, nargs, args)
case
'c'
:
if
(
cnt
==
nargs
)
error
(
"not enough arguments for format string"
);
*
bufptr
++
=
(
int
)
args
[
cnt
++
];
bufsize
--
;
continue
;
*
charbuf
=
(
int
)
args
[
cnt
++
];
string
=
charbuf
;
tem
=
1
;
if
(
fmtcpy
[
1
]
!=
'c'
)
minlen
=
atoi
(
&
fmtcpy
[
1
]);
goto
doit1
;
case
'%'
:
fmt
--
;
/* Drop thru and this % will be treated as normal */
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment