/*
testfifo.c - Part of ardcom - Easy communication over USB with Arduino
Copyright 2013 - Laurent Menu-Kerforn
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

#include <stdio.h>
#include "mkfifo.h"

main(int argc, char **argv) {
	mkf fifo;
	printf("\ndebut ok");

//	exit(0);

	mkfinit(&fifo,"tag");
	printf("\ninit ok");
	mkfdebug(&fifo);
	
	mkfload(&fifo);
	printf("\nload ok\n");

	char buf[10000];
	mkfdump(&fifo,buf,10000);
	printf("%s",buf);
	printf("\ndump ok\n==================\n\n");
	
	mkfread(&fifo,buf,10000);
	mkfwrite(&fifo,buf);

	mkfread(&fifo,buf,10000);
	mkfwrite(&fifo,buf);

	mkfdump(&fifo,buf,10000);
	printf("%s",buf);
	printf("\ndump ok\n==================\n\n");

	mkfwritehead(&fifo,"shabada shabada");
	mkfdump(&fifo,buf,10000);
	printf("%s",buf);
	printf("\ndump ok\n==================\n\n");

	if(!mkfsave(&fifo)) printf("\nPB sauvegarde fichier\n");;

	mkfflush(&fifo);
	mkfdump(&fifo,buf,10000);
	printf("%s",buf);
	printf("\ndump ok\n==================\n\n");
	}

