-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgopher.h
85 lines (69 loc) · 1.5 KB
/
gopher.h
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
#include <stdint.h>
#include <types.h>
/*
* The UMN gopherd (version 3) considers these to be text files:
* '0' (text), '1' (index), 'M' (MIME), '2' (CSO), '4' (Mac Hex)
* 'h' (HTML) was not, for reasons.
* '6' (uuencoded file) is also not.
*
* Additionally, these mime types are text:
* message/rfc822 (email)
* application/postscript
* application/mac-binhex40
* application/rtf (often 'r')
* application/gopher*
*
* Most of those should probably just be saved.
*/
enum {
kGopherTypeText = '0',
kGopherTypeIndex = '1',
kGopherTypeInfo = 'i',
kGopherTypeError = '3',
kGopherTypeSearch = '7',
kGopherTypeBinary = '9',
};
enum {
kFlagWrap = 0b00000001,
kFlagDeDot = 0b00000010,
kFlagTab = 0b00000100
};
// records for the List Manager index.
typedef struct ListEntry {
// ptrs are p-strings.
char *name;
uint8_t flags;
uint8_t type;
uint16_t port;
char *selector;
char *host;
} ListEntry;
// window refcon
typedef struct cookie {
unsigned type;
unsigned menuID;
unsigned flags;
char *title; // window title
} cookie;
typedef struct text_cookie {
unsigned type;
unsigned menuID;
unsigned flags;
char *title;
//
char data[1];
} text_cookie;
typedef struct index_cookie {
unsigned type;
unsigned menuID;
unsigned flags;
char *title;
//
Handle handle;
unsigned listSize;
ListEntry *list;
char data[1];
} index_cookie;
void NewTextWindow(text_cookie *, void *, unsigned long);
void NewIndexWindow(index_cookie *);
int DecodeBINSCII(const unsigned char *ptr, long size);