Пример #1
0
_WCRTLINK CHAR_TYPE *__F_NAME(getenv,_wgetenv)( const CHAR_TYPE *name )
{
  #ifdef __NETWARE__
    name = name;
  #else
    CHAR_TYPE       **envp;
    CHAR_TYPE       *p;
    int             len;

  #ifdef __WIDECHAR__
    if( _RWD_wenviron == NULL ) {
        __create_wide_environment();
    }
  #endif

    /*** Find the environment string ***/
    __ptr_check( name, 0 );
    envp = __F_NAME(_RWD_environ,_RWD_wenviron);
    if( (envp != NULL) && (name != NULL) ) {
        len = __F_NAME(strlen,wcslen)( name );
        for( ; p = *envp; ++envp ) {
            if( CMP_FUNC( p, name, len ) == 0 ) {
                if( p[len] == STRING( '=' ) ) {
                    return( &p[len+1] );
                }
            }
        }
    }
  #endif
    return( NULL );                 /* not found */
}
Пример #2
0
int main(int argc, char* argv[])
{
  if(argc != 3)
  {
    printf("usage: " xstr(CMP_FUNC) " <string1> <string2>\n");
    exit(EXIT_FAILURE);
  }

  // Turn off buffering
  setbuf(stdout, NULL);

  printf("%i\n", CMP_FUNC(argv[1], argv[2]));

  return EXIT_SUCCESS;
}