Updated README.txt, tweaks
This commit is contained in:
parent
41b42ac76c
commit
423d3c6f43
191
docs/README.txt
191
docs/README.txt
@ -1,53 +1,67 @@
|
|||||||
======
|
===============
|
||||||
=== SlideScript
|
= SlideScript =
|
||||||
======
|
===============
|
||||||
|
|
||||||
A simple, user friendly scripting language for the average person. SS is meant to
|
A simple, user friendly scripting language for the average person. SS is meant to
|
||||||
be simple, and work as its documented as. SlideScript is a bin tool to say the
|
be simple, and work as its documented as. SS is a bin tool to say the
|
||||||
least and is a helpful *nix userland tool in the CLI
|
least and is a helpful *nix userland tool in the CLI. Not only is SS a box full
|
||||||
|
of useful tools, it can also be used as a fully functional shell in a *nix like
|
||||||
|
environment!
|
||||||
|
|
||||||
-----
|
===============
|
||||||
Compiling
|
= Compiling =
|
||||||
-----
|
===============
|
||||||
* Compile SS using the make command.
|
|
||||||
* Install SS using make install.
|
|
||||||
* Modify test.ss to learn the basics of SS.
|
|
||||||
* Run ./test.ss to execute the script.
|
|
||||||
|
|
||||||
***NOTE: if compiling on OSX/BSD, please uncomment #define BSD in src/config.h
|
First, clone the repository:
|
||||||
|
$ git clone https://notabug.org/Pentium44/SlideScript
|
||||||
|
|
||||||
-----
|
Next, time to compile slidescript. Out the box, slidescript will compile on GNU/Linux
|
||||||
Documentation
|
distributions. ***NOTE*** If compiling on OSX/BSD/Android (and GNU/linux using clang),
|
||||||
-----
|
please uncomment "#define BSD" in src/inc/config.h
|
||||||
|
|
||||||
|
$ make
|
||||||
|
|
||||||
|
And install to the system
|
||||||
|
|
||||||
|
$ sudo make install
|
||||||
|
|
||||||
|
Testing SlideScript is very easy, you will find a nice test script in docs/examples
|
||||||
|
of the source tree. Execute functions.ss (./functions.ss from command line) and make sure
|
||||||
|
SS processes the script!
|
||||||
|
|
||||||
|
===============
|
||||||
|
=Documentation=
|
||||||
|
===============
|
||||||
Here is a list of functions and features that SlideScript comes with
|
Here is a list of functions and features that SlideScript comes with
|
||||||
at this moment!
|
at this moment!
|
||||||
|
|
||||||
* Commenting! Examples:
|
Commenting! Examples:
|
||||||
* # Comment is real in this one
|
* # Comment is real in this one
|
||||||
|
|
||||||
* Comp, loop, if, and ifn functions:
|
Comp, loop, if, and ifn functions:
|
||||||
* comp: "1" "1" -> compares integer 1 and 1 -> returns true
|
* comp: "1" "1" -> compares integer 1 and 1 -> returns true
|
||||||
* comp: "true" "false" -> compares string true and false -> returns false
|
* comp: "true" "false" -> compares string true and false -> returns false
|
||||||
* loop: 3; print "Hello world!" -> Will loop print "Hello world!" 3 times.
|
* loop: 3; print "Hello world!" -> Will loop print "Hello world!" 3 times.
|
||||||
* if: true; print "True!" -> Prints "True!"
|
* if: true; print "True!" -> Prints "True!"
|
||||||
* ifn: false; print "False!" -> Prints "False!"
|
* ifn: false; print "False!" -> Prints "False!"
|
||||||
|
|
||||||
* Read, write, and cat(enate) functions. Examples:
|
Read, write, and cat(enate) functions. Examples:
|
||||||
* write "file.txt" "This will be written to file.txt"
|
* write "file.txt" "This will be written to file.txt"
|
||||||
* read "file.txt"
|
* read "file.txt"
|
||||||
* cat "file.txt" "Data to write to end of file.txt"
|
* cat "file.txt" "Data to write to end of file.txt"
|
||||||
|
|
||||||
* Basic math expressions
|
Basic math expressions
|
||||||
* calc "45 / 5" or calc "255.3 * 442.77"
|
* calc "45 / 5" or calc "255.3 * 442.77"
|
||||||
* Of course addition and subtraction as well
|
* Of course addition and subtraction as well
|
||||||
|
|
||||||
* Time example:
|
Time example:
|
||||||
* time
|
* time
|
||||||
|
|
||||||
* Isdir and isfile function, example:
|
Isdir and isfile function, example:
|
||||||
* isdir "examples/" -> returns 0 for not, 1 for is
|
* isdir "examples/" -> returns 0 for not, 1 for is
|
||||||
* isfile "examples/functions.ss" -> returns 1, its there
|
* isfile "examples/functions.ss" -> returns 1, its there
|
||||||
|
|
||||||
* File manipulation functions
|
File manipulation functions
|
||||||
* move "file1" "file2" -> Renames/moves file1 to file2 (mv alias)
|
* move "file1" "file2" -> Renames/moves file1 to file2 (mv alias)
|
||||||
* chdir "/home/user" -> Changes directory to /home/user (cd alias)
|
* chdir "/home/user" -> Changes directory to /home/user (cd alias)
|
||||||
* backdir -> Moves you back one directory (..)
|
* backdir -> Moves you back one directory (..)
|
||||||
@ -58,48 +72,44 @@ at this moment!
|
|||||||
* mkdir "testing/" -> creates directory 'testing'
|
* mkdir "testing/" -> creates directory 'testing'
|
||||||
* mkfile "testing/file.txt" -> creates directory 'testing', and creates 'file.txt'
|
* mkfile "testing/file.txt" -> creates directory 'testing', and creates 'file.txt'
|
||||||
|
|
||||||
* Execute example:
|
Slidescript compression functions, example:
|
||||||
* exec "ls -al" (alias to ~"ls -al")
|
* compress "filename" -> compresses "filename" into "filename.lz"
|
||||||
|
* decompress "filename.lz" -> decompresses 'filename.lz'
|
||||||
|
|
||||||
* Slidescript compression functions, example:
|
Print example:
|
||||||
* compress "archivename" "file1 file2 dir1 dir2" -> file1, 2, and dir1, 2 archived, compressed,
|
|
||||||
and saved in 'archivename.tar.ss'
|
|
||||||
* decompress "archivename.tar.ss" -> decompresses 'archivename.tar.ss'
|
|
||||||
|
|
||||||
* Print example:
|
|
||||||
* print "Hi everyone!"
|
* print "Hi everyone!"
|
||||||
|
|
||||||
* Sleep (Zzz) example (sleeps for 2 seconds):
|
Sleep (Zzz) example (sleeps for 2 seconds):
|
||||||
* sleep 2
|
* sleep 2
|
||||||
|
|
||||||
* Search functions, example:
|
Search functions (similar to grep, not as powerful), example:
|
||||||
* search "README.txt" "SlideScript" -> returns each line that 'SlideScript' is found on
|
* search "README.txt" "SlideScript" -> returns each line that 'SlideScript' is found on
|
||||||
|
|
||||||
* Variable setting and passing
|
Variable setting and passing
|
||||||
* filename=file.txt -> filename
|
* filename=file.txt -> filename
|
||||||
* filedata=File '%filename%' is being moved to moo -> %filename% is populated as file.txt
|
* filedata=File '%filename%' is being moved to moo -> %filename% is populated as file.txt
|
||||||
* write "%filename%" "%filedata%" -> writes filedata contents to file.txt as expected.
|
* write "%filename%" "%filedata%" -> writes filedata contents to file.txt as expected.
|
||||||
* unset "filename" -> Removes variable data from session memory to be redefinied / reused.
|
* unset "filename" -> Removes variable data from session memory to be redefinied / reused.
|
||||||
|
|
||||||
* Decoding and encoding strings
|
Decoding and encoding strings
|
||||||
* encode "Regular string" -> Converts to encrypted string 'Uhjvqds#xuulqj'
|
* encode "Regular string" -> Converts to encrypted string 'Uhjvqds#xuulqj'
|
||||||
* decode "Uhjvqds#xuulqj" -> Converts back to 'Regular string'
|
* decode "Uhjvqds#xuulqj" -> Converts back to 'Regular string'
|
||||||
|
|
||||||
* MD5 file checking
|
MD5 file checking
|
||||||
* md5 "file.txt" -> outputs filename and md5 hash
|
* md5 "file.txt" -> outputs filename and md5 hash
|
||||||
|
|
||||||
* Layered piping
|
Layered piping
|
||||||
* md5 "file.txt" | encrypt "%PIPE%" | write "file.txt.md5.enc" "%PIPE%" -> writes output of md5 to file.txt.md5
|
* md5 "file.txt" | encrypt "%PIPE%" | write "file.txt.md5.enc" "%PIPE%" -> writes output of md5 to file.txt.md5
|
||||||
|
|
||||||
* Networking functions
|
Networking functions
|
||||||
* netlisten "<port>" "<search>" "<respond>" -> listens on <port> and replies <respond> on <search> found from outside
|
* netlisten "<port>" "<search>" "<respond>" -> listens on <port> and replies <respond> on <search> found from outside
|
||||||
* nettoss "<address>" "<port>" "<data>" -> binds to outside server at <address>:<port> and pushes <data> thus, disconnecting
|
* nettoss "<address>" "<port>" "<data>" -> binds to outside server at <address>:<port> and pushes <data> thus, disconnecting
|
||||||
* nethttp "<port>" "<forkval>" -> throws up a web server on <port> in the current working directory,
|
* nethttp "<port>" "<forkval>" -> throws up a web server on <port> in the current working directory,
|
||||||
forkval (0 or 1, 0 don't fork into background / 1 do).
|
forkval (0 or 1, 0 don't fork into background / 1 do).
|
||||||
|
|
||||||
* Backquoted function parsing within variables
|
Backquoted function parsing within variables, also works within most major functions
|
||||||
* curtime=`time` -> Will set curtime value to return of time at the time of parse.
|
* curtime=`time` -> Will set curtime value to return of time at the time of parse.
|
||||||
print "%curtime%" -> Prints the variable value of curtime, same operation as function time, but good for timing scripts
|
* print "%curtime%" -> Prints the variable value of curtime, same operation as function time, but good for timing scripts
|
||||||
|
|
||||||
|
|
||||||
This will change rapidly as of currently, slidescript is in beavy development! To get the feel of the scripting,
|
This will change rapidly as of currently, slidescript is in beavy development! To get the feel of the scripting,
|
||||||
@ -110,62 +120,62 @@ net-http.ss -> displays built in http web server
|
|||||||
net-listen.ss -> displays slidescript's raw listen socket
|
net-listen.ss -> displays slidescript's raw listen socket
|
||||||
net-toss.ss -> displays the 'client side' networking function.
|
net-toss.ss -> displays the 'client side' networking function.
|
||||||
|
|
||||||
|
===============
|
||||||
-----
|
= Todo list =
|
||||||
Todo list
|
===============
|
||||||
-----
|
|
||||||
|
|
||||||
This section will obviously expand and adapt to the direction of the language. This is going to change rapidly.
|
This section will obviously expand and adapt to the direction of the language. This is going to change rapidly.
|
||||||
|
|
||||||
* More networking function flexibility
|
- More networking function flexibility
|
||||||
* Micro text editor
|
- Micro text editor
|
||||||
* IRC server, bot, and client built in <--- in progress, will be possible with network functions
|
- IRC server, bot, and client built in <--- in progress, will be possible with network functions
|
||||||
* Probably more stuff!
|
- Probably more stuff!
|
||||||
|
|
||||||
-----
|
===============
|
||||||
Done
|
= Done =
|
||||||
-----
|
===============
|
||||||
|
|
||||||
List of finished features, in a rough summary.
|
List of finished features, in a rough summary.
|
||||||
|
|
||||||
* Added help, and version functions
|
- Added help, and version functions
|
||||||
* Simple syntax checking and error reporting, its a lazy language, syntax can sway.
|
- Simple syntax checking and error reporting, its a lazy language, syntax can sway.
|
||||||
* Most syntax errors will produce warnings instead of terminating process
|
- Most syntax errors will produce warnings instead of terminating process
|
||||||
* Up to 32 layer function piping
|
- Up to 32 layer function piping
|
||||||
* Support for linux system calls
|
- Support for linux system calls
|
||||||
* Network listen socket, toss function
|
- Network listen socket, toss function
|
||||||
* Builtin HTTP server for disposeable use, can be ran in the foreground or forked into the background
|
- Builtin HTTP server for disposeable use, can be ran in the foreground or forked into the background
|
||||||
* Read and write from file
|
- Read and write from file
|
||||||
* Some simple functions
|
- Lots of simple but useful functions
|
||||||
* Shebang handling
|
- Shebang handling
|
||||||
* Variable support
|
- Variable support
|
||||||
* If, ifn, loop, and comp statements
|
- If, ifn, loop, and comp statements
|
||||||
* PATH variable support for use as a shell in some cases
|
- PATH variable support
|
||||||
* Web server additions (pulled from chttpd)
|
- Calls system executables if not known as a SS function! (its a shell too!)
|
||||||
|
- Web server additions (pulled from chttpd)
|
||||||
|
|
||||||
-----
|
===============
|
||||||
Changelog
|
= Changelog =
|
||||||
-----
|
===============
|
||||||
|
|
||||||
Changes between version bumps in SlideScript. Hoping to have a lightweight top-down scripting language
|
Changes between version bumps in SlideScript. Hoping to have a lightweight top-down scripting language
|
||||||
by V1.0.0 release! From there it will be molding and preserving the art.
|
by V1.0.0 release! From there it will be molding and preserving the art.
|
||||||
* V0.7.2
|
V0.7.2
|
||||||
* Bug fixes
|
* Bug fixes
|
||||||
* Integrated PATH variables into slidescript for the sake of a useable shell
|
* Integrated PATH variables into slidescript for the sake of a useable shell
|
||||||
* Allow for external programs to be ran from slidescript if no functions found (shell)
|
* Allow for external programs to be ran from slidescript if no functions found (shell)
|
||||||
|
|
||||||
* V0.7.1
|
V0.7.1
|
||||||
* Removed tar sources from SlideScript, does it need to create tar packages. (You can use system utils)
|
* Removed tar sources from SlideScript, does it need to create tar packages. (You can use system utils)
|
||||||
* Reworked compress / decompress for single file operations. Great for resources FOR slidescript (assets)
|
* Reworked compress / decompress for single file operations. Great for resources FOR slidescript (assets)
|
||||||
* Working on the lexer engine for line parsing and cleaner syntax.
|
* Working on the lexer engine for line parsing and cleaner syntax.
|
||||||
|
|
||||||
* V0.7.0
|
V0.7.0
|
||||||
* Ditched old LZ77 example code, and went with a more polished LZ78 ()
|
* Ditched old LZ77 example code, and went with a more polished LZ78 ()
|
||||||
* Converted dynamic memory management layer into LZ78 engine and tar code.
|
* Converted dynamic memory management layer into LZ78 engine and tar code.
|
||||||
* Compress & Decompress are both fully functioning.
|
* Compress & Decompress are both fully functioning.
|
||||||
* Tidies, and polishing (pushing more for that full lenguage)
|
* Tidies, and polishing (pushing more for that full lenguage)
|
||||||
|
|
||||||
* V0.6.0
|
V0.6.0
|
||||||
* Multiple dynamic memory bug fixes, SlideScript is 99% dynamic on memory use
|
* Multiple dynamic memory bug fixes, SlideScript is 99% dynamic on memory use
|
||||||
* Included if, and ifn functions for comp, isfile, isdir, etc return values.
|
* Included if, and ifn functions for comp, isfile, isdir, etc return values.
|
||||||
* Incorporated unset function to wipe variable data within the same session.
|
* Incorporated unset function to wipe variable data within the same session.
|
||||||
@ -175,37 +185,37 @@ by V1.0.0 release! From there it will be molding and preserving the art.
|
|||||||
* Fixed compile warnings on some systems
|
* Fixed compile warnings on some systems
|
||||||
* Fixed system uncompatibility for Windows systems, should work cross-compiled!
|
* Fixed system uncompatibility for Windows systems, should work cross-compiled!
|
||||||
|
|
||||||
* V0.5.4
|
V0.5.4
|
||||||
* Added memory management framework for dynamic memory handling
|
* Added memory management framework for dynamic memory handling
|
||||||
* tar.c cleanup
|
* tar.c cleanup
|
||||||
* fflush additions for telnet usage of SS.
|
* fflush additions for telnet usage of SS.
|
||||||
|
|
||||||
* V0.5.3
|
V0.5.3
|
||||||
* Added version, and help command
|
* Added version, and help command
|
||||||
|
|
||||||
* V0.5.2
|
V0.5.2
|
||||||
* Bugfixes and tweaks
|
* Bugfixes and tweaks
|
||||||
* Added loop and comp(are) statements
|
* Added loop and comp(are) statements
|
||||||
|
|
||||||
* V0.5.1
|
V0.5.1
|
||||||
* Compression and decompression bugfixes
|
* Compression and decompression bugfixes
|
||||||
* System working functions (move, chdir, and showpath)
|
* System working functions (move, chdir, and showpath)
|
||||||
* General clean, removed bins/ until language stabilizes
|
* General clean, removed bins/ until language stabilizes
|
||||||
|
|
||||||
* V0.5.0
|
V0.5.0
|
||||||
* Interactive mode gives users prompt on call to slidescript (Thanks OldCoder!)
|
* Interactive mode gives users prompt on call to slidescript (Thanks OldCoder!)
|
||||||
* Added showdir (alias ls)
|
* Added showdir (alias ls)
|
||||||
* Added compress / decompress functions (WIP, slow LZ77 algorithm)
|
* Added compress / decompress functions (WIP, slow LZ77 algorithm)
|
||||||
* Multiple bug fixes
|
* Multiple bug fixes
|
||||||
* Shell like interactive behavior
|
* Shell like interactive behavior
|
||||||
|
|
||||||
* V0.4.5
|
V0.4.5
|
||||||
* Multiple bug fixes in not setting null byte to dynamic mem before strcat is used
|
* Multiple bug fixes in not setting null byte to dynamic mem before strcat is used
|
||||||
* Function isfile, as well as mkfile and mkdir are added
|
* Function isfile, as well as mkfile and mkdir are added
|
||||||
* Added grep like function, search!
|
* Added grep like function, search!
|
||||||
* Cleanup code
|
* Cleanup code
|
||||||
|
|
||||||
* V0.4.4
|
V0.4.4
|
||||||
* Softened the kill program errors, added warn functions behind the scenes
|
* Softened the kill program errors, added warn functions behind the scenes
|
||||||
* Added backquote function processing in variables
|
* Added backquote function processing in variables
|
||||||
* Fixed bug in read not displaying multi-line files
|
* Fixed bug in read not displaying multi-line files
|
||||||
@ -213,42 +223,43 @@ by V1.0.0 release! From there it will be molding and preserving the art.
|
|||||||
* Added function isdir, and cat(enate) function. NOT cat as in linux env.
|
* Added function isdir, and cat(enate) function. NOT cat as in linux env.
|
||||||
* Code clean-up
|
* Code clean-up
|
||||||
|
|
||||||
* V0.4.0
|
V0.4.0
|
||||||
* Added calc function for floating math equations
|
* Added calc function for floating math equations
|
||||||
* Cleaned up some more syntax handling, as well as bugs
|
* Cleaned up some more syntax handling, as well as bugs
|
||||||
* Added structured and savable multi-layer piping up to 32 functions deep
|
* Added structured and savable multi-layer piping up to 32 functions deep
|
||||||
|
|
||||||
* V0.3.3
|
V0.3.3
|
||||||
* Added first networking functions: netlisten, nettoss, nethttp.
|
* Added first networking functions: netlisten, nettoss, nethttp.
|
||||||
* Embedded web server functionality
|
* Embedded web server functionality
|
||||||
* Cleaned up code
|
* Cleaned up code
|
||||||
* Improved syntax handling on functions
|
* Improved syntax handling on functions
|
||||||
|
|
||||||
* V0.3.0
|
V0.3.0
|
||||||
* Added simple 2 layer function piping for more useful tasks
|
* Added simple 2 layer function piping for more useful tasks
|
||||||
* Fixed a couple core dump bugs
|
* Fixed a couple core dump bugs
|
||||||
* Now reads files into memory, and then forces text files through SS, allows for in file variables
|
* Now reads files into memory, and then forces text files through SS, allows for in file variables
|
||||||
* Added "md5" functionality
|
* Added "md5" functionality
|
||||||
* Multi-formal working syntax
|
* Multi-formal working syntax
|
||||||
|
|
||||||
* V0.2.1
|
V0.2.1
|
||||||
* Added "decrypt" decode function
|
* Added "decrypt" decode function
|
||||||
* Added "encrypt" encode function
|
* Added "encrypt" encode function
|
||||||
* Added system "exec" function
|
* Added system "exec" function
|
||||||
* Added basic syntax handling, for a more uniform language
|
* Added basic syntax handling, for a more uniform language
|
||||||
|
|
||||||
* V0.2.0
|
V0.2.0
|
||||||
* Added "delete" function
|
* Added "delete" function
|
||||||
* Added embedded variable handling to SS functions (variables can be used like everywhere!)
|
* Added embedded variable handling to SS functions (variables can be used like everywhere!)
|
||||||
* Added linux system calls via exec
|
* Added linux system calls via exec
|
||||||
* Some cleaning up.
|
* Some cleaning up.
|
||||||
|
|
||||||
* V0.1.1
|
V0.1.1
|
||||||
* Added variable handling with a buffer size of 2KB per variable, and cap of 2048 variables.
|
* Added variable handling with a buffer size of 2KB per variable, and cap of 2048 variables.
|
||||||
* Now operates under the shebang!
|
* Now operates under the shebang!
|
||||||
|
|
||||||
-----
|
===============
|
||||||
Contributions
|
=Contributions=
|
||||||
-----
|
===============
|
||||||
Robert (OldCoder) Kiraly -> shebang support and string manipulations
|
|
||||||
(C) Copyright 2014-2021 Chris Dorman, some rights reserved (GPLv2)
|
Robert (OldCoder) Kiraly -> shebang support, string manipulation, and memory management
|
||||||
|
(C) Copyright 2014-2022 Chris Dorman, some rights reserved (GPLv2)
|
||||||
|
@ -30,7 +30,7 @@ ss_stringdata=Data to encrypt and decrypt
|
|||||||
ss_exec_command=uname -a
|
ss_exec_command=uname -a
|
||||||
|
|
||||||
# Printing function in SS
|
# Printing function in SS
|
||||||
print "Welcome to SlideScript!"
|
===============print "Welcome to SlideScript!"
|
||||||
# Sleep function in SS
|
# Sleep function in SS
|
||||||
print "Some content to print, working with '%ss_filename%' today!"
|
print "Some content to print, working with '%ss_filename%' today!"
|
||||||
# Below demonstrates SS encrypting a string, passing the output
|
# Below demonstrates SS encrypting a string, passing the output
|
||||||
@ -92,7 +92,6 @@ calc "46 / 3.4"
|
|||||||
# Execute function, SS can call unix system calls!
|
# Execute function, SS can call unix system calls!
|
||||||
# Executes the ss_exec_command variable data, 'ls'
|
# Executes the ss_exec_command variable data, 'ls'
|
||||||
print "Testing exec function on system"
|
print "Testing exec function on system"
|
||||||
exec "%ss_exec_command%"
|
|
||||||
|
|
||||||
# comp, loop, if, and ifn examples
|
# comp, loop, if, and ifn examples
|
||||||
|
|
||||||
@ -116,3 +115,7 @@ unset "compvar"
|
|||||||
# Set again, and compare integers
|
# Set again, and compare integers
|
||||||
compvar=`comp: "245" "245"`
|
compvar=`comp: "245" "245"`
|
||||||
if: %compvar%; print "Values match!"
|
if: %compvar%; print "Values match!"
|
||||||
|
|
||||||
|
# Want to use SS as a shell?
|
||||||
|
# System wide executables can be ran!
|
||||||
|
%ss_exec_command%
|
||||||
|
16
src/lexer.c
16
src/lexer.c
@ -29,12 +29,9 @@ char *process_line (char *line)
|
|||||||
// Needed for strncpy
|
// Needed for strncpy
|
||||||
static char line_backup[MAXPATHLENGTH+1];
|
static char line_backup[MAXPATHLENGTH+1];
|
||||||
|
|
||||||
// save full line if popen is used, and no function is found
|
|
||||||
bzero(line_backup, sizeof(line_backup));
|
bzero(line_backup, sizeof(line_backup));
|
||||||
strcpy(line_backup, line);
|
strcpy(line_backup, line);
|
||||||
|
|
||||||
char **func_args = line_to_args(line_backup);
|
|
||||||
|
|
||||||
// Check to see if we're dealing with a
|
// Check to see if we're dealing with a
|
||||||
// variable (for the end if the lexer)
|
// variable (for the end if the lexer)
|
||||||
int isVar = check_for_var(line);
|
int isVar = check_for_var(line);
|
||||||
@ -52,8 +49,14 @@ char *process_line (char *line)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(strncmp("\n", tok_srch,1) == 0)
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
char **func_args = line_to_args(parse_vars(line_backup));
|
||||||
|
|
||||||
// Check for main calls from user in interactive
|
// Check for main calls from user in interactive
|
||||||
else if (strncmp("exit", tok_srch, 4) == 0)
|
if (strncmp("exit", tok_srch, 4) == 0)
|
||||||
x_error("ss:exit called");
|
x_error("ss:exit called");
|
||||||
|
|
||||||
else if (strncmp("version", tok_srch, 7) == 0)
|
else if (strncmp("version", tok_srch, 7) == 0)
|
||||||
@ -1114,10 +1117,7 @@ char *process_line (char *line)
|
|||||||
file_md5_val = md5_file(file_line);
|
file_md5_val = md5_file(file_line);
|
||||||
catfile = ss_concat(file_md5_val, file_line);
|
catfile = ss_concat(file_md5_val, file_line);
|
||||||
|
|
||||||
retbuf = qmalloc(QM_SS, strlen(catfile)+1);
|
return catfile;
|
||||||
strcpy(retbuf, catfile);
|
|
||||||
free(catfile);
|
|
||||||
return retbuf;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (strncmp("search",tok_srch,6) == 0)
|
else if (strncmp("search",tok_srch,6) == 0)
|
||||||
|
@ -108,7 +108,6 @@ int main(int argc, char **argv)
|
|||||||
a) scripts parsed or
|
a) scripts parsed or
|
||||||
b) user session is over */
|
b) user session is over */
|
||||||
qflush(QM_VARIABLES);
|
qflush(QM_VARIABLES);
|
||||||
|
|
||||||
if (argc != 1 ) fclose(script);
|
if (argc != 1 ) fclose(script);
|
||||||
exit(EXIT_SUCCESS);
|
exit(EXIT_SUCCESS);
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
|
|
||||||
|
|
||||||
#include "inc/deps.h"
|
#include "inc/deps.h"
|
||||||
|
#include "inc/lexer.h"
|
||||||
#include "inc/util.h"
|
#include "inc/util.h"
|
||||||
|
|
||||||
time_t current_time;
|
time_t current_time;
|
||||||
@ -89,7 +90,7 @@ int mkpath(char* file_path, mode_t mode)
|
|||||||
|
|
||||||
char *ss_concat(char *str1, char *str2)
|
char *ss_concat(char *str1, char *str2)
|
||||||
{
|
{
|
||||||
char *dymem = (char *) malloc((strlen(str1)+strlen(str2)) + 3);
|
char *dymem = qmalloc(QM_SS, (strlen(str1)+strlen(str2)) + 5);
|
||||||
sprintf(dymem, "%s, %s", str1, str2);
|
sprintf(dymem, "%s, %s", str1, str2);
|
||||||
return dymem;
|
return dymem;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user