2 * Copyright (c) 2000-2001 Silicon Graphics, Inc.
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License as
7 * published by the Free Software Foundation.
9 * This program is distributed in the hope that it would be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write the Free Software Foundation,
16 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 * fill pathname key nbyte
27 * use key to seed random number generator so data is deterministic
29 * lines are at most 72 bytes long so diff(1) does not choke
33 main(int argc, char **argv)
43 /* quick and dirty, no args checking */
44 if ((f = fopen(argv[1], "w")) == NULL) {
45 fprintf(stderr, "fill: cannot create \"%s\": %s\n", argv[1], strerror(errno));
57 nbyte = atoi(argv[3]);
62 * byte offset @ start of this line XXXXXXXXXXXX
63 * test iteration number XXXX
64 * key (usually file name) argv[2]
65 * random bytes to fill the line
68 hdr = (char *)malloc(12+1+4+1+strlen(argv[2])+1+1);
69 sprintf(hdr, "%012ld %04d %s ", (long int)0, 0, argv[2]);
72 for (i = 0; i < nbyte-1; i++) {
77 else if ((i % 72) == 71)
80 c = 32+(rand() % (128-32));
84 sprintf(hdr, "%012ld %04d %s ", i+1, 0, argv[2]);