]> sourceware.org Git - systemtap.git/commitdiff
PR18848: display current probe input
authorFelix Lu <flu@redhat.com>
Mon, 2 Nov 2015 20:56:32 +0000 (15:56 -0500)
committerFelix Lu <flu@redhat.com>
Fri, 20 Nov 2015 14:17:44 +0000 (09:17 -0500)
Input prompt now shows what the user has entered.

staprun/monitor.c

index 435b6fbb70edb2a098602c244e50637dfd99bf4b..4a035bfb6f9f1a85f73fb1f8d4a5bc54703d70d8 100644 (file)
@@ -30,6 +30,7 @@ static enum state
   insert
 } monitor_state; 
 
+static char probe[MAX_INDEX];
 static WINDOW *monitor_status = NULL;
 static WINDOW *monitor_output = NULL;
 static int comp_fn_index = 0;
@@ -116,6 +117,7 @@ static void write_command(const char *msg, const int len)
 
 void monitor_setup(void)
 {
+  probe[0] = '\0';
   start_time = time(NULL);
   initscr();
   curs_set(0);
@@ -195,7 +197,7 @@ void monitor_render(void)
       max_rows = monitor_y;
       max_cols = MIN(MAX_COLS, monitor_x);
       if (monitor_state == insert)
-        mvwprintw(monitor_status, max_rows-1, 0, "enter probe index:\n");
+        mvwprintw(monitor_status, max_rows-1, 0, "enter probe index: %s\n", probe);
       else
         mvwprintw(monitor_status, max_rows-1, 0,
                   "q (quit), r (reset globals), s (switch sort attribute), "
@@ -243,7 +245,6 @@ void monitor_render(void)
             {
               wprintw(monitor_status, "%s\n", monitor_out);
               col = 0;
-              continue;
             }
         }
       if (col != 0)
@@ -312,7 +313,6 @@ void monitor_render(void)
 void monitor_input(void)
 {
   static int i = 0;
-  static char probe[MAX_INDEX];
   char ch;
 
   switch (monitor_state)
@@ -343,10 +343,12 @@ void monitor_input(void)
             write_command(probe, i);
             monitor_state = normal;
             i = 0;
+            probe[0] = '\0';
           }
         else if (ch != ERR)
           {
             probe[i++] = ch;
+            probe[i] = '\0';
           }
         break;
     }
This page took 0.03197 seconds and 5 git commands to generate.