1 /*****************************************************************************
2    Major portions of this software are copyrighted by the Medical College
3    of Wisconsin, 1994-2000, and are released under the Gnu General Public
4    License, Version 2.  See the file README.Copyright for details.
5 ******************************************************************************/
6 
7 #ifndef _AFNI_ENVIRON_HEADER_
8 #define _AFNI_ENVIRON_HEADER_
9 
10 #ifdef  __cplusplus
11 extern "C" {
12 #endif
13 
14 /*-- macro to set environment variable if not already defined --*/
15 /*-- moved here from afni.c on 09 Mar 2011 for general usage  --*/
16 /*-- originally created there on 31 Jan 2008                  --*/
17 
18 #undef  PUTENV
19 #define PUTENV(nm,val) do{ if( getenv((nm)) == NULL ){           \
20                              char *str = (char *)malloc(256) ;   \
21                              strcpy(str,(nm)); strcat(str,"=");  \
22                              strcat(str,val);  putenv(str);      \
23                              if( PRINT_TRACING ) STATUS(str) ;   \
24                            }} while(0)
25 
26 extern int AFNI_process_environ( char * ) ;
27 extern char * AFNI_suck_file( char * ) ;
28 extern char * AFNI_suck_fifo( char * ) ;    /* 27 Aug 2019 */
29 extern int AFNI_suck_file_len(void) ;       /* 27 Feb 2009 */
30 extern char * my_getenv( char * ) ;
31 extern void AFNI_mark_environ_done(void) ;  /* 16 Apr 2000 */
32 extern void AFNI_mark_environ_undone(void); /* 26 Nov 2008 */
33 extern int  AFNI_check_environ_done(void);  /* 17 Feb 2010 */
34 extern int AFNI_yesenv( char * ) ;          /* 21 Jun 2000 */
35 extern int AFNI_noenv ( char * ) ;          /* 21 Jun 2000 */
36 extern double AFNI_numenv( char * ) ;       /* 23 Aug 2003 */
37 
38 extern double AFNI_numenv_def( char *, double ); /* 18 Sep 2007 */
39 
40 extern int AFNI_setenv( char *cmd ) ;       /* 22 Jan 2003 */
41 
42 extern char *get_gopt_help();
43 extern char *get_help_help();
44 void suggest_best_prog_option(char *prog, char *str);
45 void print_prog_options(char *prog);
46 extern int AFNI_prefilter_args( int *argc , char ***argv ) ; /* 11 Dec 2007 */
47 
48 /*-- 22 May 2000: macros for checking for Yes or No --*/
49 
50 #define YSTART(cp) \
51   ( (cp) != NULL && ( (cp)[0] == 'y' || (cp)[0] == 'Y' ) )
52 
53 #define NSTART(cp) \
54   ( (cp) != NULL && ( (cp)[0] == 'n' || (cp)[0] == 'N' ) )
55 
56 /** 21 Jun 2000: look for Yes or No **/
57 
58 #define YESSISH(ss) ( (ss)!=NULL && ( (ss)[0]=='Y' || (ss)[0]=='y' ) )
59 #define NOISH(ss)   ( (ss)!=NULL && ( (ss)[0]=='N' || (ss)[0]=='n' ) )
60 
61 #ifdef  __cplusplus
62 }
63 #endif
64 
65 #endif /* _AFNI_ENVIRON_HEADER_ */
66