Quash Shell  0.1
A simple yet powerfull shell program
Classes | Typedefs | Functions
parsing_interface.h File Reference

Defines an interface between c and the parser. This file is also responsible for defining many of the structures used by the parser. More...

#include <stdbool.h>
#include "command.h"
#include "deque.h"
#include "quash.h"

Go to the source code of this file.

Classes

struct  Redirect
 Intermediate parsing structure used to determine the final configuration of the redirects in a command. More...
 

Typedefs

typedef struct Redirect Redirect
 Intermediate parsing structure used to determine the final configuration of the redirects in a command.
 

Functions

Redirect mk_redirect (char *in, char *out, bool append)
 Creates an intermediate Redirect structure and returns a copy. More...
 
char * interpret_complex_string_token (const char *str)
 Clean up a string by removing escape symbols and unescaped single quotes. Also expands any environment variables. More...
 
CommandHolderparse (QuashState *state)
 Handles the call to the parser and provides a string equivalent of the Command structure to QuashState. More...
 
void destroy_parser ()
 Cleanup memory dynamically allocated by the parser.
 

Detailed Description

Defines an interface between c and the parser. This file is also responsible for defining many of the structures used by the parser.

Function Documentation

char* interpret_complex_string_token ( const char *  str)

Clean up a string by removing escape symbols and unescaped single quotes. Also expands any environment variables.

Parameters
strThe string to clean up
Returns
The cleaned up and expanded string allocated on the MemoryPool
See also
MemoryPool
Redirect mk_redirect ( char *  in,
char *  out,
bool  append 
)

Creates an intermediate Redirect structure and returns a copy.

Doxygen_Suppress

Parameters
inA string containing the name of a file to redirect the intput to a command from. This should be NULL if there are not any redirections in.
outA string containing the name of a file to redirect the output of a command to. This should be NULL if there are not any redirections out.
appendShould the redirect out append or truncate a file. True if append, false if truncate.
Returns
A copy of the constructed Redirect structure
See also
Redirect
CommandHolder* parse ( QuashState state)

Handles the call to the parser and provides a string equivalent of the Command structure to QuashState.

Parameters
[out]stateThe state of the quash shell. The parsed_str member of QuashState is set to the stringified command structure.
Returns
A pointer to the parsed command structure
See also
CommandHolder, QuashState