Main Page | Data Structures | File List | Data Fields | Globals | Related Pages

builtin_set.c File Reference

Functions defining the set builtin. More...

#include "config.h"
#include <stdlib.h>
#include <stdio.h>
#include <wchar.h>
#include <wctype.h>
#include <sys/types.h>
#include <termios.h>
#include <signal.h>
#include "fallback.h"
#include "util.h"
#include "wutil.h"
#include "builtin.h"
#include "env.h"
#include "expand.h"
#include "common.h"
#include "wgetopt.h"
#include "proc.h"
#include "parser.h"

This graph shows which files directly or indirectly include this file:


Defines

#define BUILTIN_SET_PATH_ERROR   L"%ls: Could not add component %ls to %ls.\n"
 Error message for invalid path operations.
#define BUILTIN_SET_PATH_HINT   L"%ls: Did you mean 'set %ls $%ls %ls'?\n"
 Hint for invalid path operation with a colon.
#define BUILTIN_SET_ARG_COUNT   L"%ls: The number of variable indexes does not match the number of values\n"
 Error for mismatch between index count and elements.

Functions

static int is_path_variable (const wchar_t *env)
 Test if the specified variable should be subject to path validation.
static int my_env_set (const wchar_t *key, array_list_t *val, int scope)
 Call env_set.
static int parse_index (array_list_t *indexes, const wchar_t *src, const wchar_t *name, int var_count)
 Extract indexes from a destination argument of the form name[index1 index2.
static int update_values (array_list_t *list, array_list_t *indexes, array_list_t *values)
 Update a list list by writing copies (using wcsdup) of the values specified by values to the indexes specified by indexes.
static int al_contains_long (array_list_t *list, long val)
 Return 1 if an array list of longs contains the specified value, 0 otherwise.
static void erase_values (array_list_t *list, array_list_t *indexes)
 Erase from a list values at specified indexes.
static void print_variables (int include_values, int esc, int scope)
 Print the names of all environment variables in the scope, with or without values, with or without escaping.
static int builtin_set (wchar_t **argv)
 The set builtin.

Detailed Description

Functions defining the set builtin.

Functions used for implementing the set builtin.


Function Documentation

static int builtin_set wchar_t **  argv  )  [static]
 

The set builtin.

Creates, updates and erases environment variables and environemnt variable arrays.

Variables used for parsing the argument list

static int my_env_set const wchar_t *  key,
array_list_t val,
int  scope
[static]
 

Call env_set.

If this is a path variable, e.g. PATH, validate the elements. On error, print a description of the problem to stderr.

static int parse_index array_list_t indexes,
const wchar_t *  src,
const wchar_t *  name,
int  var_count
[static]
 

Extract indexes from a destination argument of the form name[index1 index2.

..]

Parameters:
indexes the list to insert the new indexes into
src the source string to parse
name the name of the element. Return null if the name in src does not match this name
var_count the number of elements in the array to parse.
Returns:
the total number of indexes parsed, or -1 on error

static int update_values array_list_t list,
array_list_t indexes,
array_list_t values
[static]
 

Update a list list by writing copies (using wcsdup) of the values specified by values to the indexes specified by indexes.

The previous entries at the specidied position will be free'd.

Returns:
0 if the operation was successfull, non-zero otherwise


Generated on Sun Jan 13 02:52:34 2008 for fish by  doxygen 1.4.4