Changeset 7756 for lang/c

Show
Ignore:
Timestamp:
03/10/08 16:34:23 (5 years ago)
Author:
frsyuki
Message:

lang/c/partty: added --with-shell configure option

Location:
lang/c/partty/trunk
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • lang/c/partty/trunk/cmd_host.cc

    r7538 r7756  
    2020        } 
    2121} 
     22 
     23static char* fallback_shell[3]; 
    2224 
    2325void usage(void) 
     
    4850}; 
    4951 
    50 } 
     52struct parse_end_exception {}; 
     53struct parse_end { 
     54        unsigned int operator() (int argc, char* argv[]) { 
     55                throw parse_end_exception(); 
     56        } 
     57}; 
     58 
     59}  // noname namespace 
    5160 
    5261int main(int argc, char* argv[]) 
    5362{ 
     63        { 
     64                fallback_shell[0] = getenv("SHELL"); 
     65                if(!fallback_shell[0]) { 
     66#ifdef FALLBACK_SHELL 
     67                        fallback_shell[0] = FALLBACK_SHELL; 
     68                        fallback_shell[1] = NULL; 
     69#else 
     70                        fallback_shell[0] = "/bin/sh"; 
     71                        fallback_shell[1] = "-i"; 
     72                        fallback_shell[2] = NULL; 
     73#endif 
     74                } 
     75        } 
     76 
    5477        std::string session_name; 
    5578        std::string message; 
     
    77100                kz.on("-c", "--lock",      Accept::Character(lock_char), lock_char_set); 
    78101                kz.on("-h", "--help",      Accept::Action(usage_action())); 
    79                 kz.break_parse(argc, argv);  // parse! 
     102                kz.on("--", "",            Accept::Action(parse_end())); 
     103                try { 
     104                        kz.break_parse(argc, argv);  // parse! 
     105                } catch (parse_end_exception& e) { } 
    80106 
    81107                if( argc < 1 ) { 
     
    187213                        return host.run(argv); 
    188214                } else { 
    189                         return host.run(NULL); 
     215                        return host.run(fallback_shell); 
    190216                } 
    191217        } catch (Partty::partty_error& e) { 
  • lang/c/partty/trunk/configure.in

    r7517 r7756  
    22# Process this file with autoconf to produce a configure script. 
    33 
    4 AC_PREREQ(2.61) 
    5 AC_INIT(partty, 0.2.8, fr _at_ syuki.skr.jp) 
    6 AM_INIT_AUTOMAKE(partty, 0.2.8) 
     4AC_PREREQ(2.59) 
     5AC_INIT(partty, 0.2.9, fr _at_ syuki.skr.jp) 
     6AM_INIT_AUTOMAKE(partty, 0.2.9) 
    77AC_CONFIG_SRCDIR(partty.h) 
    88AC_CONFIG_HEADER(config.h) 
     
    2121        AC_CHECK_HEADERS(util.h) 
    2222fi 
     23 
     24AC_ARG_WITH([shell], 
     25            AS_HELP_STRING([--with-shell=shell], 
     26                           [path to fallback shell if SHELL environment variable is not available [[/bin/sh]]]), 
     27            [with_shell=$withval], [with_shell=/bin/sh]) 
     28 
     29if test -z "$with_shell" ; then 
     30        with_shell=/bin/sh 
     31fi 
     32AC_DEFINE_UNQUOTED([FALLBACK_SHELL], ["$with_shell"], [fallback shell if SHELL environment variable is not available]) 
    2333 
    2434# Checks for header files. 
  • lang/c/partty/trunk/server.cc

    r7538 r7756  
    342342        memcpy(gate_path + gate_dir_len, info.session_name, info.session_name_length); 
    343343        gate_path[gate_dir_len + info.session_name_length] = '\0'; 
    344                                 std::cerr << "gate: '"; 
    345                                 std::cerr.write(info.session_name, info.session_name_length); 
    346                                 std::cerr << "'" << std::endl; 
    347                                 std::cerr << "s name len: " << info.session_name_length << std::endl; 
    348                                 std::cerr << gate_path << std::endl; 
    349344 
    350345        int fd = info.fd;