summaryrefslogtreecommitdiff
path: root/genisoimage/exclude.c
diff options
context:
space:
mode:
authorIgor Pashev <pashev.igor@gmail.com>2012-12-31 05:04:42 +0400
committerIgor Pashev <pashev.igor@gmail.com>2012-12-31 05:04:42 +0400
commit71dc8760ff4de5f365330d1bc571d934deb54af9 (patch)
tree7346d42a282562a3937d82307012b5857d642ce6 /genisoimage/exclude.c
downloadcdrkit-71dc8760ff4de5f365330d1bc571d934deb54af9.tar.gz
Imported Upstream version 1.1.11upstream/1.1.11upstream
Diffstat (limited to 'genisoimage/exclude.c')
-rw-r--r--genisoimage/exclude.c78
1 files changed, 78 insertions, 0 deletions
diff --git a/genisoimage/exclude.c b/genisoimage/exclude.c
new file mode 100644
index 0000000..759bf35
--- /dev/null
+++ b/genisoimage/exclude.c
@@ -0,0 +1,78 @@
+/*
+ * This file has been modified for the cdrkit suite.
+ *
+ * The behaviour and appearence of the program code below can differ to a major
+ * extent from the version distributed by the original author(s).
+ *
+ * For details, see Changelog file distributed with the cdrkit package. If you
+ * received this file from another source then ask the distributing person for
+ * a log of modifications.
+ *
+ */
+
+/* @(#)exclude.c 1.9 04/03/04 joerg */
+/*
+ * 9-Dec-93 R.-D. Marzusch, marzusch@odiehh.hanse.de:
+ * added 'exclude' option (-x) to specify pathnames NOT to be included in
+ * CD image.
+ */
+
+#include <mconfig.h>
+#include <stdio.h>
+#include <stdxlib.h>
+#include <strdefs.h>
+#include <standard.h>
+#include <schily.h>
+
+
+/* this allows for 1000 entries to be excluded ... */
+#define MAXEXCL 1000
+
+static char *excl[MAXEXCL];
+
+void exclude(char *fn);
+int is_excluded(char *fn);
+
+
+void
+exclude(char *fn)
+{
+ register int i;
+
+ for (i = 0; excl[i] && i < MAXEXCL; i++)
+ ;
+
+ if (i == MAXEXCL) {
+ fprintf(stderr,
+ "Can't exclude '%s' - too many entries in table\n",
+ fn);
+ return;
+ }
+ excl[i] = (char *) malloc(strlen(fn) + 1);
+ if (excl[i] == NULL) {
+#ifdef USE_LIBSCHILY
+ errmsg("Can't allocate memory for excluded filename\n");
+#else
+ fprintf(stderr,
+ "Can't allocate memory for excluded filename\n");
+#endif
+ return;
+ }
+ strcpy(excl[i], fn);
+}
+
+int
+is_excluded(char *fn)
+{
+ register int i;
+
+ /*
+ * very dumb search method ...
+ */
+ for (i = 0; excl[i] && i < MAXEXCL; i++) {
+ if (strcmp(excl[i], fn) == 0) {
+ return (1); /* found -> excluded filenmae */
+ }
+ }
+ return (0); /* not found -> not excluded */
+}