/*
 * Micro-X -- an X server for DOS
 * Copyright (C) 1994 StarNet Communications Corp.
 *
 * 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.
 * 
 * StarNet Communications Corp.
 * 550 Lakeside Dr. #3
 * Sunnyvale CA 94086 US
 * http://www.starnet.com
 * x-dos@starnet.com
 */

#include <stdio.h>
#include "defs.h"
#include "rpc.h"
#include "funcs.h"

char *net_shared;
int net_shared_size;
struct rpc *net_rpc;

int
net_open(file)
const char *file;
{
    int i;

    net_rpc = rpc_init(file);
    if (!net_rpc) {
	perror(file);
	neterrno = NETERR_ERRNO;
	return -1;
    }
    i = rpc_call(net_rpc, FUNC_STARTUP, 0, 0, 0, 0);
    if (i < 0) {
	net_perror("net startup");
	rpc_close(net_rpc);
	return i;
    }
    i = rpc_call(net_rpc, FUNC_INIT, 0, 0, 0, 0);
    if (i < 0) {
	net_perror("net init");
	rpc_close(net_rpc);
	return i;
    }
    return i;
}

void
net_shutdown()
{
    (void)rpc_call(net_rpc, FUNC_SHUTDOWN, 0, 0, 0, 0);
    rpc_close(net_rpc);
}
