62922241982df718e06cc4182bd845372dd98c0a
[util-vserver.git] / lib / createskeleton.c
1 // $Id: createskeleton.c,v 1.1 2004/02/18 04:42:38 ensc Exp $    --*- c -*--
2
3 // Copyright (C) 2004 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
4 //  
5 // This program is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation; version 2 of the License.
8 //  
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 // GNU General Public License for more details.
13 //  
14 // You should have received a copy of the GNU General Public License
15 // along with this program; if not, write to the Free Software
16 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17
18
19 #ifdef HAVE_CONFIG_H
20 #  include <config.h>
21 #endif
22
23 #include "vserver.h"
24 #include "internal.h"
25
26 #include "pathconfig.h"
27
28 #include "createskeleton-full.hc"
29 #include "createskeleton-short.hc"
30
31 #include <errno.h>
32
33 int
34 vc_createSkeleton(char const *id, vcCfgStyle style, int flags)
35 {
36   if (style==vcCFG_NONE || style==vcCFG_AUTO) {
37     if (strchr(id, '/')!=0) style = vcCFG_RECENT_FULL;
38     else                    style = vcCFG_RECENT_SHORT;
39   }
40   
41   switch (style) {
42     case vcCFG_RECENT_SHORT     :  return vc_createSkeleton_short(id, flags);
43     case vcCFG_RECENT_FULL      :  return vc_createSkeleton_full(id, 0, flags);
44     default                     :  ;
45   }
46   
47   errno = EINVAL;
48   return -1;
49 }