source: trunk/kernel/ksh/exec_func.c @ 145

Last change on this file since 145 was 1, checked in by alain, 8 years ago

First import

File size: 1.7 KB
Line 
1/*
2   This file is part of MutekP.
3 
4   MutekP is free software; you can redistribute it and/or modify it
5   under the terms of the GNU General Public License as published by
6   the Free Software Foundation; either version 2 of the License, or
7   (at your option) any later version.
8 
9   MutekP is distributed in the hope that it will be useful, but
10   WITHOUT ANY WARRANTY; without even the implied warranty of
11   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12   General Public License for more details.
13 
14   You should have received a copy of the GNU General Public License
15   along with MutekP; if not, write to the Free Software Foundation,
16   Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 
18   UPMC / LIP6 / SOC (c) 2008
19   Copyright Ghassan Almaless <ghassan.almaless@gmail.com>
20*/
21
22#include <stdint.h>
23#include <thread.h>
24#include <task.h>
25#include <kminiShell.h>
26
27char *envrion[] = { "ALMOS_VERSION=v1", NULL};
28 
29error_t exec_func(void *param)
30{
31  char *path_name;
32  //error_t err;
33  uint32_t argc,i;
34  ms_args_t *args;
35  char *argv[MS_MAX_ARG_LEN + 1];
36
37  args = (ms_args_t *) param;
38  argc = args->argc;
39
40  if(argc < 2)
41  {
42    ksh_print("exec: missing operand\n");
43    return EINVAL;
44  }
45
46  path_name = args->argv[1];
47
48  for(i=1; i < argc; i++)
49    argv[i-1] = args->argv[i];
50
51  argv[argc - 1] = NULL;
52 
53#if 0
54  for(i=0; i < argc; i++)
55    ksh_print("%s: argv[%d]=%x, argv[%d]=%s\n", __FUNCTION__,i, argv[i], i, (argv[i] == NULL) ? "NULL" : argv[i]);
56#endif
57
58#if 0
59  if((err = do_exec(current_task, path_name, argv, &envrion[0])))
60  {
61    ksh_print("exec: error %d, faild to execute command %s\n", err, path_name);
62    return err;
63  }
64#endif
65  return 0;
66}
67
Note: See TracBrowser for help on using the repository browser.