1 /*- 2 * Copyright (c) 2000-2005 MAEKAWA Masahide <maekawa@cvsync.org> 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright 9 * notice, this list of conditions and the following disclaimer. 10 * 2. Redistributions in binary form must reproduce the above copyright 11 * notice, this list of conditions and the following disclaimer in the 12 * documentation and/or other materials provided with the distribution. 13 * 3. Neither the name of the author nor the names of its contributors 14 * may be used to endorse or promote products derived from this software 15 * without specific prior written permission. 16 * 17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. 28 */ 29 30 #ifndef __FILETYPES_H__ 31 #define __FILETYPES_H__ 32 33 #define IS_DIR_ATTIC(n, l) (((l) == 5) && ((n)[0] == 'A') && \ 34 ((n)[1] == 't') && ((n)[2] == 't') && \ 35 ((n)[3] == 'i') && ((n)[4] == 'c')) 36 #define IS_DIR_CURRENT(n, l) (((l) == 1) && ((n)[0] == '.')) 37 #define IS_DIR_CVS(n, l) (((l) == 3) && ((n)[0] == 'C') && \ 38 ((n)[1] == 'V') && ((n)[2] == 'S')) 39 #define IS_DIR_PARENT(n, l) (((l) == 2) && ((n)[0] == '.') && \ 40 ((n)[1] == '.')) 41 #define IS_FILE_CVSLOCK(n, l) ((((l) == 9) && ((n)[0] == '#') && \ 42 ((n)[1] == 'c') && ((n)[2] == 'v') && \ 43 ((n)[3] == 's') && ((n)[4] == '.') && \ 44 ((n)[5] == 'l') && ((n)[6] == 'o') && \ 45 ((n)[7] == 'c') && ((n)[8] == 'k')) || \ 46 (((l) > 9) && ((n)[0] == '#') && \ 47 ((n)[1] == 'c') && ((n)[2] == 'v') && \ 48 ((n)[3] == 's') && ((n)[4] == '.') && \ 49 (((n)[5] == 'r') || ((n)[5] == 't') || \ 50 ((n)[5] == 'w')) && \ 51 ((n)[6] == 'f') && ((n)[7] == 'l') && \ 52 ((n)[8] == '.'))) 53 #define IS_FILE_RCS(n, l) (((l) > 2) && ((n)[(l) - 2] == ',') && \ 54 ((n)[(l) - 1] == 'v')) 55 #define IS_FILE_TMPFILE(n, l) (((l) == 14) && ((n)[0] == '.') && \ 56 ((n)[1] == 'c') && ((n)[2] == 'v') && \ 57 ((n)[3] == 's') && ((n)[4] == 'y') && \ 58 ((n)[5] == 'n') && ((n)[6] == 'c') && \ 59 ((n)[7] == '.')) /* CVSYNC_TMPFILE */ 60 61 #define FILETYPE_BLKDEV 'B' 62 #define FILETYPE_CHRDEV 'C' 63 #define FILETYPE_DIR 'D' 64 #define FILETYPE_FILE 'F' 65 #define FILETYPE_LINK 'L' 66 #define FILETYPE_RCS 'R' 67 #define FILETYPE_RCS_ATTIC 'r' 68 #define FILETYPE_SYMLINK 'S' 69 70 #endif /* __FILETYPES_H__ */ 71