cluni0.c File Reference

#include <stdio.h>
#include <string.h>
#include "core_math.h"
#include "Os_specific.h"

Include dependency graph for cluni0.c:

Go to the source code of this file.

Defines

#define MAX_ENV   256

Functions

void GetenvB __PARAMS ((char *name, char *env, int len))
static int Cluni0 __PARAMS ((char *env, char **alias, char *in_name, char *out_name, long int lin))
int C2F() cluni0 (char *in_name, char *out_name, int *out_n, long int lin, long int lout)
void GetenvB (char *name, char *env, int len)
static int Cluni0 (char *env, char **alias, char *in_name, char *out_name, long int lin)

Variables

static char * SCI_a [] = { "SCI/", "sci/", "$SCI", "SCI\\", "sci\\", (char *) 0 }
static char * HOME_a [] = { "HOME/", "home/", "~/" , "HOME\\", "home\\", "~\\" ,"$HOME", (char *) 0}
static char * TMP_a [] = { "TMPDIR/", "tmpdir/","TMPDIR\\", "tmpdir\\", "$TMPDIR", (char *) 0}
int UpdateEnvVar
static int n = 0


Define Documentation

#define MAX_ENV   256

Definition at line 8 of file cluni0.c.


Function Documentation

static int Cluni0 __PARAMS ( (char *env, char **alias, char *in_name, char *out_name, long int lin  )  [static]

void GetenvB __PARAMS ( (char *name, char *env, int len  ) 

static int Cluni0 ( char *  env,
char **  alias,
char *  in_name,
char *  out_name,
long int  lin 
) [static]

Definition at line 83 of file cluni0.c.

References i.

Referenced by cluni0().

00084 {
00085   int i=0;
00086   if ( env[0] == '\0' ) return(0);
00087   while ( alias[i] != (char *) 0) 
00088     {
00089       if ( strncmp(alias[i],in_name,strlen(alias[i])) == 0)
00090         {
00091           strcpy(out_name,env);
00092           strncat(out_name,in_name+strlen(alias[i])-1,
00093                   (size_t)(lin-strlen(alias[i]+1)));
00094           /*sprintf(out_name,"%s/%s",env,in_name+strlen(alias[i]));*/
00095           return(1);
00096         }
00097       i++;
00098     }
00099   return(0);
00100 }

Here is the caller graph for this function:

int C2F() cluni0 ( char *  in_name,
char *  out_name,
int out_n,
long int  lin,
long int  lout 
)

Definition at line 23 of file cluni0.c.

References Cluni0(), GetenvB(), HOME, MAX_ENV, nc, SCI, and SCI_a.

Referenced by C2F(), getfilenamehistory(), GetIndexLastModifiedFileInList(), intopenxls(), and xgetfile().

00024 {
00025   int  nc= MAX_ENV;
00026   static char SCI[MAX_ENV],HOME[MAX_ENV],TMP[MAX_ENV];
00027   static int k;
00028   
00029   if ( ( n==0 ) || (UpdateEnvVar == 1) )
00030   {
00031           GetenvB("SCI",SCI,nc);
00032           GetenvB("HOME",HOME,nc);
00033       GetenvB("TMPDIR",TMP,nc);
00034           n=n+1;
00035           UpdateEnvVar=0;
00036   }
00037   /* in_name[lin]='\0';*/
00038   if ( Cluni0(SCI,SCI_a,in_name,out_name,lin) == 0 )
00039     if ( Cluni0(HOME,HOME_a,in_name,out_name,lin) == 0 )
00040       if ( Cluni0(TMP,TMP_a,in_name,out_name,lin) == 0 ){
00041         strncpy(out_name,in_name,(size_t)lin);
00042         out_name[lin]='\0';
00043       }
00044   /*strncpy(out_name,in_name,lout); */
00045   *out_n = strlen(out_name);
00046 #if defined(_MSC_VER)
00047   for (k=0 ; k < *out_n ;k++) if ( out_name[k]=='/') out_name[k]='\\';
00048 #else
00049   for (k=0 ; k < *out_n ;k++) if ( out_name[k]=='\\') out_name[k]='/';
00050 #endif
00051 
00052 
00054   return(0);
00055 }

Here is the call graph for this function:

Here is the caller graph for this function:

void GetenvB ( char *  name,
char *  env,
int  len 
)

Definition at line 61 of file cluni0.c.

References C2F, getenvc(), ierr, and last.

Referenced by BuildName(), and cluni0().

00062 {
00063   int ierr,un=1;
00064   C2F(getenvc)(&ierr,name,env,&len,&un);
00065   if( ierr == 0) 
00066     {
00067       char *last = &env[len-1];
00068       while ( *last == ' ' ) { last = '\0' ; } last--;
00069     }
00070   else 
00071     {
00072       env[0] = '\0' ;
00073     }  
00074 }

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

char* HOME_a[] = { "HOME/", "home/", "~/" , "HOME\\", "home\\", "~\\" ,"$HOME", (char *) 0} [static]

Definition at line 11 of file cluni0.c.

int n = 0 [static]

Definition at line 17 of file cluni0.c.

char* SCI_a[] = { "SCI/", "sci/", "$SCI", "SCI\\", "sci\\", (char *) 0 } [static]

Definition at line 10 of file cluni0.c.

Referenced by cluni0().

char* TMP_a[] = { "TMPDIR/", "tmpdir/","TMPDIR\\", "tmpdir\\", "$TMPDIR", (char *) 0} [static]

Definition at line 12 of file cluni0.c.

int UpdateEnvVar

Definition at line 16 of file setenvc.c.

Referenced by setenvc().


Generated on Sun Mar 4 15:14:43 2007 for Scilab [trunk] by  doxygen 1.5.1