diff --git a/.hgignore b/.hgignore new file mode 100644 index 0000000..3e7547e --- /dev/null +++ b/.hgignore @@ -0,0 +1,3 @@ +syntax: glob +*/* +*.tar.gz diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..ad11a78 --- /dev/null +++ b/Makefile @@ -0,0 +1,21 @@ +# +# makefile for after5 cgi wrapper +# + +CC = gcc +VERSION = `head after5.cgi|awk '/Id:/{print $$4}'` +PNAME = after5-${VERSION} + +FILES = a5.c Makefile after5.cgi after5.css after5.png after5.rb \ + holiday +GTAR = gtar + +a5.cgi: a5.c + ${CC} -o a5.cgi a5.c + chmod u+s a5.cgi + +package: + -mkdir /tmp/${PNAME} + ${GTAR} cf - ${FILES} | (cd /tmp/${PNAME}; ${GTAR} -xvpf - --unlink) + ${GTAR} zcfC /tmp/${PNAME}.tar.gz /tmp ${PNAME} + diff --git a/a5.c b/a5.c new file mode 100644 index 0000000..6ee6f5c --- /dev/null +++ b/a5.c @@ -0,0 +1,58 @@ +#include +#include +#include +#include +#include +#include + +#define AFTER5PATH "./after5.cgi" + +int main(int argc, char *argv[]) +{ + char *path=malloc(strlen(argv[0])); + char *p; + uid_t euid = geteuid(); + struct stat st; + if (0 == euid) { + fputs("Do not call this program with suid 0\n", stderr); + exit(0); + } + strcpy(path, argv[0]); + p = strrchr(path, '/'); + if (p) { + *p = '\0'; + } else { + fputs("Cannot detect the directory where this program located.\n", stderr); + exit(1); + } + + if (-1 == chdir(path)) { + fprintf(stderr, "Cannot chdir to %s\n", path); + exit(2); + } + if (0 > stat(AFTER5PATH, &st)) { + fprintf(stderr, "Cannot access %s\n", AFTER5PATH); + exit(3); + } + if (st.st_uid != euid) { + fputs("UID of cgi program mismatch\n", stderr); + fputs("Do chown so that wrapper and cgi files' uid matches.\n", stderr); + exit(4); + } + if (0 > stat(".", &st)) { + fputs("Cannot stat current directory\n", stderr); + fputs("Please ensure installed directory is readable.\n", stderr); + exit(5); + } + if (st.st_uid != euid) { + fputs("UID of directory mismatch\n", stderr); + fputs("Do chown so that wrapper and directorys' uid matches.\n", stderr); + exit(6); + } + if (st.st_mode & (S_IWGRP | S_IWOTH)) { + fputs("This directory is writable for group/others.\n", stderr); + fputs("Do chmod og-w for installed directory.\n", stderr); + exit(7); + } + execv("./after5.cgi", argv); +} diff --git a/after5.cgi b/after5.cgi new file mode 120000 index 0000000..998e97f --- /dev/null +++ b/after5.cgi @@ -0,0 +1 @@ +after5.rb \ No newline at end of file diff --git a/after5.css b/after5.css new file mode 100644 index 0000000..7f8ef9d --- /dev/null +++ b/after5.css @@ -0,0 +1,45 @@ +body {background: ivory;} +body.personal {background: mistyrose;} +a:hover {background-color: lavender;} +.main td {width: 13%; vertical-align: top;} +.dayline {text-align: right; margin-bottom: 0; white-space: pre;} +.todayline {text-align: right; margin-bottom: 0; background: #f4d9f1; + white-space: pre;} +.dayline p {margin-top: 0;} +.sun, .holiday {background: lightpink;} +th.mon, th .mon {background: #aac9ff;} +th.tue, th .tue {background: #ffe1ce;} +th.wed, th .wed{background: #4cebff;} +th.thu, th .thu{background: #d3c2c2;} +th.fri, th .fri{background: gold;} +.sat {background: #bfefff;} +.time {background: lavender;} +.who {background: lemonchiffon; width: 10em;} +.group {background: honeydew; width: 10em;} +.monthlink {background: #c1ffc1; height: 1.4em;} /* DarkSeeGreen1 */ +.admin {background: lemonchiffon;} +.warn {color: red;} +.listup {border: 1px solid navy; margin-left: 2%; background: white; + padding: grppx;} +.topic {font-size: 90%;} +.recent {background: lavender;} /* $B:G6a$N9`L\(B */ +.c {text-align: center;} +th {background: lavender;} +h1 {text-align: center; color: blue;} +h2 {text-decoration: underline; color: #00008b; + border-top: solid thin navy; /* margin-right: 30%; */ + padding-top: 0.5ex;} +h2+p {margin-top: 0.1ex;} +.list { + background-color: khaki; + margin-left: 5%; margin-right: 5%; + border: 1px none black; + padding: 0px 1ex; +} +.screen { + background-color: #606060; color: white; + margin-left: 5%; + border: 1px none navy; + padding: 0.1ex 1ex 0.1nex 1ex; +} +.screen .u {color: cyan;} diff --git a/after5.png b/after5.png new file mode 100644 index 0000000..eafa140 --- /dev/null +++ b/after5.png Binary files differ diff --git a/after5.rb b/after5.rb index 36c4b88..e05b801 100755 --- a/after5.rb +++ b/after5.rb @@ -2,9 +2,10 @@ # -*- coding: euc-jp -*- # # Associative Scheduling Table - after5 -# (C)2003, 2004, 2006, 2008 by HIROSE Yuuji [yuuji@gentei.org] -# $Id: after5.rb,v 1.18 2012/04/01 05:18:57 yuuji Exp $ -# Last modified Sun Apr 1 14:17:05 2012 on firestorm +# (C)2003, 2004, 2006, 2008, 2012 by HIROSE Yuuji [yuuji@gentei.org] +# $Id: after5.rb,v 1.18 2012/04/01 05:18:57 yuuji Exp yuuji $ +# $HGid$ +# Last modified Sun Apr 1 16:41:56 2012 on firestorm # See http://www.gentei.org/~yuuji/software/after5/ # ���Υ�����ץȤ�EUC����¸���Ƥ��������� @@ -1121,6 +1122,7 @@ 'mailerror' => ['�ᥤ�륢�ɥ쥹���㤤�ޤ�', 'Invalid email address'], 'pswderror' => ['�ѥ���ɤ��㤤�ޤ�', 'Password incorrect'], 'fmtdaysschedule'=> ['%s����ͽ��', 'Schedule from %s'], + 'schedtable' => ['ͽ��ɽ', 'Schedule Table'], 'noplan' => ['��Ͽ����Ƥ���ͽ��Ϥ���ޤ���', 'No plans'], 'allday' => ['����', 'whole day'], 'addsched' => ['����ͽ����ܤ���Ͽ', 'Register new schedule'], @@ -2021,7 +2023,7 @@ personal = (/personal/i =~ @params['displaymode']) @params['displaydays'] = @params['displaydays'] || @cookie['displaydays'] days = @params['displaydays'].to_i - days = (days > 0 ? days : 1) + days = (days > 0 ? days : 3) # str = @sc.day_all(date, user, personal) outstr = dayTableString(user, date, days, personal) @@ -2029,6 +2031,7 @@ @O.print @H.element("h1", nil){ sprintf msg('fmtdaysschedule'), date } + @O.print @H.element("h2"){msg('schedtable')} ## @O.print @H.p() @O.print @H.elementln("form", {'action'=>@myname+"?-show+#{date}", 'method'=>'POST'}){ @H.elementln("p"){ diff --git a/holiday b/holiday new file mode 100644 index 0000000..9ae12ef --- /dev/null +++ b/holiday @@ -0,0 +1,18 @@ +# +# caltab - holiday table for cal.exe, 1994 +# +01/01 ���� +01/w2mon ���ͤ��� +02/11 ����ǰ���� +03/20 ��ʬ���� +04/29 ���¤��� +05/03 ��ˡ��ǰ�� +05/04 �ߤɤ���� +05/05 ���ɤ���� +07/w3mon ������ +09/w3mon ��Ϸ���� +09/23 ��ʬ���� +10/w2mon �ΰ���� +11/03 ʸ������ +11/23 ��ϫ���դ��� +12/23 ŷ��������