//
// h8300-hms-gcc -O -mh -mint32 -r -fno-common -o specify specify.c
//
// 5 jun 04
//
#include <mes.h>
#define MASTER 24
#define MISTRESS 48
int second;
int minute;
int hour;
int date;
int month;
int year;
char heat[MASTER];
// 6 jun 04
void preserve()
{
char keep[7];
keep[0] = second;
keep[1] = minute;
keep[2] = hour;
keep[3] = date;
keep[4] = month;
keep[5] = year / 100;
keep[6] = year % 100;
int flag, fd, size, opt, banner;
char* name = "/ram0/present";
char* data;
data = &(keep[0]);
opt = 0;
size = 7;
fd = open(name, opt);
flag = write(fd, data, size);
banner = close(fd);
}
// 5 jun 04
int figure()
{
int j, number, numeral;
for (j=0; j<MASTER; j++){
if (heat[j] == 0){
number = j;
break;
}
}
if (number == 0){
return 0;
}
numeral = heat[0] - '0';
for (j=1; j<number; j++){
numeral = numeral * 10 + (heat[j] - '0');
}
return numeral;
}
// 5 jun 04
int main(int argc, char **argv)
{
int flag;
printf("<html><head><title>H8/3069F</title></head>\n");
printf("<body BGCOLOR=\"#EEFFEE\" VLINK=\"#00CC66\"><br />\n");
printf("<div align=\"center\">\n");
flag = cgi_value(argv[1], "year", heat, MASTER);
year = figure();
if (year < 1){ year = 1; } // 13 jun 04
printf("year = %d<br />\n",year);
flag = cgi_value(argv[1], "month", heat, MASTER);
month = figure();
if (month < 1){ month = 1; }
printf("month = %d<br />\n",month);
flag = cgi_value(argv[1], "date", heat, MASTER);
date = figure();
if (date < 1){ date = 1; }
printf("date = %d<br />\n",date);
flag = cgi_value(argv[1], "hour", heat, MASTER);
hour = figure();
if (hour < 0){ hour = 0; }
printf("hour = %d<br />\n",hour);
flag = cgi_value(argv[1], "minute", heat, MASTER);
minute = figure();
if (minute < 0){ minute = 0; }
printf("minute = %d<br />\n",minute);
printf("<p><A HREF=\"measure\">top</A>\n");
printf("</div></body></html>\n");
preserve();
}