1 | /* $Id: kmkbuiltin.c 225 2005-02-09 08:31:14Z bird $ */
|
---|
2 | /** @file
|
---|
3 | *
|
---|
4 | * kMk Builtin command execution.
|
---|
5 | *
|
---|
6 | * Copyright (c) 2005 knut st. osmundsen <bird@innotek.de>
|
---|
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 <stdio.h>
|
---|
29 | #include "kmkbuiltin.h"
|
---|
30 |
|
---|
31 | int kmk_builtin_cp(char **argv)
|
---|
32 | {
|
---|
33 | return 1;
|
---|
34 | }
|
---|
35 |
|
---|
36 | int kmk_builtin_command(char **argv)
|
---|
37 | {
|
---|
38 | const char *pszCmd = argv[0];
|
---|
39 | int rc;
|
---|
40 |
|
---|
41 | /*
|
---|
42 | * Check and skip the prefix.
|
---|
43 | */
|
---|
44 | if (strncmp(pszCmd, "kmk_builtin_", sizeof("kmk_builtin_") - 1))
|
---|
45 | {
|
---|
46 | printf("kmk_builtin: Invalid command prefix '%s'!\n", pszCmd);
|
---|
47 | return 1;
|
---|
48 | }
|
---|
49 | pszCmd += sizeof("kmk_builtin_") - 1;
|
---|
50 |
|
---|
51 | /*
|
---|
52 | * String switch on the command.
|
---|
53 | */
|
---|
54 | if (!strcmp(pszCmd, "cp"))
|
---|
55 | rc = kmk_builtin_cp(argv);
|
---|
56 | //else if (!strcmp(pszCmd, "chmod"))
|
---|
57 | // rc = kmk_builtin_chmod(argv);
|
---|
58 | //else if (!strcmp(pszCmd, "mkdir"))
|
---|
59 | // rc = kmk_builtin_mkdir(argv);
|
---|
60 | //else if (!strcmp(pszCmd, "mv"))
|
---|
61 | // rc = kmk_builtin_mv(argv);
|
---|
62 | //else if (!strcmp(pszCmd, "rm"))
|
---|
63 | // rc = kmk_builtin_rm(argv);
|
---|
64 | //else if (!strcmp(pszCmd, "rmdir"))
|
---|
65 | // rc = kmk_builtin_rmdir(argv);
|
---|
66 | else
|
---|
67 | {
|
---|
68 | printf("kmk_builtin: Unknown command '%s'!\n", pszCmd);
|
---|
69 | return 1;
|
---|
70 | }
|
---|
71 | return rc;
|
---|
72 | }
|
---|
73 |
|
---|