#include <stdio.h>
#include <process.h>

main(int argc, char **argv)
{
int result;

    if(argc > 1){
         result = spawnvp(P_WAIT,argv[1],&argv[1]);
         if(result >= 0){
              printf("\n----------------\nERRORLEVEL = %d\n----------------\n",result);
         }
         else
              perror("Error");
    }
    else{
         printf("ERRLVL  Executes a program and shows the ERRORLEVEL on return\n");
         printf("usage: errlvl [drive:][path]filename.ext [parameters]\n");
    }
}