/* -*- Mode: C; c-basic-offset:4 ; -*- */
/*  
 *  (C) 2003 by Argonne National Laboratory and Northwestern University.
 *      See COPYRIGHT in top-level directory.
 *
 * This file is automatically generated by command:
 *     ./buildiface -infile=../../../src/include/pnetcdf.h -deffile=./defs
 * DO NOT EDIT
 */
#ifdef __GNUC__
#pragma GCC diagnostic ignored "-Wunused-parameter"
#endif
#include "mpinetcdf_impl.h"


/* Prototypes for the Fortran interfaces */
#include "mpifnetcdf.h"

#ifdef F77_NAME_UPPER
#define nfmpi_xstrerror_ NFMPI_XSTRERROR
#elif defined(F77_NAME_LOWER_2USCORE)
#define nfmpi_xstrerror_ nfmpi_xstrerror__
#elif !defined(F77_NAME_LOWER_USCORE)
#define nfmpi_xstrerror_ nfmpi_xstrerror
/* Else leave name alone */
#endif

FORTRAN_API int FORT_CALL nfmpi_xstrerror_ ( MPI_Fint *v1, char *v2 FORT_MIXED_LEN(d2) FORT_END_LEN(d2) ){
    const char *p = ncmpi_strerror( *v1 );
    size_t len = strlen(p);
    /* d2 is the length of the string passed into the routine */
    if (len > (size_t)d2) len = (size_t)d2;  /* MIN(len, d2) */
    memcpy(v2, p, len);
    /* Blank pad */
    if (len < (size_t)d2) memset(v2+len, ' ', (size_t)d2-len);
    return 0;
}
