示例#1
0
文件: getty.c 项目: DragonQuan/minix3
/* Execute the login(1) command with the current
 * username as its argument. It will reply to the
 * calling user by typing "Password: "******"getty: can't exec ");
  std_out(LOGIN);
  std_out("\n");
  if (fstat(0, &st) == 0 && S_ISCHR(st.st_mode) && securetty(st.st_rdev)) {
	execl(SHELL, SHELL, (char *) NULL);
  }
}
示例#2
0
文件: getty.c 项目: DragonQuan/minix3
int main(int argc, char **argv)
{
  register char *s;
  char name[30];
  struct sigaction sa;

  /* Don't let QUIT dump core. */
  sigemptyset(&sa.sa_mask);
  sa.sa_flags = 0;
  sa.sa_handler = exit;
  sigaction(SIGQUIT, &sa, NULL);

  tty_name = ttyname(0);
  if (tty_name == NULL) {
	std_out("getty: tty name unknown\n");
	pause();
	return(1);
  }

  chown(tty_name, 0, 0);	/* set owner of TTY to root */
  chmod(tty_name, 0600);	/* mode to max secure */

  do_getty(name, sizeof(name), argv+1, tty_name);	/* handle getty() */
  name[29] = '\0';		/* make sure the name fits! */

  do_login(name);		/* and call login(1) if OK */

  return(1);			/* never executed */
}
示例#3
0
int test_shape_b ( void )
{
    QTextStream std_out ( stdout );
    QTextStream std_in ( stdin );

    std_out << "**** shape_b test ********************************************************" << endl;
    std_out << "shape_b* sh_b_0 =  new shape_b;" << endl;

    shape_b* sh_b_0 =  new shape_b;
    std_out << "sh_b_0->get_lenth()=" << sh_b_0->get_lenth() << endl;
    std_out << "sh_b_0->print();" << endl;
    sh_b_0->print();
    std_out << "sh_b_0->out_comment()" << endl << sh_b_0->out_comment() << endl;

    {
        shape_b* sh_b_1 = new shape_b ( 260, 30, 200, 1 );
        std_out << "sh_b_1->out_comment()" << endl << sh_b_1->out_comment() << endl;
        sh_b_1->print();
        delete sh_b_1;
    }

    {
        draw_vars dw;
        stack st;
        sh_b_0->edit ( );
    }

    return 0;
}
示例#4
0
int test_font ( void )
{
    QTextStream std_out ( stdout );
    QTextStream std_in ( stdin );

    std_out << "int test_font ( void )" << endl;
    font fnt;

    QList<forma_l*> * llist = fnt.get_m_forma_l_list();
    int sss = llist->size();


    fnt.set_file_name ( QString ( "/home/namatv/workspace/u2/shp/my_test.shp" ) );
    fnt.font_load();

    sss = llist->size();

    for ( int i = 0; i < llist->size(); ++i )
    {
        forma_l * mmm = ( *llist ) [i];

        for ( int j;j < mmm->get_List_bites().size() ;++j )
        {
//      std_out<<mmm->m_bites[j]<<" ";
        }

        std_out << endl;
    }

    std_out << "int test_font ( void )============================================" << endl;

    return 0;
}
示例#5
0
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow), selected( 0 )
{
    //create necessary slot/signal connections
    ui->setupUi(this);
    connect( ui->cancel_but,SIGNAL( clicked() ),this,SLOT(close()) );
    connect( ui->generate_but,SIGNAL( clicked() ),this,SLOT( generate_clicked() ) );
    connect( ui->browse_but,SIGNAL( clicked() ),this,SLOT( select_file() ) );
    connect( ui->typeBox,SIGNAL( currentIndexChanged(int) ),this,SLOT( type_changed( int ) ) );

    //fill combobox
    QStringList type_list;
    type_list.append( "rsa" );
    type_list.append( "dsa" );
    ui->typeBox->addItems( type_list );

    //etc
    ui->pass_edit->setEchoMode( QLineEdit::Password );
    ui->confirm_edit->setEchoMode( QLineEdit::Password );

    ui->file_edit->setText( QDir::homePath() + "/.ssh/id_key" );

    ui->bit_edit->setValidator( new QIntValidator( 256,8192,this ) );

    //setup qprocess
    ssh_process = new QProcess( this );
    connect( ssh_process,SIGNAL( readyRead() ),this,SLOT( std_out() )  ); //when there some text in output,
    connect( ssh_process,SIGNAL( finished( int ) ),this,SLOT( finished( int ) ) );
    ssh_process->setProgram( "ssh-keygen" );

    ui->std_console->setStyleSheet( "QPlainTextEdit { background-color: #2F2F2F; color: #ADADAD; }" );
    ui->std_console->insertPlainText( "Ready" );
}
示例#6
0
文件: getty.c 项目: DragonQuan/minix3
/* Read one character from stdin.
 */
int readch(void)
{
  int st;
  char ch1;

  /* read character from TTY */
  st = read(0, &ch1, 1);
  if (st == 0) {
	std_out("\n");
	exit(0);
  }
  if (st < 0) {
	std_out("getty: ");
	std_out(tty_name);
	std_out(": read error\n");
	exit(1);
  }
  return(ch1 & 0xFF);
}
示例#7
0
int test_shape_56 ( void )
{
    QTextStream std_out ( stdout );
    QTextStream std_in ( stdin );

    std_out << "**** shape_56 test ********************************************************" << endl;
    std_out << "shape_56* sh_56_0 =  new shape_56;" << endl;
    shape_56* sh_56_0 =  new shape_56;
    std_out << "sh_56_0->print();" << endl;
    sh_56_0->print();
    std_out << "sh_56_0->get_lenth()=" << sh_56_0->get_lenth() << endl;
    std_out << sh_56_0->out_comment() << endl;

    sh_56_0->set_push ( true );
    std_out << "sh_56_0->set_push(true);" << "\n" << "sh_56_0->get_push()" << sh_56_0->get_push() << endl;
    std_out << sh_56_0->out_comment() << endl;

    sh_56_0->set_push ( false );
    std_out << "sh_56_0->set_push(false);" << "\n" << "sh_56_0->get_push()" << sh_56_0->get_push() << endl;
    std_out << sh_56_0->out_comment() << endl;

    {
        shape_56* sh_56_1 =  new shape_56 ( true );
        std_out << sh_56_1->out_comment() << endl;
        delete sh_56_1;
    }

    {
        shape_56* sh_56_1 =  new shape_56 ( false );
        std_out << sh_56_1->out_comment() << endl;
        delete sh_56_1;
    }

    /*  draw_vars   draw ( draw_vars & dr,
                                stack &,
                                int color,
                                int color_,
                                int priznak );  ///<Рисовать форму
    */
    {
        draw_vars dw;
        stack st;
        sh_56_0->edit ( );
    }

    {
        shapes* sh_0 = sh_56_0->copy();
        sh_0->out_comment();
        delete sh_0;
    }

    delete sh_56_0;

    return 0;
}
示例#8
0
文件: sdb_bio.c 项目: Saroth/debug
int sdb_bio_out(const sdb_context *ctx,
        const char *file, size_t line, const char *str)
{
    if (ctx->bio_out) {
        return ctx->bio_out(ctx->bio_param, file, line, str);
    }
#if defined(SDB_SYSTEM_HAS_STDIO)
    else {
        return std_out(0, file, line, str);
    }
#endif /* defined(SDB_SYSTEM_HAS_STDIO) */
    return 0;
}
示例#9
0
int test_shape_a ( void )
{
    QTextStream std_out ( stdout );
    QTextStream std_in ( stdin );

    std_out << "**** shape_a test ********************************************************" << endl;
    std_out << "shape_a* sh_a_0 =  new shape_a;" << endl;

    shape_a* sh_a_0 =  new shape_a;
    std_out << "sh_a_0->get_lenth()=" << sh_a_0->get_lenth() << endl;
    std_out << "sh_a_0->print();" << endl;
    sh_a_0->print();
    std_out << "sh_a_0->out_comment()" << endl << sh_a_0->out_comment() << endl;

    {
        shape_a* sh_a_1 =  new shape_a ( 200, 0, 6 );
        std_out
        << "shape_a* sh_a_1 =  new shape_a (200,0,6);"  << endl
        << "sh_a_1->out_comment()"  << endl
        << sh_a_1->out_comment() << endl;
        delete sh_a_1;
    }

    {
        int i = ( 4 << 4 ) + 5;
        i = -1 * ( ( 3 << 4 ) + 5 );
        shape_a* sh_a_1 =  new shape_a ( 200, i );
        std_out
        << "shape_a* sh_a_1 =  new shape_a (200,4<<4+5);"   << endl
        << "sh_a_1->out_comment()"  << endl
        << sh_a_1->out_comment() << endl;
        delete sh_a_1;
    }

    {
        draw_vars dw;
        stack st;
        sh_a_0->edit ( );
    }

    /*    virtual draw_vars   draw ( draw_vars & dr,
                                  stack &,
                                  int color,
                                  int color_,
                                  int priznak );        ///<Рисовать форму

        virtual shapes*     copy  ( void );             ///<Копирует подформу.
    */

    return 0;
}
示例#10
0
int test_shape_7 ( void )
{
    QTextStream std_out ( stdout );
    QTextStream std_in ( stdin );

    std_out << "**** shape_7 test ********************************************************" << endl;
    std_out << "shape_7* sh_7_0 =  new shape_7;" << endl;
    shape_7* sh_7_0 =  new shape_7;
    std_out << "sh_7_0->print();" << endl;
    sh_7_0->print();
    std_out << "sh_7_0->get_lenth()=" << sh_7_0->get_lenth() << endl;
    std_out << sh_7_0->out_comment() << endl;

    sh_7_0->set_ref_number ( 300 );
    std_out << "sh_7_0->set_ref_number ( 300 );" << endl;
    std_out << "sh_7_0->get_ref_number ( )=" <<  sh_7_0->get_ref_number ( ) << endl;

    {
        shape_7* sh_7_1 = new shape_7 ( 150 );
        std_out << "shape_7* sh_7_1 = new shape_7 ( 150 );" << endl;
        std_out << "sh_7_1->out_comment()" << sh_7_1->out_comment() << endl;
        delete sh_7_1 ;
    }

    {
        shape_7* sh_7_1 = new shape_7 ( -150 );
        std_out << "shape_7* sh_7_1 = new shape_7 ( -150 );" << endl;
        std_out << "sh_7_1->out_comment()" << sh_7_1->out_comment() << endl;
        delete sh_7_1 ;
    }

    shapes* sh_cp = sh_7_0->copy( );
    std_out << "sh_cp ->out_comment()" << sh_cp ->out_comment() << endl;

    /*
    virtual draw_vars   draw ( draw_vars & dr,
                              stack &,
                              int color,
                              int color_,
                              int priznak );  ///<Рисовать форму
    */
    {
        draw_vars dw;
        stack st;
        sh_7_0->edit ( );
    }

    delete sh_7_0;
    return 0;
}
示例#11
0
std::vector<int> MPIControllerDeathTest::getProcessList(void)
{
    char buf[512];
    std::string output;
    std::shared_ptr<FILE> std_out(popen("pgrep -fu `whoami` MPIControllerDeathTest", "r"),  pclose);
    std::string token;

    while (!feof(std_out.get())) {
        if (fgets(buf, 512, std_out.get()) != NULL) {
            output += buf;
        }
    }

    std::istringstream stream(output);
    std::vector<int> pids;
    while (std::getline(stream, token, '\n')) {
        pids.push_back(std::stoi(token, nullptr));
    }

    return pids;
}
示例#12
0
int test_1_shape_ ( Main_Form *b )
{

    QTextStream std_out ( stdout );
    QTextStream std_in ( stdin );

    QTransform transform
    ( 1, 0, 0,
      0, -1, 0,
      0, 0, 1
    );
    transform.scale ( 0.5, 0.5 );


    QGraphicsView* grView = b->graphicsView;
    grView->setAlignment ( 0 ); //Qt::AlignLeft | Qt::AlignTop

    grView->setTransform ( transform );


    QGraphicsScene *grScene = new QGraphicsScene;
    grView->setScene ( grScene );
    grView->setTransform ( transform );

    grView->setRenderHints ( QPainter::Antialiasing | QPainter::TextAntialiasing | QPainter::SmoothPixmapTransform  | QPainter::HighQualityAntialiasing );


    int i = 1000;

    forma_l * a = new forma_l;
    forma *form = a->get_m_forma();
    QList<shapes*>* sh_list = form->get_m_shapes();

    sh_list->clear();

    shape_e* she_0 =  new shape_e();
    sh_list->append ( she_0 );

    shape_7* sh7_0 =  new shape_7 ( 450 );
    sh_list->append ( sh7_0 );

    shape_56* sh56_0 =  new shape_56 ( true );
    sh_list->append ( sh56_0 );

    shape_b* shb_0 =  new shape_b ( 220, -30, -120, -1 );
    sh_list->append ( shb_0 );

    shape_* sh_0 =  new shape_;
    sh_0->set_length ( 14 );
    sh_0->set_sixtant ( 0 );
    sh_list->append ( sh_0 );

    shape_34* sh34_0 =  new shape_34;
    sh34_0->set_scale_up  ( true );
    sh34_0->set_scale_factor ( 4 );
    sh_list->append ( sh34_0 );

    shape_12* sh12_0 =  new shape_12 ( false );
    sh_list->append ( sh12_0 );

    shape_* sh_1 =  new shape_;
    sh_1->set_length ( 14 );
    sh_1->set_sixtant ( 4 );
    sh_list->append ( sh_1 );

    shape_12* sh12_1 =  new shape_12 ( true );
    sh_list->append ( sh12_1 );

    shape_89* sh89_0 =  new shape_89;
    sh89_0->set_xy ( 0, 20, 20 );
    sh89_0->append ( -20, 20 );
    sh89_0->append ( -20, -20 );
    sh89_0->append ( 20, -20 );
    sh_list->append ( sh89_0 );

    shape_56* sh56_1 =  new shape_56 ( false );
    sh_list->append ( sh56_1 );

    shape_a* sha_0 =  new shape_a;
    sha_0->set_radius ( 120 );
    sha_0->set_start ( 0 );
    sha_0->set_number ( -1 );
    sh_list->append ( sha_0 );

    shape_cd* shcd_0 =  new shape_cd;
    shcd_0->set_xy_c ( 0, 20, 20, 127 );
    shcd_0->append ( -20, 20, 127 );
    shcd_0->append ( -20, -20, 127 );
    shcd_0->append ( 20, -20, 127 );
    sh_list->append ( shcd_0 );

    draw_vars dr;
    stack st;
    a->draw ( dr, st, *grScene );

    {
        draw_point p_center ( 0.0, 0.0 );
        draw_point p_radius ( 3.5, 3.5 );
        grScene->addEllipse ( p_center.x - p_radius.x / 2., p_center.y - p_radius.y / 2., p_radius.x, p_radius.y, QPen ( Qt::red ) );
    }

    std_out << a->out() << endl;
    forma_l *bb = new forma_l;
    *bb = *a;

    std_out << endl;
    std_out << endl;
    std_out << bb->out() << endl;
    delete bb;

}
示例#13
0
int test_shape_34 ( void )
{
    QTextStream std_out ( stdout );
    QTextStream std_in ( stdin );

    std_out << "**** shape_34 test ********************************************************" << endl;
    std_out << "shape_34* sh_34_0 =  new shape_34;" << endl;
    shape_34* sh_34_0 =  new shape_34;
    std_out << "sh_34_0->print();" << endl;
    sh_34_0->print();
    std_out << "sh_34_0->get_lenth()=" << sh_34_0->get_lenth() << endl;

    sh_34_0->set_scale_up ( true );
    std_out << "sh_34_0->set_scale_up ( true );" << endl;
    std_out << "sh_34_0->out_comment()\n" << sh_34_0->out_comment () << endl;

    sh_34_0->set_scale_factor ( 5 );
    std_out << "set_scale_factor ( 5 );" << endl;
    std_out << "sh_34_0->out_comment()\n" << sh_34_0->out_comment () << endl;

    sh_34_0->set ( false , 250 );
    std_out << "sh_34_0->set( false , 250 );" << endl;
    std_out << "sh_34_0->out_comment()\n" << sh_34_0->out_comment () << endl;

    shapes* sh_34_cp = sh_34_0->copy  ( );
    std_out << "sh_34_cp->out_comment()\n" << sh_34_cp->out_comment () << endl;
    delete sh_34_cp;
    {
        {
            shape_34* sh_34_1 =  new shape_34 ( true, -384 );
            std_out << "shape_34* sh_34_1 =  new shape_34 ( true, -384 );" << endl;
            std_out << "sh_34_1->print();" << endl;
            sh_34_1->print();
            std_out << "sh_34_1->get_scale_up()=" << sh_34_1->get_scale_up() << endl;
            std_out << "sh_34_1->get_scale_factor()=" << sh_34_1->get_scale_factor() << endl;
            std_out << "sh_34_1->get_scale()=" << sh_34_1->get_scale() << endl;
            std_out << "sh_34_1->out()=" << sh_34_1->out() << endl;
            std_out << "sh_34_1->out_comment()\n" << sh_34_1->out_comment () << endl;
            delete sh_34_1;
        }

        {
            shape_34* sh_34_1 =  new shape_34 ( false, -256 );
            std_out << "shape_34* sh_34_1 =  new shape_34 ( false, -256 );" << endl;
            std_out << "sh_34_1->print();" << endl;
            sh_34_1->print();
            std_out << "sh_34_1->get_scale_up()=" << sh_34_1->get_scale_up() << endl;
            std_out << "sh_34_1->get_scale_factor()=" << sh_34_1->get_scale_factor() << endl;
            std_out << "sh_34_1->get_scale()=" << sh_34_1->get_scale() << endl;
            std_out << "sh_34_1->out()=" << sh_34_1->out() << endl;
            std_out << "sh_34_1->out_comment()\n" << sh_34_1->out_comment () << endl;
            delete sh_34_1;
        }

        {
            shape_34* sh_34_1 =  new shape_34 ( true, -128 );
            std_out << "shape_34* sh_34_1 =  new shape_34 ( true, -128 );" << endl;
            std_out << "sh_34_1->print();" << endl;
            sh_34_1->print();
            std_out << "sh_34_1->get_scale_up()=" << sh_34_1->get_scale_up() << endl;
            std_out << "sh_34_1->get_scale_factor()=" << sh_34_1->get_scale_factor() << endl;
            std_out << "sh_34_1->get_scale()=" << sh_34_1->get_scale() << endl;
            std_out << "sh_34_1->out()=" << sh_34_1->out() << endl;
            std_out << "sh_34_1->out_comment()\n" << sh_34_1->out_comment () << endl;
            delete sh_34_1;
        }

        {
            shape_34* sh_34_1 =  new shape_34 ( false, -1 );
            std_out << "shape_34* sh_34_1 =  new shape_34 ( false, -1 );" << endl;
            std_out << "sh_34_1->print();" << endl;
            sh_34_1->print();
            std_out << "sh_34_1->get_scale_up()=" << sh_34_1->get_scale_up() << endl;
            std_out << "sh_34_1->get_scale_factor()=" << sh_34_1->get_scale_factor() << endl;
            std_out << "sh_34_1->get_scale()=" << sh_34_1->get_scale() << endl;
            std_out << "sh_34_1->out()=" << sh_34_1->out() << endl;
            std_out << "sh_34_1->out_comment()\n" << sh_34_1->out_comment () << endl;
            delete sh_34_1;
        }

        {
            shape_34* sh_34_1 =  new shape_34 ( true, 0 );
            std_out << "shape_34* sh_34_1 =  new shape_34 ( true, 0 );" << endl;
            std_out << "sh_34_1->print();" << endl;
            sh_34_1->print();
            std_out << "sh_34_1->get_scale_up()=" << sh_34_1->get_scale_up() << endl;
            std_out << "sh_34_1->get_scale_factor()=" << sh_34_1->get_scale_factor() << endl;
            std_out << "sh_34_1->get_scale()=" << sh_34_1->get_scale() << endl;
            std_out << "sh_34_1->out()=" << sh_34_1->out() << endl;
            std_out << "sh_34_1->out_comment()\n" << sh_34_1->out_comment () << endl;
            delete sh_34_1;
        }

        {
            shape_34* sh_34_1 =  new shape_34 ( false, 1 );
            std_out << "shape_34* sh_34_1 =  new shape_34 ( false, 1 );" << endl;
            std_out << "sh_34_1->print();" << endl;
            sh_34_1->print();
            std_out << "sh_34_1->get_scale_up()=" << sh_34_1->get_scale_up() << endl;
            std_out << "sh_34_1->get_scale_factor()=" << sh_34_1->get_scale_factor() << endl;
            std_out << "sh_34_1->get_scale()=" << sh_34_1->get_scale() << endl;
            std_out << "sh_34_1->out()=" << sh_34_1->out() << endl;
            std_out << "sh_34_1->out_comment()\n" << sh_34_1->out_comment () << endl;
            delete sh_34_1;
        }

        {
            shape_34* sh_34_1 =  new shape_34 ( true, 128 );
            std_out << "shape_34* sh_34_1 =  new shape_34 ( true, 128 );" << endl;
            std_out << "sh_34_1->print();" << endl;
            sh_34_1->print();
            std_out << "sh_34_1->get_scale_up()=" << sh_34_1->get_scale_up() << endl;
            std_out << "sh_34_1->get_scale_factor()=" << sh_34_1->get_scale_factor() << endl;
            std_out << "sh_34_1->get_scale()=" << sh_34_1->get_scale() << endl;
            std_out << "sh_34_1->out()=" << sh_34_1->out() << endl;
            std_out << "sh_34_1->out_comment()\n" << sh_34_1->out_comment () << endl;
            delete sh_34_1;
        }

        {
            shape_34* sh_34_1 =  new shape_34 ( false, 256 );
            std_out << "shape_34* sh_34_1 =  new shape_34 ( false, 256 );" << endl;
            std_out << "sh_34_1->print();" << endl;
            sh_34_1->print();
            std_out << "sh_34_1->get_scale_up()=" << sh_34_1->get_scale_up() << endl;
            std_out << "sh_34_1->get_scale_factor()=" << sh_34_1->get_scale_factor() << endl;
            std_out << "sh_34_1->get_scale()=" << sh_34_1->get_scale() << endl;
            std_out << "sh_34_1->out()=" << sh_34_1->out() << endl;
            std_out << "sh_34_1->out_comment()\n" << sh_34_1->out_comment () << endl;
            delete sh_34_1;
        }

        {
            shape_34* sh_34_1 =  new shape_34 ( true, 384 );
            std_out << "shape_34* sh_34_1 =  new shape_34 ( true, 384 );" << endl;
            std_out << "sh_34_1->print();" << endl;
            sh_34_1->print();
            std_out << "sh_34_1->get_scale_up()=" << sh_34_1->get_scale_up() << endl;
            std_out << "sh_34_1->get_scale_factor()=" << sh_34_1->get_scale_factor() << endl;
            std_out << "sh_34_1->get_scale()=" << sh_34_1->get_scale() << endl;
            std_out << "sh_34_1->out()=" << sh_34_1->out() << endl;
            std_out << "sh_34_1->out_comment()\n" << sh_34_1->out_comment () << endl;
            delete sh_34_1;
        }
    }

    /*
      virtual draw_vars   draw ( draw_vars & dr,
                                stack &,
                                int color,
                                int color_,
                                int priznak );        ///<Рисовать форму
    */
    {
        draw_vars dw;
        stack st;
        sh_34_0->edit ( );
    }

    delete sh_34_0;
    return 0;
}
示例#14
0
int test_shape_12 ( void )
{
    QTextStream std_out ( stdout );
    QTextStream std_in ( stdin );

    std_out << "shape_12 test" << endl;
    std_out << "************************************************************" << endl;
    std_out << "shape_12* sh_12_0 =  new shape_12;" << endl;
    shape_12* sh_12_0 =  new shape_12;
    std_out << "sh_12_0->print();" << endl;
    sh_12_0->print();

    std_out << "shape_12* sh_12_1 =  new shape_12 ( 1 );" << endl;
    shape_12* sh_12_1 =  new shape_12 ( 1 );
    std_out << "sh_12_1->print();" << endl;
    sh_12_1->print();

    std_out << "shape_12* sh_12_2 =  new shape_12 ( 0 );" << endl;
    shape_12* sh_12_2 =  new shape_12 ( 0 );
    std_out << "sh_12_2->print();" << endl;
    sh_12_2->print();

    std_out << "************************************************************" << endl;

    std_out << "sh_12_0->set_pen_down();" << endl;
    sh_12_0->set_pen_down ( );
    std_out << "sh_12_0->print();" << endl;
    sh_12_0->print();

    std_out << "sh_12_0->set_pen_down ( true );" << endl;
    sh_12_0->set_pen_down ( true );
    std_out << "sh_12_0->print();" << endl;
    sh_12_0->print();

    std_out << "sh_12_0->set_pen_down ( false );" << endl;
    sh_12_0->set_pen_down ( false );
    std_out << "sh_12_0->print();" << endl;
    sh_12_0->print();

    std_out << "************************************************************" << endl;

    std_out << "sh_12_0->set_pen_up();" << endl;
    sh_12_0->set_pen_up ( );
    std_out << "sh_12_0->print();" << endl;
    sh_12_0->print();
    std_out << "sh_12_0->is_pen_down()=" << sh_12_0->is_pen_down() << endl;
    std_out << "sh_12_0->is_pen_up()  =" << sh_12_0->is_pen_up() << endl;

    std_out << "sh_12_0->set_pen_up( true );" << endl;
    sh_12_0->set_pen_up ( true );
    std_out << "sh_12_0->print();" << endl;
    sh_12_0->print();
    std_out << "sh_12_0->is_pen_down()=" << sh_12_0->is_pen_down() << endl;
    std_out << "sh_12_0->is_pen_up()  =" << sh_12_0->is_pen_up() << endl;

    std_out << "sh_12_0->set_pen_up( false );" << endl;
    sh_12_0->set_pen_up ( false );
    std_out << "sh_12_0->print();" << endl;
    sh_12_0->print();
    std_out << "sh_12_0->is_pen_down()=" << sh_12_0->is_pen_down() << endl;
    std_out << "sh_12_0->is_pen_up()  =" << sh_12_0->is_pen_up() << endl;

    std_out << "************************************************************" << endl;

    std_out << "sh_12_0->get_lenth()=" << sh_12_0->get_lenth() << endl;

    std_out << "************************************************************" << endl;

    sh_12_0->set_pen_down();
    shape_12* sh_12_3 = dynamic_cast <shape_12 *> ( sh_12_0->copy() );

    if ( sh_12_3 )
    {
        std_out << "sh_12_0->set_pen_down();" << "\n" <<
        "shape_12* sh_12_3 = dynamic_cast <shape_12 *> ( sh_12_0->copy() );" << "\n" <<
        "sh_12_3->print();" << endl;
        sh_12_3->print();
    }

    sh_12_1->set_pen_up();

    shape_12* sh_12_4 = dynamic_cast <shape_12 *> ( sh_12_1->copy() );

    if ( sh_12_4 )
    {
        std_out << "sh_12_1->set_pen_up();" << "\n" <<
        "shape_12* sh_12_4 = dynamic_cast <shape_12 *> ( sh_12_1->copy() );" << "\n" <<
        "sh_12_4->print();" << endl;
        sh_12_4->print();
    }

    {
        draw_vars dw;
        stack st;
        sh_12_0->edit ( );
    }

    /*    draw_vars   draw ( draw_vars & dr,
                                   stack &,
                                   int color,
                                   int color_,
                                   int priznak );
        QString     out ( void );
        void        out_file  ( FILE* );
        void        edit ( draw_vars &,
                                stack &,
                                int ,
                                int );
        void        clear ( void );
    */
    delete sh_12_0;

    delete sh_12_1;

    delete sh_12_2;

    delete sh_12_3;

    delete sh_12_4;

    return 0;
}
示例#15
0
int test_shape_ ( void )
{

    QTextStream std_out ( stdout );
    QTextStream std_in ( stdin );

    std_out << "**** Test condition start *****************************************************************" << endl;
    std_out
    << "shape_* sh_0 =  new shape_;" << endl
    << "std_out << sh_0->out_comment() << endl;" << endl
    << "sh_0->print();" << endl << endl;
    std_out << "*******************************************************************************************" << endl;
    shape_* sh_0 =  new shape_;
    draw_vars dr;
    stack st;
    sh_0->edit();
    std_out << sh_0->out_comment() << endl;
    sh_0->print();
    std_out << "**** Test condition end *******************************************************************" << endl;

    std_out << "**** Test condition start *****************************************************************" << endl;
    std_out
    << "for ( int ir = 0;ir < 16 ;ir++ )" << endl
    << "{" << endl
    << "  for ( int io = 0;ir < 16;io++ )" << endl
    << "  {" << endl
    << "    shape_* sh_1 = new shape_ ( ir*16 + io );" << endl
    << "    std_out << sh_1->out_comment() << endl;" << endl
    << "    sh_1->print();" << endl
    << "    delete sh_1;" << endl
    << "  }" << endl
    << "}" << endl << endl;
    std_out << "*******************************************************************************************" << endl;

    for ( int ir = 0; ir < 16 ;ir++ )
    {
        for ( int io = 0; io < 16;io++ )
        {
            shape_* sh_1 = new shape_ ( ir*16 + io );
            std_out << sh_1->out_comment() << endl;
            sh_1->print();
            delete sh_1;
        }
    }

    std_out << "**** Test condition end *******************************************************************" << endl;

    std_out << "**** Test condition start *****************************************************************" << endl;
    std_out
    << "for ( int ir = 0;ir < 16 ;ir++ )" << endl
    << "{  for ( int io = 0; io < 16;io++ )" << endl
    << "  {" << endl
    << "    shape_*sh_2 = new shape_ ( ir, io );" << endl
    << "    std_out << sh_2->out_comment() << endl;" << endl
    << "    sh_2->print();" << endl
    << "    delete sh_2;" << endl
    << "  }" << endl
    << "}" << endl << endl;
    std_out << "*******************************************************************************************" << endl;

    for ( int ir = 0; ir < 16 ; ir++ )
    {
        for ( int io = 0; io < 16; io++ )
        {
            shape_*sh_2 = new shape_ ( ir, io );
            std_out << sh_2->out_comment() << endl;
            sh_2->print();
            delete sh_2;
        }
    }

    std_out << "**** Test condition end *******************************************************************" << endl;

    std_out << "**** Test condition start *****************************************************************" << endl;

    std_out
    << "for ( int ir = 0;ir < 16;ir++ )" << endl
    << "{"
    << "  sh_0->set_radius ( ir );"
    << "  for ( int io = 0;io < 16;io++ )" << endl
    << "  {" << endl
    << "    std_out << \"ir=\" << ir << \" io=\" << io << endl;" << endl
    << "    sh_0->set_sixtant ( io );" << endl
    << "    std_out << \"radius=\" << sh_0->get_radius() << \" octant=\" << sh_0->get_octant()" << endl
    << "    << \"byte=\" << sh_0->get_byte() << endl;" << endl
    << "    sh_0->print();" << endl
    << "  }" << endl
    << "}" << endl << endl;

    std_out << "*******************************************************************************************" << endl;

    for ( int ir = -20;ir < 20;ir++ )
    {
        sh_0->set_length ( ir );

        for ( int io = -20;io < 20;io++ )
        {
            std_out << "ir=" << ir << " io=" << io << endl;
            sh_0->set_sixtant ( io );
            std_out << "radius=" << sh_0->get_length() << " octant=" << sh_0->get_sixtant()
            << "byte=" << sh_0->get_byte() << endl;
            sh_0->print();
        }
    }

    std_out << "**** Test condition end *******************************************************************" << endl;

    std_out << "**** Test condition start *****************************************************************" << endl;

    std_out
    << "for ( int ir = 0;ir < 16;ir++ )" << endl
    << "{"
    << "  sh_0->set_radius ( ir );"
    << "  for ( int io = 0;io < 16;io++ )" << endl
    << "  {" << endl
    << "    std_out << \"ir=\" << ir << \" io=\" << io << endl;" << endl
    << "    sh_0->set_sixtant ( io );" << endl
    << "    std_out << \"radius=\" << sh_0->get_radius() << \" octant=\" << sh_0->get_octant()" << endl
    << "    << \" byte=\" << sh_0->get_byte() << endl;" << endl
    << "    sh_0->print();" << endl
    << "  }" << endl
    << "}" << endl << endl;

    std_out << "*******************************************************************************************" << endl;

    for ( int ibyte = -20; ibyte < 300 ; ibyte++ )
    {
        sh_0->set_byte ( ibyte );
        std_out << "ibyte=" << ibyte << endl;
        std_out << "radius=" << sh_0->get_length() << " octant=" << sh_0->get_sixtant()
        << " byte=" << sh_0->get_byte() << endl;
        sh_0->print();
    }

    std_out << "**** Test condition end *******************************************************************" << endl;

    {
        draw_vars dv;
        stack st;
        sh_0->edit ( );
    }

    delete sh_0;
    return 0;
}
示例#16
0
文件: main.hpp 项目: medusade/coral
 virtual int before_cgi_run(int argc, char_t** argv, char_t** env) {
     int err = 0;
     set_file_mode_is_binary(std_in());
     set_file_mode_is_binary(std_out());
     return err;
 }
示例#17
0
文件: getty.c 项目: DragonQuan/minix3
/* Handle the process of a GETTY.
 */
void do_getty(char *name, size_t len, char **args, const char *ttyname)
{
  register char *np, *s, *s0;
  int ch;
  struct utsname utsname;
  char **banner, *t;
  static char *def_banner[] = { "%s  Release %r Version %v  (%t)\n\n%n login: "******"\n" : " ");
		s0 = *banner;
		for (s = *banner; *s != 0; s++) {
			if (*s == '\\') {
				write(1, s0, s-s0);
				s0 = s+2;
				switch (*++s) {
				case 'n':  std_out("\n"); break;
				case 's':  std_out(" "); break;
				case 't':  std_out("\t"); break;
				case 0:	   goto leave;
				default:   s0 = s;
				}
			} else
			if (*s == '%') {
				write(1, s0, s-s0);
				s0 = s+2;
				switch (*++s) {
				case 's':  std_out(utsname.sysname); break;
				case 'n':  std_out(utsname.nodename); break;
				case 'r':  std_out(utsname.release); break;
				case 'v':  std_out(utsname.version); break;
				case 'm':  std_out(utsname.machine); break;
				case 'p':  std_out(utsname.arch); break;
				case 't':  std_out(ttyname); break;
#if __minix_vmd
				case 'k':  std_out(utsname.kernel); break;
				case 'h':  std_out(utsname.hostname); break;
				case 'b':  std_out(utsname.bus); break;
#endif
				case 0:	   goto leave;
				default:   s0 = s-1;
				}
			}
		}
	    leave:
		write(1, s0, s-s0);
	}

	np = name;
	while ((ch = readch()) != '\n') {
		if (np < name + len) *np++ = ch;
	}
	*np = '\0';
	if (*name == '\0') ch = ' ';	/* blank line typed! */
  }
}
示例#18
0
int test_shape_89 ( void )
{
    QTextStream std_out ( stdout );
    QTextStream std_in ( stdin );

    std_out << "**** shape_89 test ********************************************************" << endl;
    std_out << "shape_89* sh_89_0 =  new shape_89;" << endl;
    shape_89* sh_89_0 =  new shape_89;
    std_out << "sh_89_0->get_lenth()=" << sh_89_0->get_lenth() << endl;
    std_out << "sh_89_0->print();" << endl;
    sh_89_0->print();
    std_out << "sh_89_0->out_comment()" << endl << sh_89_0->out_comment() << endl;

    {
        sh_89_0->set_x ( 0, 50 ) ;
        sh_89_0->set_y ( 0, 60 ) ;
        std_out << "sh_89_0->set_x(0, 50) ;" << endl;
        std_out << "sh_89_0->set_y(0, 60) ;" << endl;
        std_out << "sh_89_0->out_comment()" << endl << sh_89_0->out_comment() << endl;
    }

    {
        sh_89_0->set_xy ( 0, 125, -127 ) ;
        std_out << "sh_89_0->set_xy(0, 125,-127) ;" << endl;
        std_out << "sh_89_0->out_comment()" << endl << sh_89_0->out_comment() << endl;
    }

    {
        sh_89_0->insert ( 1, 10, 10 ) ;
        std_out << "sh_89_0->out_comment()" << endl << sh_89_0->out_comment() << endl;
        std_out << "sh_89_0->is_index_good(-10)=" << sh_89_0->is_index_good ( -10 )  << endl;
        std_out << "sh_89_0->is_index_good(-1)=" << sh_89_0->is_index_good ( -1 )  << endl;
        std_out << "sh_89_0->is_index_good(0)=" << sh_89_0->is_index_good ( 0 )  << endl;
        std_out << "sh_89_0->is_index_good(1)=" << sh_89_0->is_index_good ( 1 )  << endl;
        std_out << "sh_89_0->is_index_good(2)=" << sh_89_0->is_index_good ( 2 )  << endl;
        std_out << "sh_89_0->is_index_good(3)=" << sh_89_0->is_index_good ( 3 )  << endl;
        std_out << "sh_89_0->is_index_good(4)=" << sh_89_0->is_index_good ( 4 )  << endl;

        std_out << "sh_89_0->out_i(-1)" << endl << sh_89_0->out_i ( -1 ) << endl;
        std_out << "sh_89_0->print_i ( 0 );" << endl;
        sh_89_0->print_i ( 0 );
        std_out << endl;
        std_out << "sh_89_0->out_i(1)" << endl << sh_89_0->out_i ( 1 ) << endl;
    }

    {
        QList<int> Dxy;
        Dxy << 101 << 102 << 103 << 104 << 105 << 106;
        sh_89_0->insert ( sh_89_0->get_n_segment() - 1, Dxy );
        sh_89_0->insert ( 1, Dxy );
        sh_89_0->print ( );
    }

    {
        sh_89_0->removeAt ( sh_89_0->get_n_segment() - 1 );
        sh_89_0->print ( );
        sh_89_0->removeAt ( sh_89_0->get_n_segment() );
        sh_89_0->print ( );
        sh_89_0->removeAt ( 0 );
        sh_89_0->print ( );
    }

    {
        draw_vars dw;
        stack st;
        sh_89_0->edit ( );
    }
    {
        QList<int> Dxy;
        Dxy << 11 << 12 << 21<< 22 << 31 << 32 << 41 << 42;
        sh_89_0->replace(Dxy);
        sh_89_0->edit ( );
    }
    shapes * sh_cp = sh_89_0->copy();
    std_out << sh_cp->out_comment() << endl;

    {
        DialogMultiLineEdit *a = new DialogMultiLineEdit;
        a->show();
        a->set_shape ( sh_89_0 );
    }
    return 0;
}