VirtualBox

source: kBuild/trunk/src/kash/shinstance.c@ 1222

Last change on this file since 1222 was 1222, checked in by bird, 17 years ago

more fixes - it all compiles now (linking fails of course).

  • Property svn:eol-style set to LF
File size: 2.0 KB
Line 
1/* $Id: $ */
2/** @file
3 *
4 * The shell instance methods.
5 *
6 * Copyright (c) 2007 knut st. osmundsen <[email protected]>
7 *
8 *
9 * This file is part of kBuild.
10 *
11 * kBuild is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 *
16 * kBuild is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with kBuild; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 *
25 */
26
27#include <string.h>
28#include "shinstance.h"
29
30
31/**
32 * Creates a root shell instance.
33 *
34 * @param inherit The shell to inherit from. If NULL inherit from environment and such.
35 * @param argc The argument count.
36 * @param argv The argument vector.
37 *
38 * @returns pointer to root shell on success, NULL on failure.
39 */
40shinstance *sh_create_root_shell(shinstance *inherit, int argc, char **argv)
41{
42 shinstance *psh;
43
44 psh = malloc(sizeof(*psh));
45 if (psh)
46 {
47 memset(psh, 0, sizeof(*psh));
48
49 /* memalloc.c */
50 psh->stacknleft = MINSIZE;
51 psh->herefd = -1;
52 psh->stackp = &psh->stackbase;
53 psh->stacknxt = psh->stackbase.space;
54
55 /* input.c */
56 psh->plinno = 1;
57 psh->init_editline = 0;
58 psh->parsefile = &psh->basepf;
59
60 /* output.c */
61 psh->output.bufsize = OUTBUFSIZ;
62 psh->output.fd = 1;
63 psh->errout.bufsize = 100;
64 psh->errout.fd = 2;
65 psh->memout.fd = MEM_OUT;
66 psh->out1 = &psh->output;
67 psh->out2 = &psh->errout;
68
69 /* jobs.c */
70 psh->backgndpid = -1;
71#if JOBS
72 psh->curjob = -1;
73#endif
74 psh->ttyfd = -1;
75
76 }
77 return psh;
78}
79
80
Note: See TracBrowser for help on using the repository browser.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette