home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 9 Archive / 09-Archive.zip / unzip52.zip / apihelp.c < prev    next >
C/C++ Source or Header  |  1996-04-27  |  3KB  |  111 lines

  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.         "UZPMAIN"  , "UzpMain"  ,
  13.         "int UzpMain(int argc, char *argv[]);",
  14.         "Provide a direct entry point to the command line interface.\n\n"
  15.         "\t\tThis is used by the UnZip stub but you can use it in your\n"
  16.         "\t\town program as well.  Output is sent to STDOUT.\n"
  17.         "\t\t0 on return indicates success.\n\n"
  18.         "  Example:\t/* Extract 'test.zip' silently, junking paths. */\n"
  19.         "\t\tchar *argv[] = { \"-q\", \"-j\", \"test.zip\" };\n"
  20.         "\t\tint argc = 3;\n"
  21.         "\t\tif (UzpUnZip(argc,argv))\n"
  22.         "\t\t  printf(\"error: unzip failed\\n\");\n\n"
  23.         "\t\tSee unzipapi.h for details.\n"
  24.     },
  25.   
  26.     {
  27.         "UZPUNZIPTOMEMORY", "UzpUnzipToMemory",
  28.         "int UzpUnzipToMemory(char *zip, char *file, UzpBuffer *retstr);",
  29.         "Pass the name of the zip file and the name of the file\n"
  30.         "\t\tyou wish to extract.  UzpUnzipToMemory will create a\n"
  31.         "\t\tbuffer and return it in *retstr;  0 on return indicates\n"
  32.         "\t\tfailure.\n\n"
  33.         "\t\tSee unzipapi.h for details.\n"
  34.     },
  35.   
  36.     {
  37.         "UZPFILETREE", "UzpFileTree",
  38.         "int UzpFileTree(char *name, cbList(callBack),\n"
  39.         "\t\t\tchar *cpInclude[], char *cpExclude[]);",
  40.         "Pass the name of the zip file, a callback function, an\n"
  41.         "\t\tinclude and exclude file list. UzpUnzipToMemory calls\n"
  42.         "\t\tthe callback for each valid file found in the zip file.\n"
  43.         "\t\t0 on return indicates failure.\n\n"
  44.         "\t\tSee unzipapi.h for details.\n"
  45.     },
  46.   
  47.     { 0 }
  48. };
  49.  
  50.  
  51.  
  52. int function_help(__G__ doc, fname)
  53.     __GDEF
  54.     APIDocStruct *doc;
  55.     char *fname;
  56. {
  57.     strcpy(slide, fname);
  58.     strupr(slide);
  59.     while (doc->compare && strcmp(doc->compare,slide))
  60.         doc++;
  61.     if (!doc->compare)
  62.         return 0;
  63.     else
  64.         Info(slide, 0, ((char *)slide,
  65.           "  Function:\t%s\n\n  Syntax:\t%s\n\n  Purpose:\t%s",
  66.           doc->function, doc->syntax, doc->purpose));
  67.  
  68.     return 1;
  69. }  
  70.  
  71.  
  72.  
  73. void APIhelp(__G__ argc, argv)
  74.     __GDEF
  75.     int argc;
  76.     char **argv;
  77. {
  78.     if (argc > 1) {
  79.         struct APIDocStruct *doc;
  80.  
  81.         if (function_help(__G__ APIDoc, argv[1]))
  82.             return;
  83. #ifdef SYSTEM_API_DETAILS
  84.         if (function_help(__G__ SYSTEM_API_DETAILS, argv[1]))
  85.             return;
  86. #endif
  87.         Info(slide, 0, ((char *)slide,
  88.           "%s is not a documented command.\n\n",argv[1]));
  89.     }
  90.  
  91.     Info(slide, 0, ((char *)slide,"\
  92. This API provides a number of external C and REXX functions for handling\n\
  93. zipfiles in OS/2.  Programmers are encouraged to expand this API.\n\
  94. \n\
  95. C functions: -- See unzipapi.h for details\n\
  96.   int UzpMain(int argc, char *argv[]);\n\
  97.   int UzpAltMain(int argc, char *argv[], struct _UzpInit *UzpInit);\n\
  98.   int UzpUnzipToMemory(char *zip, char *file, UzpBuffer *retstr);\n\
  99.   int UzpFileTree(char *name, cbList(callBack),\n\
  100.           char *cpInclude[], char *cpExclude[]);\n\n"));
  101.  
  102. #ifdef SYSTEM_API_BRIEF
  103.     Info(slide, 0, ((char *)slide, SYSTEM_API_BRIEF));
  104. #endif
  105.  
  106.     Info(slide, 0, ((char *)slide,
  107.       "\nFor more information, type 'unzip -A <function-name>'"));
  108. }
  109.  
  110. #endif /* API_DOC */
  111.