/[ascend]/trunk/base/generic/general/env.h
ViewVC logotype

Contents of /trunk/base/generic/general/env.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 584 - (show annotations) (download) (as text)
Wed May 10 16:56:00 2006 UTC (18 years, 2 months ago) by johnpye
File MIME type: text/x-chdr
File size: 1880 byte(s)
Adding these files which will help with the environment variable/default path problem.
1 /* ASCEND modelling environment
2 Copyright (C) 2006 Carnegie Mellon University
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2, or (at your option)
7 any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 59 Temple Place - Suite 330,
17 Boston, MA 02111-1307, USA.
18 *//**
19 @file
20 Environment variable helper routines
21 *//*
22 by John Pye, May 2006.
23 */
24
25 #ifndef ASC_ENV_H
26 #define ASC_ENV_H
27
28 #ifdef TEST
29 # define ASC_DLLSPEC(T) T
30 #else
31 # include <utilities/config.h>
32 # include <utilities/ascConfig.h>
33 # include <utilities/ascMalloc.h>
34 # define FREE ascfree
35 # define MALLOC ascmalloc
36 #endif
37
38 /**
39 This is the type of env var function that you must send to 'env_subst'.
40 It doesn't have to actually consult the environment; it could do all
41 sorts of other stuff if you wanted.
42 */
43 typedef char *(GetEnvFn)(const char *name);
44
45 /**
46 Perform variable substitution on a string in shell-like way.
47 This should replace any $VARNAME with the result of
48 (*getenvptr)(VARNAME).
49
50 At present there will be no allowance for lowercase env var names
51 only uppercase and underscores. No escaping of dollar signs is
52 allowed for yet, and not ${BRACKETING}TO_STOP adjected characters
53 from being swallowed up is allowed for, either. These can be added
54 later, 'as an exercise'.
55 */
56 ASC_DLLSPEC(char *) env_subst(const char *path,GetEnvFn *getenvptr);
57
58 #endif

john.pye@anu.edu.au
ViewVC Help
Powered by ViewVC 1.1.22