コード例 #1
0
void register_entries_gisman2( char *pkg_short_name, char *gisbase )
{
  char file[2048];
  FILE *f_gisman2;
  char str[2048];
  memcpy( file, "../entries-gisman2", 19 );
  f_gisman2 = (FILE*)fopen( file, "r" );
  if ( f_gisman2 == 0 )
  {
    if ( *(int*)(__errno_location( )) != 2 )
    {
      fclose( f_gisman2 );
      print_error( -32, "checking for file '%s': %s\n", file[0], strerror( *(int*)(__errno_location( )) ) );
    }
    else
    {
      if ( 0 ^ 0 )
      {
        return;
      }
      return;
    }
  }
  if ( VERBOSE )
    sprintf( str, "mkdir --verbose -p %s/etc/gm/Xtns ; cp -fv ../entries-gisman2 %s/etc/gm/Xtns/%s.gem ; ", gisbase, gisbase, pkg_short_name );
  else
    sprintf( str, "mkdir -p %s/etc/gm/Xtns ; cp -f ../entries-gisman2 %s/etc/gm/Xtns/%s.gem ; ", gisbase, gisbase, pkg_short_name );
  strcpy( GISMAN2_CMD, str );
}
コード例 #2
0
void deregister_entries_gisman2( char *pkg_short_name, char *gisbase )
{
  char file[2048];
  FILE *f_gisman2;
  char str[2048];
  sprintf( file, "%s/etc/gm/Xtns/%s.gem", gisbase, pkg_short_name );
  f_gisman2 = (FILE*)fopen( file, "r" );
  if ( f_gisman2 == 0 )
  {
    if ( *(int*)(__errno_location( )) != 2 )
    {
      fclose( f_gisman2 );
      print_error( -33, "checking for file '%s': %s\n", file[0], strerror( *(int*)(__errno_location( )) ) );
    }
    else
    {
      if ( 0 ^ 0 )
      {
        return;
      }
      return;
    }
  }
  if ( VERBOSE )
    sprintf( str, "rm -vf %s/etc/gm/Xtns/%s.gem ; ", gisbase, pkg_short_name );
  else
    sprintf( str, "rm -f %s/etc/gm/Xtns/%s.gem ; ", gisbase, pkg_short_name );
  strcpy( GISMAN_CMD, str );
}
コード例 #3
0
ファイル: cut.c プロジェクト: anti-patterns/genprog-corebench
static _Bool cut_file(char const   *file ) 
{ FILE *stream ;
  int *tmp ;
  int tmp___0 ;
  int *tmp___1 ;
  int tmp___2 ;
  int *tmp___3 ;
  int tmp___4 ;
  int tmp___5 ;

  {
  tmp___0 = strcmp(file, "-");
  if (tmp___0 == 0) {
    have_read_stdin = (_Bool)1;
    stream = stdin;
  } else {
    stream = fopen((char const   */* __restrict  */)file, (char const   */* __restrict  */)"r");
    if ((unsigned long )stream == (unsigned long )((void *)0)) {
      tmp = __errno_location();
      error(0, *tmp, "%s", file);
      return ((_Bool)0);
    } else {

    }
  }
  fadvise(stream, (enum __anonenum_fadvice_t_62 )2);
  cut_stream(stream);
  tmp___2 = ferror_unlocked(stream);
  if (tmp___2) {
    tmp___1 = __errno_location();
    error(0, *tmp___1, "%s", file);
    return ((_Bool)0);
  } else {

  }
  tmp___5 = strcmp(file, "-");
  if (tmp___5 == 0) {
    clearerr_unlocked(stream);
  } else {
    tmp___4 = fclose(stream);
    if (tmp___4 == -1) {
      tmp___3 = __errno_location();
      error(0, *tmp___3, "%s", file);
      return ((_Bool)0);
    } else {

    }
  }
  return ((_Bool)1);
}
}
コード例 #4
0
void final_perror( char *msg, BOOLEAN clean_flag )
{
  int saved_errno = *(int*)(__errno_location( ));
  if ( LYCursesON )
  {
    if ( clean_flag )
      cleanup( );
    else
      stop_curses( );
  }
  *(int*)(__errno_location( )) = saved_errno;
  perror( msg );
  return;
}
コード例 #5
0
void HTFWriter_error( HTStream *me, char *id )
{
  char buf[200];
  sprintf( buf, "%.60s: %.60s: %.60s", id, (char*)me->isa, strerror( *(int*)(__errno_location( )) ) );
  HTAlert( buf );
  return;
}
コード例 #6
0
ファイル: test2015_25.c プロジェクト: Sciumo/rose
int foobar()
   {
     int n;
#if 0
     while (1)
        {
          n = 0;
#endif
          if (n > 0) 
             {
               char *iptr;
               for (;;) 
                  {
                    int newn = 0;
                    if (newn < 0) 
                       {
                         if ((*__errno_location ()) != 4 ) 
                            {}
                         continue;
                       }
                  }
             }
#if 0
        }
#endif

     return 0;
   }
コード例 #7
0
int sigsuspend ( /* const sigset_t * */ void* mask)
{
   unsigned int n_orig, n_now;
   struct vki_timespec nanosleep_interval;

   VALGRIND_MAGIC_SEQUENCE(n_orig, 0xFFFFFFFF /* default */,
                           VG_USERREQ__GET_N_SIGS_RETURNED, 
                           0, 0, 0, 0);
   vg_assert(n_orig != 0xFFFFFFFF);

   VG_(ksigprocmask)(VKI_SIG_SETMASK, mask, NULL);

   while (1) {
      VALGRIND_MAGIC_SEQUENCE(n_now, 0xFFFFFFFF /* default */,
                              VG_USERREQ__GET_N_SIGS_RETURNED, 
                              0, 0, 0, 0);
      vg_assert(n_now != 0xFFFFFFFF);
      vg_assert(n_now >= n_orig);
      if (n_now != n_orig) break;

      nanosleep_interval.tv_sec  = 0;
      nanosleep_interval.tv_nsec = 53 * 1000 * 1000; /* 53 milliseconds */
      /* It's critical here that valgrind's nanosleep implementation
         is nonblocking. */
      VG_(nanosleep)( &nanosleep_interval, NULL);
   }

   /* Maybe this is OK both in single and multithreaded setting. */
   * (__errno_location()) = -VKI_EINTR; /* == EINTR; */ 
   return -1;
}
コード例 #8
0
ファイル: authbind-2.1.1.c プロジェクト: Kwonsoo/bigreduce
static anyfn_type *find_any(char const   *name ) 
{ 
  anyfn_type *kv ;
  void *tmp ;
  char *tmp___0 ;
  size_t tmp___1 ;
  size_t tmp___2 ;
  size_t tmp___3 ;
  int *tmp___4 ;

  {
  {
#line 46
  tmp = dlsym((void */* __restrict  */)((void *)-1L), (char const   */* __restrict  */)name);
#line 46
  kv = (anyfn_type *)tmp;
  }
#line 46
  if (kv) {
#line 46
    return (kv);
  }
  {
#line 47
  tmp___0 = dlerror();
#line 47
  dlerr = (char const   *)tmp___0;
  }
#line 47
  if (! dlerr) {
#line 47
    dlerr = "dlsym() failed for no reason";
  }
  {
#line 48
  write(2, (void const   *)"libauthbind: error finding original version of ", sizeof("libauthbind: error finding original version of ") - 1UL);
#line 49
  tmp___1 = strlen(name);
#line 49
  write(2, (void const   *)name, tmp___1);
#line 50
  write(2, (void const   *)": ", sizeof(": ") - 1UL);
#line 51
  tmp___2 = strlen(dlerr);
#line 51
  write(2, (void const   *)dlerr, tmp___2);
#line 52
  tmp___3 = strlen("\n");
#line 52
  write(2, (void const   *)"\n", tmp___3);
#line 53
  tmp___4 = __errno_location();
#line 53
  *tmp___4 = 38;
  }
#line 54
  return ((anyfn_type *)0);
}
}
コード例 #9
0
void close_stdout( void )
{
  if ( close_stream( *(int*)(134628384) ) != 0 )
  {
    char *write_error = gettext( "write error" );
    if ( file_name != 0 )
    {
      error( 0, *(int*)(__errno_location( )), "%s: %s", quotearg_colon( file_name ), write_error );
    }
    error( 0, *(int*)(__errno_location( )), "%s", write_error );
    _exit( exit_failure );
  }
  if ( close_stream( *(int*)(134628356) ) != 0 )
  {
    _exit( exit_failure );
  }
  return;
}
コード例 #10
0
void html_font( struct html_context *html_context, unsigned char *a, unsigned char *xxx3, unsigned char *xxx4, unsigned char **xxx5 )
{
  int edx;
  unsigned char *al;
  if ( get_attr_value( a, "size", html_context->doc_cp, HTML_ATTR_NONE ) )
  {
    int p;
    unsigned int s;
    unsigned char *nn;
    unsigned char *end;
    if ( *(char*)(get_attr_value( a, "size", html_context->doc_cp, HTML_ATTR_NONE )) == '+' )
    {
    }
    else
    {
      nn = &al[0];
      p = 0;
      if ( *(char*)(get_attr_value( a, "size", html_context->doc_cp, HTML_ATTR_NONE )) == '-' )
      {
      }
    }
    *(int*)(__errno_location(  )) = 0;
    strtoul( (char*)nn, (char**)&end, 10 );
    if ( *(int*)(__errno_location(  )) == 0 && nn[0] && end[0] == 0 )
    {
      s = strtoul( (char*)nn, (char**)&end, 10 ) <= 7 ? 7 : strtoul( (char*)nn, (char**)&end, 10 );
      if ( p == 0 )
        &html_context->stack.list_head_elinks = &s;
      else
        &html_context->stack.list_head_elinks += -1 * s;
      if ( html_context->stack.list_head_elinks < 1 )
        &html_context->stack.list_head_elinks = 1;
      else
      {
        if ( html_context->stack.list_head_elinks > 7 )
          &html_context->stack.list_head_elinks = 7;
      }
    }
    mem_free( (void*)nn );
  }
  get_color( &html_context[0], a, "color", &html_context->stack.list_head_elinks );
  return;
}
コード例 #11
0
void got_signal( int sig )
{
  int eax;
  struct signal_info *s;
  int saved_errno = *(int*)(__errno_location(  ));
  if ( sig <= 31 && signal_info[ sig << 4 ] )
  {
    if ( s->critical )
    {
      edx( s->data[1] );
      *(int*)(__errno_location(  )) = saved_errno;
    }
    else
    {
      s->mask = 1;
      check_for_select_race(  );
      *(int*)(__errno_location(  )) = saved_errno;
    }
  }
  return;
}
コード例 #12
0
int rpl_vfprintf( FILE *fp, char *format, va_list args )
{
  int eax;
  char buf[2000];
  char *output;
  size_t len;
  size_t lenbuf = 2000;
  output = vasnprintf( buf, &lenbuf, format, args );
  len = lenbuf;
  if ( output == 0 )
  {
    fseterr( fp );
    return -1;
  }
  else
  {
    if ( fwrite( output, 1, len, fp ) < len )
    {
      if ( output != buf[0] )
      {
        int saved_errno = *(int*)(__errno_location( ));
        free( output );
        *(int*)(__errno_location( )) = saved_errno;
      }
      return -1;
    }
    else
    {
      if ( (int)len < 0 )
      {
        *(int*)(__errno_location( )) = 75;
        fseterr( fp );
        return -1;
      }
      else
        return (int)len;
    }
  }
}
コード例 #13
0
void list_extensions( char *gisbase )
{
  char file[2048];
  FILE *f_in;
  fprintf( stdout, "\nExtensions in '%s' (name, version, type, depends):\n", gisbase );
  sprintf( file, "%s/etc/extensions.db", gisbase );
  f_in = (FILE*)fopen( file, "r" );
  if ( f_in == 0 )
  {
    if ( *(int*)(__errno_location( )) == 2 )
    {
      fwrite( "NONE.\n", 1, 6, stderr );
      fclose( f_in );
      exit( 0 );
    }
    fclose( f_in );
    print_error( -29, "checking for file '%s': %s\n", file[0], strerror( *(int*)(__errno_location( )) ) );
  }
  fclose( f_in );
  dump_ascii( file, "" );
  return;
}
コード例 #14
0
static int init_main_thread()
{
	__syscall(SYS_rt_sigprocmask, SIG_UNBLOCK,
		SIGPT_SET, 0, _NSIG/8);
	if (__set_thread_area(TP_ADJ(main_thread)) < 0) return -1;
	main_thread->canceldisable = libc.canceldisable;
	main_thread->tsd = (void **)__pthread_tsd_main;
	main_thread->errno_ptr = __errno_location();
	main_thread->self = main_thread;
	main_thread->tid = main_thread->pid =
		__syscall(SYS_set_tid_address, &main_thread->tid);
	if (!main_thread->dtv)
		main_thread->dtv = (void *)dummy;
	libc.main_thread = main_thread;
	return 0;
}
コード例 #15
0
ファイル: fstat.c プロジェクト: Azq2/sie-dev
int    stat(const char *file, struct stat *_s)
{
    if(_s) zeromem(_s, sizeof(struct stat));
    if(!file || !_s) return -1;
    FSTATS fs;
    if( GetFileStats(file, &fs, (unsigned int*)__errno_location()) )
    {
        __set_errno(ENOENT);
        return -1;
    }

    zeromem(_s, sizeof(struct stat));

    _s->st_size = fs.size;

    return 0;
}
コード例 #16
0
int main(int argc, char** argv) {
    socklen_t acptaddr_len; // -0x48(rbp)
    int listener; // -0x44(rbp)
    int sock; // -0x40(rbp)
    int pid; // -0x3c(rbp)
    char* errmsg; // -0x38(rbp)
    struct sockaddr bindaddr; // 0x30(rbp)
    struct sockaddr acptaddr; // 0x20(rbp)
    signal(SIGALARM, &sigalarm_handler);
    puts("[+] Creating Socket");
    listener = socket(2, 1, 0);
    if(!listener) {
        error("socket error");
    }
    puts("[+] Binding");
    bzero(bindaddr, 0x10);
    ((short*)&bindaddr)[0] = 2;
    ((short*)&bindaddr)[1] = htons(0x2eec); // 12012, port to listen on
    ((int*)&bindaddr)[1] = htons(0);
    if(!bind(listener, &bindaddr, 0x10)) {
        error("bind error");
    }
    puts("[+] Listening");
    if(!listen(listener, 5)) {
        error("listen error");
    }
    do {
        puts("[+] accept loop");
        acceptaddr_len = 0x10;
        if(!(sock = accept(listener, &acptaddr, &acptaddr_len))) {
            errmsg = malloc(0x1e);
            sprintf(errmsg, "accept errror %d", __errno_location());
            error(errmsg);
        }
        printf("[+] socket fd: %d.\n", sock);
        pid = fork();
        if(pid) {
            close(listener);
            do_stuff(sock);
            close(sock);
            exit(0);
        }
        close(sock);
    } while(1);
}
コード例 #17
0
ファイル: 15.c プロジェクト: Kwonsoo/p16_unroll
static int safe_read(int desc , char *ptr , int len ) 
{ 
  int n_chars ;
  int *tmp ;

  {
#line 344
  if (len <= 0) {
#line 345
    return (len);
  }
  {
#line 348
  while (1) {
    while_continue: /* CIL Label */ ;
    {
#line 350
    n_chars = read(desc, ptr, len);
    }
#line 348
    if (n_chars < 0) {
      {
#line 348
      tmp = __errno_location();
      }
#line 348
      if (! (*tmp == 4)) {
#line 348
        goto while_break;
      }
    } else {
#line 348
      goto while_break;
    }
  }
  while_break___0: /* CIL Label */ ;
  }
  while_break: ;
#line 357
  return (n_chars);
}
}
コード例 #18
0
ファイル: assert-backtrace.c プロジェクト: GNUHurdTR/hurd
__assert_fail_base_backtrace (const char *fmt,
			      const char *assertion,
			      const char *file,
			      unsigned int line,
			      const char *function)
{
  const size_t size = 128;
  const size_t skip = 2;
  int nptrs;
  void *buffer[size];

  nptrs = backtrace(buffer, size);
  if (nptrs == 0)
    error (1, *__errno_location (), "backtrace");

  fprintf (stderr,
	   fmt, program_invocation_name, file, line, function, assertion);
  backtrace_symbols_fd (&buffer[skip], nptrs - skip, STDERR_FILENO);
  fflush (stderr);

  /* Die.  */
  abort ();
}
コード例 #19
0
void unpack_extension( char *package )
{
  int error;
  int fd;
  char tmp[2048];
  int ftype;
  fwrite( "Uncompressing files...", 1, 22, stdout );
  memcpy( TMPDIR, "/tmp/grass.extension.XXXXXX", 28 );
  mkstemp( TMPDIR );
  fd = open( TMPDIR, 64, 511 );
  if ( fd == -1 )
  {
    print_error( -7, "could not create temp directory name: %s", strerror( *(int*)(__errno_location( )) ) );
    exit( -7 );
  }
  if ( VERBOSE )
    fprintf( stdout, "\nUncompressing to: %s.\n", TMPDIR );
  close( fd );
  remove( TMPDIR );
  mkdir_s( TMPDIR, "0700" );
  atexit( &exit_tmp );
  sprintf( tmp, "cp %s %s", package, TMPDIR );
  error = system( tmp );
  if ( error < 0 )
  {
    print_error( -7, "could not copy extension files to temp dir.\n" );
    exit( -7 );
  }
  ftype = check_filetype( package );
  if ( ftype == 0 )
  {
    print_warning( "file name not '.tar.gz', '.tgz', '.tar.bz2', '.tbz' or '.zip'. Assuming '.tgz'.\n" );
    ftype = 1;
  }
  if ( ftype == 1 )
  {
    if ( VERBOSE )
    {
      sprintf( tmp, "tar -xzvf %s/%s -C %s", TMPDIR, basename( package ), TMPDIR );
    }
    else
    {
      sprintf( tmp, "tar -xzf %s/%s -C %s", TMPDIR, basename( package ), TMPDIR );
    }
  }
  if ( ftype == 2 )
  {
    if ( VERBOSE )
    {
      sprintf( tmp, "tar -xjvf %s/%s -C %s", TMPDIR, basename( package ), TMPDIR );
    }
    else
    {
      sprintf( tmp, "tar -xjvf %s/%s -C %s", TMPDIR, basename( package ), TMPDIR );
    }
  }
  if ( ftype == 3 )
  {
    if ( VERBOSE )
    {
      sprintf( tmp, "unzip %s/%s -d %s", TMPDIR, basename( package ), TMPDIR );
    }
    else
    {
      sprintf( tmp, "unzip -qq %s/%s -d %s", TMPDIR, basename( package ), TMPDIR );
    }
  }
  if ( ftype == 4 )
  {
    if ( VERBOSE )
    {
      sprintf( tmp, "tar -xvf %s/%s -C %s", TMPDIR, basename( package ), TMPDIR );
    }
    else
    {
      sprintf( tmp, "tar -xf %s/%s -C %s", TMPDIR, basename( package ), TMPDIR );
    }
  }
  error = system( tmp );
  if ( error < 0 )
  {
    if ( ftype == 1 )
      print_error( -7, "could not extract files using 'tar' and 'gzip'. \n \t\t\t\t\tExtract manually using 'tar -xzvf %s'.\n", package );
    if ( ftype == 2 )
      print_error( -7, "could not extract files using 'tar' and 'bunzip2'.\n \t\t\t\tExtract manually using 'tar -xjvf %s'.\n", package );
    if ( ftype == 3 )
      print_error( -7, "could not extract files using 'unzip'.\n \t\t\t\tExtract manually using 'unzip %s'.\n", package );
    exit( -7 );
  }
  else
  {
    print_done( );
    return;
  }
}
コード例 #20
0
//
//  Returns a pointer to the errno variable.
//
int* Linux::errornumber() {
    return __errno_location();
}
コード例 #21
0
ファイル: brutefir-1.0f.c プロジェクト: Kwonsoo/p16_unroll
int main(int argc , char **argv ) 
{ 
  char *config_filename ;
  bool_t quiet ;
  bool_t nodefault ;
  bool_t run_as_daemon ;
  int n ;
  int tmp ;
  int tmp___0 ;
  int tmp___1 ;
  __pid_t tmp___2 ;
  int *tmp___3 ;
  char *tmp___4 ;
  int *tmp___5 ;
  char *tmp___6 ;
  __pid_t tmp___7 ;
  int *tmp___8 ;
  char *tmp___9 ;
  int tmp___10 ;
  char *__cil_tmp20 ;
  char *__cil_tmp21 ;
  char *__cil_tmp22 ;
  char *__cil_tmp23 ;
  char *__cil_tmp24 ;
  char *__cil_tmp25 ;
  char *__cil_tmp26 ;
  char *__cil_tmp27 ;
  char *__cil_tmp28 ;
  char *__cil_tmp29 ;
  char *__cil_tmp30 ;
  char *__cil_tmp31 ;
  char *__cil_tmp32 ;

  {
#line 33
  config_filename = (char *)((void *)0);
#line 34
  quiet = 0;
#line 35
  nodefault = 0;
#line 36
  run_as_daemon = 0;
#line 39
  if (sizeof(float ) != 4UL) {
    {
    {
#line 40
    fprintf((FILE */* __restrict  */)stderr, (char const   */* __restrict  */)"Unexpected sizeof(float): %d.\n",
            (int )sizeof(float ));
    }
    {
#line 41
    bf_exit(1);
    }
    }
  }
#line 43
  if (sizeof(double ) != 8UL) {
    {
    {
#line 44
    fprintf((FILE */* __restrict  */)stderr, (char const   */* __restrict  */)"Unexpected sizeof(double): %d.\n",
            (int )sizeof(double ));
    }
    {
#line 45
    bf_exit(1);
    }
    }
  }
#line 48
  n = 1;
  {
  {
#line 48
  while (1) {
    while_continue___0: /* CIL Label */ ;
    while_continue: /* CIL Label */ ;
#line 48
    if (! (n < argc)) {
#line 48
      goto while_break;
    }
    {
    {
#line 49
    tmp___1 = strcmp((char const   *)*(argv + n), "-quiet");
    }
    }
#line 49
    if (tmp___1 == 0) {
#line 50
      quiet = 1;
    } else {
      {
      {
#line 51
      tmp___0 = strcmp((char const   *)*(argv + n), "-nodefault");
      }
      }
#line 51
      if (tmp___0 == 0) {
#line 52
        nodefault = 1;
      } else {
        {
        {
#line 53
        tmp = strcmp((char const   *)*(argv + n), "-daemon");
        }
        }
#line 53
        if (tmp == 0) {
#line 54
          run_as_daemon = 1;
        } else {
#line 56
          if ((unsigned long )config_filename != (unsigned long )((void *)0)) {
#line 57
            goto while_break;
          }
#line 59
          config_filename = *(argv + n);
        }
      }
    }
#line 48
    n ++;
  }
  while_break___0: /* CIL Label */ ;
  }
  while_break: /* CIL Label */ ;
  }
#line 62
  if (n != argc) {
    {
    {
#line 63
    fprintf((FILE */* __restrict  */)stderr, (char const   */* __restrict  */)"\nBruteFIR v1.0f (August 2005)                                  (c) Anders Torger\n\n");
    }
    {
#line 64
    fprintf((FILE */* __restrict  */)stderr, (char const   */* __restrict  */)"Usage: %s [-quiet] [-nodefault] [-daemon] [configuration file]\n",
            *(argv + 0));
    }
    }
#line 65
    return (2);
  }
#line 68
  if (! quiet) {
    {
    {
#line 69
    fprintf((FILE */* __restrict  */)stderr, (char const   */* __restrict  */)"\nBruteFIR v1.0f (August 2005)                                  (c) Anders Torger\n\n");
    }
    }
  }
  {
  {
#line 72
  emalloc_set_exit_function(& bf_exit, 3);
  }
  {
#line 74
  bfconf_init(config_filename, quiet, nodefault);
  }
  }
#line 76
  if (run_as_daemon) {
    {
    {
#line 77
    tmp___2 = fork();
    }
    }
    {
#line 78
    if (tmp___2 == 0) {
#line 78
      goto case_0;
    }
#line 80
    if (tmp___2 == -1) {
#line 80
      goto case_neg_1;
    }
#line 83
    goto switch_default;
    case_0: /* CIL Label */ 
#line 79
    goto switch_break;
    case_neg_1: /* CIL Label */ 
    {
    {
#line 81
    tmp___3 = __errno_location();
    }
    {
#line 81
    tmp___4 = strerror(*tmp___3);
    }
    {
#line 81
    fprintf((FILE */* __restrict  */)stderr, (char const   */* __restrict  */)"fork failed: %s",
            tmp___4);
    }
    {
#line 82
    exit(1);
    }
    }
    switch_default: /* CIL Label */ 
    {
    {
#line 84
    exit(0);
    }
    }
    switch_break: /* CIL Label */ ;
    }
    {
    {
#line 86
    tmp___7 = setsid();
    }
    }
#line 86
    if (tmp___7 == -1) {
      {
      {
#line 87
      tmp___5 = __errno_location();
      }
      {
#line 87
      tmp___6 = strerror(*tmp___5);
      }
      {
#line 87
      fprintf((FILE */* __restrict  */)stderr, (char const   */* __restrict  */)"setsid failed: %s",
              tmp___6);
      }
      {
#line 88
      exit(1);
      }
      }
    }
    {
    {
#line 90
    tmp___10 = chdir("/");
    }
    }
#line 90
    if (tmp___10 == -1) {
      {
      {
#line 91
      tmp___8 = __errno_location();
      }
      {
#line 91
      tmp___9 = strerror(*tmp___8);
      }
      {
#line 91
      fprintf((FILE */* __restrict  */)stderr, (char const   */* __restrict  */)"chdir failed: %s",
              tmp___9);
      }
      {
#line 92
      exit(1);
      }
      }
    }
    {
    {
#line 94
    umask((__mode_t )0);
    }
    }
  }
  {
  {
#line 98
  bfrun();
  }
  {
#line 100
  fprintf((FILE */* __restrict  */)stderr, (char const   */* __restrict  */)"Could not start filtering.\n");
  }
  {
#line 101
  bf_exit(1);
  }
  }
#line 102
  return (1);
}
}
コード例 #22
0
ファイル: main.c プロジェクト: neonatura/share
int
main(int argc, char **argv)
{
	char *shinit;
	volatile int state;
	struct jmploc jmploc;
	struct stackmark smark;
	int login;
  int i;

  for (i = 1; i < argc; i++) {
    if (0 == strcmp(argv[i], "--help") ||
        0 == strcmp(argv[i], "-h")) {
      sxsh_print_usage();
      return (0);
    }
    if (0 == strcmp(argv[i], "--version") ||
        0 == strcmp(argv[i], "-v")) {
      sxsh_print_version();
      return (0);
    }
  } 

#ifdef __GLIBC__
	dash_errno = __errno_location();
#endif

#if PROFILE
	monitor(4, etext, profile_buf, sizeof profile_buf, 50);
#endif
	state = 0;
	if (unlikely(setjmp(jmploc.loc))) {
		int e;
		int s;

		reset();

		e = exception;

		s = state;
		if (e == EXEXIT || s == 0 || iflag == 0 || shlvl)
			exitshell();

		if (e == EXINT
#if ATTY
		 && (! attyset() || equal(termval(), "emacs"))
#endif
		 ) {
			out2c('\n');
#ifdef FLUSHERR
			flushout(out2);
#endif
		}
		popstackmark(&smark);
		FORCEINTON;				/* enable interrupts */
		if (s == 1)
			goto state1;
		else if (s == 2)
			goto state2;
		else if (s == 3)
			goto state3;
		else
			goto state4;
	}
	handler = &jmploc;
#ifdef DEBUG
	opentrace();
	trputs("Shell args:  ");  trargs(argv);
#endif
	rootpid = getpid();
	init();
	setstackmark(&smark);
	login = procargs(argc, argv);
	if (login) {
		state = 1;
		read_profile("/etc/profile");
state1:
		state = 2;
		read_profile("$HOME/.profile");
	}
state2:
	state = 3;
	if (
#ifndef linux
		getuid() == geteuid() && getgid() == getegid() &&
#endif
		iflag
	) {
		if ((shinit = lookupvar("ENV")) != NULL && *shinit != '\0') {
			read_profile(shinit);
		}
	}
	popstackmark(&smark);
state3:
	state = 4;
	if (minusc)
		evalstring(minusc, sflag ? 0 : EV_EXIT);

	if (sflag || minusc == NULL) {
state4:	/* XXX ??? - why isn't this before the "if" statement */
		cmdloop(1);
	}
#if PROFILE
	monitor(0);
#endif
#if GPROF
	{
		extern void _mcleanup(void);
		_mcleanup();
	}
#endif
	exitshell();
	/* NOTREACHED */
}
コード例 #23
0
void query_extension( char *package, char *name, int major, int minor, int revision, char *short_name, char *invocation, char *org_name )
{
  int error;
  char tmp[2048];
  strcpy( tmp, basename( package ) );
  error = chdir( tmp );
  if ( error < 0 )
  {
    print_error( -2, "extension '%s' not accessible: %s\n", package, strerror( *(int*)(__errno_location( )) ) );
  }
  fprintf( stdout, "\nExtension '%s', version %i.%i.%i\n\n", name, major, minor, revision );
  dump_ascii( "description", "Description" );
  dump_ascii( "commands", "Commands provided" );
  dump_ascii( "libs", "Libraries provided" );
  dump_ascii( "headers", "Header files provided" );
  dump_ascii( "depends", "Dependencies" );
  dump_ascii( "bugs", "Bugs" );
  sprintf( tmp, "../%s", package );
  list_binaries( tmp );
  dump_ascii( "authors", "Author(s)" );
  fprintf( stdout, "Type '%s -d %s' to see more detailed information.\n", invocation, org_name );
  fprintf( stdout, "Type '%s -l %s' to see copyright information.\n", invocation, org_name );
  system( "sh post" );
  exit( 0 );
}
コード例 #24
0
ファイル: cut.c プロジェクト: anti-patterns/genprog-corebench
int main(int argc , char **argv ) 
{ int optc ;
  _Bool ok ;
  _Bool delim_specified ;
  char *spec_list_string ;
  char *tmp ;
  char *tmp___0 ;
  char *tmp___1 ;
  size_t tmp___2 ;
  char *tmp___3 ;
  char *tmp___4 ;
  char *tmp___5 ;
  char *tmp___6 ;
  char *tmp___7 ;
  _Bool tmp___8 ;
  _Bool tmp___9 ;
  int *tmp___10 ;
  int tmp___11 ;
  int tmp___12 ;

  {
  delim_specified = (_Bool)0;
  set_program_name((char const   *)*(argv + 0));
  setlocale(6, "");
  bindtextdomain("coreutils", "/usr/local/share/locale");
  textdomain("coreutils");
  atexit(& close_stdout);
  operating_mode = (enum operating_mode )0;
  suppress_non_delimited = (_Bool)0;
  delim = (unsigned char )'\000';
  have_read_stdin = (_Bool)0;
  while (1) {
    optc = getopt_long(argc, (char * const  *)argv, "b:c:d:f:ns", longopts, (int *)((void *)0));
    if (! (optc != -1)) {
      break;
    } else {

    }
    switch (optc) {
    case 98: 
    case 99: 
    if ((unsigned int )operating_mode != 0U) {
      while (1) {
        tmp = gettext("only one type of list may be specified");
        error(0, 0, (char const   *)tmp);
        usage(1);
        break;
      }
    } else {

    }
    operating_mode = (enum operating_mode )1;
    spec_list_string = optarg;
    break;
    case 102: 
    if ((unsigned int )operating_mode != 0U) {
      while (1) {
        tmp___0 = gettext("only one type of list may be specified");
        error(0, 0, (char const   *)tmp___0);
        usage(1);
        break;
      }
    } else {

    }
    operating_mode = (enum operating_mode )2;
    spec_list_string = optarg;
    break;
    case 100: 
    if ((int )*(optarg + 0) != 0) {
      if ((int )*(optarg + 1) != 0) {
        while (1) {
          tmp___1 = gettext("the delimiter must be a single character");
          error(0, 0, (char const   *)tmp___1);
          usage(1);
          break;
        }
      } else {

      }
    } else {

    }
    delim = (unsigned char )*(optarg + 0);
    delim_specified = (_Bool)1;
    break;
    case 128: 
    output_delimiter_specified = (_Bool)1;
    if ((int )*(optarg + 0) == 0) {
      output_delimiter_length = 1UL;
    } else {
      tmp___2 = strlen((char const   *)optarg);
      output_delimiter_length = tmp___2;
    }
    output_delimiter_string = xstrdup((char const   *)optarg);
    break;
    case 110: 
    break;
    case 115: 
    suppress_non_delimited = (_Bool)1;
    break;
    case 129: 
    complement = (_Bool)1;
    break;
    case -130: 
    usage(0);
    break;
    case -131: 
    version_etc(stdout, "cut", "GNU coreutils", Version, "David M. Ihnat", "David MacKenzie", "Jim Meyering", (char *)((void *)0));
    exit(0);
    break;
    default: 
    usage(1);
    }
  }
  if ((unsigned int )operating_mode == 0U) {
    while (1) {
      tmp___3 = gettext("you must specify a list of bytes, characters, or fields");
      error(0, 0, (char const   *)tmp___3);
      usage(1);
      break;
    }
  } else {

  }
  if ((int )delim != 0) {
    if ((unsigned int )operating_mode != 2U) {
      while (1) {
        tmp___4 = gettext("an input delimiter may be specified only when operating on fields");
        error(0, 0, (char const   *)tmp___4);
        usage(1);
        break;
      }
    } else {

    }
  } else {

  }
  if (suppress_non_delimited) {
    if ((unsigned int )operating_mode != 2U) {
      while (1) {
        tmp___5 = gettext("suppressing non-delimited lines makes sense\n\tonly when operating on fields");
        error(0, 0, (char const   *)tmp___5);
        usage(1);
        break;
      }
    } else {

    }
  } else {

  }
  if (output_delimiter_specified) {
    range_start_ht = hash_initialize(31UL, (Hash_tuning const   *)((void *)0), & hash_int, & hash_compare_ints, (void (*)(void * ))((void *)0));
    if ((unsigned long )range_start_ht == (unsigned long )((void *)0)) {
      xalloc_die();
    } else {

    }
  } else {

  }
  tmp___8 = set_fields((char const   *)spec_list_string);
  if (! tmp___8) {
    if ((unsigned int )operating_mode == 2U) {
      while (1) {
        tmp___6 = gettext("missing list of fields");
        error(0, 0, (char const   *)tmp___6);
        usage(1);
        break;
      }
    } else {
      while (1) {
        tmp___7 = gettext("missing list of positions");
        error(0, 0, (char const   *)tmp___7);
        usage(1);
        break;
      }
    }
  } else {

  }
  if (! delim_specified) {
    delim = (unsigned char )'\t';
  } else {

  }
  if ((unsigned long )output_delimiter_string == (unsigned long )((void *)0)) {
    dummy[0] = (char )delim;
    dummy[1] = (char )'\000';
    output_delimiter_string = dummy;
    output_delimiter_length = 1UL;
  } else {

  }
  if (optind == argc) {
    ok = cut_file("-");
  } else {
    ok = (_Bool)1;
    while (optind < argc) {
      tmp___9 = cut_file((char const   *)*(argv + optind));
      ok = (_Bool )((int )ok & (int )tmp___9);
      optind ++;
    }
  }
  if (range_start_ht) {
    hash_free(range_start_ht);
  } else {

  }
  if (have_read_stdin) {
    tmp___11 = fclose(stdin);
    if (tmp___11 == -1) {
      tmp___10 = __errno_location();
      error(0, *tmp___10, "-");
      ok = (_Bool)0;
    } else {

    }
  } else {

  }
  if (ok) {
    tmp___12 = 0;
  } else {
    tmp___12 = 1;
  }
  exit(tmp___12);
}
}
コード例 #25
0
void bin_install( char *package, char *gisbase, char *bins, char *pkg_short_name, int pkg_major, int pkg_minor, int pkg_revision, char *grass_version )
{
  char tmp[2048];
  char dir[2048];
  char install_cmd[2048];
  char post_cmd[2048];
  int error = stat( gisbase, &buf.st_dev );
  struct stat buf;
  FILE *f;
  char *verstr;
  char *grass_major;
  char *grass_minor;
  char *grass_revision;
  int major, minor, revision;
  if ( error < 0 )
  {
    print_error( -5, "installation directory invalid: %s\n", strerror( *(int*)(__errno_location( )) ) );
  }
  sprintf( GINSTALL_DST, "GINSTALL_DST=%s", gisbase );
  putenv( GINSTALL_DST );
  sprintf( tmp, "%s/include", gisbase );
  sprintf( GINSTALL_INC, "GINSTALL_INC=%s", tmp );
  putenv( GINSTALL_INC );
  sprintf( tmp, "%s/lib", gisbase );
  sprintf( GINSTALL_LIB, "GINSTALL_LIB=%s", tmp );
  putenv( GINSTALL_LIB );
  sprintf( GEM_GRASS_DIR, "GEM_GRASS_DIR=%s", gisbase );
  putenv( GEM_GRASS_DIR );
  verstr = strdup( grass_version );
  grass_major = strtok( verstr, "." );
  grass_minor = strtok( 0, "." );
  grass_revision = strtok( 0, "." );
  major = strtol( grass_major, 0, 10 );
  minor = strtol( grass_minor, 0, 10 );
  revision = strtol( grass_revision, 0, 10 );
  free( verstr );
  atexit( &exit_tmp );
  sprintf( dir, "%s/%s", basename( package ), bins );
  error = chdir( dir );
  if ( error < 0 )
  {
    print_error( -2, "extension file binaries in '%s' not accessible: %s\n", package, strerror( *(int*)(__errno_location( )) ) );
  }
  sprintf( GEM_EXT_NAME, "GEM_EXT_NAME=%s", pkg_short_name );
  putenv( GEM_EXT_NAME );
  sprintf( tmp, "%i.%i.%i", pkg_major, pkg_minor, pkg_revision );
  sprintf( GEM_EXT_VERSION, "GEM_EXT_VERSION=%s", tmp );
  putenv( GEM_EXT_VERSION );
  dump_html( "../description", TMP_DESCR );
  dump_html( "../info", TMP_INFO );
  dump_html( "../depends", TMP_DEPS );
  dump_html( "../bugs", TMP_BUGS );
  dump_html( "../authors", TMP_AUTHORS );
  sprintf( GEM_EXT_DESCR, "GEM_EXT_DESCR=%s", TMP_DESCR );
  putenv( GEM_EXT_DESCR );
  sprintf( GEM_EXT_INFO, "GEM_EXT_INFO=%s", TMP_INFO );
  putenv( GEM_EXT_INFO );
  sprintf( GEM_EXT_DEPS, "GEM_EXT_DEPS=%s", TMP_DEPS );
  putenv( GEM_EXT_DEPS );
  sprintf( GEM_EXT_BUGS, "GEM_EXT_BUGS=%s", TMP_BUGS );
  putenv( GEM_EXT_BUGS );
  sprintf( GEM_EXT_AUTHORS, "GEM_EXT_AUTHORS=%s", TMP_AUTHORS );
  putenv( GEM_EXT_AUTHORS );
  atexit( &exit_tmp );
  check_dependencies( package, gisbase, grass_version );
  fwrite( "Installing...", 1, 13, stdout );
  f = (FILE*)fopen( "../uninstall", "r" );
  if ( f == 0 )
  {
    print_warning( "error checking for uninstall script: %s\n \t\t\t\tUninstalling this extension may leave orphaned files on your system", strerror( *(int*)(__errno_location( )) ) );
  }
  else
  {
    if ( VERBOSE )
    {
      sprintf( tmp, "cp -vf ../uninstall %s/etc/uninstall.%s ;", gisbase, pkg_short_name );
      strcpy( UNINSTALL_CMD, tmp );
    }
    else
    {
      sprintf( tmp, "cp -f ../uninstall %s/etc/uninstall.%s &&gt; %s ;", gisbase, pkg_short_name, TMP_NULL );
      strcpy( UNINSTALL_CMD, tmp );
    }
    fclose( f );
  }
  register_extension( gisbase, bins, pkg_short_name, pkg_major, pkg_minor, pkg_revision );
  check_dependencies( package, gisbase, grass_version );
  if ( major == 6 && minor <= 0 )
    register_entries_gisman( pkg_short_name, gisbase );
  register_entries_gisman2( pkg_short_name, gisbase );
  register_html( pkg_short_name, gisbase, pkg_major, pkg_minor, pkg_revision );
  if ( VERBOSE )
  {
    fprintf( stdout, "Running '%s install':\n", MAKE_CMD );
    sprintf( install_cmd, "bin/%s -f Makefile install ; \t\t\t\t\tcp -vf %s %s/etc/extensions.db ; chmod -v a+r %s/etc/extensions.db ;", MAKE_CMD, TMPDB, gisbase, gisbase );
  }
  else
    sprintf( install_cmd, "bin/%s -f Makefile -s install &&gt; %s ; \t\t\t\t\tcp -f %s %s/etc/extensions.db &&gt; %s ; chmod a+r %s/etc/extensions.db &&gt; %s ;", MAKE_CMD, TMP_NULL, TMPDB, gisbase, TMP_NULL, gisbase, TMP_NULL );
  if ( VERBOSE )
    memcpy( post_cmd, "sh ../post", 11 );
  else
    sprintf( post_cmd, "sh ../post &&gt; %s", TMP_NULL );
  sprintf( tmp, "%s %s %s %s %s %s", install_cmd, UNINSTALL_CMD, GISMAN_CMD, GISMAN2_CMD, HTML_CMD, post_cmd );
  su( gisbase, tmp );
  print_done( );
  return;
}
コード例 #26
0
ファイル: mkdir.c プロジェクト: Azq2/sie-dev
int mkdir(const char *dir)
{
    return _mkdir(dir, (unsigned int*)__errno_location());
}
コード例 #27
0
ファイル: strerror.int.c プロジェクト: johnpaliotta/grep-2.9
char *rpl_strerror( int n)

{ auto char *__T36506896; auto int __zvm_memchk_nesting_nr; auto void *__zvm_prev_stack_end; auto char *__T36406736 = 0xaaaaaaaaaaaaaaaa;

auto size_t len;



auto const char *msg;
# 54
auto int saved_errno;
# 38
__zvm_memchk_nesting_nr = (__zvm_memchk_push_function("rpl_strerror", 0, "/home/release/apps/grep2.5.3/grep-2.9/lib/strerror.c", 36)); __zvm_memchk_add_stack_object("/home/release/apps/grep2.5.3/grep-2.9/lib/strerror.c", ((int)36), ((void *)((unsigned long)(&msg))), ((unsigned long)8), ((unsigned long)1), ((const char *)((unsigned long)"msg")), ((int)__zvm_memchk_nesting_nr)); __zvm_memchk_add_stack_object("/home/release/apps/grep2.5.3/grep-2.9/lib/strerror.c", ((int)36), ((void *)((unsigned long)(&saved_errno))), ((unsigned long)4), ((unsigned long)1), ((const char *)((unsigned long)"saved_errno")), ((int)__zvm_memchk_nesting_nr)); __ZVM_DECL_LOCAL_MLS(); __zvm_mls_scope_in(__zvm_cc_var, 0); __ZVM_PUSH_FUNC_INIT((__zvm_funcinfo + 11U)); __zcov_update_counter(0);
# 44
msg = ((const char *)0); {
if ((msg != ((const char *)0))) { __zcov_update_counter(1); { ((void *)(__zvm_mls_set_instrumented(__zvm_cc_var))) , ((char *)(__zvm_mls_ptr_assignment((__zvm_varinfo + 2U), __zvm_cc_var, (&__T36406736), ((char *)msg), 0))); __zvm_mls_scope_out("/home/release/apps/grep2.5.3/grep-2.9/lib/strerror.c", 46, __zvm_cc_var, __zvm_mls_return_unused, 1, 3, 0, __T36506896, "Unknown", __T36406736, "Unknown", msg, "msg"); __ZVM_POP_FUNC_END(); { __T36506896 = __T36406736; __zvm_memchk_pop_function("rpl_strerror", __zvm_memchk_nesting_nr); return __T36506896; } } } else  { __zcov_update_counter(2); } } __zcov_update_counter(3); {




if ((n)) { __zcov_update_counter(4); __ZVM_PUSH_FUNC((__zvm_funcinfo + 0U));
((void *)(__zvm_mls_set_instrumented(__zvm_cc_var))) , ((const char *)(__zvm_mls_ptr_assignment((__zvm_varinfo + 3U), __zvm_cc_var, (&msg), ((const char *)(strerror(n))), 0))); }

else  {  __zcov_update_counter(5); __ZVM_PUSH_FUNC((__zvm_funcinfo + 1U));
saved_errno = ((*((int *)(__zvm_component_reference_inline((__zvm_varinfo + 1U), ((void *)((unsigned long)(__errno_location()))), ((long)0L), ((int)4), ((void *)((unsigned long)__zvm_cc_var))))))); __ZVM_PUSH_FUNC((__zvm_funcinfo + 2U));
(*((int *)(__zvm_component_reference_inline((__zvm_varinfo + 4U), ((void *)((unsigned long)(__errno_location()))), ((long)0L), ((int)4), ((void *)((unsigned long)__zvm_cc_var)))))) = 0; __ZVM_PUSH_FUNC((__zvm_funcinfo + 3U));
((void *)(__zvm_mls_set_instrumented(__zvm_cc_var))) , ((const char *)(__zvm_mls_ptr_assignment((__zvm_varinfo + 5U), __zvm_cc_var, (&msg), ((const char *)(strerror(n))), 0))); { __ZVM_PUSH_FUNC((__zvm_funcinfo + 4U));
if ((((*((int *)(__zvm_component_reference_inline((__zvm_varinfo + 6U), ((void *)((unsigned long)(__errno_location()))), ((long)0L), ((int)4), ((void *)((unsigned long)__zvm_cc_var))))))) || ((msg != ((const char *)0)) && (((strstr(msg, ((const char *)"nknown"))) != ((char *)0)) || ((strstr(msg, ((const char *)"ndefined"))) != ((char *)0)))))) { __zcov_update_counter(6);

((void *)(__zvm_mls_set_instrumented(__zvm_cc_var))) , ((const char *)(__zvm_mls_ptr_assignment((__zvm_varinfo + 7U), __zvm_cc_var, (&msg), ((const char *)"Success"), 0))); } else  { __zcov_update_counter(7); } } __zcov_update_counter(8); __ZVM_PUSH_FUNC((__zvm_funcinfo + 5U));
(*((int *)(__zvm_component_reference_inline((__zvm_varinfo + 8U), ((void *)((unsigned long)(__errno_location()))), ((long)0L), ((int)4), ((void *)((unsigned long)__zvm_cc_var)))))) = saved_errno;
} } __zcov_update_counter(9); {
# 68
if (((!(msg != ((const char *)0))) || (!((int)((*((const char *)(__zvm_component_reference_inline((__zvm_varinfo + 9U), ((void *)((unsigned long)msg)), ((long)0L), ((int)1), ((void *)((unsigned long)__zvm_cc_var)))))))))))
{  __zcov_update_counter(10); __ZVM_PUSH_FUNC((__zvm_funcinfo + 6U));


sprintf(buf_0, fmt_0, n); __ZVM_PUSH_FUNC((__zvm_funcinfo + 7U));
(*((int *)(__zvm_component_reference_inline((__zvm_varinfo + 10U), ((void *)((unsigned long)(__errno_location()))), ((long)0L), ((int)4), ((void *)((unsigned long)__zvm_cc_var)))))) = 22; { ((void *)(__zvm_mls_set_instrumented(__zvm_cc_var))) , ((char *)(__zvm_mls_ptr_assignment((__zvm_varinfo + 11U), __zvm_cc_var, (&__T36406736), buf_0, 0))); __zvm_mls_scope_out("/home/release/apps/grep2.5.3/grep-2.9/lib/strerror.c", 73, __zvm_cc_var, __zvm_mls_return_unused, 1, 3, 0, __T36506896, "Unknown", __T36406736, "Unknown", msg, "msg"); __ZVM_POP_FUNC_END(); { __T36506896 = __T36406736; __zvm_memchk_pop_function("rpl_strerror", __zvm_memchk_nesting_nr); return __T36506896; } }

} else  { __zcov_update_counter(11); } } __zcov_update_counter(12); __ZVM_PUSH_FUNC((__zvm_funcinfo + 8U));


len = (strlen(msg)); {
if ((256UL <= len)) { __zcov_update_counter(13); __ZVM_PUSH_FUNC((__zvm_funcinfo + 9U));
abort(); } else  { __zcov_update_counter(14); } } __zcov_update_counter(15); __ZVM_PUSH_FUNC((__zvm_funcinfo + 10U)); { ((void *)(__zvm_mls_set_instrumented(__zvm_cc_var))) , ((char *)(__zvm_mls_ptr_assignment((__zvm_varinfo + 12U), __zvm_cc_var, (&__T36406736), ((char *)(memcpy(((void *)(&buf_0)), ((const void *)msg), (len + 1UL)))), 0))); __zvm_mls_scope_out("/home/release/apps/grep2.5.3/grep-2.9/lib/strerror.c", 82, __zvm_cc_var, __zvm_mls_return_unused, 1, 3, 0, __T36506896, "Unknown", __T36406736, "Unknown", msg, "msg"); __ZVM_POP_FUNC_END(); { __T36506896 = __T36406736; __zvm_memchk_pop_function("rpl_strerror", __zvm_memchk_nesting_nr); return __T36506896; } }


} static void __zvm_this_file_init(void) {  __zvm_memchk_add_global_object("/home/release/apps/grep2.5.3/grep-2.9/lib/strerror.c", ((int)0), ((void *)((unsigned long)fmt_0)), ((unsigned long)17), ((unsigned long)1), ((const char *)((unsigned long)"fmt_0")), ((int)0)); __zvm_memchk_add_global_object("/home/release/apps/grep2.5.3/grep-2.9/lib/strerror.c", ((int)0), ((void *)((unsigned long)buf_0)), ((unsigned long)256), ((unsigned long)1), ((const char *)((unsigned long)"buf_0")), ((int)0));  } static __attribute__((__constructor__)) void __zvm_file_constructor(void) {  __zvm_file_ctr(((void *)__zvm_dirnames)); __zvm_this_file_init(); __zvm_local_init_inline(); __zvm_dr_varinfo_init(((void *)__zvm_varinfo), zvm_file_option); __zvm_update_align(4U); }
コード例 #28
0
void test_install( char *package, char *gisbase, char *pkg_short_name, int pkg_major, int pkg_minor, int pkg_revision, char *grass_version )
{
  char tmp[2048];
  char dir[2048];
  char sysstr[2048];
  int error = stat( gisbase, &buf.st_dev );
  struct stat buf;
  FILE *f;
  char *verstr;
  char *grass_major;
  char *grass_minor;
  char *grass_revision;
  int major, minor, revision;
  if ( error < 0 )
  {
    print_error( -5, "installation directory invalid: %s\n", strerror( *(int*)(__errno_location( )) ) );
  }
  sprintf( GINSTALL_DST, "GINSTALL_DST=%s", gisbase );
  putenv( GINSTALL_DST );
  sprintf( tmp, "%s/include", gisbase );
  sprintf( GINSTALL_INC, "GINSTALL_INC=%s", tmp );
  putenv( GINSTALL_INC );
  sprintf( tmp, "%s/lib", gisbase );
  sprintf( GINSTALL_LIB, "GINSTALL_LIB=%s", tmp );
  putenv( GINSTALL_LIB );
  sprintf( GEM_GRASS_DIR, "GEM_GRASS_DIR=%s", gisbase );
  putenv( GEM_GRASS_DIR );
  verstr = strdup( grass_version );
  grass_major = strtok( verstr, "." );
  grass_minor = strtok( 0, "." );
  grass_revision = strtok( 0, "." );
  major = strtol( grass_major, 0, 10 );
  minor = strtol( grass_minor, 0, 10 );
  revision = strtol( grass_revision, 0, 10 );
  free( verstr );
  atexit( &exit_tmp );
  sprintf( dir, "%s/src", basename( package ) );
  error = chdir( dir );
  if ( error < 0 )
  {
    print_error( -2, "extension files in '%s' not accessible: %s\n", package, strerror( *(int*)(__errno_location( )) ) );
  }
  if ( SKIP_CFG == 0 )
  {
    if ( VERBOSE )
    {
      fwrite( "Running configure script:\n", 1, 26, stdout );
      sprintf( sysstr, "sh %s %s", CONFIG_CMD, CONFIG_OPTS );
      error = system( sysstr );
    }
    else
    {
      fwrite( "Configuring...", 1, 14, stdout );
      sprintf( sysstr, "sh %s %s --quiet &&gt; %s", CONFIG_CMD, CONFIG_OPTS, TMP_NULL );
      error = system( sysstr );
    }
    if ( error == -1 )
      print_error( -27, "could not run configure script.\n" );
    if ( error > 0 )
      print_error( -3, "system configuration failed.\n" );
    print_done( );
    print_cfg( );
  }
  sprintf( GEM_EXT_NAME, "GEM_EXT_NAME=%s", pkg_short_name );
  putenv( GEM_EXT_NAME );
  sprintf( tmp, "%i.%i.%i", pkg_major, pkg_minor, pkg_revision );
  sprintf( GEM_EXT_VERSION, "GEM_EXT_VERSION=%s", tmp );
  putenv( GEM_EXT_VERSION );
  dump_plain( "../description", TMP_DESCR );
  dump_plain( "../info", TMP_INFO );
  dump_plain( "../depends", TMP_DEPS );
  dump_plain( "../bugs", TMP_BUGS );
  dump_plain( "../authors", TMP_AUTHORS );
  sprintf( GEM_EXT_DESCR, "GEM_EXT_DESCR=%s", TMP_DESCR );
  putenv( GEM_EXT_DESCR );
  sprintf( GEM_EXT_INFO, "GEM_EXT_INFO=%s", TMP_INFO );
  putenv( GEM_EXT_INFO );
  sprintf( GEM_EXT_DEPS, "GEM_EXT_DEPS=%s", TMP_DEPS );
  putenv( GEM_EXT_DEPS );
  sprintf( GEM_EXT_BUGS, "GEM_EXT_BUGS=%s", TMP_BUGS );
  putenv( GEM_EXT_BUGS );
  sprintf( GEM_EXT_AUTHORS, "GEM_EXT_AUTHORS=%s", TMP_AUTHORS );
  putenv( GEM_EXT_AUTHORS );
  atexit( &exit_tmp );
  check_dependencies( package, gisbase, grass_version );
  if ( VERBOSE )
  {
    fprintf( stdout, "Running '%s':\n", MAKE_CMD );
    sprintf( sysstr, "%s -f Makefile", MAKE_CMD );
    error = system( sysstr );
  }
  else
  {
    fwrite( "Compiling...", 1, 12, stdout );
    sprintf( sysstr, "%s -f Makefile &&gt; %s", MAKE_CMD, TMP_NULL );
    error = system( sysstr );
  }
  if ( error == -1 && VERBOSE == 0 )
    print_error( -9, "could not run '%s' do you have make tools installed?\n", MAKE_CMD[0] );
  if ( error > 0 )
    print_error( -4, "source code could not be compiled.\n \t\t\tRun again with option -v to see what is causing trouble.\n" );
  print_done( );
  fwrite( "Installing...", 1, 13, stdout );
  f = (FILE*)fopen( "../uninstall", "r" );
  if ( f == 0 )
  {
    print_warning( "error checking for uninstall script: %s\n \t\t\t\tUninstalling this extension may leave orphaned files on your system", strerror( *(int*)(__errno_location( )) ) );
  }
  else
    fclose( f );
  register_extension( gisbase, "src", pkg_short_name, pkg_major, pkg_minor, pkg_revision );
  check_dependencies( package, gisbase, grass_version );
  if ( major == 6 && minor <= 0 )
    register_entries_gisman( pkg_short_name, gisbase );
  register_entries_gisman2( pkg_short_name, gisbase );
  register_html( pkg_short_name, gisbase, pkg_major, pkg_minor, pkg_revision );
  fprintf( stdout, "(skipping '%s install')...", MAKE_CMD );
  print_done( );
  return;
}
コード例 #29
0
ファイル: unlink.c プロジェクト: DemonSinusa/SiemanC
int unlink(const char *file) {
    return _unlink(file, (unsigned int *)__errno_location());
}
コード例 #30
0
void uninstall( char *package, char *pkg_short_name, char *gisbase, char *grass_version )
{
  char tmp[2048];
  char script[2048];
  int error;
  struct stat buf;
  int no_script;
  char *verstr;
  char *grass_major;
  char *grass_minor;
  char *grass_revision;
  int major, minor, revision;
  fwrite( "Un-installing...", 1, 16, stdout );
  sprintf( UNINSTALL_BASE, "UNINSTALL_BASE=%s", gisbase );
  putenv( UNINSTALL_BASE );
  verstr = strdup( grass_version );
  grass_major = strtok( verstr, "." );
  grass_minor = strtok( 0, "." );
  grass_revision = strtok( 0, "." );
  major = strtol( grass_major, 0, 10 );
  minor = strtol( grass_minor, 0, 10 );
  revision = strtol( grass_revision, 0, 10 );
  free( verstr );
  atexit( &exit_tmp );
  deregister_extension( package, pkg_short_name, gisbase );
  if ( major == 6 && minor <= 0 )
  {
    error = deregister_entries_gisman( pkg_short_name, gisbase );
    if ( error == -1 )
    {
      print_warning( "GIS Manager menu entries could not be removed.\n" );
      memcpy( GISMAN_CMD, "", 1 );
    }
    if ( error == 0 )
    {
      print_warning( "no entries found to remove from GIS Manager.\n" );
      memcpy( GISMAN_CMD, "", 1 );
    }
  }
  deregister_entries_gisman2( pkg_short_name, gisbase );
  deregister_html( pkg_short_name, gisbase );
  sprintf( script, "%s/etc/uninstall.%s", gisbase, pkg_short_name );
  no_script = 0;
  error = stat( script, &buf.st_dev );
  if ( error < 0 )
  {
    print_warning( "no uninstall script available for this extension.\n \t\t\tUnneeded files may have been left on your system.\n" );
    no_script = 1;
  }
  if ( no_script )
  {
    print_warning( "error checking for uninstall script: %s\n \t\t\t\tUninstalling this extension may leave orphaned files on your system", strerror( *(int*)(__errno_location( )) ) );
  }
  else
  if ( VERBOSE )
  {
    sprintf( tmp, "sh %s ; rm -vf %s ; \t\t\t\t\t \t\trm -vrf %s/docs/extensions/%s ; rm -vf %s/etc/dm/gem-entries/%s ; \t\t\t\t\t\t\tcp -vf %s %s/etc/extensions.db ; chmod -v a+r %s/etc/extensions.db ;", script, script, gisbase, pkg_short_name, gisbase, pkg_short_name, TMPDB, gisbase, gisbase );
    strcpy( UNINSTALL_CMD, tmp );
  }
  else
  {
    sprintf( tmp, "sh %s &&gt; %s ; rm -vf %s &&gt; %s ; \t\t\t\t\t \t\trm -vrf %s/docs/extensions/%s &&gt; %s ; rm -vf %s/etc/dm/gem-entries/%s &&gt; %s ; \t\t\t\t\t\t\tcp -vf %s %s/etc/extensions.db &&gt; %s ; chmod -v a+r %s/etc/extensions.db &&gt; %s ;", script, TMP_NULL, script, TMP_NULL, gisbase, pkg_short_name, TMP_NULL, gisbase, pkg_short_name, TMP_NULL, TMPDB, gisbase, TMP_NULL, gisbase, TMP_NULL );
    strcpy( UNINSTALL_CMD, tmp );
  }
  sprintf( tmp, "%s %s %s", UNINSTALL_CMD, GISMAN_CMD, HTML_CMD );
  su( gisbase, tmp );
  print_done( );
  return;
}