Blame test/mpi/errhan/errmsg.c

Packit 0848f5
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
Packit 0848f5
/*
Packit 0848f5
 *  (C) 2001 by Argonne National Laboratory.
Packit 0848f5
 *      See COPYRIGHT in top-level directory.
Packit 0848f5
 */
Packit 0848f5
#include <stdio.h>
Packit 0848f5
#include "mpi.h"
Packit 0848f5
Packit 0848f5
void ChkMsg(int, int, const char[]);
Packit 0848f5
Packit 0848f5
/*
Packit 0848f5
 * This routine is used to check the message associated with an error
Packit 0848f5
 * code.  Currently, it uses MPI_Error_string to get the corresponding
Packit 0848f5
 * message for a code, and prints out the cooresponding class and original
Packit 0848f5
 * message.
Packit 0848f5
 *
Packit 0848f5
 * Eventually, we should also access the generic anc specific messages
Packit 0848f5
 * separately.
Packit 0848f5
 */
Packit 0848f5
void ChkMsg(int err, int msgclass, const char msg[])
Packit 0848f5
{
Packit 0848f5
    char errmsg[MPI_MAX_ERROR_STRING];
Packit 0848f5
    int len;
Packit 0848f5
Packit 0848f5
    MPI_Error_string(err, errmsg, &len;;
Packit 0848f5
Packit 0848f5
    fprintf(stdout, "[0x%08x] %2d %s \tgives %s\n", err, msgclass, msg, errmsg);
Packit 0848f5
}