- int padding, nbytes, start, end;
- int width = lisp_string_width (args[n], -1, NULL, NULL);
+ /* handle case (precision[n] >= 0) */
+
+ int width, padding;
+ int nbytes, start, end;
+ int nchars_string;
+
+ /* lisp_string_width ignores a precision of 0, but GNU
+ libc functions print 0 characters when the precision
+ is 0. Imitate libc behavior here. Changing
+ lisp_string_width is the right thing, and will be
+ done, but meanwhile we work with it. */
+
+ if (precision[n] == 0)
+ width = nchars_string = nbytes = 0;
+ else if (precision[n] > 0)
+ width = lisp_string_width (args[n], precision[n], &nchars_string, &nbytes);
+ else
+ { /* no precision spec given for this argument */
+ width = lisp_string_width (args[n], -1, NULL, NULL);
+ nbytes = SBYTES (args[n]);
+ nchars_string = SCHARS (args[n]);
+ }