jot.c (f88b45d7df9ba19dd72e7521853593ecf2d16073) jot.c (82417e9f0390a0aacb61fc5d35e4304af949faad)
1/*-
2 * Copyright (c) 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 379 unchanged lines hidden (view full) ---

388{
389 char *p, *p2;
390 int dot, hash, space, sign, numbers = 0;
391 size_t sz;
392
393 if (boring) /* no need to bother */
394 return;
395 for (p = format; *p; p++) /* look for '%' */
1/*-
2 * Copyright (c) 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 379 unchanged lines hidden (view full) ---

388{
389 char *p, *p2;
390 int dot, hash, space, sign, numbers = 0;
391 size_t sz;
392
393 if (boring) /* no need to bother */
394 return;
395 for (p = format; *p; p++) /* look for '%' */
396 if (*p == '%')
396 if (*p == '%') {
397 if (p[1] == '%')
398 p++; /* leave %% alone */
399 else
400 break;
397 if (p[1] == '%')
398 p++; /* leave %% alone */
399 else
400 break;
401 }
401 sz = sizeof(format) - strlen(format) - 1;
402 if (!*p && !chardata) {
403 if (snprintf(p, sz, "%%.%df", prec) >= (int)sz)
404 errx(1, "-w word too long");
405 } else if (!*p && chardata) {
406 if (strlcpy(p, "%c", sz) >= sz)
407 errx(1, "-w word too long");
408 intdata = true;

--- 81 unchanged lines hidden ---
402 sz = sizeof(format) - strlen(format) - 1;
403 if (!*p && !chardata) {
404 if (snprintf(p, sz, "%%.%df", prec) >= (int)sz)
405 errx(1, "-w word too long");
406 } else if (!*p && chardata) {
407 if (strlcpy(p, "%c", sz) >= sz)
408 errx(1, "-w word too long");
409 intdata = true;

--- 81 unchanged lines hidden ---