This is fix 2. The original Mosaic 2.0 can not retrieve information from ftp servers running under VMS. This fix makes that possible. It does not contain any VMS specific code. This patch has only been tested with VMS ftp-servers using MultiNet. I believe it works with UCX also. If you find problems, please inform me. This fix should be extended later with a change giving the file date information provided by the server. This could be difficult with UCX based servers, though. 1-Dec-1993. ************ File PD_ROOT:[MOSAIC.MOSAIC-2_0.LIBWWW2]HTFTP.C;2 97 #ifndef NotBSN 98 PRIVATE char VMS_server[10]; 99 #endif /* BSN, VMS FTP servers */ 100 ****** File PD_ROOT:[MOSAIC.MOSAIC-2_0.LIBWWW2]HTFTP.C;1 97 ************ ************ File PD_ROOT:[MOSAIC.MOSAIC-2_0.LIBWWW2]HTFTP.C;2 364 #ifndef Not_BSN 365 if (strstr (response_text, "UCX")) strcpy (VMS_server, "UCX"); 366 if (strstr (response_text, "MultiNet")) strcpy (VMS_server, "MultiNet"); 367 #endif /* VMS server, BSN */ 368 if (username) ****** File PD_ROOT:[MOSAIC.MOSAIC-2_0.LIBWWW2]HTFTP.C;1 361 if (username) ************ ************ File PD_ROOT:[MOSAIC.MOSAIC-2_0.LIBWWW2]HTFTP.C;2 697 #ifdef Not_BSN 698 ret=sscanf(buffer,"%c%*9s%*d %*s %*s %s", &itemtype, itemsize); 699 #else 700 if (VMS_server[0] == 0) 701 { 702 ret=sscanf(buffer,"%c%*9s%*d %*s %*s %s", &itemtype, itemsize); 703 if (ret != 2) 704 { 705 free (full_ftp_name); 706 continue; 707 } 708 } 709 else 710 { 711 if ((strchr (buffer, ' ') != 0) || ((ptr=strchr (buffer, '.')) == 0)) 712 { 713 free (full_ftp_name); 714 continue; 715 } 716 /* 717 * MultiNet servers return file_name.file_type while UCX servers return 718 * a file_version too. 719 */ 720 strncpy (itemname, buffer, sizeof(itemname)); 721 ptr = strchr (itemname, ';'); 722 if (ptr != 0) *ptr = '\0'; 723 if ((strstr (itemname, ".DIR") != 0) || 724 (strstr (itemname, ".dir") != 0)) 725 { 726 itemtype = 'd'; 727 ptr = strchr (itemname, '.'); 728 *ptr = '\0'; 729 } 730 else 731 itemtype = '-'; 732 } 733 #endif /* VMS server, BSN */ 734 ****** File PD_ROOT:[MOSAIC.MOSAIC-2_0.LIBWWW2]HTFTP.C;1 690 ret=sscanf(buffer,"%c%*9s%*d %*s %*s %s", &itemtype, itemsize); 691 692 if (ret != 2) 693 { 694 free (full_ftp_name); 695 continue; 696 } 697 ************ ************ File PD_ROOT:[MOSAIC.MOSAIC-2_0.LIBWWW2]HTFTP.C;2 737 #ifdef Not_BSN 738 ptr = strrchr(buffer,' '); 739 #else 740 if (VMS_server[0] == 0) 741 ptr = strrchr(buffer,' '); 742 else 743 ptr = itemname; 744 #endif /* VMS server, BSN */ 745 ****** File PD_ROOT:[MOSAIC.MOSAIC-2_0.LIBWWW2]HTFTP.C;1 700 ptr = strrchr(buffer,' '); 701 ************ ************ File PD_ROOT:[MOSAIC.MOSAIC-2_0.LIBWWW2]HTFTP.C;2 749 #ifdef Not_BSN 750 strcpy(itemname,ptr+1); 751 #else 752 if (VMS_server[0] == 0) 753 strcpy(itemname,ptr+1); 754 #endif /* VMS server, BSN */ 755 ****** File PD_ROOT:[MOSAIC.MOSAIC-2_0.LIBWWW2]HTFTP.C;1 705 strcpy(itemname,ptr+1); 706 ************ ************ File PD_ROOT:[MOSAIC.MOSAIC-2_0.LIBWWW2]HTFTP.C;2 920 #ifndef Not_BSN 921 VMS_server[0] = '\0'; 922 #endif /* VMS server, BSN */ 923 for (retry = 0; retry < 2; retry++) ****** File PD_ROOT:[MOSAIC.MOSAIC-2_0.LIBWWW2]HTFTP.C;1 871 for (retry = 0; retry < 2; retry++) ************ ************ File PD_ROOT:[MOSAIC.MOSAIC-2_0.LIBWWW2]HTFTP.C;2 999 #ifndef Not_BSN 1000 if (VMS_server[0] != 0) 1001 { 1002 if (strcmp (filename, "/") == 0) 1003 { 1004 free (filename); 1005 StrAllocCopy(filename, "[]"); 1006 } 1007 else 1008 { 1009 /* 1010 * Now we are in trouble. Convert the UNIX name to a VMS name. I guess 1011 * we can safely assume that we always start in the server's topdirectory. 1012 * Therefore a construct like /dir1/dir2.../dirn/name.type has to be 1013 * converted to [.dir1.dir2..dirn]name.type 1014 */ 1015 char *file_temp = (char *)malloc (strlen(filename) + 4); 1016 int i1 = 0, i2 = 1, i3 = 2; 1017 1018 file_temp[0] = '['; 1019 file_temp[1] = '.'; 1020 if (filename[0] == '/') i1 = 1; 1021 for (; i1 < strlen (filename); i1++,i3++) 1022 { 1023 if (filename[i1] != '/') 1024 { 1025 file_temp[i3] = filename[i1]; 1026 continue; 1027 } 1028 file_temp[i3] = ']'; 1029 if (i2 > 1) file_temp[i2] = '.'; 1030 i2 = i3; 1031 } 1032 if (i2 == 1) file_temp[1] = ']'; 1033 file_temp[i3] = '\0'; 1034 free (filename); 1035 StrAllocCopy(filename, file_temp); 1036 free (file_temp); 1037 } 1038 } 1039 #endif /* VMS server, BSN */ 1040 sprintf(command, "TYPE %s%c%c", "I", CR, LF); ****** File PD_ROOT:[MOSAIC.MOSAIC-2_0.LIBWWW2]HTFTP.C;1 947 948 sprintf(command, "TYPE %s%c%c", "I", CR, LF); ************ ************ File PD_ROOT:[MOSAIC.MOSAIC-2_0.LIBWWW2]HTFTP.C;2 1068 #ifndef Not_BSN 1069 if (VMS_server[0] != 0) 1070 { 1071 if (filename[strlen(filename)-1] != ']') 1072 { 1073 char *cp = strchr (filename, ']'); 1074 *cp = '.'; 1075 strcat (filename, "]"); 1076 } 1077 } 1078 #endif /* VMS server, BSN */ 1079 sprintf(command, "CWD %s%c%c", filename, CR, LF); ****** File PD_ROOT:[MOSAIC.MOSAIC-2_0.LIBWWW2]HTFTP.C;1 976 sprintf(command, "CWD %s%c%c", filename, CR, LF); ************ ************ File PD_ROOT:[MOSAIC.MOSAIC-2_0.LIBWWW2]HTFTP.C;2 1095 #ifdef Not_BSN 1096 sprintf(command, "LIST%c%c", CR, LF); 1097 #else 1098 /* 1099 * Make an NLST for VMS servers. It's much faster and avoids bugs in 1100 * early UCX servers. 1101 */ 1102 if (!VMS_server[0]) 1103 sprintf(command, "LIST%c%c", CR, LF); 1104 else 1105 sprintf(command, "NLST%c%c", CR, LF); 1106 #endif /* VMS server, BSN */ 1107 status = response (command); ****** File PD_ROOT:[MOSAIC.MOSAIC-2_0.LIBWWW2]HTFTP.C;1 992 sprintf(command, "LIST%c%c", CR, LF); 993 status = response (command); ************ Number of difference sections found: 9 Number of difference records found: 125