Update 2024-02-14 07:51 OpenBSD/amd64-x13
This commit is contained in:
10
.bin/OLD/t2i/Makefile
Normal file
10
.bin/OLD/t2i/Makefile
Normal file
@@ -0,0 +1,10 @@
|
||||
all: build test
|
||||
|
||||
build:
|
||||
cc -o text2ical text2ical.c
|
||||
|
||||
clean:
|
||||
rm -f text2ical
|
||||
|
||||
test:
|
||||
./text2ical < test.txt
|
||||
24
.bin/OLD/t2i/test.txt
Normal file
24
.bin/OLD/t2i/test.txt
Normal file
@@ -0,0 +1,24 @@
|
||||
FIXME 07.10.2022 19:00
|
||||
FIXME 11.11.2022 19:00 statt 04.11, Grund: Raumsituation
|
||||
FIXME 02.12.2022 19:00
|
||||
FIXME 13.01.2023 19:00 statt 06.01.2023, Grund: Raumsituation
|
||||
FIXME 03.02.2023 19:00
|
||||
FIXME 03.03.2023 19:00
|
||||
FIXME 14.04.2023 19:00 statt 07.04.2023, Grund: Raumsituation
|
||||
FIXME 05.05.2023 19:00
|
||||
FIXME 02.06.2023 19:00
|
||||
FIXME 07.07.2023 19:00
|
||||
FIXME 04.08.2023 19:00
|
||||
FIXME 01.09.2023 19:00
|
||||
FIXME 06.10.2023 19:00
|
||||
FIXME 03.11.2023 19:00
|
||||
FIXME 01.12.2023 19:00
|
||||
|
||||
|
||||
STAMMTISCH 19.12.2022 18:00
|
||||
STAMMTISCH 17.01.2023 18:00
|
||||
STAMMTISCH 20.02.2023 18:00
|
||||
STAMMTISCH 20.03.2023 18:00
|
||||
STAMMTISCH 17.04.2023 18:00
|
||||
STAMMTISCH 15.05.2023 18:00
|
||||
STAMMTISCH 19.06.2023 18:00
|
||||
BIN
.bin/OLD/t2i/text2ical
Executable file
BIN
.bin/OLD/t2i/text2ical
Executable file
Binary file not shown.
88
.bin/OLD/t2i/text2ical.c
Normal file
88
.bin/OLD/t2i/text2ical.c
Normal file
@@ -0,0 +1,88 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
|
||||
int main(int argc, const char *argv[])
|
||||
{
|
||||
char buf[256];
|
||||
int bufpos = 0;
|
||||
int sepno = 0;
|
||||
int newevent = 1;
|
||||
struct tm timeptr;
|
||||
|
||||
char *pevent, *pdate, *ptime, *comment = &buf[0];
|
||||
char c;
|
||||
|
||||
memset(buf, 0x0, sizeof(buf));
|
||||
|
||||
printf("BEGIN:VCALENDAR\n");
|
||||
printf("VERSION:2.0\n");
|
||||
printf("PRODID:-//uugrn.org//Event Calendar 1.0//EN\n");
|
||||
printf("CALSCALE:GREGORIAN\n");
|
||||
printf("METHOD:PUBLISH\n");
|
||||
printf("ORGANIZER:Unix User Group Rhein-Neckar\n\n");
|
||||
|
||||
while((c = getc(stdin)) != EOF) {
|
||||
|
||||
if(newevent) {
|
||||
printf("BEGIN:VEVENT\n");
|
||||
newevent = 0;
|
||||
}
|
||||
|
||||
/* append the current charater to our buffer */
|
||||
buf[bufpos] = c;
|
||||
|
||||
/* we found a tab or newline */
|
||||
if(c == 0x9 || c == 0x0a) {
|
||||
|
||||
/* count it */
|
||||
sepno++;
|
||||
|
||||
/* ... and terminate here, so we can print buf */
|
||||
buf[bufpos] = 0x0;
|
||||
|
||||
/* skip lines without at least two tabs and one newline */
|
||||
if(sepno < 3 && c == 0x0a) {
|
||||
bufpos = sepno = 0;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (sepno == 1)
|
||||
printf("SUMMARY:%s\n", buf);
|
||||
|
||||
else if (sepno == 2) {
|
||||
strptime(buf, "%d.%m.%Y", &timeptr);
|
||||
printf("DTSTART:%.4d%.2d%.2d",
|
||||
timeptr.tm_year + 1900,
|
||||
timeptr.tm_mon + 1,
|
||||
timeptr.tm_mday);
|
||||
|
||||
} else if (sepno == 3) {
|
||||
strptime(buf, "%H:%M", &timeptr);
|
||||
printf("%.2d%.2d\n",
|
||||
timeptr.tm_hour,
|
||||
timeptr.tm_min);
|
||||
printf("DTEND:%.2d%.2d\n",
|
||||
timeptr.tm_hour + 3,
|
||||
timeptr.tm_min);
|
||||
}
|
||||
|
||||
else if (sepno == 4)
|
||||
printf("DESCRIPTION:%s\n", buf);
|
||||
|
||||
if (c == 0x0a) {
|
||||
printf("END:VEVENT\n\n");
|
||||
newevent = 1;
|
||||
|
||||
sepno = 0;
|
||||
}
|
||||
|
||||
bufpos = 0;
|
||||
} else
|
||||
bufpos++;
|
||||
}
|
||||
|
||||
printf("END:VCALENDAR\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
BIN
.bin/OLD/t2i/timetest
Executable file
BIN
.bin/OLD/t2i/timetest
Executable file
Binary file not shown.
13
.bin/OLD/t2i/timetest.c
Normal file
13
.bin/OLD/t2i/timetest.c
Normal file
@@ -0,0 +1,13 @@
|
||||
#include <stdio.h>
|
||||
#include <time.h>
|
||||
|
||||
int main(int argc, const char *argv[])
|
||||
{
|
||||
char str[] = "07.10.2022";
|
||||
struct tm timeptr;
|
||||
strptime(str, "%d.%m.%Y", &timeptr);
|
||||
printf("%d%d%d\n", timeptr.tm_year + 1900, timeptr.tm_mon + 1, timeptr.tm_mday);
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user