How about the following program to do this.
Roger.
/* Written By R.E.Wolff@BitWizard.nl
*
* This program is distributed under GPL. */
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
int main (int argc, char **argv)
{
int i;
int ascii = 0;
int size = 512;
long long secno;
char *buf;
int s;
for (i=1;i<argc;i++) {
if (strcmp (argv[i], "-a") == 0) {
ascii = 1;
}
if (strcmp (argv[i], "-b") == 0) {
ascii = 0;
}
if (strncmp (argv[i], "-s", 2) == 0) {
if (strlen (argv[i]) > 2)
size = atoi (argv[i]+2);
else
/* Sorry. Will crash if you specify -s as the last argument */
size = atoi (argv[++i]);
}
}
buf = malloc (size + 16);
if (!buf) {
fprintf (stderr, "Can't allocate buffer.\n");
exit (1);
}
secno = 0;
while (1) {
if (ascii) {
sprintf (buf, "%lld\n", secno);
s = strlen (buf);
for (i=s;i<size;i+=s)
sprintf (buf+i, "%lld\n", secno);
} else {
for (i=0;i<size;i+=sizeof (long long))
*(long long *)(buf+i) = secno;
}
if (write (1, buf, size) < 0)
break;
secno++;
}
exit (0);
}
-- ** R.E.Wolff@BitWizard.nl ** http://www.BitWizard.nl/ ** +31-15-2600998 ** *-- BitWizard writes Linux device drivers for any device you may have! --* * The Worlds Ecosystem is a stable system. Stable systems may experience * * excursions from the stable situation. We are currently in such an * * excursion: The stable situation does not include humans. *************** - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/