File: ftpsupt.h

package info (click to toggle)
lurkftp 1.00-1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 324 kB
  • ctags: 375
  • sloc: ansic: 4,551; sh: 186; makefile: 162
file content (105 lines) | stat: -rw-r--r-- 2,257 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
/*
 * Support routines' header for lurkftp
 * 
 * (C) 1997 Thomas J. Moore
 * questions/comments -> dark@mama.indstate.edu
 * 
 * This is free software.  No warranty for applicability or fitness is
 * expressed or implied.
 * 
 * This code may be modified and distributed freely so long as the original
 * author is credited and any changes are documented as such.
 * 
 */

/* all things needed by either ftpsupt.c or lurkftp.c */
/* Yes, I know, this violates standard coding practices, but I'm lazy */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <signal.h>
#include <ctype.h>
#include <time.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <errno.h>
#include <regex.h>
#include "ftp.h"
#include <sys/sysmacros.h>

#ifndef major
#waring old major/minor defs for Linux
# ifdef __linux__
#include <linux/kdev_t.h>
#define major MAJOR
#define minor MINOR
#define makedev MKDEV
#else
#define MINORBITS (sizeof(dev_t)/2)
#define MINORMASK (~0UL>>(sizeof(unsigned long)-MINORBITS))
#define major(x) ((x)>>MINORBITS)
#define minor(x) ((x)&MINORMASK)
#ifndef makedev
#define makedev(maj,min) (((maj)<<MINORBITS)|(min))
#endif
#warning you may want to include better defs for major/minor
#endif
#endif

extern char *crpg, *uncrpg; /* compression programs */

extern struct tm curtm;

#define BUFLEN (4096-sizeof(struct strmem *)-sizeof(short))

struct strmem {
    struct strmem *nxt;
    short ptr;
    char buf[BUFLEN];
};

struct fname {
    const char *dir, *name, *lnk, *root;
    mode_t mode;
    unsigned long size;
    short year;
    char month, day;
    signed char hr, min;
    char flags;
};

#define FNF_MOVE	1
#define FNF_APPEND	2
#define FNF_MODEONLY	4
#define FNF_DONE	8
#define FNF_PROCESS	16
#define FNF_DODIR	32

#define NSKIP 256

struct fnamemem {
    struct fnamemem *nxt;
    struct fname names[NSKIP];
};

struct dirmem {
    struct strmem *names;
    struct fnamemem *files;
    struct fname **array;
    unsigned long count;
};

enum {
    ERR_DIR = ERR_MAX,
    ERR_PWD,
    ERR_MAXRETR
};

struct myfile {
    void *data;
    int (*readln)(void *data, char *buf, int buflen);
    int (*read)(void *data, char *buf, int buflen);
    int (*write)(void *data, char *buf, int buflen);
};