| 1 |
/* |
| 2 |
* Ikarus Scheme -- A compiler for R6RS Scheme. |
| 3 |
* Copyright (C) 2006,2007,2008 Abdulaziz Ghuloum |
| 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 version 3 as |
| 7 |
* published by the Free Software Foundation. |
| 8 |
* |
| 9 |
* This program 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 this program. If not, see <http://www.gnu.org/licenses/>. |
| 16 |
*/ |
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
#include "ikarus-main.h" |
| 21 |
#include "bootfileloc.h" |
| 22 |
#include <stdio.h> |
| 23 |
#include <string.h> |
| 24 |
#include <stdio.h> |
| 25 |
#include <stdlib.h> |
| 26 |
|
| 27 |
void ikarus_usage_short(){ |
| 28 |
fprintf(stderr, "scheme-script <script-name> arguments ...\n"); |
| 29 |
} |
| 30 |
|
| 31 |
void ikarus_usage(){ |
| 32 |
static char* helpstring = |
| 33 |
"Usage: \n\ |
| 34 |
scheme-script <script-name> arguments ...\n\ |
| 35 |
\n\ |
| 36 |
Runs the file <script-name> as a Scheme script, passing\n\ |
| 37 |
arguments ... as (command-line)\n\ |
| 38 |
\n\ |
| 39 |
Consult the Ikarus Scheme User's Guide for more details.\n\n"; |
| 40 |
fprintf(stderr, "%s", helpstring); |
| 41 |
} |
| 42 |
|
| 43 |
int main(int argc, char** argv){ |
| 44 |
if(argc < 2) { |
| 45 |
ikarus_usage(); |
| 46 |
exit(-1); |
| 47 |
} |
| 48 |
char* boot_file = BOOTFILE; |
| 49 |
char** args = calloc(sizeof(char*), argc+1); |
| 50 |
args[0] = argv[0]; |
| 51 |
args[1] = "--r6rs-script"; |
| 52 |
int i; |
| 53 |
for(i=1; i<argc; i++){ |
| 54 |
args[i+1] = argv[i]; |
| 55 |
} |
| 56 |
return ikarus_main(argc+1, args, boot_file); |
| 57 |
} |
| 58 |
|
| 59 |
|