1 // SPDX-License-Identifier: GPL-2.0
3 * Copyright (c) 2000-2001 Silicon Graphics, Inc.
13 * fill pathname key nbyte
15 * use key to seed random number generator so data is deterministic
17 * lines are at most 72 bytes long so diff(1) does not choke
21 main(int argc, char **argv)
31 /* quick and dirty, no args checking */
32 if ((f = fopen(argv[1], "w")) == NULL) {
33 fprintf(stderr, "fill: cannot create \"%s\": %s\n", argv[1], strerror(errno));
45 nbyte = atoi(argv[3]);
50 * byte offset @ start of this line XXXXXXXXXXXX
51 * test iteration number XXXX
52 * key (usually file name) argv[2]
53 * random bytes to fill the line
56 hdr = (char *)malloc(12+1+4+1+strlen(argv[2])+1+1);
57 sprintf(hdr, "%012ld %04d %s ", (long int)0, 0, argv[2]);
60 for (i = 0; i < nbyte-1; i++) {
65 else if ((i % 72) == 71)
68 c = 32+(rand() % (128-32));
72 sprintf(hdr, "%012ld %04d %s ", i+1, 0, argv[2]);