~ubuntu-branches/ubuntu/trusty/httrack/trusty

« back to all changes in this revision

Viewing changes to src/htsjava.c

  • Committer: Package Import Robot
  • Author(s): Xavier Roche
  • Date: 2013-05-17 21:18:50 UTC
  • mfrom: (5.2.33 sid)
  • Revision ID: package-import@ubuntu.com-20130517211850-604ltzlucy7th6ai
Tags: 3.47.12-1
Updated to 3.47.12 (3.47-12)
closes:#708707

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
along with this program; if not, write to the Free Software
18
18
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
19
19
 
20
 
 
21
20
Important notes:
22
21
 
23
22
- We hereby ask people using this source NOT to use it in purpose of grabbing
24
23
emails addresses, or collecting any other private information on persons.
25
24
This would disgrace our work, and spoil the many hours we spent on it.
26
25
 
27
 
 
28
26
Please visit our Website: http://www.httrack.com
29
27
*/
30
28
 
31
 
 
32
29
/* ------------------------------------------------------------ */
33
30
/* File: Java classes parser                                    */
34
31
/* Author: Yann Philippot                                       */
35
32
/* ------------------------------------------------------------ */
36
33
 
37
 
 
38
34
/* Version: Oct/2000 */
39
35
/* Fixed: problems with class structure (10/2000) */
40
36
 
69
65
#include "htsjava.h"
70
66
 
71
67
static int reverse_endian(void) {
72
 
        int endian = 1;
73
 
        return ( * ( (char*) &endian) == 1);
 
68
  int endian = 1;
 
69
 
 
70
  return (*((char *) &endian) == 1);
74
71
}
75
72
 
76
73
/* big/little endian swap */
78
75
#define hts_swap32(A) ( (( (hts_swap16(A)) & 0xFFFF)<<16) | (( (hts_swap16(A>>16)) & 0xFFFF)) )
79
76
 
80
77
/* Static definitions */
81
 
static RESP_STRUCT readtable(htsmoduleStruct* str,FILE *fp,RESP_STRUCT,int*);
82
 
static unsigned short int readshort(FILE *fp);
83
 
static int tris(httrackp *opt,char*);
84
 
static char * printname(char [1024],char [1024]);
 
78
static RESP_STRUCT readtable(htsmoduleStruct * str, FILE * fp, RESP_STRUCT,
 
79
                             int *);
 
80
static unsigned short int readshort(FILE * fp);
 
81
static int tris(httrackp * opt, char *);
 
82
static char *printname(char[1024], char[1024]);
85
83
 
86
84
// ** HTS_xx sinon pas pris par VC++
87
85
#define HTS_CLASS  7
106
104
#define strncasecmp(a,b,n) strnicmp(a,b,n)
107
105
#endif
108
106
 
109
 
static int detect_mime(htsmoduleStruct* str) {
110
 
  const char* savename = str->filename;
 
107
static int detect_mime(htsmoduleStruct * str) {
 
108
  const char *savename = str->filename;
 
109
 
111
110
  if (savename) {
112
111
    int len = (int) strlen(savename);
113
 
    if (len > 6 && strcasecmp(savename + len - 6,".class") == 0) {
 
112
 
 
113
    if (len > 6 && strcasecmp(savename + len - 6, ".class") == 0) {
114
114
      return 1;
115
115
    }
116
116
  }
117
117
  return 0;
118
118
}
119
119
 
120
 
static int hts_detect_java(t_hts_callbackarg *carg, httrackp *opt,
121
 
                           htsmoduleStruct* str) 
122
 
{
 
120
static int hts_detect_java(t_hts_callbackarg * carg, httrackp * opt,
 
121
                           htsmoduleStruct * str) {
123
122
  /* Call parent functions if multiple callbacks are chained. */
124
123
  if (CALLBACKARG_PREV_FUN(carg, detect) != NULL) {
125
 
    if (CALLBACKARG_PREV_FUN(carg, detect)(CALLBACKARG_PREV_CARG(carg), opt, str)) {
126
 
      return 1;  /* Found before us, let them have the priority */
 
124
    if (CALLBACKARG_PREV_FUN(carg, detect)
 
125
        (CALLBACKARG_PREV_CARG(carg), opt, str)) {
 
126
      return 1;                 /* Found before us, let them have the priority */
127
127
    }
128
128
  }
129
129
 
130
130
  /* Check MIME */
131
131
  if (detect_mime(str)) {
132
 
    str->wrapper_name = libName;  /* Our ID */
133
 
    return 1; /* Known format, we take it */
 
132
    str->wrapper_name = libName;        /* Our ID */
 
133
    return 1;                   /* Known format, we take it */
134
134
  }
135
135
 
136
 
  return 0;   /* Unknown format */
 
136
  return 0;                     /* Unknown format */
137
137
}
138
138
 
139
 
static off_t fsize(const char* s) {
 
139
static off_t fsize(const char *s) {
140
140
  STRUCT_STAT st;
 
141
 
141
142
  if (STAT(s, &st) == 0 && S_ISREG(st.st_mode)) {
142
143
    return st.st_size;
143
144
  } else {
145
146
  }
146
147
}
147
148
 
148
 
static int hts_parse_java(t_hts_callbackarg *carg, httrackp *opt,
149
 
                          htsmoduleStruct* str)
150
 
{
 
149
static int hts_parse_java(t_hts_callbackarg * carg, httrackp * opt,
 
150
                          htsmoduleStruct * str) {
151
151
  /* The wrapper_name memebr has changed: not for us anymore */
152
152
  if (str->wrapper_name == NULL || strcmp(str->wrapper_name, libName) != 0) {
153
153
    /* Call parent functions if multiple callbacks are chained. */
154
154
    if (CALLBACKARG_PREV_FUN(carg, parse) != NULL) {
155
 
      return CALLBACKARG_PREV_FUN(carg, parse)(CALLBACKARG_PREV_CARG(carg), opt, str);
 
155
      return CALLBACKARG_PREV_FUN(carg, parse) (CALLBACKARG_PREV_CARG(carg),
 
156
                                                opt, str);
156
157
    }
157
 
    strcpy(str->err_msg, "unexpected error: bad wrapper_name and no previous wrapper");
158
 
    return 0;     /* Unexpected error */
 
158
    strcpy(str->err_msg,
 
159
           "unexpected error: bad wrapper_name and no previous wrapper");
 
160
    return 0;                   /* Unexpected error */
159
161
  } else {
160
162
    if (detect_mime(str)) {
161
163
 
164
166
      FILE *fpout;
165
167
      JAVA_HEADER header;
166
168
      RESP_STRUCT *tab;
167
 
      const char* file = str->filename;
 
169
      const char *file = str->filename;
168
170
 
169
171
      str->relativeToHtmlLink = 1;
170
172
 
171
173
#if JAVADEBUG
172
174
      printf("fopen\n");
173
175
#endif
174
 
      if ((fpout = FOPEN(fconv(catbuff, file), "r+b")) == NULL)
175
 
      {
 
176
      if ((fpout = FOPEN(fconv(catbuff, file), "r+b")) == NULL) {
176
177
        //fprintf(stderr, "Cannot open input file.\n");
177
 
        sprintf(str->err_msg,"Unable to open file %s",file);
178
 
        return 0;   // une erreur..
 
178
        sprintf(str->err_msg, "Unable to open file %s", file);
 
179
        return 0;               // une erreur..
179
180
      }
180
 
 
181
181
#if JAVADEBUG
182
182
      printf("fread\n");
183
183
#endif
184
184
      //if (fread(&header,1,sizeof(JAVA_HEADER),fpout) != sizeof(JAVA_HEADER)) {   // pas complet..
185
 
      if (fread(&header,1,10,fpout) != 10) {   // pas complet..
 
185
      if (fread(&header, 1, 10, fpout) != 10) { // pas complet..
186
186
        fclose(fpout);
187
 
        sprintf(str->err_msg,"File header too small (file len = "LLintP")",(LLint)fsize(file));
 
187
        sprintf(str->err_msg, "File header too small (file len = " LLintP ")",
 
188
                (LLint) fsize(file));
188
189
        return 0;
189
190
      }
190
 
 
191
191
#if JAVADEBUG
192
192
      printf("header\n");
193
193
#endif
194
 
      // tester en t�te
 
194
      // tester en tête
195
195
      if (reverse_endian()) {
196
196
        header.magic = hts_swap32(header.magic);
197
 
        header.count = hts_swap16(header.count); 
 
197
        header.count = hts_swap16(header.count);
198
198
      }
199
 
      if(header.magic!=0xCAFEBABE) {
200
 
        sprintf(str->err_msg,"non java file");
201
 
        if (fpout) { fclose(fpout); fpout=NULL; }
 
199
      if (header.magic != 0xCAFEBABE) {
 
200
        sprintf(str->err_msg, "non java file");
 
201
        if (fpout) {
 
202
          fclose(fpout);
 
203
          fpout = NULL;
 
204
        }
202
205
        return 0;
203
206
      }
204
207
 
205
 
      tab =(RESP_STRUCT*)calloc(header.count,sizeof(RESP_STRUCT));
 
208
      tab = (RESP_STRUCT *) calloc(header.count, sizeof(RESP_STRUCT));
206
209
      if (!tab) {
207
 
        sprintf(str->err_msg,"Unable to alloc %d bytes",(int)sizeof(RESP_STRUCT));
208
 
        if (fpout) { fclose(fpout); fpout=NULL; }
209
 
        return 0;    // erreur..
 
210
        sprintf(str->err_msg, "Unable to alloc %d bytes",
 
211
                (int) sizeof(RESP_STRUCT));
 
212
        if (fpout) {
 
213
          fclose(fpout);
 
214
          fpout = NULL;
 
215
        }
 
216
        return 0;               // erreur..
210
217
      }
211
 
 
212
218
#if JAVADEBUG
213
219
      printf("calchead\n");
214
220
#endif
215
221
      {
216
222
        int i;
217
223
 
218
 
        for (i = 1; i < header.count; i++) {
219
 
          int err=0;  // ++    
220
 
          tab[i]=readtable(str,fpout,tab[i],&err);
 
224
        for(i = 1; i < header.count; i++) {
 
225
          int err = 0;          // ++    
 
226
 
 
227
          tab[i] = readtable(str, fpout, tab[i], &err);
221
228
          if (!err) {
222
 
            if ((tab[i].type == HTS_LONG) ||(tab[i].type == HTS_DOUBLE)) i++;  //2 element si double ou float
223
 
          } else {    // ++ une erreur est survenue!
224
 
            if (strnotempty(str->err_msg)==0)
225
 
              strcpy(str->err_msg,"Internal readtable error");
 
229
            if ((tab[i].type == HTS_LONG) || (tab[i].type == HTS_DOUBLE))
 
230
              i++;              //2 element si double ou float
 
231
          } else {              // ++ une erreur est survenue!
 
232
            if (strnotempty(str->err_msg) == 0)
 
233
              strcpy(str->err_msg, "Internal readtable error");
226
234
            free(tab);
227
 
            if (fpout) { fclose(fpout); fpout=NULL; }
 
235
            if (fpout) {
 
236
              fclose(fpout);
 
237
              fpout = NULL;
 
238
            }
228
239
            return 0;
229
240
          }
230
241
        }
231
242
 
232
243
      }
233
244
 
234
 
 
235
245
#if JAVADEBUG
236
246
      printf("addfiles\n");
237
247
#endif
240
250
        unsigned int Class;
241
251
        unsigned int SClass;
242
252
        int i;
 
253
 
243
254
        //acess = readshort(fpout);
244
255
        Class = readshort(fpout);
245
256
        SClass = readshort(fpout);
246
257
 
247
 
        for (i = 1; i <header.count; i++) {
 
258
        for(i = 1; i < header.count; i++) {
248
259
 
249
260
          if (tab[i].type == HTS_CLASS) {
250
261
 
251
 
            if ((tab[i].index1<header.count) && (tab[i].index1>=0)) {
252
 
 
253
 
 
254
 
              if((tab[i].index1!=SClass) && (tab[i].index1!=Class) && (tab[tab[i].index1].name[0]!='[')) {
255
 
 
256
 
                if(!strstr(tab[tab[i].index1].name,"java/")) {
 
262
            if ((tab[i].index1 < header.count) && (tab[i].index1 >= 0)) {
 
263
 
 
264
              if ((tab[i].index1 != SClass) && (tab[i].index1 != Class)
 
265
                  && (tab[tab[i].index1].name[0] != '[')) {
 
266
 
 
267
                if (!strstr(tab[tab[i].index1].name, "java/")) {
257
268
                  char BIGSTK tempo[1024];
258
 
                  tempo[0]='\0';
259
 
 
260
 
                  sprintf(tempo,"%s.class",tab[tab[i].index1].name);
 
269
 
 
270
                  tempo[0] = '\0';
 
271
 
 
272
                  sprintf(tempo, "%s.class", tab[tab[i].index1].name);
261
273
#if JAVADEBUG
262
 
                  printf("add %s\n",tempo);
 
274
                  printf("add %s\n", tempo);
263
275
#endif
264
276
                  if (tab[tab[i].index1].file_position >= 0)
265
 
                    str->addLink(str,tempo);  /* tab[tab[i].index1].file_position */
 
277
                    str->addLink(str, tempo);   /* tab[tab[i].index1].file_position */
266
278
                }
267
279
 
268
280
              }
269
 
            } else { 
270
 
              i=header.count;  // exit 
 
281
            } else {
 
282
              i = header.count; // exit 
271
283
            }
272
284
          }
273
285
 
274
286
        }
275
287
      }
276
288
 
277
 
 
278
289
#if JAVADEBUG
279
290
      printf("end\n");
280
291
#endif
281
292
      free(tab);
282
 
      if (fpout) { fclose(fpout); fpout=NULL; }
 
293
      if (fpout) {
 
294
        fclose(fpout);
 
295
        fpout = NULL;
 
296
      }
283
297
      return 1;
284
298
 
285
299
    } else {
286
300
      strcpy(str->err_msg, "bad MIME type");
287
301
    }
288
302
  }
289
 
  return 0;   /* Error */
 
303
  return 0;                     /* Error */
290
304
}
291
305
 
292
306
/*
293
307
module entry point 
294
308
*/
295
 
EXTERNAL_FUNCTION int hts_plug(httrackp *opt, const char* argv);
296
 
EXTERNAL_FUNCTION int hts_plug(httrackp *opt, const char* argv) {
 
309
EXTERNAL_FUNCTION int hts_plug(httrackp * opt, const char *argv);
 
310
EXTERNAL_FUNCTION int hts_plug(httrackp * opt, const char *argv) {
297
311
  /* Plug callback functions */
298
312
  CHAIN_FUNCTION(opt, detect, hts_detect_java, NULL);
299
313
  CHAIN_FUNCTION(opt, parse, hts_parse_java, NULL);
300
314
 
301
 
  return 1;  /* success */
 
315
  return 1;                     /* success */
302
316
}
303
317
 
304
318
// error: !=0 si erreur fatale
305
 
static  RESP_STRUCT readtable(htsmoduleStruct* str, 
306
 
                              FILE *fp, RESP_STRUCT trans, int* error)
307
 
{
308
 
        char rname[1024];
 
319
static RESP_STRUCT readtable(htsmoduleStruct * str, FILE * fp,
 
320
                             RESP_STRUCT trans, int *error) {
 
321
  char rname[1024];
309
322
  unsigned short int length;
310
323
  int j;
311
 
  *error = 0;  // pas d'erreur
312
 
  trans.file_position=-1;
313
 
  trans.type = (int)(unsigned char)fgetc(fp);
 
324
 
 
325
  *error = 0;                   // pas d'erreur
 
326
  trans.file_position = -1;
 
327
  trans.type = (int) (unsigned char) fgetc(fp);
314
328
  switch (trans.type) {
315
329
  case HTS_CLASS:
316
 
    strcpy(trans.name,"Class");
 
330
    strcpy(trans.name, "Class");
317
331
    trans.index1 = readshort(fp);
318
332
    break;
319
 
    
 
333
 
320
334
  case HTS_FIELDREF:
321
 
    strcpy(trans.name,"Field Reference");
 
335
    strcpy(trans.name, "Field Reference");
322
336
    trans.index1 = readshort(fp);
323
337
    readshort(fp);
324
338
    break;
325
 
    
 
339
 
326
340
  case HTS_METHODREF:
327
 
    strcpy(trans.name,"Method Reference");
 
341
    strcpy(trans.name, "Method Reference");
328
342
    trans.index1 = readshort(fp);
329
343
    readshort(fp);
330
344
    break;
331
 
    
 
345
 
332
346
  case HTS_INTERFACE:
333
 
    strcpy(trans.name,"Interface Method Reference");
334
 
    trans.index1 =readshort(fp);
 
347
    strcpy(trans.name, "Interface Method Reference");
 
348
    trans.index1 = readshort(fp);
335
349
    readshort(fp);
336
350
    break;
337
351
  case HTS_NAMEANDTYPE:
338
 
    strcpy(trans.name,"Name and Type");
 
352
    strcpy(trans.name, "Name and Type");
339
353
    trans.index1 = readshort(fp);
340
354
    readshort(fp);
341
355
    break;
342
 
    
343
 
  case HTS_STRING:                // CONSTANT_String
344
 
    strcpy(trans.name,"String");
 
356
 
 
357
  case HTS_STRING:             // CONSTANT_String
 
358
    strcpy(trans.name, "String");
345
359
    trans.index1 = readshort(fp);
346
360
    break;
347
 
    
 
361
 
348
362
  case HTS_INTEGER:
349
 
    strcpy(trans.name,"Integer");
350
 
    for(j=0;j<4;j++) fgetc(fp);
 
363
    strcpy(trans.name, "Integer");
 
364
    for(j = 0; j < 4; j++)
 
365
      fgetc(fp);
351
366
    break;
352
 
    
 
367
 
353
368
  case HTS_FLOAT:
354
 
    strcpy(trans.name,"Float");
355
 
    for(j=0;j<4;j++) fgetc(fp);
 
369
    strcpy(trans.name, "Float");
 
370
    for(j = 0; j < 4; j++)
 
371
      fgetc(fp);
356
372
    break;
357
 
    
 
373
 
358
374
  case HTS_LONG:
359
 
    strcpy(trans.name,"Long");
360
 
    for(j=0;j<8;j++) fgetc(fp);
 
375
    strcpy(trans.name, "Long");
 
376
    for(j = 0; j < 8; j++)
 
377
      fgetc(fp);
361
378
    break;
362
379
  case HTS_DOUBLE:
363
 
    strcpy(trans.name,"Double");
364
 
    for(j=0;j<8;j++) fgetc(fp);
 
380
    strcpy(trans.name, "Double");
 
381
    for(j = 0; j < 8; j++)
 
382
      fgetc(fp);
365
383
    break;
366
 
    
 
384
 
367
385
  case HTS_ASCIZ:
368
386
  case HTS_UNICODE:
369
 
    
 
387
 
370
388
    if (trans.type == HTS_ASCIZ)
371
 
      strcpy(trans.name,"HTS_ASCIZ");
 
389
      strcpy(trans.name, "HTS_ASCIZ");
372
390
    else
373
 
      strcpy(trans.name,"HTS_UNICODE");
374
 
    
 
391
      strcpy(trans.name, "HTS_UNICODE");
 
392
 
375
393
    {
376
 
      char BIGSTK buffer[1024]; 
 
394
      char BIGSTK buffer[1024];
377
395
      char *p;
378
 
      
379
 
      p=&buffer[0];
 
396
 
 
397
      p = &buffer[0];
380
398
 
381
399
      //fflush(fp); 
382
 
      trans.file_position=ftell(fp);
 
400
      trans.file_position = ftell(fp);
383
401
      length = readshort(fp);
384
 
      if (length<HTS_URLMAXSIZE) {
 
402
      if (length < HTS_URLMAXSIZE) {
385
403
        // while ((length > 0) && (length<500)) {
386
 
        while (length > 0) {
387
 
          *p++ =fgetc(fp);
388
 
          
 
404
        while(length > 0) {
 
405
          *p++ = fgetc(fp);
 
406
 
389
407
          length--;
390
408
        }
391
 
        *p='\0';
392
 
        
 
409
        *p = '\0';
 
410
 
393
411
        //#if JDEBUG
394
412
        //      if(tris(buffer)==1) printf("%s\n ",buffer);
395
413
        //      if(tris(buffer)==2)  printf("%s\n ",printname(buffer));
396
414
        //#endif
397
 
                                if(tris(str->opt,buffer)==1)  str->addLink(str, buffer);       /* trans.file_position */
398
 
        else if(tris(str->opt,buffer)==2)  str->addLink(str, printname(rname,buffer));
 
415
        if (tris(str->opt, buffer) == 1)
 
416
          str->addLink(str, buffer);    /* trans.file_position */
 
417
        else if (tris(str->opt, buffer) == 2)
 
418
          str->addLink(str, printname(rname, buffer));
399
419
 
400
 
        strcpy(trans.name,buffer);
401
 
      } else {    // gros pb
402
 
        while ( (length > 0) && (!feof(fp))) {
 
420
        strcpy(trans.name, buffer);
 
421
      } else {                  // gros pb
 
422
        while((length > 0) && (!feof(fp))) {
403
423
          fgetc(fp);
404
424
          length--;
405
425
        }
406
426
        if (!feof(fp)) {
407
 
          trans.type=-1;
 
427
          trans.type = -1;
408
428
        } else {
409
 
          sprintf(str->err_msg,"Internal stucture error (ASCII)");
 
429
          sprintf(str->err_msg, "Internal stucture error (ASCII)");
410
430
          *error = 1;
411
431
        }
412
 
        return(trans);
 
432
        return (trans);
413
433
      }
414
434
    }
415
435
    break;
416
436
  default:
417
437
    // printf("Type inconnue\n");
418
 
    // on arr�te tout 
419
 
    sprintf(str->err_msg,"Internal structure unknown (type %d)",trans.type);
 
438
    // on arrête tout 
 
439
    sprintf(str->err_msg, "Internal structure unknown (type %d)", trans.type);
420
440
    *error = 1;
421
 
    return(trans);
 
441
    return (trans);
422
442
    break;
423
 
  }  
424
 
  return(trans);
 
443
  }
 
444
  return (trans);
425
445
}
426
446
 
427
 
 
428
 
static unsigned short int readshort(FILE *fp)
429
 
{
 
447
static unsigned short int readshort(FILE * fp) {
430
448
  unsigned short int valint;
431
 
  fread(&valint,sizeof(valint),1,fp);
 
449
 
 
450
  fread(&valint, sizeof(valint), 1, fp);
432
451
 
433
452
  if (reverse_endian())
434
453
    return hts_swap16(valint);
435
454
  else
436
455
    return valint;
437
 
  
 
456
 
438
457
}
439
458
 
440
 
static int tris(httrackp *opt,char * buffer)
441
 
{
442
 
        char catbuff[CATBUFF_SIZE];
 
459
static int tris(httrackp * opt, char *buffer) {
 
460
  char catbuff[CATBUFF_SIZE];
 
461
 
443
462
  //
444
463
  // Java
445
 
  if((buffer[0]=='[') && buffer[1]=='L' && (!strstr(buffer,"java/")) ) 
 
464
  if ((buffer[0] == '[') && buffer[1] == 'L' && (!strstr(buffer, "java/")))
446
465
    return 2;
447
 
  if (strstr(buffer,".gif") || strstr(buffer,".jpg") || strstr(buffer,".jpeg") || strstr(buffer,".au") ) 
 
466
  if (strstr(buffer, ".gif") || strstr(buffer, ".jpg")
 
467
      || strstr(buffer, ".jpeg") || strstr(buffer, ".au"))
448
468
    return 1;
449
469
  // Ajouts R.X: test type
450
470
  // Autres fichiers
451
471
  {
452
472
    char type[256];
453
 
    type[0]='\0';
454
 
    get_httptype(opt,type,buffer,0);
455
 
    if (strnotempty(type))     // type reconnu!
 
473
 
 
474
    type[0] = '\0';
 
475
    get_httptype(opt, type, buffer, 0);
 
476
    if (strnotempty(type))      // type reconnu!
456
477
      return 1;
457
478
    // ajout RX 05/2001
458
 
    else if (is_dyntype(get_ext(catbuff, buffer)))   // asp,cgi...
 
479
    else if (is_dyntype(get_ext(catbuff, buffer)))      // asp,cgi...
459
480
      return 1;
460
481
  }
461
482
  return 0;
462
483
}
463
484
 
464
 
static char * printname(char rname[1024], char name[1024])
465
 
{
 
485
static char *printname(char rname[1024], char name[1024]) {
466
486
  char *p;
467
487
  char *p1;
468
488
  int j;
469
 
  rname[0]='\0';
 
489
 
 
490
  rname[0] = '\0';
470
491
  //
471
 
 
472
 
  p=&name[0];
473
 
  
474
 
  if(*p!='[')  return "";
475
 
  p+=2;
 
492
 
 
493
  p = &name[0];
 
494
 
 
495
  if (*p != '[')
 
496
    return "";
 
497
  p += 2;
476
498
  //rname=(char*)calloct(strlen(name)+8,sizeof(char));
477
 
  p1=rname;
478
 
  for (j = 0; j < (int) strlen(name); j++,p++) {
479
 
    if (*p == '/') *p1='.'; 
480
 
    if (*p==';'){*p1='\0';
481
 
    strcat(rname,".class");
482
 
    return (rname);}
483
 
    else *p1=*p;
 
499
  p1 = rname;
 
500
  for(j = 0; j < (int) strlen(name); j++, p++) {
 
501
    if (*p == '/')
 
502
      *p1 = '.';
 
503
    if (*p == ';') {
 
504
      *p1 = '\0';
 
505
      strcat(rname, ".class");
 
506
      return (rname);
 
507
    } else
 
508
      *p1 = *p;
484
509
    p1++;
485
510
  }
486
 
  p1-=3;
487
 
  *p1='\0';
 
511
  p1 -= 3;
 
512
  *p1 = '\0';
488
513
  return (rname);
489
 
  
 
514
 
490
515
}