iconv-zipinfo_c 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. $OpenBSD: iconv-zipinfo_c,v 1.1 2015/05/11 21:19:23 czarkoff Exp $
  2. --- zipinfo.c.orig Sun Feb 8 18:04:30 2009
  3. +++ zipinfo.c Sat May 9 13:31:20 2015
  4. @@ -457,6 +457,10 @@ int zi_opts(__G__ pargc, pargv)
  5. int tflag_slm=TRUE, tflag_2v=FALSE;
  6. int explicit_h=FALSE, explicit_t=FALSE;
  7. +#ifdef UNIX
  8. + extern char OEM_CP[MAX_CP_NAME];
  9. + extern char ISO_CP[MAX_CP_NAME];
  10. +#endif
  11. #ifdef MACOS
  12. uO.lflag = LFLAG; /* reset default on each call */
  13. @@ -501,6 +505,35 @@ int zi_opts(__G__ pargc, pargv)
  14. uO.lflag = 0;
  15. }
  16. break;
  17. +#ifdef UNIX
  18. + case ('I'):
  19. + if (negative) {
  20. + Info(slide, 0x401, ((char *)slide,
  21. + "error: encodings can't be negated"));
  22. + return(PK_PARAM);
  23. + } else {
  24. + if(*s) { /* Handle the -Icharset case */
  25. + /* Assume that charsets can't start with a dash to spot arguments misuse */
  26. + if(*s == '-') {
  27. + Info(slide, 0x401, ((char *)slide,
  28. + "error: a valid character encoding should follow the -I argument"));
  29. + return(PK_PARAM);
  30. + }
  31. + strncpy(ISO_CP, s, sizeof(ISO_CP));
  32. + } else { /* -I charset */
  33. + ++argv;
  34. + if(!(--argc > 0 && *argv != NULL && **argv != '-')) {
  35. + Info(slide, 0x401, ((char *)slide,
  36. + "error: a valid character encoding should follow the -I argument"));
  37. + return(PK_PARAM);
  38. + }
  39. + s = *argv;
  40. + strncpy(ISO_CP, s, sizeof(ISO_CP));
  41. + }
  42. + while(*(++s)); /* No params straight after charset name */
  43. + }
  44. + break;
  45. +#endif /* ?UNIX */
  46. case 'l': /* longer form of "ls -l" type listing */
  47. if (negative)
  48. uO.lflag = -2, negative = 0;
  49. @@ -521,6 +554,35 @@ int zi_opts(__G__ pargc, pargv)
  50. G.M_flag = TRUE;
  51. break;
  52. #endif
  53. +#ifdef UNIX
  54. + case ('O'):
  55. + if (negative) {
  56. + Info(slide, 0x401, ((char *)slide,
  57. + "error: encodings can't be negated"));
  58. + return(PK_PARAM);
  59. + } else {
  60. + if(*s) { /* Handle the -Ocharset case */
  61. + /* Assume that charsets can't start with a dash to spot arguments misuse */
  62. + if(*s == '-') {
  63. + Info(slide, 0x401, ((char *)slide,
  64. + "error: a valid character encoding should follow the -I argument"));
  65. + return(PK_PARAM);
  66. + }
  67. + strncpy(OEM_CP, s, sizeof(OEM_CP));
  68. + } else { /* -O charset */
  69. + ++argv;
  70. + if(!(--argc > 0 && *argv != NULL && **argv != '-')) {
  71. + Info(slide, 0x401, ((char *)slide,
  72. + "error: a valid character encoding should follow the -O argument"));
  73. + return(PK_PARAM);
  74. + }
  75. + s = *argv;
  76. + strncpy(OEM_CP, s, sizeof(OEM_CP));
  77. + }
  78. + while(*(++s)); /* No params straight after charset name */
  79. + }
  80. + break;
  81. +#endif /* ?UNIX */
  82. case 's': /* default: shorter "ls -l" type listing */
  83. if (negative)
  84. uO.lflag = -2, negative = 0;