diff options
author | tenox <as@tenoware.com> | 2016-01-11 23:57:03 -0800 |
---|---|---|
committer | tenox <as@tenoware.com> | 2016-01-11 23:57:03 -0800 |
commit | 245eaad379742cc0ba9992c858523664b02102fb (patch) | |
tree | 47eb4faed0a498e42aaf927ed24eb66bac601a9e /wfm.h | |
download | wfm-245eaad379742cc0ba9992c858523664b02102fb.tar.gz |
initial commit1.0.0
Diffstat (limited to 'wfm.h')
-rw-r--r-- | wfm.h | 149 |
1 files changed, 149 insertions, 0 deletions
@@ -0,0 +1,149 @@ +#define VERSION "1.0.0" +#define copyright "<!-- WFM Version " VERSION ", Mountain View, CA, " __DATE__ " [" __TIME__ "] -->\n<!-- Copyright (c) 1994-2015 by Antoni Sawicki -->\n" + +#define CSS_STYLE \ + " <STYLE TYPE=\"text/css\"><!-- \n" \ + " A:link {text-decoration: none; color:#0000CE; } \n" \ + " A:visited {text-decoration: none; color:#0000CE; } \n" \ + " A:active {text-decoration: none; color:#FF0000; } \n" \ + " A:hover {text-decoration: none; color:#FF0000; } \n" \ + " body, td, th, input { font-family: Tahoma, Sans-Serif; font-size:11px; } \n" \ + " html, body { box-sizing: border-box; width:100%%; height:100%%; margin:0px; padding:0px; } \n" \ + " input { border-color:#000000; border-style:solid; }\n" \ + " img { vertical-align: middle; }\n" \ + " .tbr { border-width: 1px; border-style: solid solid solid solid; border-color: #AAAAAA #555555 #555555 #AAAAAA; }\n" \ + " .twh { width:100%%; height:100%%; }\n" \ + " --></STYLE>\n" + +#define HTML_HEADER \ + "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\"\n" \ + " \"http://www.w3.org/TR/html4/loose.dtd\">\n" \ + "<HTML>\n" \ + copyright \ + "<HEAD>\n" \ + " <META HTTP-EQUIV=\"Content-type\" CONTENT=\"text/html;charset=UTF-8\">\n" \ + CSS_STYLE + + +#define _FILE_OFFSET_BITS 64 + +#ifdef __sun__ +#define _POSIX_PTHREAD_SEMANTICS +#endif + +#include <stdio.h> +#include <string.h> +#include <strings.h> +#include <stdlib.h> +#include <unistd.h> +#include <libgen.h> +#include <ctype.h> +#include <dirent.h> +#include <regex.h> +#include <stdarg.h> +#include <errno.h> +#include <time.h> +#include <sys/time.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <sys/shm.h> +//#include <sys/dir.h> +#include "md5.h" +#include "cgic.h" +#include "wfmiconres.h" + +#define VALIDCHRS "anu-_." +#define VALIDCHRS_DST "anu-_./" + + +#define P1024_1 1024.0f +#define P1024_2 1048576.0f +#define P1024_3 1073741824.0f +#define P1024_4 1099511627776.0f + +#define SHM_SIZE 16 + +#define NORMAL_COLOR "FFFFFF" +#define HIGH_COLOR "33CC33" +#define HL_COLOR "FFD700" + + +#define VIRT_DIRNAME_SIZE NAME_MAX +#define PHYS_DIRNAME_SIZE 1024 +#define VIRT_FILENAME_SIZE NAME_MAX +#define PHYS_FILENAME_SIZE 1280 +#define VIRT_DESTINATION_SIZE NAME_MAX +#define PHYS_DESTINATION_SIZE 1280 + +char virt_dirname[VIRT_DIRNAME_SIZE]; +char phys_dirname[PHYS_DIRNAME_SIZE]; +char virt_filename[VIRT_FILENAME_SIZE]; +char phys_filename[PHYS_FILENAME_SIZE]; +char virt_destination[VIRT_DESTINATION_SIZE]; +char phys_destination[PHYS_DESTINATION_SIZE]; +char virt_parent[VIRT_DIRNAME_SIZE]; + +char ICONSURL[1024]; +char HOMEDIR[1024]; +char HOMEURL[1024]; +char TAGLINE[1024]; + +char token[256]; +char loggedinuser[64]; + +regex_t dotdot; +int access_level; +int access_as_user; +int users_defined; +int edit_by_default; +int edit_any_file; +int recursive_du; + +double t1, t2; +struct timeval mt; + +enum { FALSE, TRUE }; +enum { PERM_NO, PERM_RO, PERM_RW }; + +typedef struct asdir_ { + char name[NAME_MAX]; + mode_t type; + off_t size; + time_t atime, mtime, rtime; +} ASDIR; + +int namesort(const void *, const void *); +int rnamesort(const void *, const void *); +int sizesort(const void *, const void *); +int rsizesort(const void *, const void *); +int timesort(const void *, const void *); +int rtimesort(const void *, const void *); +int asscandir(const char *, ASDIR **, int (*compar)(const void *, const void *)); + +void error(char *, ...); +void redirect(char *, ...); +char *buprintf(float, int); +int strip(char *, int, char *); +void checkfilename(char *); +void checkdestination(void); +void mkfile(void); +void newdir(void); +void edit_save(void); +void delete(void); +void move(void); +void dirlist(void); +void edit_ui(void); +void rename_ui(void); +void mkdir_ui(void); +void mkfile_ui(void); +void multiprompt_ui(char *); +void about(void); +void sendfile(void); +void receivefile(void); +off_t du(char *); +void re_dir_ui(char *, int); +void login_ui(void); +void tstop(void); +void html_title(char *); +void singleprompt_ui(char *); + |