version 1.15, 2001/05/24 00:59:38 |
version 1.16, 2001/05/24 03:05:22 |
|
|
*/ |
*/ |
#include "def.h" |
#include "def.h" |
|
|
static FILE *ffp; |
static FILE *ffp; |
|
|
#include <sys/types.h> |
#include <sys/types.h> |
#include <sys/stat.h> |
#include <sys/stat.h> |
|
|
*/ |
*/ |
int |
int |
ffropen(fn, bp) |
ffropen(fn, bp) |
char *fn; |
char *fn; |
BUFFER *bp; |
BUFFER *bp; |
{ |
{ |
struct stat statbuf; |
struct stat statbuf; |
|
|
if ((ffp = fopen(fn, "r")) == NULL) |
if ((ffp = fopen(fn, "r")) == NULL) |
return (FIOFNF); |
return (FIOFNF); |
|
|
*/ |
*/ |
int |
int |
ffgetline(buf, nbuf, nbytes) |
ffgetline(buf, nbuf, nbytes) |
char *buf; |
char *buf; |
int nbuf; |
int nbuf; |
int *nbytes; |
int *nbytes; |
{ |
{ |
int c; |
int c, i; |
int i; |
|
|
|
i = 0; |
i = 0; |
while ((c = getc(ffp)) != EOF && c != '\n') { |
while ((c = getc(ffp)) != EOF && c != '\n') { |
|
|
fbackupfile(fn) |
fbackupfile(fn) |
char *fn; |
char *fn; |
{ |
{ |
struct stat sb; |
struct stat sb; |
int from, to, serrno; |
int from, to, serrno; |
size_t nread; |
size_t nread; |
size_t len; |
size_t len; |
char buf[BUFSIZ]; |
char buf[BUFSIZ]; |
char *nname; |
char *nname; |
|
|
len = strlen(fn); |
len = strlen(fn); |
if ((nname = malloc(len + 1 + 1)) == NULL) { |
if ((nname = malloc(len + 1 + 1)) == NULL) { |
|
|
#endif |
#endif |
#include <pwd.h> |
#include <pwd.h> |
#ifndef NO_DIR |
#ifndef NO_DIR |
extern char *wdir; |
extern char *wdir; |
#endif |
#endif |
|
|
char * |
char * |
adjustname(fn) |
adjustname(fn) |
char *fn; |
char *fn; |
{ |
{ |
char *cp; |
char *cp; |
static char fnb[NFILEN]; |
static char fnb[NFILEN]; |
struct passwd *pwent; |
struct passwd *pwent; |
#ifdef SYMBLINK |
#ifdef SYMBLINK |
struct stat statbuf; |
struct stat statbuf; |
int i, j; |
int i, j; |
char linkbuf[NFILEN]; |
char linkbuf[NFILEN]; |
#endif |
#endif |
|
|
switch (*fn) { |
switch (*fn) { |
|
|
*/ |
*/ |
char * |
char * |
startupfile(suffix) |
startupfile(suffix) |
char *suffix; |
char *suffix; |
{ |
{ |
static char file[NFILEN]; |
static char file[NFILEN]; |
char *home; |
char *home; |
|
|
if ((home = getenv("HOME")) == NULL || *home == '\0') |
if ((home = getenv("HOME")) == NULL || *home == '\0') |
goto nohome; |
goto nohome; |
|
|
|
|
int |
int |
copy(frname, toname) |
copy(frname, toname) |
char *frname; |
char *frname; |
char *toname; |
char *toname; |
{ |
{ |
pid_t pid; |
pid_t pid; |
int status; |
int status; |
|
|
if ((pid = vfork())) { |
if ((pid = vfork())) { |
if (pid == -1) |
if (pid == -1) |
|
|
|
|
BUFFER * |
BUFFER * |
dired_(dirname) |
dired_(dirname) |
char *dirname; |
char *dirname; |
{ |
{ |
BUFFER *bp; |
BUFFER *bp; |
FILE *dirpipe; |
FILE *dirpipe; |
char line[256]; |
char line[256]; |
int len; |
int len; |
|
|
if ((dirname = adjustname(dirname)) == NULL) { |
if ((dirname = adjustname(dirname)) == NULL) { |
|
|
#endif /* NO_DIRED */ |
#endif /* NO_DIRED */ |
|
|
struct filelist { |
struct filelist { |
LIST fl_l; |
LIST fl_l; |
char fl_name[NFILEN + 2]; |
char fl_name[NFILEN + 2]; |
}; |
}; |
|
|
/* |
/* |
|
|
|
|
LIST * |
LIST * |
make_file_list(buf) |
make_file_list(buf) |
char *buf; |
char *buf; |
{ |
{ |
char *dir, *file, *cp; |
char *dir, *file, *cp; |
int len, preflen; |
int len, preflen; |
DIR *dirp; |
DIR *dirp; |
struct dirent *dent; |
struct dirent *dent; |
LIST *last; |
LIST *last; |
struct filelist *current; |
struct filelist *current; |
char prefixx[NFILEN + 1]; |
char prefixx[NFILEN + 1]; |
struct stat statbuf; |
struct stat statbuf; |
char statname[NFILEN + 2]; |
char statname[NFILEN + 2]; |
|
|
/* |
/* |
* We need three different strings: dir - the name of the directory |
* We need three different strings: dir - the name of the directory |