diff --git a/du3/program b/du3/program new file mode 100755 index 0000000..92fd8f0 Binary files /dev/null and b/du3/program differ diff --git a/du3/program.c b/du3/program.c new file mode 100644 index 0000000..608d9ea --- /dev/null +++ b/du3/program.c @@ -0,0 +1,32 @@ +#define __USE_XOPEN +#define _GNU_SOURCE + +#include +#include +#include + +int main() { + char buffer[20]; + struct tm tm; + + char *retval = fgets(buffer, sizeof(buffer), stdin); + + if (retval == 0) { + puts("Neplatny datum"); + return 0; + } + + retval = strptime(buffer, "%e.%m.%-Y", &tm); + + if (retval == 0) { + puts("Neplatny datum"); + return 0; + } + + tm.tm_mday += 7; + + strftime(buffer, sizeof(buffer), "%e.%m.%-Y", &tm); + puts(buffer); + + return 0; +} \ No newline at end of file