]> gitweb.hhaalo.de Git - discspan-java.git/commitdiff
add: basic parameter read incomplete
authorBastian Dehn <hhaalo@arcor.de>
Thu, 3 Feb 2022 08:48:45 +0000 (09:48 +0100)
committerBastian Dehn <hhaalo@arcor.de>
Thu, 3 Feb 2022 08:48:45 +0000 (09:48 +0100)
CMakeLists.txt
src/de/hhaalo/discspan.java [new file with mode: 0644]
src/de/hhaalo/parameter.java [new file with mode: 0644]
src/manifest.mf [new file with mode: 0644]

index 2c213f9a9da5f9135cd01fdcc1b13ace2c0b227a..49864cd181c486f6501245157e0ee115be340fa8 100644 (file)
@@ -1,8 +1,14 @@
 cmake_minimum_required(VERSION 3.18.4)
 
-project("discspan-java")
-
+project("discspan")
 find_package(Java REQUIRED)
 include(UseJava)
 
-add_jar(discspan src/discspan.java)
+set(SRC_PREFIX "src/de/hhaalo")
+set(SRC_FILES
+       "${SRC_PREFIX}/discspan.java"
+       "${SRC_PREFIX}/parameter.java")
+
+add_jar(discspan "${SRC_FILES}"
+       INCLUDE_JARS "/usr/share/java/gnu-getopt.jar"
+       MANIFEST "src/manifest.mf")
diff --git a/src/de/hhaalo/discspan.java b/src/de/hhaalo/discspan.java
new file mode 100644 (file)
index 0000000..cabb451
--- /dev/null
@@ -0,0 +1,8 @@
+public class discspan
+{
+       public static void main(String[] args)
+       {
+               System.out.println("Hello World!");
+               parameter param = new parameter(args);
+       }
+}
diff --git a/src/de/hhaalo/parameter.java b/src/de/hhaalo/parameter.java
new file mode 100644 (file)
index 0000000..7d4218a
--- /dev/null
@@ -0,0 +1,58 @@
+import gnu.getopt.Getopt;
+
+public class parameter
+{
+       String _input = "";
+       String _output = "";
+       long _split = 0;
+
+       public parameter(String argv[])
+       {
+               final Long bluray = Long.parseUnsignedLong("24159191040");
+               final Long dvd9 = Long.parseUnsignedLong("8500000000");
+               final Long dvd5 = Long.parseUnsignedLong("4700000000");
+               final Long cd = Long.parseUnsignedLong("734003200");
+
+               Getopt g = new Getopt("discspan", argv, ":59bcf:hi:o:v");
+
+               int c = 0;
+               while ((c = g.getopt()) != -1) {
+                       switch (c) {
+                       case 'i':
+                               _input = g.getOptarg();
+                               break;
+                       case 'o':
+                               _output = g.getOptarg();
+                               break;
+                       case '5':
+                               _split = dvd5;
+                               break;
+                       case '9':
+                               _split = dvd9;
+                               break;
+                       case 'b':
+                               _split = bluray;
+                               break;
+                       case 'c':
+                               _split = cd;
+                               break;
+                       case 'f':
+                               _split = Long.parseUnsignedLong(g.getOptarg());
+                               break;
+                       case 'h':
+                               //show_version();
+                               //useage();
+                               System.out.println("help");
+                               System.exit(0);
+                               break;
+                       case 'v':
+                               //show_version();
+                               System.exit(0);
+                               break;
+                       default:
+                               System.out.println("WARNING: " + g.getopt() +  " unknown option");
+                               break;
+                       }
+               }
+       }
+}
diff --git a/src/manifest.mf b/src/manifest.mf
new file mode 100644 (file)
index 0000000..619f0c5
--- /dev/null
@@ -0,0 +1,2 @@
+Manifest-version: 1.0
+Main-Class: discspan