View | Details | Raw Unified | Return to bug 208994 | Differences between
and this patch

Collapse All | Expand All

(-)/usr/ports/archivers/paq/files/patch-zpsfx.cpp (+77 lines)
Line 0 Link Here
1
--- zpsfx.cpp.orig	2012-04-09 04:01:23.000000000 -0400
2
+++ zpsfx.cpp	2012-04-09 04:02:25.000000000 -0400
3
@@ -16,19 +16,38 @@
4
 the executable smaller. -DNDEBUG turns off run time checks.
5
 To convert a ZPAQ archive to a self extracting archive:
6
 
7
+On Windows:
8
+
9
   copy/b zpsfx.exe+zpsfx.tag+archive.zpaq archive.exe
10
 
11
+On FreeBSD(the choice of archive name is discretionary): 
12
+
13
+  cat zpsfx zpsfx.tag archive.zpaq > archive.sfx
14
+
15
 zpsfx.tag is a 13 byte file used to mark the start of the compressed data
16
 that is appended. Alternatively, zpaq with the "t" modifier will append
17
 the same tag ("a" appends).
18
 
19
+On Windows:
20
+
21
   copy zpsfx.exe archive.exe
22
   zpaq ta archive.exe files...
23
 
24
+On FreeBSD:
25
+
26
+  cp zpsfx archive.sfx
27
+  zpaq ta archive.sfx files...
28
+
29
 To extract:
30
 
31
+On Windows:
32
+
33
   archive.exe
34
 
35
+On FreeBSD:
36
+
37
+  archive.sfx
38
+
39
 The program reads itself and decompresses the appended archive.
40
 You must enter the .exe extension as shown. If the file is not in
41
 the current folder then you need to specify the path. The PATH environment
42
@@ -44,7 +63,11 @@
43
 #include <stdio.h>
44
 #include <stdlib.h>
45
 #include <string>
46
+#ifdef unix
47
+#include <sys/stat.h>
48
+#else
49
 #include <windows.h>
50
+#endif
51
 
52
 // An error handler is required as shown in this example. libzpaq will
53
 // call it with an English language message in case of a fatal error.
54
@@ -96,7 +119,11 @@
55
 
56
 // Return '/' in Linux or '\' in Windows
57
 char slash() {
58
+#ifdef unix
59
+  return '/';
60
+#else
61
   return '\\';
62
+#endif
63
 }
64
 
65
 // Create directories as needed. For example if path="/tmp/foo/bar"
66
@@ -106,7 +133,11 @@
67
   for (int i=0; i<path.size(); ++i) {
68
     if (path[i]=='\\' || path[i]=='/') {
69
       path[i]=0;
70
+#ifdef unix
71
+      int ok=!mkdir(path.c_str(), 0777);
72
+#else
73
       int ok=CreateDirectory(path.c_str(), 0);
74
+#endif
75
       path[i]=slash();
76
     }
77
   }
(-)/usr/ports/archivers/paq/files/patch_zpsfx.cpp (-77 lines)
Lines 1-77 Link Here
1
--- zpsfx.cpp.orig	2012-04-09 04:01:23.000000000 -0400
2
+++ zpsfx.cpp	2012-04-09 04:02:25.000000000 -0400
3
@@ -16,19 +16,38 @@
4
 the executable smaller. -DNDEBUG turns off run time checks.
5
 To convert a ZPAQ archive to a self extracting archive:
6
 
7
+On Windows:
8
+
9
   copy/b zpsfx.exe+zpsfx.tag+archive.zpaq archive.exe
10
 
11
+On FreeBSD(the choice of archive name is discretionary): 
12
+
13
+  cat zpsfx zpsfx.tag archive.zpaq > archive.sfx
14
+
15
 zpsfx.tag is a 13 byte file used to mark the start of the compressed data
16
 that is appended. Alternatively, zpaq with the "t" modifier will append
17
 the same tag ("a" appends).
18
 
19
+On Windows:
20
+
21
   copy zpsfx.exe archive.exe
22
   zpaq ta archive.exe files...
23
 
24
+On FreeBSD:
25
+
26
+  cp zpsfx archive.sfx
27
+  zpaq ta archive.sfx files...
28
+
29
 To extract:
30
 
31
+On Windows:
32
+
33
   archive.exe
34
 
35
+On FreeBSD:
36
+
37
+  archive.sfx
38
+
39
 The program reads itself and decompresses the appended archive.
40
 You must enter the .exe extension as shown. If the file is not in
41
 the current folder then you need to specify the path. The PATH environment
42
@@ -44,7 +63,11 @@
43
 #include <stdio.h>
44
 #include <stdlib.h>
45
 #include <string>
46
+#ifdef unix
47
+#include <sys/stat.h>
48
+#else
49
 #include <windows.h>
50
+#endif
51
 
52
 // An error handler is required as shown in this example. libzpaq will
53
 // call it with an English language message in case of a fatal error.
54
@@ -96,7 +119,11 @@
55
 
56
 // Return '/' in Linux or '\' in Windows
57
 char slash() {
58
+#ifdef unix
59
+  return '/';
60
+#else
61
   return '\\';
62
+#endif
63
 }
64
 
65
 // Create directories as needed. For example if path="/tmp/foo/bar"
66
@@ -106,7 +133,11 @@
67
   for (int i=0; i<path.size(); ++i) {
68
     if (path[i]=='\\' || path[i]=='/') {
69
       path[i]=0;
70
+#ifdef unix
71
+      int ok=!mkdir(path.c_str(), 0777);
72
+#else
73
       int ok=CreateDirectory(path.c_str(), 0);
74
+#endif
75
       path[i]=slash();
76
     }
77
   }

Return to bug 208994