#include <stdio.h>
#include <stdlib.h>
#include <mpc.h>
#include <sys/utsname.h>

int [*]main(int [host]argc, char **[host]argv) {
  repl n;

  if(argc<2)
    n = 1;
  else
    n = [host]atoi(argv[1]);
  if(n<1)
    [host]printf("Wrong input (%d processes required).\n", [host]n);
  else if(n>MPC_Total_nodes()) 
    [host]printf("Required too many processes (%d against %d available).\n",
                 [host]n, [host]MPC_Total_nodes());
  else {
    net SimpleNet(n) mynet;
    struct utsname [mynet]un;

    [mynet]uname(&un);
    [mynet]MPC_Printf("Hello world! I'm on \"%s\".\n", un.nodename);
  }
  MPC_Printf("* ");
}