/* * newlinelib.c * Used for determining and converting newline formats. * * History: * Developed 970714 for use in creating automatic file format changing in Samba. * * Copyright (c) 1997 David R. Harris. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. */ /******************************************************************************/ /******************************************************************************/ /* Some defines for this library */ /* The size of the read buffer */ #define NLL_BUFFSIZE 500 /* The amount of charactes to read in for determining the size of a file */ #define NLL_FFF_FIRSTREAD 300 #define NLL_FFF_SECONDREAD 3000 /******************************************************************************/ /******************************************************************************/ /* Enum for the newline/file formats */ enum fileFormat {BINARY = 1, ASCII_UNIX, ASCII_DOS}; /******************************************************************************/ /******************************************************************************/ /* Functions */ int findFileFormat( int readFile ); int convertUnixToDos( int readFile, int writeFile ); int convertDosToUnix( int readFile, int writeFile ); int convertNone( int readFile, int writeFile );