misc.c File Reference

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

Functions

void p_help ()
void strip_nl (char *data)
int str_begin (char *src, char *pat)
void parse_pwd (char *pwd, char *dir)
void p_header (char *host, char *dir)
void nullify (struct parse_list *head)
void fnullify (struct parse_list *head)
parse_listfscan (struct parse_list *head, char *filter)

Variables

char helpmsg []

Detailed Description

Miscellaneous functions.

Function Documentation

void fnullify ( struct parse_list head  ) 

Simliar to nullify, except doesn't free the lp member. For filtered lists.

Parameters:
head The container of all this soon-to-be-free stuff.

struct parse_list* fscan ( struct parse_list head,
char *  filter 
)

Used with the filtering. This builds a linked list of all the filenames that match the given filter.

Parameters:
head The head of the entire directory listing.
filter The given name filter.
Returns:
Pointer to the head of the filtered list.

void nullify ( struct parse_list head  ) 

Frees head, the lp member inside of head, and the name member inside of that.

Parameters:
head The container of all this soon-to-be-free stuff.

void p_header ( char *  host,
char *  dir 
)

Easier way to print the header up top.

Parameters:
host Current hostname.
dir Current directory.

void p_help (  ) 

Prints a helpful message using the "less" pager.

void parse_pwd ( char *  pwd,
char *  dir 
)

Parses the output of PWD to find out what directory we're in.

Parameters:
pwd Output of PWD.
dir The directory name will be put in this address.

int str_begin ( char *  src,
char *  pat 
)

Tests to see whether the string src begins with the string pat.

Parameters:
src What to search in.
pat The pattern to match.
Returns:
1 for success, else 0.

void strip_nl ( char *  data  ) 

Strips out CR and LF from the end of something.

Parameters:
data What will be stripped.


Variable Documentation

char helpmsg[]

Initial value:

 
        "stftp help\n"
        "\n"
        "Note that the left and right arrow keys are synonyms for 'u' and '\\n'\n"
        "when traversing directories.\n"
        "\n"
        "ubiquitous commands\n"
        "h\tthis help message\n"
        "u\tgo up a directory (cd ..)\n"
        "f\tfilter by beginning pattern\n"
        "\n"
        "remote view commands\n"
        "g\tgoto (a directory)\n"
        "l\tchange current local directory\n"
        "L\tprint current local directory\n"
        "q\tquit\n"
        "d\tdelete the highlighted file\n"
        "\\n\tdirectory: change server to selected directory\n"
        "\tfile: download selected file to current local directory\n"
        "p\tupload a file to the current remote directory, switches to local view\n"
        "\n"
        "local view commands\n"
        "q\treturn to remote view\n"
        "l/g\tchange local directory\n"
        "\\n\tdirectory: change to selected directory\n"
        "\tfile: upload selected file to current remote directory\n"
Used with p_help().


Generated by  doxygen 1.4.7.
SourceForge.net Logo