#ifndef MPAIR_H
#define MPAIR_H

#include "qmalloc.h"

#ifdef __cplusplus
extern "C" {
#endif

typedef struct MPAIR {
	char *var;
	char *val;
	struct MPAIR *next;
} MPair;

typedef struct {
	MPair *first;
	Qmalloc *qmalloc;
} MPairList;



#ifndef iseol
#	define iseol(x) (x == '\r' || x == '\n' || x == '\0')
#endif

MPairList *mpair_new(void);
char *mpair_find(MPairList *qp, char *name);
int mpair_add(MPairList **qp, char *var, char *val);
int mpair_add_atend(MPairList **qp, char *var, char *val);
int mpair_free(MPairList **qp);
int mpair_test(void);
void mpair_reverse(MPairList **src) ;
void mpair_copy(MPairList **dst, MPairList *src);
void mpair_remove(MPairList *qp, char *var, char *val) ;
void mpair_removenc(MPairList *qp, char *var, char *val) ;
char *mpair_findnc(MPairList *qp, char *name);
MPair *mpair_first(MPairList *m);

#ifdef __cplusplus
}
#endif

#endif
