sxunzip.c 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. /*
  2. Copyright (c) 1990-2001 Info-ZIP. All rights reserved.
  3. See the accompanying file LICENSE, version 2000-Apr-09 or later
  4. (the contents of which are also included in unzip.h) for terms of use.
  5. If, for some reason, all these files are missing, the Info-ZIP license
  6. also may be found at: ftp://ftp.info-zip.org/pub/infozip/license.html
  7. */
  8. /*****************************************************************************/
  9. /* Includes */
  10. /*****************************************************************************/
  11. #include <string.h>
  12. #include "unzvers.h"
  13. #include <stdio.h>
  14. #ifdef USE_SIOUX
  15. # include <sioux.h>
  16. # include <signal.h>
  17. # include <stdlib.h>
  18. # include <console.h>
  19. #endif /* USE_SIOUX */
  20. /*****************************************************************************/
  21. /* Global Vars */
  22. /*****************************************************************************/
  23. char fileList[256];
  24. /*****************************************************************************/
  25. /* Prototypes */
  26. /*****************************************************************************/
  27. int UzpMain(int argc,char **argv);
  28. char *GetUnZipLocalVersion(void);
  29. char *GetUnZipInfoVersions(void);
  30. int macgetch(void);
  31. void UserStop(void);
  32. /*****************************************************************************/
  33. /* Functions */
  34. /*****************************************************************************/
  35. #ifndef MacStaticLib
  36. #ifndef MACUNZIP_STANDALONE
  37. /*
  38. Program execution starts here with Metrowerks SIOUX-Console */
  39. int main(int argc,char **argv)
  40. {
  41. int return_code;
  42. SIOUXSettings.asktosaveonclose = FALSE;
  43. SIOUXSettings.showstatusline = TRUE;
  44. SIOUXSettings.columns = 100;
  45. SIOUXSettings.rows = 40;
  46. argc = ccommand(&argv);
  47. return_code = UzpMain(argc,argv);
  48. printf("\n\n Finish %d",return_code);
  49. return return_code;
  50. }
  51. int macgetch(void)
  52. {
  53. WindowPtr whichWindow;
  54. EventRecord theEvent;
  55. char c; /* one-byte buffer for read() to use */
  56. do {
  57. SystemTask();
  58. if (!GetNextEvent(everyEvent, &theEvent))
  59. theEvent.what = nullEvent;
  60. else {
  61. switch (theEvent.what) {
  62. case keyDown:
  63. c = theEvent.message & charCodeMask;
  64. break;
  65. case mouseDown:
  66. if (FindWindow(theEvent.where, &whichWindow) ==
  67. inSysWindow)
  68. SystemClick(&theEvent, whichWindow);
  69. break;
  70. case updateEvt:
  71. break;
  72. }
  73. }
  74. } while (theEvent.what != keyDown);
  75. printf("*");
  76. fflush(stdout);
  77. return (int)c;
  78. }
  79. /* SIOUX needs no extra event handling */
  80. void UserStop(void)
  81. {
  82. }
  83. #endif /* #ifndef MACUNZIP_STANDALONE */
  84. #endif /* #ifndef MacStaticLib */
  85. char *GetUnZipLocalVersion(void)
  86. {
  87. static char UnZipVersionLocal[50];
  88. memset(UnZipVersionLocal,0,sizeof(UnZipVersionLocal));
  89. sprintf(UnZipVersionLocal, "[%s %s]", __DATE__, __TIME__);
  90. return UnZipVersionLocal;
  91. }
  92. char *GetUnZipInfoVersions(void)
  93. {
  94. static char UnzipVersion[200];
  95. memset(UnzipVersion,0,sizeof(UnzipVersion));
  96. sprintf(UnzipVersion, "Unzip Module\n%d.%d%d%s of %s", UZ_MAJORVER,
  97. UZ_MINORVER, UZ_PATCHLEVEL, UZ_BETALEVEL, UZ_VERSION_DATE);
  98. return UnzipVersion;
  99. }