Lines Matching refs:fmt

96 	char *format, *fmt, *start;
126 fmt = format = *argv;
127 (void) escape(fmt, 1, &len); /* backslash interpretation */
137 start = fmt;
138 while (fmt < format + len) {
139 if (fmt[0] == '%') {
140 (void) fwrite(start, 1, PTRDIFF(fmt, start),
142 if (fmt[1] == '%') {
145 fmt += 2;
147 fmt = doformat(fmt, &rval);
148 if (fmt == NULL)
152 start = fmt;
154 fmt++;
164 (void) fwrite(start, 1, PTRDIFF(fmt, start), stdout);
168 fmt = format;
176 doformat(char *fmt, int *rval)
186 start = alloca(strlen(fmt) + 1);
192 fmt++;
195 l = strspn(fmt, digits);
196 if ((l > 0) && (fmt[l] == '$')) {
197 int idx = atoi(fmt);
206 fmt += l + 1;
215 while (*fmt && strchr(skip1, *fmt) != NULL) {
216 *dptr++ = *fmt++;
221 if (*fmt == '*') {
223 fmt++;
224 l = strspn(fmt, digits);
225 if ((l > 0) && (fmt[l] == '$')) {
226 int idx = atoi(fmt);
236 fmt += l + 1;
255 while (isdigit(*fmt)) {
256 *dptr++ = *fmt++;
261 if (*fmt == '.') {
263 fmt++;
266 if (*fmt == '*') {
268 fmt++;
269 l = strspn(fmt, digits);
270 if ((l > 0) && (fmt[l] == '$')) {
271 int idx = atoi(fmt);
282 fmt += l + 1;
300 while (isdigit(*fmt)) {
301 *dptr++ = *fmt++;
307 if (!*fmt) {
311 *dptr++ = *fmt;
324 if (*fmt == 'L') {
326 fmt++;
327 if (!strchr("aAeEfFgG", *fmt)) {
328 warnx2(_("bad modifier L for %%%c"), *fmt, NULL);
340 convch = *fmt;
341 nextch = *++fmt;
343 *fmt = '\0';
412 *fmt = nextch;
415 return (fmt);
445 escape(char *fmt, int percent, size_t *len)
450 for (save = store = fmt; ((c = *fmt) != 0); ++fmt, ++store) {
455 switch (*++fmt) {
463 *store = *fmt;
497 c = (!percent && *fmt == '0') ? 4 : 3;
499 c-- && *fmt >= '0' && *fmt <= '7'; ++fmt) {
501 value += *fmt - '0';
503 --fmt;
511 *store = *fmt;