1 /* This program is free software; you can redistribute it and/or modify 2 it under the terms of the GNU General Public License as published by 3 the Free Software Foundation; either version 2, or (at your option) 4 any later version. 5 6 This program is distributed in the hope that it will be useful, 7 but WITHOUT ANY WARRANTY; without even the implied warranty of 8 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 9 GNU General Public License for more details. */ 10 11 #include <io.h> 12 #include <stdio.h> 13 #include <stdlib.h> 14 #include <sys/types.h> 15 #include <sys/stat.h> 16 #include <sys/param.h> 17 #include <fnmatch.h> 18 19 20 /* Expand wildcards in argv. We probably should be expanding wildcards 21 via expand_wild instead; that way we could expand only filenames and 22 not tag names and the like. */ 23 24 void 25 os2_initialize (pargc, pargv) 26 int *pargc; 27 char **pargv[]; 28 { 29 _wildcard (pargc, pargv); 30 } 31 32 33 /* Modifies 'stat' so that always the same inode is returned. EMX never 34 returns the same value for st_ino. Without this modification, 35 release_delete in module src/release.c refuses to work. Care must 36 be taken if someone is using the value of st_ino (but as far as I know, 37 no callers are). */ 38 39 int 40 os2_stat (name, buffer) 41 const char *name; 42 struct stat *buffer; 43 { 44 int rc = stat (name, buffer); 45 46 /* There are no inodes on OS/2. */ 47 buffer->st_ino = 42; 48 49 return rc; 50 } 51 52 53 /* We must not only change the directory, but also the current drive. 54 Otherwise it is be impossible to have the working directory and the 55 repository on different drives. */ 56 57 int 58 os2_chdir (name) 59 const char *name; 60 { 61 return _chdir2 (name); 62 } 63 64 65 /* getwd must return a drive specification. */ 66 67 char * 68 xgetwd () 69 { 70 return _getcwd2 (NULL, 1); 71 } 72 73 74 /* fnmatch must recognize OS/2 filename conventions: Filename case 75 must be preserved, but ignored in searches. It would perhaps be better 76 to just have CVS pick how to match based on FILENAMES_CASE_INSENSITIVE 77 or something rather than having an OS/2-specific version of CVS_FNMATCH. 78 Note that lib/fnmatch.c uses FOLD_FN_CHAR; that is how we get 79 case-insensitivity on NT (and VMS, I think). */ 80 81 #define _FNM_OS2 1 82 #define _FNM_IGNORECASE 128 83 84 int 85 os2_fnmatch (pattern, name, flags) 86 const char *pattern; 87 const char *name; 88 int flags; 89 { 90 return fnmatch (pattern, name, _FNM_IGNORECASE | _FNM_OS2 | flags); 91 } 92