/*
This source file is part of Scol
For the latest info, see http://www.scolring.org

Copyright (c) 2010 Stephane Bisaro, aka Iri <iri@irizone.net>

This program is free software; you can redistribute it and/or modify it under
the terms of the GNU Lesser 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 Lesser General Public License for more details.

You should have received a copy of the GNU Lesser 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, or go to
http://www.gnu.org/copyleft/lesser.txt

For others informations, please contact us from http://www.scolring.org/
*/

/* Warning !

SCOL SERVER LINUX VERSION ! 

*/

#include "main.h"





int initSPP (void)
{
    spPartition = malloc (sizeof (struct scolPathPartition));
    if (spPartition == NULL)
        return 1;
    spPartition->admin = NULL;
    spPartition->admin = malloc (sizeof (char) * SIZESIGN);
    memset (spPartition->admin, '\0', SIZESIGN-1);
    spPartition->admin = lib_sys_getDatasFromUsm (spPartition->admin, NULL, 16665, lib_sys_getPathAdminPartition);

    spPartition->cache = NULL;
    spPartition->cache = malloc (sizeof (char) * SIZESIGN);
    memset (spPartition->cache, '\0', SIZESIGN-1);

    spPartition->log = NULL;
    spPartition->log = malloc (sizeof (char) * SIZESIGN);
    memset (spPartition->log, '\0', SIZESIGN-1);

    spPartition->user = NULL;
    spPartition->user = malloc (sizeof (char) * SIZESIGN);
    memset (spPartition->user, '\0', SIZESIGN-1);
    spPartition->user = lib_sys_getDatasFromUsm (spPartition->user, NULL, 16665, lib_sys_getPathPartition);
    return 0;
}

void endSPP (void)
{
    free (spPartition->admin);
    free (spPartition->cache);
    free (spPartition->log);
    free (spPartition->user);
    free (spPartition);
    return;
}




/* Loading library ...*/

int SCOLinitSYSPACKclass (mmachine m)
{
    int k = 0;
    MMechostr (0, "SCOLinitSYSPACKclass library : entering\n");

    if ((k = initSPP ())) return k;

    /* load tempfile */
    if ((k = SCOLinitTEMPFILEclass (m))) return k;
    /* load standard library */
    if ((k = SCOLinitSTANDARDLIBRARYclass (m))) return k;
    /* load benchmark lib */
    if ((k = SCOLinitBENCHMARKclass (m))) return k;
    /* load update lib */
    if ((k = SCOLinitUPDATEclass (m))) return k;

    return k;
}


int ScolLoadPlugin (mmachine m, cbmachine w)
{
    ww = w;

    MMechostr (0, "SYSPACK library loading ...\n");
    return SCOLinitSYSPACKclass (m);
}


int ScolUnloadPlugin()
{
    endSPP ();
    MMechostr (0, "SYSPACK library released !\n");
    return 0;
}

