Skip to content
Snippets Groups Projects
Select Git revision
  • a81bcf4311624b15525cfe4b376c667fbf40cbdd
  • master default protected
  • rednatco-v2
  • rednatco
  • test
  • ntc-tube-uniform-color
  • ntc-tube-missing-atoms
  • restore-vertex-array-per-program
  • watlas2
  • dnatco_new
  • cleanup-old-nodejs
  • webmmb
  • fix_auth_seq_id
  • update_deps
  • ext_dev
  • ntc_balls
  • nci-2
  • plugin
  • bugfix-0.4.5
  • nci
  • servers
  • v0.5.0-dev.1
  • v0.4.5
  • v0.4.4
  • v0.4.3
  • v0.4.2
  • v0.4.1
  • v0.4.0
  • v0.3.12
  • v0.3.11
  • v0.3.10
  • v0.3.9
  • v0.3.8
  • v0.3.7
  • v0.3.6
  • v0.3.5
  • v0.3.4
  • v0.3.3
  • v0.3.2
  • v0.3.1
  • v0.3.0
41 results

sort.ts

Blame
  • main.c 4.85 KiB
    /* ncdu - NCurses Disk Usage 
        
      Copyright (c) 2007-2009 Yoran Heling
    
      Permission is hereby granted, free of charge, to any person obtaining
      a copy of this software and associated documentation files (the
      "Software"), to deal in the Software without restriction, including
      without limitation the rights to use, copy, modify, merge, publish,
      distribute, sublicense, and/or sell copies of the Software, and to
      permit persons to whom the Software is furnished to do so, subject to
      the following conditions:
      
      The above copyright notice and this permission notice shall be included
      in all copies or substantial portions of the Software.
      
      THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
      EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
      MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
      IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
      CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
      TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
      SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
    
    */
    
    #include "global.h"
    
    #include <stdlib.h>
    #include <string.h>
    #include <errno.h>
    
    #include <unistd.h>
    #include <sys/time.h>
    
    int pstate;
    
    int min_rows = 17,
        min_cols = 60;
    long update_delay = 100,
         lastupdate = 999;
    
    
    void screen_draw() {
      switch(pstate) {
        case ST_CALC:   calc_draw();   break;
        case ST_BROWSE: browse_draw(); break;
        case ST_HELP:   help_draw();   break;
        case ST_DEL:    delete_draw(); break;
      }
    }
    
    
    /* wait:
     *  -1: non-blocking, always draw screen
     *   0: blocking wait for input and always draw screen
     *   1: non-blocking, draw screen only if a configured delay has passed or after keypress
     */
    int input_handle(int wait) {
      int ch;
      struct timeval tv;
    
      nodelay(stdscr, wait?1:0);
      if(wait != 1)
        screen_draw();
      else {
        gettimeofday(&tv, (void *)NULL);
        tv.tv_usec = (1000*(tv.tv_sec % 1000) + (tv.tv_usec / 1000)) / update_delay;
        if(lastupdate != tv.tv_usec) {
          screen_draw();
          lastupdate = tv.tv_usec;