/* Backend selector */
/* $Id: backsel.c,v 1.4 2003/07/30 18:06:14 pasky Exp $ */

/*
 * PaVS - Pasky's Version System, advanced version control system
 * Copyright (C) 2003  Petr Baudis
 *
 * 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 2 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, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

#include <assert.h>

#include <libpavs/backsel.h>
#include <librcs/file.h>
#include <librev/inode.h>


static char *pavs_backendstrs [PBE_MAX] = {
	"none",
	"RCS",
};

char *
pavs_backendstr (enum pavs_backend backend)
{
	assert (backend >= 0 && backend < PBE_MAX);

	return pavs_backendstrs [backend];
}


/* FIXME: We do basically nothing so far, just dumbly forward everything to
 * librcs. */


enum pavs_backend
rev_inode_attach_backend (struct rev_inode *inode, char *filename)
{
	assert (inode && filename);

	if (! *filename)
		return PBE_NONE;

	if (! rcs_file_init (inode, filename))
		return -1;

	return PBE_LIBRCS;
}
