#include #include #include #include char *minutn[] = { "", "aans ", "zwa ", "drei ", "vier ", "fümf ", "sechs ", "siem ", "ocht ", "nein ", "zehn " }; char *vurnoch[]= { "vur ", "noch ", "", "punkt " }; char *viadln[]= { "", "viadl ", "hoiwa ", "dreiviadl " }; char *stundn[]= { "zwöfe","aans","zwa","drei","viere","fümfe", "sechse","siewane","ochte","neine","zehne","öfe" }; char *togeszeid[]= { " auf d'nocht", " in da frua", " am vuamittog", " z'mittog", " am nochmittog", " am obnd" }; int main(int argc, char *argv[]) { time_t bintime; struct tm ltime; int hour, mins; int nminutn,nvurnoch,nviadln,nstundn, ntogeszeid; puts ("Content-type: text/html\n\n"); if (argc < 2) { puts(""); time(&bintime); memcpy(<ime,localtime(&bintime),sizeof(struct tm)); hour=ltime.tm_hour; mins=ltime.tm_min; } else { int fc; char dammi; fc=sscanf(argv[1],"%2u:%2u%1c",&hour,&mins,&dammi); if (hour<0 || hour>23 || mins<0 || mins>59 || argc!=2 || fc!=2) { puts("\n

Richtige Vawendung:

\n
    "); puts("
  • .../sagzeit? --> aktuelle Uhrzeit"); puts("
  • .../sagzeit?hh:mm --> hh=Stundn,mm=Minutn"); puts ("
\n\n"); return 1; } } if (mins == 0) { nminutn=0; nvurnoch=3; nviadln=0; nstundn= hour%12; } else if (mins <= 10) { nminutn=mins; nvurnoch=1; nviadln=0; nstundn= hour%12; } else if (mins < 15) { nminutn=15-mins; nvurnoch=0; nviadln=1; nstundn= (hour+1)%12; } else if (mins == 15) { nminutn=0; nvurnoch=2; nviadln=1; nstundn= (hour+1)%12; } else if (mins < 20) { nminutn=mins-15; nvurnoch=1; nviadln=1; nstundn= (hour+1)%12; } else if (mins < 30) { nminutn=30-mins; nvurnoch=0; nviadln=2; nstundn= (hour+1)%12; } else if (mins == 30) { nminutn=0; nvurnoch=2; nviadln=2; nstundn= (hour+1)%12; } else if (mins <= 40) { nminutn=mins-30; nvurnoch=1; nviadln=2; nstundn= (hour+1)%12; } else if (mins < 45) { nminutn=45-mins; nvurnoch=0; nviadln=3; nstundn= (hour+1)%12; } else if (mins == 45) { nminutn=0; nvurnoch=2; nviadln=3; nstundn= (hour+1)%12; } else if (mins < 50) { nminutn=mins-45; nvurnoch=1; nviadln=3; nstundn= (hour+1)%12; } else { nminutn=60-mins; nvurnoch=0; nviadln=0; nstundn= (hour+1)%12; } if (hour < 4) { ntogeszeid=0; } else if (hour < 10) { ntogeszeid=1; } else if (hour < 12) { ntogeszeid=2; } else if (hour < 14) { ntogeszeid=3; } else if (hour < 19) { ntogeszeid=4; } else if (hour < 23) { ntogeszeid=5; } else { ntogeszeid=0; } printf("

"); printf("Es is %s%s%s%s%s",minutn[nminutn],vurnoch[nvurnoch], viadln[nviadln], stundn[nstundn], togeszeid[ntogeszeid]); puts ("

\n"); return 0; }