#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <err.h>
#include <errno.h>
#include "../lpi.h"             /* for toInt() */

int
main(int argc, char *argv[])
{
    int nforks;

    if (argc != 2) {
        fprintf(stderr, "usage: %s number-of-forks\n", argv[0]);
        exit(EXIT_FAILURE);
    }

    if ((errno = toInt(argv[1], &nforks)) != 0)
        err(EXIT_FAILURE, "toInt('%s')", argv[1]);

    for (int i = 0; i < nforks; i++)
        fork();

    write(STDOUT_FILENO, "*\n", 2);
    exit(EXIT_SUCCESS);
}
