示例#1
0
文件: psax.c 项目: kzfm1024/misc
main()
{
    char c;
    // ウィンドウを準備する。以下の3行でcursesライブラリを呼び出す
    // cursesプログラムの標準的な初期化手順である
    scrn = initscr();
    noecho(); // キー入力をエコーしない
    cbreak(); // キー入力は即時有効になる。Enterキー入力を必要としない
    // 'ps ax' を実行し出力を処理する
    runpsax();
    // ウィンドウに表示する
    showlastpart();
    // ユーザコマンドループ
    while (1) {
        // ユーザコマンドを受け取る
        c = getch();
        if (c == 'u') updown(-1);
        else if (c == 'd') updown(1);
        else if (c == 'r') rerun();
        else if (c == 'k') prockill();
        else break; // 終了する
    }
    // 元の設定を復元する
    endwin();
}
示例#2
0
文件: ex2.cpp 项目: fcym92321/hw1
 int   main()

    { char c;

     // window setup, next 3 lines are curses library calls, a standard

     // initializing sequence for curses programs

       scrn = initscr();

       noecho(); // don’t echo keystrokes

       cbreak(); // keyboard input valid immediately, not after hit Enter

       // run ’ps ax’ and process the output

       runpsax();

       // display in the window

       showlastpart();

       // user command loop

       while (1) {

           // get user command

           c = getch();

           if (c == ’u’) updown(-1);

           else if (c == ’d’) updown(1);

                                                     6
         else if (c == ’r’) rerun();

         else if (c == ’k’) prockill();

         else break; // quit

      }

      // restore original settings and leave

     endwin();

return 0;

    }