3 MPSL - Minimum Profit Scripting Language
4 Copyright (C) 2003/2007 Angel Ortega <angel@triptico.com>
6 mpsl_m.c - Minimum Profit Scripting Language main()
8 This program is free software; you can redistribute it and/or
9 modify it under the terms of the GNU General Public License
10 as published by the Free Software Foundation; either version 2
11 of the License, or (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 http://www.triptico.com
38 int mpsl_main(int argc
, char * argv
[])
41 char * immscript
= NULL
;
42 FILE * script
= stdin
;
46 /* skip the executable */
51 if(strcmp(argv
[0], "-v") == 0 ||
52 strcmp(argv
[0], "--help") == 0)
54 printf("MPSL %s - Minimum Profit Scripting Language\n", VERSION
);
55 printf("Copyright (C) 2003-2007 Angel Ortega <angel@triptico.com>\n");
56 printf("This software is covered by the GPL license. NO WARRANTY.\n\n");
58 printf("Usage: mpsl [-d] [-e 'script' | script.mpsl ]\n\n");
63 if(strcmp(argv
[0], "-d") == 0)
66 if(strcmp(argv
[0], "-e") == 0)
73 /* next argument is a script name; open it */
74 if((script
= fopen(argv
[0], "r")) == NULL
)
76 fprintf(stderr
, "Can't open '%s'\n", argv
[0]);
87 mpsl_argv(argc
, argv
);
91 v
= mpsl_compile(MPDM_MBS(immscript
));
93 v
= mpsl_compile_file(MPDM_F(script
));
103 /* prints the error, if any */
104 if((v
= mpsl_error(NULL
)) != NULL
)
106 mpdm_write_wcs(stderr
, mpdm_string(v
));
107 fprintf(stderr
, "\n");
118 int main(int argc
, char * argv
[])
120 return(mpsl_main(argc
, argv
));