jot.c (164852) | jot.c (165029) |
---|---|
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 --- 29 unchanged lines hidden (view full) --- 38#endif /* not lint */ 39 40#ifndef lint 41#if 0 42static char sccsid[] = "@(#)jot.c 8.1 (Berkeley) 6/6/93"; 43#endif 44#endif 45#include <sys/cdefs.h> | 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 --- 29 unchanged lines hidden (view full) --- 38#endif /* not lint */ 39 40#ifndef lint 41#if 0 42static char sccsid[] = "@(#)jot.c 8.1 (Berkeley) 6/6/93"; 43#endif 44#endif 45#include <sys/cdefs.h> |
46__FBSDID("$FreeBSD: head/usr.bin/jot/jot.c 164852 2006-12-03 17:50:21Z dds $"); | 46__FBSDID("$FreeBSD: head/usr.bin/jot/jot.c 165029 2006-12-09 15:23:20Z delphij $"); |
47 48/* 49 * jot - print sequential or random data 50 * 51 * Author: John Kunze, Office of Comp. Affairs, UCB 52 */ 53 54#include <ctype.h> --- 333 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 '%' */ | 47 48/* 49 * jot - print sequential or random data 50 * 51 * Author: John Kunze, Office of Comp. Affairs, UCB 52 */ 53 54#include <ctype.h> --- 333 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 --- |