Tässä tärkein diffi, joka ei tosin ole kaikkien diffien äiti...
--- ../../Lataukset/pakkausOhjelmanSorsat/libarchive-3.7.2/unzip/bsdunzip.c 2024-02-15 17:35:04.877180993 +0200
+++ bsdunzip.cpp 2024-02-16 08:27:51.112305013 +0200
@@ -3,6 +3,7 @@
*
* Copyright (c) 2009, 2010 Joerg Sonnenberger <joerg@NetBSD.org>
* Copyright (c) 2007-2008 Dag-Erling Smørgrav
+ * Copyright (c) 2024 Kamara
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -29,15 +30,20 @@
*
* $FreeBSD$
*
+ * Kääntyy ...
+ * g++ "-DBSDUNZIP_VERSION_STRING=\"Kamaran beta versio\"" -DHAVE_FNMATCH_H -DHAVE_UNISTD_H -DHAVE_FNMATCH -DHAVE_STDLIB_H -DHAVE_STDARG_H -DHAVE_STRING_H -Wno-deprecated-declarations -o unzip/bsdunzip unzip/bsdunzip.h unzip/bsdunzip.cpp unzip/err.h unzip/err.cpp unzip/lafe_platform.h unzip/passphrase.h unzip/passphrase.cpp unzip/cmdline.cpp -larchive -lz
+ *
+ *
+ *
* This file would be much shorter if we didn't care about command-line
* compatibility with Info-ZIP's UnZip, which requires us to duplicate
* parts of libarchive in order to gain more detailed control of its
* behaviour for the purpose of implementing the -n, -o, -L and -a
* options.
*/
-
+#include <iostream>
#include "bsdunzip_platform.h"
-
+#include "passphrase.h"
#ifdef HAVE_SYS_QUEUE_H
#include <sys/queue.h>
#else
@@ -78,11 +84,12 @@
#include <sys/time.h>
#endif
#endif
-
+#include <fcntl.h>
#include "bsdunzip.h"
#include "passphrase.h"
#include "err.h"
-
+//#include "cmdline.cpp"
+//#include <fnmatch.h>
// Oma lisäys arvonta
//extern "C" void lafe_setprogname(char const*,char const*);
// Oma lisäys arvonta loppuu...
@@ -121,7 +128,6 @@ static int tty;
static int unzip_exclude_mode = 0;
int bsdunzip_optind;
-
/* convenience macro */
/* XXX should differentiate between ARCHIVE_{WARN,FAIL,RETRY} */
#define ac(call) \
@@ -158,6 +164,8 @@ error(const char *fmt, ...)
exit(EXIT_FAILURE);
}
+
+
/* fatal error message, no errno */
static void
errorx(const char *fmt, ...)
@@ -212,7 +220,6 @@ static void
info(const char *fmt, ...)
{
va_list ap;
-
if (q_opt && !unzip_debug)
return;
va_start(ap, fmt);
@@ -225,7 +232,6 @@ info(const char *fmt, ...)
else
noeol = fmt[strlen(fmt) - 1] != '\n';
}
-
/* debug message (if unzip_debug) */
static void
debug(const char *fmt, ...)
@@ -244,7 +250,6 @@ debug(const char *fmt, ...)
else
noeol = fmt[strlen(fmt) - 1] != '\n';
}
-
/* duplicate a path name, possibly converting to lower case */
static char *
pathdup(const char *path)
@@ -852,6 +857,8 @@ extract(struct archive *a, struct archiv
free(pathname);
}
+// Rivi 854 20240216
+
static void
extract_stdout(struct archive *a, struct archive_entry *e)
{
@@ -894,7 +901,6 @@ extract_stdout(struct archive *a, struct
free(pathname);
}
-
/*
* Print the name of an entry to stdout.
*/
@@ -960,7 +966,6 @@ test(struct archive *a, struct archive_e
return error_count;
}
-
/*
* Callback function for reading passphrase.
* Originally from cpio.c and passphrase.c, libarchive.
@@ -991,6 +996,7 @@ passphrase_callback(struct archive *a, v
return p;
}
+
/*
* Main loop: open the zipfile, iterate over its contents and decide what
* to do with each entry.
@@ -1107,6 +1113,7 @@ version(void)
exit(0);
}
+
static int
getopts(int argc, char *argv[])
{
@@ -1205,6 +1212,9 @@ getopts(int argc, char *argv[])
return (bsdunzip_optind);
}
+
+/* command-line options */
+
int
main(int argc, char *argv[])
{
@@ -1212,7 +1222,7 @@ main(int argc, char *argv[])
int nopts;
lafe_setprogname(*argv, "bsdunzip");
-
+ std::cout << "C++ toimii myös!!!\n";
if (isatty(STDOUT_FILENO))
tty = 1;
@@ -1283,5 +1293,5 @@ main(int argc, char *argv[])
unzip(zipfile);
- exit(EXIT_SUCCESS);
+ exit(0);
}