From: Jan Vorbrueggen Date: Fri, 28 May 93 09:01:51 +0200 The new version of the iserver file filec.c-new does the following: - converts \ in filenames to / - squeeze \r out of text files on read These changes allow us transparently share files with our PCs (where the C run time library does the \r-squeezing) and transputer applications which have directory paths coded into them. The changes to filec.c are as follows: - In SpOpen, the following is inserted; this converts DOS-style directory delimiters to Unix-style: /* JV 17.8.1992 */ #ifdef SUN {int i; for (i = 0; i < strlen(Name); i++) { if (*(Name+i) == '\\') { *(Name+i) = '/'; } } } #endif - I've defined an additional ifdef-flag called DOS_FILES. With this defined, three pieces of code are included: 1. In the declarations at the beginning, I define a flag bit which happens to be unused in the flag word of the file descriptor - at least on SunOs. This admittedly is a kludge, but saves a lot of work - and it _does_ work. #ifdef DOS_FILES #define TEXT_FLAG 010000 #endif 2. In SpOpen, if the transputer application says it's opening a text file for reading, this flag is set in the file descriptor: #ifdef DOS_FILES if (Type == 2) Fd->_flag |= TEXT_FLAG; #endif 3. In SpRead, if the flag is set for the file being read from, the block read is scanned for "\r", which are squeezed out and the number of bytes read are adjusted accordingly. As the block can only become smaller, this can be done in place: #ifdef DOS_FILES if (Fd->_flag & TEXT_FLAG) { int i, j, incount; j = 0; incount = Read; for (i = 0; i < incount; i++) { if (DataBuffer[i] == '\r') { --Read; } else { DataBuffer[j] = DataBuffer[i]; j++; } } } #endif I've used this iserver for almost a year now, regularly editing files from both PC and Sun and compiling, linking etc. on both without trouble, using the occam and C toolset. The toolset seems to only use the block-mode SpRead and not the record-mode SpGets, so that's all I touched. Jan