55 lines
1.1 KiB
C
55 lines
1.1 KiB
C
/*
|
|
SlideScript - minimalistic top-down scripting language.
|
|
(C) Copyright 2014-2021 Chris Dorman - some rights reserved (GPLv2)
|
|
|
|
View README file supplied with this software for more details
|
|
*/
|
|
|
|
|
|
#include "deps.h"
|
|
#include "util.h"
|
|
|
|
void syn_error(char *message)
|
|
{
|
|
printf("%s\n", message);
|
|
exit(1);
|
|
}
|
|
|
|
char *strip_nl (char *string)
|
|
{
|
|
int n = strlen (string);
|
|
|
|
if ((n-- > 0) && (string [n] == '\n'))
|
|
{
|
|
string [n] = NULLBYTE;
|
|
return string;
|
|
}
|
|
else
|
|
{
|
|
/* no newline found, return the original string */
|
|
return string;
|
|
}
|
|
}
|
|
|
|
void parse_args(int argc, char** argv)
|
|
{
|
|
/* -h flag given, show help */
|
|
if(argc == 2 && strncmp("-h", argv[1], 2) == 0)
|
|
{
|
|
printf("SlideScript - simple top-down scripting language for the average user\n"
|
|
"Arguments:\n\n"
|
|
"-v\t Display version number\n"
|
|
"-h\t Display this help page\n"
|
|
"Usage: %s <filename>\n", argv[0]);
|
|
exit(EXIT_SUCCESS);
|
|
}
|
|
/* -v flag given, show version */
|
|
else if(argc == 2 && strncmp("-v", argv[1], 2) == 0)
|
|
{
|
|
printf("SlideScript %s-%s, Chris Dorman (cddo@riseup.net), 2021\n", VERSION, VERSION_EXTRA);
|
|
exit(EXIT_SUCCESS);
|
|
}
|
|
|
|
}
|
|
|