pike.git / lib / master.pike.in

version» Context lines:

pike.git/lib/master.pike.in:1:   // -*- Pike -*-   //   // Master Control Program for Pike.   //   // This file is part of Pike. For copyright information see COPYRIGHT.   // Pike is distributed under GPL, LGPL and MPL. See the file COPYING   // for more information.   // - // $Id: master.pike.in,v 1.406 2007/12/27 22:12:36 nilsson Exp $ + // $Id: master.pike.in,v 1.407 2007/12/28 14:51:29 nilsson Exp $      #pike __REAL_VERSION__   //#pragma strict_types      // Some programs destroys character pairs beginning with the currency   // symbol when running in chinese locale.   #if "ยค/" != "\244/"   #error "master.pike.in is corrupted."   #endif   
pike.git/lib/master.pike.in:2948:       program prog;       if(run_tool) {    mixed err = catch {    prog = main_resolv("Tools.Standalone." + argv[0],    get_compilation_handler(compat_major, compat_minor));    };       if (err) -  error( "Pike: Failed to load tool %s:\n" +  exit(1, "Pike: Failed to load tool %s:\n"    "%s\n", argv[0], -  stringp(err[0])?err[0]:describe_backtrace(err) ); +  stringp(err[0])?err[0]:describe_backtrace(err));       argv[0] = search(programs, prog) || argv[0];    } else {    argv[0]=combine_path_with_cwd(argv[0]);       mixed err = catch {    prog=(program)argv[0];    };       if (err) { -  if( !file_stat(argv[0]) ) -  exit(1, "Could not find file %O. %s.\n", argv[0], strerror(errno())); -  if( !file_stat(argv[0])->isreg ) -  exit(1, "File %O is not a regular file.\n", argv[0]); -  if( !master_read_file(argv[0]) ) -  exit(1, "File %O is not readable. %s.\n", argv[0], strerror(errno())); -  error( "Pike: Failed to compile script:\n" -  "%s\n", stringp(err[0])?err[0]:describe_backtrace(err) ); +  string eno = strerror(errno()); +  string fn = argv[0]; +  if( !file_stat(fn) ) +  { +  if( file_stat(fn+".pike") ) +  fn += ".pike"; +  else +  exit(1, "Could not find file %O. %s.\n", fn, eno);    } -  +  if( !file_stat(fn)->isreg ) +  exit(1, "File %O is not a regular file.\n", fn); +  if( !master_read_file(fn) ) +  exit(1, "File %O is not readable. %s.\n", fn, eno); +  exit(1, "Pike: Failed to compile script:\n" +  "%s\n", stringp(err[0])?err[0]:describe_backtrace(err)); +  }       // Don't list the program with its real path in the programs    // mapping, so that reverse lookups (typically by the codec)    // always find the canonical "/main" instead.    programs[argv[0]] = no_value;    }       programs["/main"] = prog;    -  +  // FIXME: Can this occur at all?    if(!prog)    error("Pike: Couldn't find script to execute\n(%O)\n", argv[0]);      #if constant(_debug)    if(debug) _debug(debug);   #endif    if(trace) trace = predef::trace(trace);    mixed ret;    mixed err = catch {    // The main reason for this catch is actually to get a new call