]> git.saurik.com Git - wxWidgets.git/blob - utils/Install/packzip/apihelp.c
Added Net library to contrib
[wxWidgets.git] / utils / Install / packzip / apihelp.c
1 /* apihelp.c */
2
3 #ifdef API_DOC
4
5 #define UNZIP_INTERNAL
6 #include "unzip.h"
7 #include "version.h"
8
9
10 APIDocStruct APIDoc[] = {
11 {
12 "UZPVERSION" , "UzpVersion" ,
13 "UzpVer *UzpVersion(void);",
14 "Get version numbers of the API and the underlying UnZip code.\n\n"
15 "\t\tThis is used for comparing the version numbers of the run-time\n"
16 "\t\tDLL code with those expected from the unzip.h at compile time.\n"
17 "\t\tIf the version numbers do not match, there may be compatibility\n"
18 "\t\tproblems with further use of the DLL.\n\n"
19 " Example:\t/* Check the major version number of the DLL code. */\n"
20 "\t\tUzpVer *pVersion;\n"
21 "\t\tpVersion = UzpVersion();\n"
22 "\t\tif (pVersion->unzip.major != UZ_MAJORVER)\n"
23 "\t\t fprintf(stderr, \"error: using wrong version of DLL\\n\");\n\n"
24 "\t\tSee unzip.h for details and unzipstb.c for an example.\n"
25 },
26
27 {
28 "UZPMAIN" , "UzpMain" ,
29 "int UzpMain(int argc, char *argv[]);",
30 "Provide a direct entry point to the command line interface.\n\n"
31 "\t\tThis is used by the UnZip stub but you can use it in your\n"
32 "\t\town program as well. Output is sent to stdout.\n"
33 "\t\t0 on return indicates success.\n\n"
34 " Example:\t/* Extract 'test.zip' silently, junking paths. */\n"
35 "\t\tchar *argv[] = { \"-q\", \"-j\", \"test.zip\" };\n"
36 "\t\tint argc = 3;\n"
37 "\t\tif (UzpMain(argc,argv))\n"
38 "\t\t printf(\"error: unzip failed\\n\");\n\n"
39 "\t\tSee unzip.h for details.\n"
40 },
41
42 {
43 "UZPALTMAIN" , "UzpAltMain" ,
44 "int UzpAltMain(int argc, char *argv[], UzpInit *init);",
45 "Provide a direct entry point to the command line interface,\n"
46 "optionally installing replacement I/O handler functions.\n\n"
47 "\t\tAs with UzpMain(), output is sent to stdout by default.\n"
48 "\t\t`InputFn *inputfn' is not yet implemented. 0 on return\n"
49 "\t\tindicates success.\n\n"
50 " Example:\t/* Replace normal output and `more' functions. */\n"
51 "\t\tchar *argv[] = { \"-q\", \"-j\", \"test.zip\" };\n"
52 "\t\tint argc = 3;\n"
53 "\t\tUzpInit init = { 16, MyMessageFn, NULL, MyPauseFn };\n"
54 "\t\tif (UzpAltMain(argc,argv,&init))\n"
55 "\t\t printf(\"error: unzip failed\\n\");\n\n"
56 "\t\tSee unzip.h for details.\n"
57 },
58
59 {
60 "UZPUNZIPTOMEMORY", "UzpUnzipToMemory",
61 "int UzpUnzipToMemory(char *zip, char *file, UzpBuffer *retstr);",
62 "Pass the name of the zip file and the name of the file\n"
63 "\t\tyou wish to extract. UzpUnzipToMemory will create a\n"
64 "\t\tbuffer and return it in *retstr; 0 on return indicates\n"
65 "\t\tfailure.\n\n"
66 "\t\tSee unzip.h for details.\n"
67 },
68
69 {
70 "UZPFILETREE", "UzpFileTree",
71 "int UzpFileTree(char *name, cbList(callBack),\n"
72 "\t\t\tchar *cpInclude[], char *cpExclude[]);",
73 "Pass the name of the zip file, a callback function, an\n"
74 "\t\tinclude and exclude file list. UzpFileTree calls the\n"
75 "\t\tcallback for each valid file found in the zip file.\n"
76 "\t\t0 on return indicates failure.\n\n"
77 "\t\tSee unzip.h for details.\n"
78 },
79
80 { 0 }
81 };
82
83
84 static int function_help OF((__GPRO__ APIDocStruct *doc, char *fname));
85
86
87
88 static int function_help(__G__ doc, fname)
89 __GDEF
90 APIDocStruct *doc;
91 char *fname;
92 {
93 strcpy(slide, fname);
94 /* strupr(slide); non-standard */
95 while (doc->compare && STRNICMP(doc->compare,slide,strlen(fname)))
96 doc++;
97 if (!doc->compare)
98 return 0;
99 else
100 Info(slide, 0, ((char *)slide,
101 " Function:\t%s\n\n Syntax:\t%s\n\n Purpose:\t%s",
102 doc->function, doc->syntax, doc->purpose));
103
104 return 1;
105 }
106
107
108
109 void APIhelp(__G__ argc, argv)
110 __GDEF
111 int argc;
112 char **argv;
113 {
114 if (argc > 1) {
115 struct APIDocStruct *doc;
116
117 if (function_help(__G__ APIDoc, argv[1]))
118 return;
119 #ifdef SYSTEM_API_DETAILS
120 if (function_help(__G__ SYSTEM_API_DETAILS, argv[1]))
121 return;
122 #endif
123 Info(slide, 0, ((char *)slide,
124 "%s is not a documented command.\n\n\a", argv[1]));
125 }
126
127 Info(slide, 0, ((char *)slide, "\
128 This API provides a number of external C and REXX functions for handling\n\
129 zipfiles in OS/2. Programmers are encouraged to expand this API.\n\
130 \n\
131 C functions: -- See unzip.h for details\n\
132 UzpVer *UzpVersion(void);\n\
133 int UzpMain(int argc, char *argv[]);\n\
134 int UzpAltMain(int argc, char *argv[], UzpInit *init);\n\
135 int UzpUnzipToMemory(char *zip, char *file, UzpBuffer *retstr);\n\
136 int UzpFileTree(char *name, cbList(callBack),\n\
137 char *cpInclude[], char *cpExclude[]);\n\n"));
138
139 #ifdef SYSTEM_API_BRIEF
140 Info(slide, 0, ((char *)slide, SYSTEM_API_BRIEF));
141 #endif
142
143 Info(slide, 0, ((char *)slide,
144 "\nFor more information, type 'unzip -A <function-name>'\n"));
145 }
146
147 #endif /* API_DOC */