tty.c File Reference

#include <curses.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "misc.h"
#include "main.h"
#include "listparse.h"
#include "tty.h"

Defines

#define MIN(a, b)   ((a) < (b)) ? (a) : (b)

Functions

void curses_init ()
void curses_display ()
int curses_getch ()
void p_dir (struct parse_list *head)
void curses_end ()
void fatalerror (char *msg)
void e_prompt (char *msg, char *input, int becho)
char c_prompt (char *msg)
void set_line (int set)
int get_line ()
int inc_line ()
int dec_line ()
void error (char *msg)
void status (char *msg)
void header (char *msg)

Variables

char l_header [81]
char l_error [81]
char l_status [81]
int hi_line = 0

Detailed Description

Terminal handling (via Curses).

Define Documentation

#define MIN ( a,
 )     ((a) < (b)) ? (a) : (b)

Finds the minimum of two numbers.


Function Documentation

char c_prompt ( char *  msg  ) 

Prompts the user with a message, but only waits for one character.

Parameters:
msg The message to prompt.
Returns:
The character the user gave us.

void curses_display (  ) 

Display the window.

void curses_end (  ) 

Destroy the curses window.

int curses_getch (  ) 

Wrapper function for outside usage.

void curses_init (  ) 

Simple curses initialization.

int dec_line (  ) 

See inc_line().

void e_prompt ( char *  msg,
char *  input,
int  becho 
)

Prompts the user with a message, and waits for newline. Then it returns the input without the trailing newline.

Parameters:
msg The prompt message.
input Used to store the user's input.
becho Is the input echoed or not?

void error ( char *  msg  ) 

A non-fatal error; simply output msg to the error line and update the display.

Parameters:
msg Our new error message.

void fatalerror ( char *  msg  ) 

A "fatal" error; exit the program and print msg.

Parameters:
msg The msg to print.

int get_line (  ) 

Returns:
The hi_line so outside functions can know it.

void header ( char *  msg  ) 

Output a message to the header line and update display.

Parameters:
msg Our new header message.

int inc_line (  ) 

Increments the line counter.

/return 0 normally, 1 if out of bounds.

void p_dir ( struct parse_list head  ) 

Prints the directory listing starting from the head.

Parameters:
head The beginning of the directory listing.

void set_line ( int  set  ) 

Sets the highlighted line to set.

Parameters:
set Which line?

void status ( char *  msg  ) 

Output a message to the status line and update display.

Parameters:
msg Our new status message.


Variable Documentation

int hi_line = 0

Which line shall we highlight?

char l_error[81]

The error line.

char l_header[81]

The header.

char l_status[81]

The status line.


Generated by  doxygen 1.4.7.
SourceForge.net Logo