set the filetype based on the extension.

This commit is contained in:
Kelvin Sherlock 2012-04-16 18:38:25 -04:00
parent 8c5c7e43c6
commit b4242ec271
3 changed files with 20 additions and 3 deletions

View File

@ -1,13 +1,20 @@
#pragma optimize 79
#include <Types.h>
int parse_ftype(const char *cp, Word size, Word *ftype, Word *atype)
{
Word *wp = (Word *)cp;
Word h;
*ftype = 0;
*atype = 0;
switch ((*cp | 0x20) ^ size)
if (!cp || !size) return 0;
h = ((*cp | 0x20) ^ size) & 0x0f;
switch (h)
{
case 0x00:
// shk

View File

@ -6,11 +6,16 @@
int parse_ftype(const char *cp, Word size, Word *ftype, Word *atype)
{
Word *wp = (Word *)cp;
Word h;
*ftype = 0;
*atype = 0;
switch ((*cp | 0x20) ^ size)
if (!cp || !size) return 0;
h = ((*cp | 0x20) ^ size) & 0x0f;
switch (h)
{
%%
}

View File

@ -16,6 +16,8 @@
#include <unistd.h>
extern int setfiletype(const char *filename);
/*
* connect gopher.floodgap.com:70
* send path
@ -566,6 +568,7 @@ int main(int argc, char **argv)
filename, strerror(errno));
exit(1);
}
setfiletype(filename);
}
else if (flagO)
{
@ -586,6 +589,8 @@ int main(int argc, char **argv)
exit(1);
}
setfiletype(filename);
free(filename);
filename = NULL;
}