From abbdb46243b3340f9a73adff8a0941931eab0daa Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Tue, 6 Nov 2012 22:52:30 -0800 Subject: [PATCH] Imported Upstream version 6.0 --- BUGS.txt | 15 + COPYING.txt | 30 ++ ChangeLog.txt | 519 ++++++++++++++++++++ INSTALL.txt | 195 ++++++++ Makefile | 473 ++++++++++++++++++ NEWS.txt | 112 +++++ README.txt | 90 ++++ TODO.txt | 14 + bcc.mak | 55 +++ common.c | 645 +++++++++++++++++++++++++ common.h | 218 +++++++++ djgpp.mak | 36 ++ dos16_gnu.mak | 32 ++ dos2unix.c | 1181 +++++++++++++++++++++++++++++++++++++++++++++ dos2unix.h | 222 +++++++++ man/es/man1/dos2unix.pod | 548 +++++++++++++++++++++ man/man1/Makefile | 101 ++++ man/man1/dos2unix.pod | 535 ++++++++++++++++++++ man/nl/man1/dos2unix.pod | 539 +++++++++++++++++++++ mingw.mak | 37 ++ mingw64.mak | 40 ++ os2.mak | 35 ++ po/de.po | 411 ++++++++++++++++ po/dos2unix.pot | 331 +++++++++++++ po/eo-x.po | 367 ++++++++++++++ po/eo.po | 367 ++++++++++++++ po/es.po | 378 +++++++++++++++ po/nl.po | 378 +++++++++++++++ querycp.c | 196 ++++++++ querycp.h | 3 + unix2dos.c | 1204 ++++++++++++++++++++++++++++++++++++++++++++++ unix2dos.h | 222 +++++++++ version.mk | 4 + wccdos16.mak | 63 +++ wccdos32.mak | 63 +++ wccwin32.mak | 65 +++ 36 files changed, 9724 insertions(+) create mode 100644 BUGS.txt create mode 100644 COPYING.txt create mode 100644 ChangeLog.txt create mode 100644 INSTALL.txt create mode 100644 Makefile create mode 100644 NEWS.txt create mode 100644 README.txt create mode 100644 TODO.txt create mode 100644 bcc.mak create mode 100644 common.c create mode 100644 common.h create mode 100644 djgpp.mak create mode 100644 dos16_gnu.mak create mode 100644 dos2unix.c create mode 100644 dos2unix.h create mode 100755 man/es/man1/dos2unix.pod create mode 100644 man/man1/Makefile create mode 100644 man/man1/dos2unix.pod create mode 100644 man/nl/man1/dos2unix.pod create mode 100644 mingw.mak create mode 100644 mingw64.mak create mode 100644 os2.mak create mode 100644 po/de.po create mode 100644 po/dos2unix.pot create mode 100644 po/eo-x.po create mode 100644 po/eo.po create mode 100644 po/es.po create mode 100644 po/nl.po create mode 100644 querycp.c create mode 100644 querycp.h create mode 100644 unix2dos.c create mode 100644 unix2dos.h create mode 100644 version.mk create mode 100644 wccdos16.mak create mode 100644 wccdos32.mak create mode 100644 wccwin32.mak diff --git a/BUGS.txt b/BUGS.txt new file mode 100644 index 0000000..0495938 --- /dev/null +++ b/BUGS.txt @@ -0,0 +1,15 @@ +KNOWN BUGS + + querycp.c: query_con_codepage() + The DOS 16 and 32 bit versions compiled with OpenWatcom report + a wrong active code page under Windows 98. + A correct code page is reported under FreeDOS. + + +REPORTING BUGS + + Report bugs at the dos2unix SourceForge Tracker page + http://sourceforge.net/projects/dos2unix/ + Bugs tracker: http://sourceforge.net/tracker/?group_id=292083&atid=1234808 + + or send an email to Erwin Waterlander diff --git a/COPYING.txt b/COPYING.txt new file mode 100644 index 0000000..bdb650f --- /dev/null +++ b/COPYING.txt @@ -0,0 +1,30 @@ +The dos2unix package is distributed under FreeBSD style license. +See also http://www.freebsd.org/copyright/freebsd-license.html +-------- + +Copyright (C) 2009-2012 Erwin Waterlander +Copyright (C) 1998 Christian Wurll +Copyright (C) 1998 Bernd Johannes Wuebben +Copyright (C) 1994-1995 Benjamin Lin. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright + notice in the documentation and/or other materials provided with + the distribution. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT +OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR +BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE +OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/ChangeLog.txt b/ChangeLog.txt new file mode 100644 index 0000000..d2ec09e --- /dev/null +++ b/ChangeLog.txt @@ -0,0 +1,519 @@ +2012-05-06 Erwin Waterlander + * Version 6.0 + * man/*/man1/*.pod: Removed =encoding. It is not supported + by perl 5.8.8, which is shipped with MinGW and DJGPP. + +2012-04-20 Erwin Waterlander + * man/*/man1/*.pod: Set encoding explicitly to Latin-1. + * Makefile: Target 'doc' makes all man pages. + +2012-04-12 Erwin Waterlander + * po/de.po: Update German translations. Thanks to Philipp Thomas. + +2012-04-09 Erwin Waterlander + * INSTALL.txt: List the prerequisites. + * Makefile: Friendlier for DJGPP/MinGW/MSYS. + +2012-04-04 Erwin Waterlander + * po/eo.po: Update Esperanto translations. Thanks to Rugxulo. + +2012-03-30 Erwin Waterlander + * Skip UTF-16 file when conversion to UTF-8 goes wrong. + * Update English and Dutch manual. + +2012-03-28 Erwin Waterlander + * common.c: Support UTF-16 surrogate pairs. + * dos2unix.c, unix2dos.c: Check wchar_t size. + +2012-03-26 Erwin Waterlander + * *.c: Use fgetc/fputc instead of getc/putc. + +2012-03-25 Erwin Waterlander + * po, man: Update Dutch translations. + +2012-03-24 Erwin Waterlander + * On Unix, convert UTF-16 files only when the locale encoding + is UTF-8 to prevent accidental loss of text. + +2012-03-23 Erwin Waterlander + * Turn off ISO and 7-bit mode if an Unicode text file is detected, + to prevent corruption of UTF-8 files. + * Update English manual. + * Fix compilation for WatcomC, DJGPP, MSYS, OS/2. + * Makefile: Support CFLAGS_USER, LDFLAGS_USER, and DEFS_USER for + Debian Linux. Thanks to Jari Aalto. + +2012-03-21 Erwin Waterlander + * Support conversion of Unicode UTF-16 from stdin. + * Update English manual. + +2012-03-20 Erwin Waterlander + * Support conversion of Unicode UTF-16 encoded files. + +2012-03-16 Erwin Waterlander + * common.c: Make it compile on Cygwin 1.5. + +2012-03-10 Erwin Waterlander + * Version 5.3.3 + * Makefile: Binary packages with native language support + get "-nls" suffix. + +2012-03-08 Erwin Waterlander + * common.c: Option -V prints target OS on DOS/Windows/OS2. + +2012-03-07 Erwin Waterlander + * dos2unix.c, unix2dos.c, mingw64.mak: Enabled wildcard + expansion for Win64 (MinGW-w64). Thanks to Steve Hay. + * wccdos16.mak: Enabled wildcard expansion. + * wccdos32.mak: Enabled wildcard expansion. + * wccwin32.mak: Enabled wildcard expansion. + * bcc.mak: Enabled wildcard expansion. + +2012-03-02 Erwin Waterlander + * Makefile: New target 'mostlyclean' that preserves the manual + files. Target 'clean' removes all built files, it restores the + Unix source package to its original state. + * Makefile: New variable HTMLEXT to override the default 'htm' + extension for the manual in HTML format. + +2012-02-01 Erwin Waterlander + * Makefile, version.mk: Fix a compile error when debug + is enabled. Thanks to Maurizio Camisaschi and Lars Wendler. + See https://bugs.gentoo.org/400769 + * Makefile: Enable debugging info for gdb when DEBUG=1 + * man page: Small update in section RETURN VALUE. + +2012-01-27 Erwin Waterlander + * Version 5.3.2 + +2012-01-02 Erwin Waterlander + * os2.mak: Enable support for wild cards (-Zargs-wild). + Thanks to Steven H. Levine and Elbert Pol. + +2011-12-20 Erwin Waterlander + * querycp.c: Extra comment from Rugxulo. + * querycp.c: Undid change of 2011-11-12. MSYS version + behaves as Cygwin version. + +2011-12-15 Erwin Waterlander + * wccdos32.mak: New makefile for Open Watcom for DOS32. + +2011-12-06 Erwin Waterlander + * Makefile: Undo previous change for Darwin. Not restoring group and + owner may be destructive or a security risk. + * Makefile, common.[ch]: Dos2unix builds on MSYS now. + +2011-12-02 Erwin Waterlander + * Makefile: For MacOS the option -DNO_CHOWN has been be added to the compile time flags. + This is necessary because Darwin will create files with the + file-owner-group set to the file-owner-group of the directory - EVEN if + the caller is not a member of the group! Chowning *from* the group is ok, + chowning *to* the group is not - and this will make unix2dos fail when it + tries to restore the permissions. + Thanks to Wolf Geldmacher. + See bug report 3444337, https://sourceforge.net/tracker/?func=detail&atid=1234808&aid=3444337&group_id=292083 + +2011-11-16 Erwin Waterlander + * README.txt, man/man1/dos2unix.pod: Freshmeat changed name to Freecode. + +2011-11-12 Erwin Waterlander + * querycp.c: Fix for MSYS. + +2011-10-20 Erwin Waterlander + * querycp.c: Support OS/2, and Watcom C for Win32. + * wccwin32.mak: New makefile for Open Watcom for Win32. + +2011-08-22 Erwin Waterlander + * Makefile: Added RPM_OPT_FLAGS to LDFLAGS. Required for + cross-platform RPM package building. + +2011-08-20 Erwin Waterlander + * Home page URL: change to http://waterlan.home.xs4all.nl/dos2unix.html + +2011-08-09 Erwin Waterlander + * Version 5.3.1 + +2011-08-08 Julio A. Freyre-Gonzalez + * Spanish translation of messages and manual. + +2011-06-26 Erwin Waterlander + * bugfix: dos2unix changes ownership and permissions on file. + When an other user (e.g. root) than the owner has write permission + on the input file, dos2unix changes owner, group and umask in old + file mode to the other user's owner, group and umask who runs + dos2unix. Fixed only for Unix. Thanks to Christopher Williams. + See http://sourceforge.net/tracker/?func=detail&aid=3327171&group_id=292083&atid=1234808 + * Keep permissions also on Windows. Use chmod() i.s.o. fchmod(). + +2011-06-16 Erwin Waterlander + * Identical functions from dos2unix.c and unix2dos.c + are moved to common.c. + +2011-06-15 Erwin Waterlander + * Dos2unix and Unix2dos share the same language files. + +2011-05-04 Erwin Waterlander + * dos2unix.c: Removed redundant ConvertDosToUnixOldFile(). + * unix2dos.c: Removed redundant ConvertUnixToDosOldFile(). + +2011-04-26 Erwin Waterlander + * Version 5.3 + +2011-04-23 Erwin Waterlander + * Don't report an error when unlink() fails because a file + doesn't exist. + +2011-04-13 Erwin Waterlander + * Print system error when input file can't be openened. + For instance "Permission denied" + * Update manuals. + * Update translations. + +2011-04-04 Erwin Waterlander + * Always print and return an error when wrong command-line + options are used. Also in quiet mode. + * New option '--': Treat all following options as file names. + +2011-04-03 Erwin Waterlander + * Improved error reporting. Return system error when an error occurs. + * Don't quit after first error (like rm, ls, grep, tar). + * In quiet mode the return value is always zero. + +2011-03-27 Erwin Waterlander + * dos2unix.c/unix2dos.c: Check if symbolic links point to + regular files. + * dos2unix.c/unix2dos.c: Added short options -F, -R, -S. + * po: update translations. + +2011-03-24 Erwin Waterlander + * dos2unix.c/unix2dos.c: Changed options --follow, --no-follow, + to --follow-symlink, --replace-symlink, --skip-symlink. + * dos2unix.c/unix2dos.c: Options --force and --safe are only to + covert binary files or skip them. + * dos2unix.c/unix2dos.c: Non-regular files that are not symbolic + links are never converted. + +2011-03-23 Charles Wilson + * dos2unix.c/unix2dos.c: New options --follow and --no-follow. + In follow mode dos2unix writes to the symlink target, instead + of replacing the symbolic link with an output file. + +2011-03-22 Charles Wilson + * querycp.c: Behave on Cygwin same as on Linux. Default + code page in ISO mode is CP437. + +2011-03-21 Charles Wilson + * dos2unix.c/unix2dos.c: + - Cygwin may define WIN32 (via include files). + - bugfix: Cygwin: set mode to binary in stdio mode conversion. + Needed in case non-Cygwin program launches dos2unix. + - bugfix: set failure mode if rename fails in quiet mode. + - New option: -s, --safe. Opposite of -f, --force. + * Makefile: Cleanup for Cygwin. + +2011-03-19 Erwin Waterlander + * Makefile: Install links instead of binary/manpage copies on Cygwin. + +2011-03-05 Erwin Waterlander + * man/man1/dos2unix.pod: Replace GPL with FreeBSD license. + * man/nl/man1/dos2unix.pod: Replace GPL with FreeBSD license. + +2011-03-04 Erwin Waterlander + * Version 5.2.1 + +2011-03-03 Erwin Waterlander + * Don't print used code page in quiet mode. + +2011-03-02 Erwin Waterlander + * Esperanto x-notation format is optional. Default is Unicode. + There is no installation of an 'eo-x' locale any more. + Add EO_XNOTATION=1 to make command-line to select x-notation. + It will change the format of the normal 'eo' locale from Unicode + to ASCII x-notation. + +2011-02-28 Erwin Waterlander + * Makefile: Make LFS optional with variable LFS (default on). + * dos2unix.c/unix2dos.c: Print file name with stat() system error. + +2011-02-26 Erwin Waterlander + * dos2unix.c/unix2dos.c: Report system error when stat() fails. + * Makefile: Enable 64 bit file system interface (_FILE_OFFSET_BITS=64). + This enables opening files larger than 2GB on 32 bit systems, provided + the system has Large File Support (LFS). See also section 1.3.4 + "Feature Test Macros" of The GNU C Library manual. + http://www.gnu.org/s/libc/manual/html_node/Feature-Test-Macros.html + +2011-02-22 Erwin Waterlander + * In debug mode file mode is printed (compile with DEBUG=1). + +2011-02-19 Erwin Waterlander + * Makefile: Generation of PostScript and PDF is optional. + This removes dependency on Groff and GhostScript (thanks to Philipp Thomas). + +2011-02-04 Erwin Waterlander + * Makefile: Replace GPL (accidently patched in) with FreeBSD license. + * man/man1/Makefile: Fix perl command for for DOS alike file systems + (Can't do inplace edit without backup.). (thanks to Elbert Pol) + +2011-01-31 Erwin Waterlander + * Version 5.2 + +2011-01-19 Erwin Waterlander + * Update manual. + +2011-01-13 Rugxulo + * querycp.c: Active code page detection. DOS 16 bit, OpenWatcom. + +2011-01-12 Erwin Waterlander + * querycp.c: Detect active code page for ISO mode on Windows. + +2011-01-12 Rugxulo + * querycp.c: Detect active code page for ISO mode. DOS 32 bit, DJGPP. + +2011-01-11 Erwin Waterlander + * New ISO conversion modes DOS CP860 (Portuguese) + and CP863 (French Canadian). + +2011-01-10 Erwin Waterlander + * New ISO conversion mode DOS CP865 (Nordic). + +2011-01-07 Erwin Waterlander + * ISO mode CP437: fix conversion of non-breaking space (NBSP) + * New ISO conversion modes: DOS CP850 (Western European) and Windows + CP1252 (Western European). + * SunOS compatible command-line options -ascii, -iso, -7, -437, -850. + +2011-01-04 Erwin Waterlander + * 7bit and iso mode can be used in Mac mode. + +2010-11-22 Jari Aalto + * Small updates man page and Makefile. + +2010-11-21 Ben Pfaff + * Don't indicate text files with ASCII Form Feed control + characters (^L) as binary. + Form feed characters are fairly common in GNU software text files, + because the GNU coding standards advice to use form feeds to + divide text into pages. + +2010-11-15 Erwin Waterlander + * Put full copyright text in *.h source files (FSF's recommendation). + Thanks to Jari Aalto . + * Don't include generated documentation files in Unix source package. + * Create a source package in DOS text format. + +2010-08-18 Erwin Waterlander + * version 5.1.1 + +2010-07-23 Erwin Waterlander + * Added Dutch translation of the manual. + +2010-07-19 Erwin Waterlander + * MinGW-w64 Makefile added for Windows 64 bit port. + +2010-06-20 Erwin Waterlander + * Don't ship po/*.mo files in source package. + * Win32 binary package uses patched MinGW's libintl, with builtin + relocation support. See http://www.xs4all.nl/~waterlan/libintl.html + +2010-04-22 Erwin Waterlander + * Support compilation in DOSBox (8.3 file names where needed). + +2010-04-14 Erwin Waterlander + * Fixed compilation on Darwin OS. Thanks to Marc Gianzero. + +2010-04-03 Erwin Waterlander + * version 5.1 + +2010-03-22 Erwin Waterlander + * Man page generation from Perl POD file. + Thanks to Jari Aalto + * Merge dos2unix and unix2dos man pages. + +2010-03-17 Erwin Waterlander + * Add localization information to manual. + +2010-03-16 Rugxulo + * Added Esperanto translation. + +2010-03-13 Erwin Waterlander + * DJGPP, dos32bit: Create 'stubs' for mac2unix and unix2mac. + See also http://www.delorie.com/djgpp/v2faq/faq22_5.html + Thanks to Rugxulo + +2010-03-11 Erwin Waterlander + * Allow to set options in stdio mode. + * dos2unix: bugfix MAC mode: Don't change DOS line endings. + * Display help if a wrong option was used. + +2010-03-04 Erwin Waterlander + * Port to 16 bit DOS, using OpenWatcom. + +2010-03-03 Erwin Waterlander + * Port to 16 bit DOS, using Borland C. + +2010-02-16 Erwin Waterlander + * version 5.0 + +2010-02-15 Erwin Waterlander + * unix2dos: Fix problem of reading Mac files. + * unix2dos: Added command 'unix2mac'. + * unix2dos: Can use DOS2UNIX_LOCALEDIR i.s.o. UNIX2DOS_LOCALEDIR. + * dos2unix: 'mac2unix' command can have a prefix. + * Makefile: mac2unix and unix2mac are installed as soft links. + +2010-02-13 Erwin Waterlander + * Bundled dos2unix and unix2dos in one package. + * dos2unix/unix2dos : Cleanup messages and manual. + * dos2unix: Option -l --newline also works in MAC mode. + * unix2dos: Added option -l, --newline. + * unix2dos: Added MAC mode. Convert Unix line endings + to Mac line endings. + +2010-02-10 Erwin Waterlander + * unix2dos: Makefile : + - Use GNU standard directory variables everywhere. + - New target 'dist-tbz' creates bzip2 compressed archive. + +2010-02-10 Philipp Thomas + * unix2dos: po/de.po : Added German translation. + * unix2dos: Makefile : + - Added $(RPM_OPT_FLAGS) to CFLAGS. + - Use DESTDIR only in install and uninstall targets (not in variables, + this is more common practice). + +2010-02-03 Erwin Waterlander + * dos2unix: Makefile : + - Use GNU standard directory variables everywhere. + +2010-02-03 Philipp Thomas + * dos2unix: po/de.po : Added German translation. + * dos2unix: Makefile : + - Use GNU standard directory variable 'datadir' i.s.o. 'sharedir'. + - Added $(RPM_OPT_FLAGS) to CFLAGS. + - New target 'dist-tbz' creates bzip2 compressed archive. + - Use DESTDIR only in install and uninstall targets (not in variables, + this is more common practice). + +2010-02-02 Erwin Waterlander + * dos2unix/unix2dos: Update Dutch translation. + +2010-01-24 Erwin Waterlander + * dos2unix/unix2dos: version 4.1.2 + +2010-01-22 Tim Waugh + * dos2unix/unix2dos: Preserve file mode in 'new file mode'. + * dos2unix/unix2dos: Makefile: Allow CFLAGS to be set externally. + +2010-01-21 Erwin Waterlander + * dos2unix/unix2dos: version 4.1.1 + * dos2unix/unix2dos: Fix compilation on FreeBSD. + * dos2unix/unix2dos: Changed home page URL to http://www.xs4all.nl/~waterlan/dos2unix.html + +2009-12-28 Erwin Waterlander + * dos2unix/unix2dos: version 4.1 + * dos2unix/unix2dos: Automatically skip binary files. + * dos2unix/unix2dos: Automatically skip non-regular files. + * dos2unix/unix2dos: New option: -f --force: Force conversion of all files. + * dos2unix/unix2dos: Option -h: Print options in alphabetical order. + * dos2unix/unix2dos: Update manual. + * dos2unix/unix2dos: ISO mode: + - Non-convertable characters are converted to a dot. + Old conversion risked conversion to unwanted ISO C1 + control characters from ISO 6429. + - Fixed wrong conversion of Interpunct. + - Don't convert ASCII control characters + DC4 (Pilcrow, 0x14) and NAK (Section-sign, 0x15). + +2009-12-21 Erwin Waterlander + * dos2unix/unix2dos: version 4.0.1 + * dos2unix/unix2dos: man page improvements: Thanks to Jari Aalto . + - Replace hyphens with minus signs (look like dashes) where needed. + - Options in alphabetical order. + * dos2unix/unix2dos: man page: Update ISO mode information. + * dos2unix/unix2dos: Option -V prints localedir used. + * dos2unix: Localedir can be overruled with environment variable + DOS2UNIX_LOCALEDIR. + * unix2dos: Localedir can be overruled with environment variable + UNIX2DOS_LOCALEDIR. + * dos2unix/unix2dos: Fixed two wrong conversions in ISO mode: + - Greek mu. + - Closing guillemet (angle quotation mark, >>). + * dos2unix/unix2dos: Port to OS/2 Warp: Thanks to Elbert Pol . + * dos2unix/unix2dos: Makefiles: Added target 'strip'. + +2009-12-15 Erwin Waterlander + * dos2unix/unix2dos: version 4.0 + * dos2unix/unix2dos: Added internationalisation using gettext. + * dos2unix/unix2dos: Added Dutch translation. + * dos2unix/unix2dos: Ported to Win32 using Mingw32 + * dos2unix/unix2dos: Ported to DOS using DJGPP + * dos2unix/unix2dos: Fixed problem in DOS/Windows stdio mode. + * dos2unix/unix2dos: New option -L/--license that prints software license. + * dos2unix/unix2dos: Code cleanup + * dos2unix/unix2dos: Update manual + +2009-12-04 Erwin Waterlander + * dos2unix: version 3.2 + * unix2dos: version 2.3 + * dos2unix/unix2dos: version.mk: New file. + * dos2unix/unix2dos: README: New file. + * dos2unix/unix2dos: ChangeLog : New file. + * dos2unix: INSTALL: Updated. + * dos2unix/unix2dos: Makefile: Makefile according GNU standards. + * unix2dos: INSTALL: New file. + * dos2unix: Applied all patches from RedHat: + - use mkstemp i.s.o. mktemp: Nov 17 2000 Tim Powers + - segfault: Jan 17 2002 Bernhard Rosenkraenzer + - safeconv: Oct 20 2004 Miloslav Trmac + - manpage-update: Oct 6 2004 Mike A. Harris + - preserve-file-modes: Feb 6 2007 Tim Waugh + - tmppath: Apr 13 2005 Tim Waugh + - c-missing-arg: Jan 18 2008 Tim Waugh + - Remove trailing white space. + * unix2dos: Applied all patches from RedHat: + - use mkstemp i.s.o. mktemp: Nov 17 2000 Tim Powers + - segfault: Jan 17 2002 Bernhard Rosenkraenzer + - manpage-update: Oct 6 2004 Mike A. Harris + - preserve-file-modes: Oct 11 2004 Tim Waugh + - tmppath: Apr 13 2005 Tim Waugh + - Remove trailing white space. + +1998-11-19 Christian Wurll + * dos2unix: version 3.1 + * dos2unix: Added extra newline if ^M occurs + +1998-02-04 Bernd Johannes Wuebben + * dos2unix: version 3.0 + * dos2unix: Added Mac text file translation, i.e. \r to \n conversion + +1995-03-30 Benjamin Lin + * dos2unix/unix2dos: version 2.2 + * dos2unix: Fixed a bug in 2.1 where in new file mode, if outfile already exists + * dos2unix: conversion can not be completed properly. + * unix2dos: Conversion from SunOS charset implemented. + +1995-03-29 Benjamin Lin + * dos2unix: version 2.1 + * dos2unix: Conversion to SunOS charset implemented. + +1995-03-19 Benjamin Lin + * dos2unix/unix2dos: version 2.0 + * dos2unix/unix2dos: Rewritten from scratch. + +1995-03-16 Benjamin Lin + * dos2unix: version 1.2 + * unix2dos: version 1.3 + * dos2unix/unix2dos: Modified to more conform to UNIX style. + +1995-03-09 Benjamin Lin + * unix2dos: version 1.2 + * unix2dos: Fixed minor typo error + +1994-12-20 Benjamin Lin + * dos2unix/unix2dos: version 1.1 + * dos2unix/unix2dos: Cleaned up for Borland C/C++ 4.02 + +1989-10-04 John Birchfield + * dos2unix/unix2dos: version 1.0 + diff --git a/INSTALL.txt b/INSTALL.txt new file mode 100644 index 0000000..d70dcd0 --- /dev/null +++ b/INSTALL.txt @@ -0,0 +1,195 @@ +PREREQUISITES + + Using GCC: + Required + * gcc : GNU C compiler + * GNU binutils : A collection of binary tools + * GNU make : make + * sh : POSIX type shell + * GNU coreutils: Core utilities package (chmod, install, mkdir, + mv, rm, uname) + * sed : Stream editor + * perl : Practical Extraction and Report Language (perlpod) + + Optional (depending on build targets): + * gettext : Framework to help GNU packages produce multi- + lingual messages. + * groff : GNU troff text formatting system. + * ghostscript : An interpreter for the PostScript language and + for PDF (ps2pdf) + + Alternative for Windows/DOS: + * Open Watcom : http://www.openwatcom.org/ + + Required for DOS16 bit: + * Open Watcom : http://www.openwatcom.org/ + + +BASIC INSTALLATION + + To build the program type: + + make + + + To strip the executables: + + make strip + + + To install: + + make install + + + Clean: + + make clean + + + Mostly clean. The target mostlyclean will preserve the generated + documentation files. + + make mostlyclean + + +INSTALLATION NAMES + + By default the 'install' target will install the program in + /usr/bin, the language files in /usr/share/locale + and the man page in /usr/share/man. You can specify an + installation prefix other than /usr by modifying the + 'prefix' variable. An Example: + + make prefix=$HOME clean all + make prefix=$HOME install + +DEBUG + + A debug enabled build can be made by adding DEBUG=1 + to the make command. Example: + + make clean install DEBUG=1 + + With debug enabled dos2unix will print extra information + and you can debug the source code in gdb. + +NATIVE LANGUAGE SUPPORT + + Native Language Support (NLS) is by default enabled. + To disable NLS add ENABLE_NLS=. Example: + + make clean install ENABLE_NLS= + +LARGE FILE SUPPORT + + Large File Support (LFS) is by default enabled. This enables + the use of 64 bit file system interface on 32 bit systems. + This makes it possible to open files larger than 2GB on 32 bit + systems, provided the OS has LFS support builtin. + To disable LFS make the LFS variable empty. Example: + + Disable LFS: + make clean install LFS= + +UNICODE SUPPORT + + Unicode UTF-16 support is by default enabled for Windows and Unix. To + disable make the UCS variable (Universal Character Set) empty. + + Disable Unicode: + make clean install UCS= + + Unicode UTF-16 is not supported by the DOS versions. + + +ESPERANTO X-NOTATION + + For systems that don't support the Unicode or Latin-3 character set, + Esperanto messages in ASCII x-notation format can be selected. Add + EO_XNOTATION=1 tot the make command-line. It will change the format of the + normal dos2unix 'eo' locale from Unicode to ASCII x-notation. + + make clean install EO_XNOTATION=1 + +DOCUMENTATION + + Manual pages are generated from Perl POD files. By default + the manual pages are are created in text and html format. + To create a manual in PDF format type: + + make pdf + + PDF generation requires GhostScript to be installed. + +WINDOWS PORT + + To compile a version for Windows, get the Mingw compiler + , and use makefile mingw.mak: + + make -f mingw.mak clean + make -f mingw.mak + make -f mingw.mak strip + make -f mingw.mak install + + Or get the Open Watcom C compiler + and type: + + wmake -f wccwin32.mak clean + wmake -f wccwin32.mak + + + The win32 binaries built with MinGW32 are packed with a patched version of + MinGW's libintl-8.dll that has builtin support for relocation. See also + http://waterlan.home.xs4all.nl/libintl.html and + http://sourceforge.net/tracker/?func=detail&atid=302435&aid=3003879&group_id=2435 + + +WINDOWS 64 BIT PORT + + To compile a version for Windows, get the Mingw-w64 compiler + , and use makefile mingw64.mak: + + make -f mingw64.mak clean + make -f mingw64.mak + make -f mingw64.mak strip + make -f mingw64.mak install + +DOS PORT, 32 BIT + + To compile a version for DOS, get the DJGPP compiler + , and use makefile djgpp.mak: + + make -f djgpp.mak clean + make -f djgpp.mak + make -f djgpp.mak strip + make -f djgpp.mak install + + Or use the OpenWatcom compiler . + + wmake -f wccdos32.mak clean + wmake -f wccdos32.mak + +DOS PORT, 16 BIT + + To compile a version for DOS, use the Borland C compiler 3.1 or 4.0, + and use makefile bcc.mak: + + make -f bcc.mak clean + make -f bcc.mak + + Or use the OpenWatcom compiler . + + wmake -f wccdos16.mak clean + wmake -f wccdos16.mak + +OS/2 PORT + + Using Paul Smedley's build environment, available + at + + make -f os2.mak clean + make -f os2.mak + make -f os2.mak strip + make -f os2.mak install + diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..dbabab8 --- /dev/null +++ b/Makefile @@ -0,0 +1,473 @@ +# Author: Erwin Waterlander +# +# Copyright (C) 2009-2012 Erwin Waterlander +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice in the documentation and/or other materials provided with +# the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY +# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT +# OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR +# BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE +# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +# IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# Description +# +# This is a GNU Makefile that uses GNU compilers, linkers and cpp. The +# platform specific issues are determined by the various OS teets that +# rely on the uname(1) command and directory locations. +# +# Set additional flags for the build with variables CFLAGS_USER, +# DEFS_USER and LDFLAGS_USER. + +include version.mk + +CC = gcc +CPP = cpp +CPP_FLAGS_POD = ALL +STRIP = strip + +PACKAGE = dos2unix +UNIX2DOS = unix2dos +MAC2UNIX = mac2unix +UNIX2MAC = unix2mac + +# Native Language Support (NLS) +ENABLE_NLS = 1 +# Large File Support (LFS) +LFS = 1 +DEBUG = 0 +UCS = 1 + +EXE= + +BIN = $(PACKAGE)$(EXE) +UNIX2DOS_BIN = $(UNIX2DOS)$(EXE) +MAC2UNIX_BIN = $(MAC2UNIX)$(EXE) +UNIX2MAC_BIN = $(UNIX2MAC)$(EXE) + +# DJGPP support linking of .EXEs via 'stubify'. +# See djgpp.mak and http://www.delorie.com/djgpp/v2faq/faq22_5.html + +LINK = ln -sf +LINK_MAN = $(LINK) + +prefix = /usr +exec_prefix = $(prefix) +bindir = $(exec_prefix)/bin +datarootdir = $(prefix)/share +datadir = $(datarootdir) + +docsubdir = $(PACKAGE)-$(DOS2UNIX_VERSION) +docdir = $(datarootdir)/doc/$(docsubdir) +localedir = $(datarootdir)/locale +mandir = $(datarootdir)/man +man1dir = $(mandir)/man1 +manext = .1 +man1ext = .1 + +ifdef ENABLE_NLS + POT = po/$(PACKAGE).pot + POFILES = $(wildcard po/??.po) + MOFILES = $(patsubst %.po,%.mo,$(POFILES)) + EOX_POFILES = po/eo-x.po + NLSSUFFIX = -nls +endif + +HTMLEXT = htm +DOCFILES = $(PACKAGE).txt $(PACKAGE).$(HTMLEXT) +INSTALL_OBJS_DOC = README.txt NEWS.txt ChangeLog.txt COPYING.txt TODO.txt BUGS.txt $(DOCFILES) + +#PODFILES = man/man1/dos2unix.pod $(wildcard man/*/man1/dos2unix.pod) +PODFILES = $(wildcard man/*/man1/dos2unix.pod) +MANFILES = $(patsubst %.pod,%.1,$(PODFILES)) + +# On some systems (e.g. FreeBSD 4.10) GNU install is installed as `ginstall'. +INSTALL = install + +# On some systems (e.g. GNU Win32) GNU mkdir is installed as `gmkdir'. +MKDIR = mkdir + +ifdef ENABLE_NLS + DOS2UNIX_NLSDEFS = -DENABLE_NLS -DLOCALEDIR=\"$(localedir)\" -DPACKAGE=\"$(PACKAGE)\" +endif + +VERSIONSUFFIX = -bin + +# ......................................................... OS flags ... + +OS = + +ifndef OS +ifneq (, $(wildcard /boot/vmlinuz*)) + OS = linux +endif +endif + +ifndef OS +ifeq ($(findstring CYGWIN,$(shell uname)),CYGWIN) + OS = cygwin +endif +endif + +ifeq (cygwin,$(OS)) +ifdef ENABLE_NLS + LDFLAGS_EXTRA = -lintl -liconv -Wl,--enable-auto-import +endif + EXE = .exe + # allow non-cygwin clients which do not understand cygwin + # symbolic links to launch applications... + LINK = ln -f + # but use symbolic links for man pages, since man client + # IS a cygwin app and DOES understand symlinks. + LINK_MAN = ln -fs + # Cygwin packaging standard avoids version numbers on + # documentation directories. + docsubdir = $(PACKAGE) + VERSIONSUFFIX = -cygwin +endif + +ifndef OS +ifeq ($(findstring MSYS,$(shell uname)),MSYS) + OS = msys + EXE = .exe + VERSIONSUFFIX = -msys + EO_XNOTATION=1 + UCS = +ifdef ENABLE_NLS + LDFLAGS_EXTRA = -lintl -liconv +endif +endif +endif + +ifndef OS +ifeq ($(findstring MINGW32,$(shell uname)),MINGW32) + OS = mingw32 + prefix=c:/usr/local + EXE = .exe + VERSIONSUFFIX = -win32 + LINK = cp -f + EO_XNOTATION=1 +ifdef ENABLE_NLS + LDFLAGS_EXTRA = -lintl -liconv + ZIPOBJ_EXTRA = bin/libintl-8.dll bin/libiconv-2.dll +endif +endif +endif + +ifndef OS +ifeq ($(shell uname),MS-DOS) + OS = msdos + prefix=c:/djgpp + EXE = .exe + VERSIONSUFFIX = -dos32 + LINK_MAN = cp -f + docsubdir = dos2unix + EO_XNOTATION=1 + UCS = + ZIPOBJ_EXTRA = bin/cwsdpmi.exe +ifdef ENABLE_NLS + LDFLAGS_EXTRA = -lintl -liconv +endif +endif +endif + +ifndef OS +ifeq (FreeBSD, $(shell uname -s)) + OS = freebsd +ifdef ENABLE_NLS + CFLAGS_OS = -I/usr/local/include + LDFLAGS_EXTRA = -lintl -L/usr/local/lib +endif +endif +endif + +ifeq (Darwin, $(shell uname -s)) + OS = Darwin +ifdef ENABLE_NLS + CFLAGS_OS = -I/usr/local/include + LDFLAGS_EXTRA = -lintl -L/usr/local/lib +endif +endif + + +ifndef OS +ifneq (, $(wildcard /opt/csw)) + OS = sun +endif +endif + +ifeq (sun,$(OS)) + # Running under SunOS/Solaris + LDFLAGS_EXTRA = -lintl +endif + +ifndef OS +ifeq (HP-UX, $(shell uname -s)) + OS = hpux +endif +endif + +ifeq (hpux,$(OS)) + # Running under HP-UX + EXTRA_DEFS += -Dhpux -D_HPUX_SOURCE +endif + +ifndef OS + OS = unknown +endif + +# ............................................................ flags ... + +# For systems that don't support Unicode or Latin-3, select +# Esperanto in X-notation format: EO_XNOTATION=1 + +ifdef EO_XNOTATION +EO_NOTATION = -x +endif + +CFLAGS_USER = +CFLAGS = -O2 -Wall $(RPM_OPT_FLAGS) $(CPPFLAGS) $(CFLAGS_USER) + +EXTRA_CFLAGS = -DVER_REVISION=\"$(DOS2UNIX_VERSION)\" \ + -DVER_DATE=\"$(DOS2UNIX_DATE)\" \ + -DVER_AUTHOR=\"$(DOS2UNIX_AUTHOR)\" \ + -DDEBUG=$(DEBUG) \ + $(CFLAGS_OS) + +ifeq ($(DEBUG), 1) + EXTRA_CFLAGS += -g +endif + +ifdef STATIC + EXTRA_CFLAGS += -static +endif + +ifdef UCS + EXTRA_CFLAGS += -DD2U_UNICODE +endif + +ifdef LFS + EXTRA_CFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 +endif + +LDFLAGS_USER = +LDFLAGS = $(RPM_OPT_FLAGS) $(LDFLAGS_EXTRA) $(LDFLAGS_USER) + +DEFS_USER = +DEFS = $(EXTRA_DEFS) $(DEFS_USER) + +# .......................................................... targets ... + +all: $(BIN) $(MAC2UNIX_BIN) $(UNIX2DOS_BIN) $(UNIX2MAC_BIN) $(DOCFILES) $(MOFILES) $(EOX_POFILES) $(MANFILES) man/man1/dos2unix.1 + +common.o : common.c common.h + $(CC) $(DEFS) $(EXTRA_CFLAGS) $(DOS2UNIX_NLSDEFS) $(CFLAGS) -c $< -o $@ + +querycp.o : querycp.c querycp.h + $(CC) $(DEFS) $(EXTRA_CFLAGS) $(DOS2UNIX_NLSDEFS) $(CFLAGS) -c $< -o $@ + +dos2unix.o : dos2unix.c dos2unix.h querycp.h common.h + $(CC) $(DEFS) $(EXTRA_CFLAGS) $(DOS2UNIX_NLSDEFS) $(CFLAGS) -c $< -o $@ + +unix2dos.o : unix2dos.c unix2dos.h querycp.h common.h + $(CC) $(DEFS) $(EXTRA_CFLAGS) $(DOS2UNIX_NLSDEFS) $(CFLAGS) -c $< -o $@ + +$(BIN): dos2unix.o querycp.o common.o + $(CC) $+ $(LDFLAGS) -o $@ + +$(UNIX2DOS_BIN): unix2dos.o querycp.o common.o + $(CC) $+ $(LDFLAGS) -o $@ + +$(MAC2UNIX_BIN) : $(BIN) + $(LINK) $< $@ + +%.1 : %.pod + $(MAKE) -C man/man1 + +$(UNIX2MAC_BIN) : $(UNIX2DOS_BIN) + $(LINK) $< $@ + +mofiles: $(MOFILES) + +html: $(PACKAGE).$(HTMLEXT) + +txt: $(PACKAGE).txt + +ps: $(PACKAGE).ps + +pdf: $(PACKAGE).pdf + +doc: $(DOCFILES) $(MANFILES) man/man1/dos2unix.1 + +tags: $(POT) + +merge: $(POFILES) $(EOX_POFILES) + +po/%.po : $(POT) + msgmerge -U $@ $(POT) --backup=numbered + # change timestamp in case .po file was not updated. + touch $@ + +%.mo : %.po + msgfmt -c $< -o $@ + +po/eo.mo : po/eo$(EO_NOTATION).po + msgfmt -c $< -o $@ + +$(POT) : dos2unix.c unix2dos.c common.c + xgettext -C --keyword=_ $+ -o $(POT) + +%.txt : man/man1/%.pod + LC_CTYPE=C pod2text $< > $@ + +%.ps : man/man1/%.1 + groff -man $< -T ps > $@ + +%.pdf: %.ps + ps2pdf $< $@ + +%.$(HTMLEXT) : man/man1/%.pod + pod2html --title="$(PACKAGE) $(DOS2UNIX_VERSION) - DOS/MAC to UNIX and vice versa text file format converter" $< > $@ + +install: all + $(MKDIR) -p -m 755 $(DESTDIR)$(bindir) + $(INSTALL) -m 755 $(BIN) $(DESTDIR)$(bindir) + $(INSTALL) -m 755 $(UNIX2DOS_BIN) $(DESTDIR)$(bindir) +ifeq ($(LINK),cp -f) + $(INSTALL) -m 755 $(MAC2UNIX_BIN) $(DESTDIR)$(bindir) + $(INSTALL) -m 755 $(UNIX2MAC_BIN) $(DESTDIR)$(bindir) +else + cd $(DESTDIR)$(bindir); $(LINK) $(BIN) $(MAC2UNIX_BIN) + cd $(DESTDIR)$(bindir); $(LINK) $(UNIX2DOS_BIN) $(UNIX2MAC_BIN) +endif + $(MKDIR) -p -m 755 $(DESTDIR)$(man1dir) + $(INSTALL) -m 644 man/man1/$(PACKAGE).1 $(DESTDIR)$(man1dir) +ifeq ($(LINK_MAN),cp -f) + $(INSTALL) -m 644 man/man1/$(PACKAGE).1 $(DESTDIR)$(man1dir)/$(MAC2UNIX).1 + $(INSTALL) -m 644 man/man1/$(PACKAGE).1 $(DESTDIR)$(man1dir)/$(UNIX2DOS).1 + $(INSTALL) -m 644 man/man1/$(PACKAGE).1 $(DESTDIR)$(man1dir)/$(UNIX2MAC).1 +else + cd $(DESTDIR)$(man1dir); $(LINK_MAN) $(PACKAGE).1 $(MAC2UNIX).1 + cd $(DESTDIR)$(man1dir); $(LINK_MAN) $(PACKAGE).1 $(UNIX2DOS).1 + cd $(DESTDIR)$(man1dir); $(LINK_MAN) $(PACKAGE).1 $(UNIX2MAC).1 +endif + $(foreach manfile, $(MANFILES), $(MKDIR) -p -m 755 $(DESTDIR)$(datarootdir)/$(dir $(manfile)) ;) + $(foreach manfile, $(MANFILES), $(INSTALL) -m 644 $(manfile) $(DESTDIR)$(datarootdir)/$(dir $(manfile)) ;) + $(foreach manfile, $(MANFILES), cd $(DESTDIR)$(datarootdir)/$(dir $(manfile)) ; $(LINK_MAN) $(PACKAGE).1 $(MAC2UNIX).1 ;) + $(foreach manfile, $(MANFILES), cd $(DESTDIR)$(datarootdir)/$(dir $(manfile)) ; $(LINK_MAN) $(PACKAGE).1 $(UNIX2DOS).1 ;) + $(foreach manfile, $(MANFILES), cd $(DESTDIR)$(datarootdir)/$(dir $(manfile)) ; $(LINK_MAN) $(PACKAGE).1 $(UNIX2MAC).1 ;) +ifdef ENABLE_NLS + @echo "-- install-mo" + $(foreach mofile, $(MOFILES), $(MKDIR) -p -m 755 $(DESTDIR)$(localedir)/$(basename $(notdir $(mofile)))/LC_MESSAGES ;) + $(foreach mofile, $(MOFILES), $(INSTALL) -m 644 $(mofile) $(DESTDIR)$(localedir)/$(basename $(notdir $(mofile)))/LC_MESSAGES/$(PACKAGE).mo ;) +endif + @echo "-- install-doc" + $(MKDIR) -p -m 755 $(DESTDIR)$(docdir) + $(INSTALL) -m 644 $(INSTALL_OBJS_DOC) $(wildcard $(PACKAGE).ps) $(wildcard $(PACKAGE).pdf) $(DESTDIR)$(docdir) + +uninstall: + @echo "-- target: uninstall" + -rm -f $(DESTDIR)$(bindir)/$(BIN) + -rm -f $(DESTDIR)$(bindir)/$(MAC2UNIX_BIN) + -rm -f $(DESTDIR)$(bindir)/$(UNIX2DOS_BIN) + -rm -f $(DESTDIR)$(bindir)/$(UNIX2MAC_BIN) +ifdef ENABLE_NLS + $(foreach mofile, $(MOFILES), rm -f $(DESTDIR)$(localedir)/$(basename $(notdir $(mofile)))/LC_MESSAGES/$(PACKAGE).mo ;) +endif + -rm -f $(DESTDIR)$(mandir)/man1/$(PACKAGE).1 + -rm -f $(DESTDIR)$(mandir)/man1/$(MAC2UNIX).1 + -rm -f $(DESTDIR)$(mandir)/man1/$(UNIX2DOS).1 + -rm -f $(DESTDIR)$(mandir)/man1/$(UNIX2MAC).1 + $(foreach manfile, $(MANFILES), rm -f $(DESTDIR)$(datarootdir)/$(manfile) ;) + -rm -rf $(DESTDIR)$(docdir) + +mostlyclean: + rm -f *.o + rm -f $(BIN) $(UNIX2DOS_BIN) $(MAC2UNIX_BIN) $(UNIX2MAC_BIN) + rm -f *.bak *~ + rm -f *.tmp + rm -f man/man1/*.bak man/man1/*~ + rm -f man/*/man1/*.bak man/*/man1/*~ + rm -f po/*.bak po/*~ + rm -f po/*.mo + +clean: mostlyclean + rm -f $(DOCFILES) $(PACKAGE).ps $(PACKAGE).pdf + rm -f man/man1/*.1 + rm -f man/*/man1/*.1 + +distclean: clean + +maintainer-clean: distclean + +realclean: maintainer-clean + + +ZIPOBJ = bin/$(BIN) \ + bin/$(MAC2UNIX_BIN) \ + bin/$(UNIX2DOS_BIN) \ + bin/$(UNIX2MAC_BIN) \ + share/man/man1/$(PACKAGE).1 \ + share/man/man1/$(MAC2UNIX).1 \ + share/man/man1/$(UNIX2DOS).1 \ + share/man/man1/$(UNIX2MAC).1 \ + share/man/*/man1/$(PACKAGE).1 \ + share/man/*/man1/$(MAC2UNIX).1 \ + share/man/*/man1/$(UNIX2DOS).1 \ + share/man/*/man1/$(UNIX2MAC).1 \ + share/doc/$(docsubdir) \ + $(ZIPOBJ_EXTRA) + +ifdef ENABLE_NLS +ZIPOBJ += share/locale/*/LC_MESSAGES/$(PACKAGE).mo +endif + +ZIPFILE = $(PACKAGE)-$(DOS2UNIX_VERSION)$(VERSIONSUFFIX)$(NLSSUFFIX).zip +TGZFILE = $(PACKAGE)-$(DOS2UNIX_VERSION)$(VERSIONSUFFIX)$(NLSSUFFIX).tar.gz +TBZFILE = $(PACKAGE)-$(DOS2UNIX_VERSION)$(VERSIONSUFFIX)$(NLSSUFFIX).tar.bz2 + +dist-zip: + rm -f $(prefix)/$(ZIPFILE) + cd $(prefix) ; unix2dos share/doc/$(docsubdir)/*.txt share/man/man1/$(PACKAGE).1 share/man/man1/$(MAC2UNIX).1 share/man/man1/$(UNIX2DOS).1 share/man/man1/$(UNIX2MAC).1 + cd $(prefix) ; unix2dos share/doc/$(docsubdir)/*.$(HTMLEXT) + cd $(prefix) ; unix2dos share/man/*/man1/$(PACKAGE).1 share/man/*/man1/$(MAC2UNIX).1 share/man/*/man1/$(UNIX2DOS).1 share/man/*/man1/$(UNIX2MAC).1 + cd $(prefix) ; zip -r $(ZIPFILE) $(ZIPOBJ) + mv -f $(prefix)/$(ZIPFILE) .. + +dist-tgz: + cd $(prefix) ; dos2unix share/doc/$(docsubdir)/*.txt share/man/man1/$(PACKAGE).1 share/man/man1/$(MAC2UNIX).1 share/man/man1/$(UNIX2DOS).1 share/man/man1/$(UNIX2MAC).1 + cd $(prefix) ; dos2unix share/man/*/man1/$(PACKAGE).1 share/man/*/man1/$(MAC2UNIX).1 share/man/*/man1/$(UNIX2DOS).1 share/man/*/man1/$(UNIX2MAC).1 + cd $(prefix) ; tar cvzf $(TGZFILE) $(ZIPOBJ) + mv $(prefix)/$(TGZFILE) .. + +dist-tbz: + cd $(prefix) ; dos2unix share/doc/$(docsubdir)/*.txt share/man/man1/$(PACKAGE).1 share/man/man1/$(MAC2UNIX).1 share/man/man1/$(UNIX2DOS).1 share/man/man1/$(UNIX2MAC).1 + cd $(prefix) ; dos2unix share/man/*/man1/$(PACKAGE).1 share/man/*/man1/$(MAC2UNIX).1 share/man/*/man1/$(UNIX2DOS).1 share/man/*/man1/$(UNIX2MAC).1 + cd $(prefix) ; tar cvjf $(TBZFILE) $(ZIPOBJ) + mv $(prefix)/$(TBZFILE) .. + +dist: dist-tgz + +strip: + $(STRIP) $(BIN) + $(STRIP) $(UNIX2DOS_BIN) +ifeq ($(LINK),cp -f) + $(STRIP) $(MAC2UNIX_BIN) + $(STRIP) $(UNIX2MAC_BIN) +endif + +# End of file diff --git a/NEWS.txt b/NEWS.txt new file mode 100644 index 0000000..e34e660 --- /dev/null +++ b/NEWS.txt @@ -0,0 +1,112 @@ +2012-05-06: Version 6.0 + + * Conversion of Windows UTF-16 files to Unix UTF-8 files. + * Conversion of Unix UTF-8 files to Windows UTF-8 files with byte + order mark. + +2012-03-10: Version 5.3.3 + + * Enabled wildcard expansion for all versions. + * Fixed a compilation error when debug was enabled. + +2012-01-27: Version 5.3.2 + + * New homepage URL: http://waterlan.home.xs4all.nl/dos2unix.html + * Compiles for native MSYS. + * Compile with OpenWatcom for DOS32 and Win32. + * Detect code page on OS/2. + * Support wild cards on OS/2. + +2011-08-09: Version 5.3.1 + + * Spanish translation of messages and manual. + * File ownership is maintained in old file mode (Unix only). + * Dos2unix and Unix2dos share the same language files. + * Code cleanup. + +2011-04-26: Version 5.3 + + * Improved handling of symbolic links. New options -F, -R, -S. + * Improved handling and reporting of errors. + * Source code improvements for Cygwin. Behave exactly as on Linux. + * New option --. Treat all following options as file names. + +2011-03-04: Version 5.2.1 + + * PDF and PostScript generation is optional. No default dependency on + GhostScript and Groff. + * Enable optional Large File Support (LFS). + * Esperanto x-notation is optional. No longer installation of non-standard + locale 'eo-x'. + * Improved error messages. + +2011-01-31: Version 5.2 + + * ISO conversion mode supports same DOS code pages as SunOS dos2unix does: + CP437 (US), CP850 (Western European), CP860 (Portuguese), + CP863 (French Canadian), and CP865 (Nordic). + * ISO conversion mode supports Windows code page CP1252 (Western). + * SunOS compatible options -ascii, -iso, -7, -437, -850, -860, -863, and -865. + * Active code page detection for ISO mode. + * Fixed ISO conversion of non-breaking space (NBSP). + * ISO and 7bit mode can be used in Mac mode. + * Treat ASCII Form Feed control characters as valid text. + * Update manual pages. + * Don't include generated documentation files in Unix source package. + * Create a source package in DOS text format. + +2010-08-18: Version 5.1.1 + + * Added Dutch translation of the manual. + * Win64 port. + * Win32 binary package uses patched MinGW's libintl, with builtin + * relocation support. + * Support compilation in DOSBox (8.3 file names where needed). + * Fixed compilation on Darwin OS. + +2010-04-03: Version 5.1 + + * Esperanto translations have been added. + * Ports to 16 bit DOS have been made. + * Command-line options can be set in stdio mode. + * Bugfix dos2unix MAC mode: Don't change DOS line endings. + * Create stubs for DOS32 versions of mac2unix and unix2mac. + * Localization information has been added to the manual. + * Man pages have been merged. + * Man page generation from Perl POD file. + + +2010-02-16: Version 5.0 + + * Dos2unix and Unix2dos have been bundled in a single package. + * German translations have been added. + * Dos2unix -l --newline also works in MAC mode. + * Unix2dos also got option -l, --newline. + * Added MAC mode to Unix2dos: Convert Unix line endings to Mac line endings. + * Cleanup of messages and manual. + +2010-01-24: Version 4.1.2 + + * Preserves file modes in new file mode. + +2010-01-21: Version 4.1.1 + + * Fixes a compilation problem on FreeBSD. + +2009-12-28: Version 4.1 + + Automatically skips binary and non-regular files, + and the ISO mode has been cleaned up (see ChangeLog). + +2009-12-21: Version 4.0.1 + + Adds a port to OS/2 Warp. Two wrong conversions in ISO mode + have been fixed. The manual page has been updated. + +2009-12-15: Version 4.0 + + Adds internationalisation (Native Language Support, NLS). A Dutch + translation has been added. Ports to Windows and DOS have been made. + The problem in DOS/Windows stdio mode has been fixed. The manual has + been updated. + diff --git a/README.txt b/README.txt new file mode 100644 index 0000000..d300e80 --- /dev/null +++ b/README.txt @@ -0,0 +1,90 @@ + +dos2unix - DOS/Mac to Unix and vice versa text file format converter. + + +FILE LIST + + README.txt : This file. + INSTALL.txt : How to build and install. + COPYING.txt : distribution license. + NEWS.txt : Basic change log for users. + ChangeLog.txt : Detailed change log for programmers. + TODO.txt : Things to do. + BUGS.txt : Known bugs and instructions on reporting new ones. + dos2unix.txt : Dos2unix manual, text format. + dos2unix.ps : Dos2unix manual, PostScript format. + dos2unix.pdf : Dos2unix manual, PDF format. + dos2unix.htm : Dos2unix manual, HTML format. + + +HISTORY + + This is an update of Benjamin Lin's implementations of dos2unix and + unix2dos. Benjamin Lin's implementations of dos2unix and unix2dos are + part of several Linux distributions such as RedHat, Fedora, Suse and + others. This update includes all RedHat patches and fixes several + other problems. Internationalization has been added and ports to DOS, + Windows, Cygwin and OS/2 Warp have been made. + + These implementations of dos2unix and unix2dos have been modelled after + dos2unix/unix2dos under SunOS/Solaris. They have similar conversion + modes, namely ascii, 7bit and iso. The first versions were made by + John Birchfield in 1989, and in 1995 rewritten from scratch by Benjamin + Lin. Mac to Unix conversion was added by Bernd Johannes Wuebben in + 1998, Unix to Mac conversion by Erwin Waterlander in 2010. + + Features + + * Native language support: Dutch, English, Esperanto, German, Spanish. + * Automatically skips binary and non-regular files + * In-place, paired, or stdio mode conversion. + * Keep original file dates option. + * 7-bit and iso conversion modes like SunOS dos2unix. + * Conversion of Windows UTF-16 files to Unix UTF-8. + + +AUTHORS + + Erwin Waterlander version 3.2-6.0 2009-2012 + Christian Wurll version 3.1 1998 + Bernd Johannes Wuebben version 3.0 1998 + Benjamin Lin version 1.1-2.3 1994-1995 + John Birchfield version 1.0 1989 + +TRANSLATORS + + Dutch Erwin Waterlander + Esperanto Rugxulo + German Philipp Thomas + Spanish Julio A. Freyre-Gonzalez + +ACKNOWLEDGEMENTS + + Rugxulo query_con_codepage(), code page detection in DOS. + Rugxulo DJGPP stubs for mac2unix and unix2mac. + Jari Aalto Improvements man page. + Jari Aalto Improvments Makefile. + Ben Pfaff Treat form feeds as valid text. + Marc Gianzero Darwin OS port. + Elbert Pol OS/2 port. + Tim Waugh Various patches. + Mike Harris Man page update. + Bernard RosenKraenzer segfault patch. + Tim Powers mkstemp patch. + Miloslav Trmac safeconv patch. + Charles Wilson Follow symbolic links. + Charles Wilson Makefile and code cleanup for Cygwin. + Christopher Williams Maintain file ownership in old file mode. + Steven H. Levine Support wildcard expansion on OS/2. + Steve Hay Support wildcard expansion on win64. + +CONTACT INFORMATION + + Project page : http://waterlan.home.xs4all.nl/dos2unix.html + SourceForge project page : http://sourceforge.net/projects/dos2unix/ + Freecode project page : http://freecode.com/projects/dos2unix/ + + Erwin Waterlander + waterlan@xs4all.nl + http://waterlan.home.xs4all.nl/ + diff --git a/TODO.txt b/TODO.txt new file mode 100644 index 0000000..31b746a --- /dev/null +++ b/TODO.txt @@ -0,0 +1,14 @@ + +TO DO +===== + +* Translations. + + Translate into more languages. Contact Erwin Waterlander + if you want to help (waterlan@xs4all.nl). Programming skills + are not required. + +* Support Windows native symbolic links (Windows Vista and up). + +* Keep original owner in old file mode, on Windows. + diff --git a/bcc.mak b/bcc.mak new file mode 100644 index 0000000..25cbdbe --- /dev/null +++ b/bcc.mak @@ -0,0 +1,55 @@ +!include version.mk + +CC = bcc +DEFINES = -DMSDOS -DVER_REVISION="$(DOS2UNIX_VERSION)" -DVER_DATE="$(DOS2UNIX_DATE)" +CFLAGS = $(DEFINES) -Z -O -w -mc -1 +WILDARGS = c:/bc4/lib/16bit/wildargs.obj + +all: dos2unix.exe unix2dos.exe mac2unix.exe unix2mac.exe + +dos2unix.exe: dos2unix.obj querycp.obj common.obj + bcc -mc dos2unix.obj querycp.obj common.obj $(WILDARGS) noehc.lib + +unix2dos.exe: unix2dos.obj querycp.obj common.obj + bcc -mc unix2dos.obj querycp.obj common.obj $(WILDARGS) noehc.lib + +# remove noehc.lib if you are using Borland C version prior +# to 4.0. noeh?.lib, where ? stands for the memory model, +# removes the C++ exception handling from the startup-code +# which is included by default since Borland 4.0 and +# higher. Including noeh?.lib reduces the executable size +# significant, provided your source is C only. + + +#.c.obj: +# $(CC) -c $(CFLAGS) $< + +dos2unix.obj : dos2unix.c dos2unix.h querycp.h common.h + $(CC) -c $(CFLAGS) -o$@ dos2unix.c + +unix2dos.obj : unix2dos.c unix2dos.h querycp.h common.h + $(CC) -c $(CFLAGS) -o$@ unix2dos.c + +querycp.obj : querycp.c querycp.h querycp.h + $(CC) -c $(CFLAGS) -o$@ querycp.c + +common.obj : querycp.c querycp.h common.h + $(CC) -c $(CFLAGS) -o$@ common.c + +mac2unix.exe: dos2unix.exe + copy /v dos2unix.exe mac2unix.exe + +unix2mac.exe: unix2dos.exe + copy /v unix2dos.exe unix2mac.exe + + +strip : + tdstrip dos2unix.exe + tdstrip unix2dos.exe + tdstrip mac2unix.exe + tdstrip unix2mac.exe + +clean: + del *.obj + del *.exe + diff --git a/common.c b/common.c new file mode 100644 index 0000000..cc111fd --- /dev/null +++ b/common.c @@ -0,0 +1,645 @@ +/* + * Copyright (C) 2009-2012 Erwin Waterlander + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice in the documentation and/or other materials provided with + * the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "common.h" +#if defined(D2U_UNICODE) +#if defined(WIN32) || defined(__CYGWIN__) +#include +#endif +#endif + +#if defined(__GLIBC__) +/* on glibc, canonicalize_file_name() broken prior to 2.4 (06-Mar-2006) */ +# if __GNUC_PREREQ (2,4) +# define USE_CANONICALIZE_FILE_NAME 1 +# endif +#elif defined(__CYGWIN__) +/* on cygwin, canonicalize_file_name() available since api 0/213 */ +/* (1.7.0beta61, 25-Sep-09) */ +# include +# if (CYGWIN_VERSION_DLL_COMBINED >= 213) && (CYGWIN_VERSION_DLL_MAJOR >= 1007) +# define USE_CANONICALIZE_FILE_NAME 1 +# endif +#endif + + +/****************************************************************** + * + * int symbolic_link(char *path) + * + * test if *path points to a file that exists and is a symbolic link + * + * returns 1 on success, 0 when it fails. + * + ******************************************************************/ +int symbolic_link(char *path) +{ +#ifdef S_ISLNK + struct stat buf; + + if (STAT(path, &buf) == 0) + { + if (S_ISLNK(buf.st_mode)) + return(1); + } +#endif + return(0); +} + +/****************************************************************** + * + * int regfile(char *path, int allowSymlinks) + * + * test if *path points to a regular file (or is a symbolic link, + * if allowSymlinks != 0). + * + * returns 0 on success, -1 when it fails. + * + ******************************************************************/ +int regfile(char *path, int allowSymlinks, CFlag *ipFlag, char *progname) +{ + struct stat buf; + char *errstr; + + if (STAT(path, &buf) == 0) + { +#if DEBUG + fprintf(stderr, "%s: %s MODE 0%o ", progname, path, buf.st_mode); +#ifdef S_ISSOCK + if (S_ISSOCK(buf.st_mode)) + fprintf(stderr, " (socket)"); +#endif +#ifdef S_ISLNK + if (S_ISLNK(buf.st_mode)) + fprintf(stderr, " (symbolic link)"); +#endif + if (S_ISREG(buf.st_mode)) + fprintf(stderr, " (regular file)"); + if (S_ISBLK(buf.st_mode)) + fprintf(stderr, " (block device)"); + if (S_ISDIR(buf.st_mode)) + fprintf(stderr, " (directory)"); + if (S_ISCHR(buf.st_mode)) + fprintf(stderr, " (character device)"); + if (S_ISFIFO(buf.st_mode)) + fprintf(stderr, " (FIFO)"); + fprintf(stderr, "\n"); +#endif + if ((S_ISREG(buf.st_mode)) +#ifdef S_ISLNK + || (S_ISLNK(buf.st_mode) && allowSymlinks) +#endif + ) + return(0); + else + return(-1); + } + else + { + if (!ipFlag->Quiet) + { + ipFlag->error = errno; + errstr = strerror(errno); + fprintf(stderr, "%s: %s: %s\n", progname, path, errstr); + } + return(-1); + } +} + +/****************************************************************** + * + * int regfile_target(char *path) + * + * test if *path points to a regular file (follow symbolic link) + * + * returns 0 on success, -1 when it fails. + * + ******************************************************************/ +int regfile_target(char *path, CFlag *ipFlag, char *progname) +{ + struct stat buf; + char *errstr; + + if (stat(path, &buf) == 0) + { + if (S_ISREG(buf.st_mode)) + return(0); + else + return(-1); + } + else + { + if (!ipFlag->Quiet) + { + ipFlag->error = errno; + errstr = strerror(errno); + fprintf(stderr, "%s: %s: %s\n", progname, path, errstr); + } + return(-1); + } +} + +void PrintBSDLicense(void) +{ + fprintf(stderr, "%s", _("\ +Redistribution and use in source and binary forms, with or without\n\ +modification, are permitted provided that the following conditions\n\ +are met:\n\ +1. Redistributions of source code must retain the above copyright\n\ + notice, this list of conditions and the following disclaimer.\n\ +2. Redistributions in binary form must reproduce the above copyright\n\ + notice in the documentation and/or other materials provided with\n\ + the distribution.\n\n\ +\ +THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY\n\ +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n\ +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\n\ +PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE\n\ +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n\ +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT\n\ +OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR\n\ +BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n\ +WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE\n\ +OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN\n\ +IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\ +")); +} + +void PrintUsage(char *progname) +{ + fprintf(stderr, _("\ +%s %s (%s)\n\ +Usage: %s [options] [file ...] [-n infile outfile ...]\n\ + -ascii convert only line breaks (default)\n\ + -iso conversion between DOS and ISO-8859-1 character set\n\ + -1252 Use Windows code page 1252 (Western European)\n\ + -437 Use DOS code page 437 (US) (default)\n\ + -850 Use DOS code page 850 (Western European)\n\ + -860 Use DOS code page 860 (Portuguese)\n\ + -863 Use DOS code page 863 (French Canadian)\n\ + -865 Use DOS code page 865 (Nordic)\n\ + -7 Convert 8 bit characters to 7 bit space\n\ + -c, --convmode conversion mode\n\ + convmode ascii, 7bit, iso, mac, default to ascii\n\ + -f, --force force conversion of binary files\n\ + -h, --help give this help\n\ + -k, --keepdate keep output file date\n\ + -L, --license display software license\n\ + -l, --newline add additional newline\n\ + -m, --add-bom add UTF-8 Byte Order Mark\n\ + -n, --newfile write to new file\n\ + infile original file in new file mode\n\ + outfile output file in new file mode\n\ + -o, --oldfile write to old file\n\ + file ... files to convert in old file mode\n\ + -q, --quiet quiet mode, suppress all warnings\n\ + always on in stdio mode\n\ + -s, --safe skip binary files (default)\n"), + progname, VER_REVISION, VER_DATE, progname); +#ifdef S_ISLNK + fprintf(stderr, _("\ + -F, --follow-symlink follow symbolic links and convert the targets\n\ + -R, --replace-symlink replace symbolic links with converted files\n\ + (original target files remain unchanged)\n\ + -S, --skip-symlink keep symbolic links and targets unchanged (default)\n")); +#endif + fprintf(stderr, _("\ + -V, --version display version number\n")); +} + + +void PrintVersion(char *progname) +{ + fprintf(stderr, "%s %s (%s)\n", progname, VER_REVISION, VER_DATE); +#if DEBUG + fprintf(stderr, "VER_AUTHOR: %s\n", VER_AUTHOR); +#endif +#if defined(__WATCOMC__) && defined(__I86__) + fprintf(stderr, "%s", _("DOS 16 bit version (WATCOMC).\n")); +#elif defined(__TURBOC__) + fprintf(stderr, "%s", _("DOS 16 bit version (TURBOC).\n")); +#elif defined(__WATCOMC__) && defined(__DOS__) + fprintf(stderr, "%s", _("DOS 32 bit version (WATCOMC).\n")); +#elif defined(DJGPP) + fprintf(stderr, "%s", _("DOS 32 bit version (DJGPP).\n")); +#elif defined(__MSYS__) + fprintf(stderr, "%s", _("MSYS version.\n")); +#elif defined(__CYGWIN__) + fprintf(stderr, "%s", _("Cygwin version.\n")); +#elif defined(__WIN64__) + fprintf(stderr, "%s", _("Windows 64 bit version (MinGW-w64).\n")); +#elif defined(__WATCOMC__) && defined(__NT__) + fprintf(stderr, "%s", _("Windows 32 bit version (WATCOMC).\n")); +#elif defined(__WIN32__) + fprintf(stderr, "%s", _("Windows 32 bit version (MinGW).\n")); +#elif defined (__OS2__) /* OS/2 Warp */ + fprintf(stderr, "%s", _("OS/2 version.\n")); +#endif +#ifdef D2U_UNICODE + fprintf(stderr, "%s", _("With Unicode UTF-16 support.\n")); +#else + fprintf(stderr, "%s", _("Without Unicode UTF-16 support.\n")); +#endif +#ifdef ENABLE_NLS + fprintf(stderr, "%s", _("With native language support.\n")); +#else + fprintf(stderr, "%s", "Without native language support.\n"); +#endif +} + +#ifdef ENABLE_NLS +void PrintLocaledir(char *localedir) +{ + fprintf(stderr, "LOCALEDIR: %s\n", localedir); +} +#endif + +/* opens file of name ipFN in read only mode + * RetVal: NULL if failure + * file stream otherwise + */ +FILE* OpenInFile(char *ipFN) +{ + return (fopen(ipFN, R_CNTRL)); +} + + +/* opens file of name ipFN in write only mode + * RetVal: NULL if failure + * file stream otherwise + */ +FILE* OpenOutFile(int fd) +{ + return (fdopen(fd, W_CNTRL)); +} + +#if defined(__TURBOC__) || defined(__MSYS__) +char *dirname(char *path) +{ + char *ptr; + + if (( path == NULL) || (((ptr=strrchr(path,'/')) == NULL) && ((ptr=strrchr(path,'\\')) == NULL)) ) + return "."; + else + { + *ptr = '\0'; + return(path); + } +} +#endif + +#ifdef NO_MKSTEMP +FILE* MakeTempFileFrom(const char *OutFN, char **fname_ret) +#else +int MakeTempFileFrom(const char *OutFN, char **fname_ret) +#endif +{ + char *cpy = strdup(OutFN); + char *dir = NULL; + size_t fname_len = 0; + char *fname_str = NULL; +#ifdef NO_MKSTEMP + char *name; + FILE *fd = NULL; +#else + int fd = -1; +#endif + + *fname_ret = NULL; + + if (!cpy) + goto make_failed; + + dir = dirname(cpy); + + fname_len = strlen(dir) + strlen("/d2utmpXXXXXX") + sizeof (char); + if (!(fname_str = malloc(fname_len))) + goto make_failed; + sprintf(fname_str, "%s%s", dir, "/d2utmpXXXXXX"); + *fname_ret = fname_str; + + free(cpy); + +#ifdef NO_MKSTEMP + name = mktemp(fname_str); + *fname_ret = name; + if ((fd = fopen(fname_str, W_CNTRL)) == NULL) + goto make_failed; +#else + if ((fd = mkstemp(fname_str)) == -1) + goto make_failed; +#endif + + return (fd); + + make_failed: + free(*fname_ret); + *fname_ret = NULL; +#ifdef NO_MKSTEMP + return (NULL); +#else + return (-1); +#endif +} + +/* Test if *lFN is the name of a symbolic link. If not, set *rFN equal + * to lFN, and return 0. If so, then use canonicalize_file_name or + * realpath to determine the pointed-to file; the resulting name is + * stored in newly allocated memory, *rFN is set to point to that value, + * and 1 is returned. On error, -1 is returned and errno is set as + * appropriate. + * + * Note that if symbolic links are not supported, then 0 is always returned + * and *rFN = lFN. + * + * RetVal: 0 if success, and *lFN is not a symlink + * 1 if success, and *lFN is a symlink + * -1 otherwise + */ +int ResolveSymbolicLink(char *lFN, char **rFN, CFlag *ipFlag, char *progname) +{ + int RetVal = 0; +#ifdef S_ISLNK + struct stat StatBuf; + char *errstr; + char *targetFN = NULL; + + if (STAT(lFN, &StatBuf)) + { + if (!ipFlag->Quiet) + { + ipFlag->error = errno; + errstr = strerror(errno); + fprintf(stderr, "%s: %s: %s\n", progname, lFN, errstr); + } + RetVal = -1; + } + else if (S_ISLNK(StatBuf.st_mode)) + { +#if USE_CANONICALIZE_FILE_NAME + targetFN = canonicalize_file_name(lFN); + if (!targetFN) + { + if (!ipFlag->Quiet) + { + errstr = strerror(errno); + fprintf(stderr, "%s: %s: %s\n", progname, lFN, errstr); + ipFlag->error = 1; + } + RetVal = -1; + } + else + { + *rFN = targetFN; + RetVal = 1; + } +#else + /* Sigh. Use realpath, but realize that it has a fatal + * flaw: PATH_MAX isn't necessarily the maximum path + * length -- so realpath() might fail. */ + targetFN = (char *) malloc(PATH_MAX * sizeof(char)); + if (!targetFN) + { + if (!ipFlag->Quiet) + { + errstr = strerror(errno); + fprintf(stderr, "%s: %s: %s\n", progname, lFN, errstr); + ipFlag->error = 1; + } + RetVal = -1; + } + else + { + /* is there any platform with S_ISLNK that does not have realpath? */ + char *rVal = realpath(lFN, targetFN); + if (!rVal) + { + if (!ipFlag->Quiet) + { + errstr = strerror(errno); + fprintf(stderr, "%s: %s: %s\n", progname, lFN, errstr); + ipFlag->error = 1; + } + free(targetFN); + RetVal = -1; + } + else + { + *rFN = rVal; + RetVal = 1; + } + } +#endif /* !USE_CANONICALIZE_FILE_NAME */ + } + else + *rFN = lFN; +#else /* !S_ISLNK */ + *rFN = lFN; +#endif /* !S_ISLNK */ + return RetVal; +} + +FILE *read_bom (FILE *f, int *bomtype) +{ + int bom[3]; + /* BOMs + * UTF16-LE ff fe + * UTF16-BE fe ff + * UTF-8 ef bb bf + */ + + *bomtype = FILE_MBS; + + /* Check for BOM */ + if (f != NULL) + { + if ((bom[0] = fgetc(f)) == EOF) + { + ungetc(bom[0], f); + *bomtype = FILE_MBS; + return(f); + } + if ((bom[0] != 0xff) && (bom[0] != 0xfe) && (bom[0] != 0xef)) + { + ungetc(bom[0], f); + *bomtype = FILE_MBS; + return(f); + } + if ((bom[1] = fgetc(f)) == EOF) + { + ungetc(bom[1], f); + ungetc(bom[0], f); + *bomtype = FILE_MBS; + return(f); + } + if ((bom[0] == 0xff) && (bom[1] == 0xfe)) /* UTF16-LE */ + { + *bomtype = FILE_UTF16LE; + return(f); + } + if ((bom[0] == 0xfe) && (bom[1] == 0xff)) /* UTF16-BE */ + { + *bomtype = FILE_UTF16BE; + return(f); + } + if ((bom[2] = fgetc(f)) == EOF) + { + ungetc(bom[2], f); + ungetc(bom[1], f); + ungetc(bom[0], f); + *bomtype = FILE_MBS; + return(f); + } + if ((bom[0] == 0xef) && (bom[1] == 0xbb) && (bom[2]== 0xbf)) /* UTF-8 */ + { + *bomtype = FILE_UTF8; + return(f); + } + ungetc(bom[2], f); + ungetc(bom[1], f); + ungetc(bom[0], f); + *bomtype = FILE_MBS; + return(f); + } + return(f); +} + + +#ifdef D2U_UNICODE +wint_t d2u_getwc(FILE *f, int bomtype) +{ + int c_trail, c_lead; + wint_t wc; + + if (((c_lead=fgetc(f)) == EOF) || ((c_trail=fgetc(f)) == EOF)) + return(WEOF); + + if (bomtype == FILE_UTF16LE) /* UTF16 little endian */ + { + c_trail <<=8; + wc = (wint_t)(c_trail + c_lead) ; + } else { /* UTF16 big endian */ + c_lead <<=8; + wc = (wint_t)(c_trail + c_lead) ; + } + return(wc); +} + +wint_t d2u_ungetwc(wint_t wc, FILE *f, int bomtype) +{ + int c_trail, c_lead; + + if (bomtype == FILE_UTF16LE) /* UTF16 little endian */ + { + c_trail = (int)(wc & 0xff00); + c_trail >>=8; + c_lead = (int)(wc & 0xff); + } else { /* UTF16 big endian */ + c_lead = (int)(wc & 0xff00); + c_lead >>=8; + c_trail = (int)(wc & 0xff); + } + + /* push back in reverse order */ + if ((ungetc(c_trail,f) == EOF) || (ungetc(c_lead,f) == EOF)) + return(WEOF); + return(wc); +} + +/* Put wide character */ +wint_t d2u_putwc(wint_t wc, FILE *f, CFlag *ipFlag) +{ + static char mbs[8]; + static wchar_t lead, trail; + static wchar_t wstr[3]; + size_t i,len; + + if ((wc >= 0xd800) && (wc < 0xdc00)) + { + /* fprintf(stderr, "UTF-16 lead %x\n",wc); */ + lead = (wchar_t)wc; /* lead (high) surrogate */ + return(wc); + } + if ((wc >= 0xdc00) && (wc < 0xe000)) + { + /* fprintf(stderr, "UTF-16 trail %x\n",wc); */ + trail = (wchar_t)wc; /* trail (low) surrogate */ +#if defined(WIN32) || defined(__CYGWIN__) + /* On Windows (including Cygwin) wchar_t is 16 bit */ + /* We cannot decode an UTF-16 surrogate pair, because it will + not fit in a 16 bit wchar_t. */ + wstr[0] = lead; + wstr[1] = trail; + wstr[2] = L'\0'; +#else + /* On Unix wchar_t is 32 bit */ + /* When we don't decode the UTF-16 surrogate pair, wcstombs() does not + * produce the same UTF-8 as WideCharToMultiByte(). The UTF-8 output + * produced by wcstombs() is bigger, because it just translates the wide + * characters in the range 0xD800..0xDBFF individually to UTF-8 sequences + * (although these code points are reserved for use only as surrogate + * pairs in UTF-16). Probably because on Unix the size of wide char + * (wchar_t) is 32 bit, wcstombs assumes the encoding is UTF-32, and + * ignores UTF-16 surrogates all together. Some smart viewers can still + * display this UTF-8 correctly (like Total Commander lister), however + * the UTF-8 is not readable by Windows Notepad (on Windows 7). When we + * decode the UTF-16 surrogate pairs ourselves the wcstombs() UTF-8 + * output is identical to what WideCharToMultiByte() produces, and is + * readable by Notepad. + */ + /* Decode UTF-16 surrogate pair */ + wstr[0] = 0x10000; + wstr[0] += (lead & 0x03FF) << 10; + wstr[0] += (trail & 0x03FF); + wstr[1] = L'\0'; +#endif + } else { + wstr[0] = (wchar_t)wc; + wstr[1] = L'\0'; + } + +#if defined(WIN32) || defined(__CYGWIN__) + /* On Windows we convert UTF-16 always to UTF-8 */ + len = (size_t)(WideCharToMultiByte(CP_UTF8, 0, wstr, -1, mbs, sizeof(mbs), NULL, NULL) -1); +#else + /* On Unix we convert UTF-16 to the locale encoding */ + len = wcstombs(mbs, wstr, sizeof(mbs)); +#endif + + if ( len == (size_t)(-1) ) + { /* Stop when there is a conversion error */ + ipFlag->status |= UNICODE_CONVERSION_ERROR ; + return(WEOF); + } else { + for (i=0; i +#define _(String) gettext (String) +#define gettext_noop(String) String +#define N_(String) gettext_noop (String) + +#else + +#define _(String) (String) +#define N_(String) String +#define textdomain(Domain) +#define bindtextdomain(Package, Directory) + +#endif + +#if defined(DJGPP) || defined(__TURBOC__) /* DJGPP */ +# include +#else +# ifndef __MSYS__ +# include +# endif +#endif +#ifndef __TURBOC__ +#include +#endif +#include +#include +#include +#include +#include +#ifdef __TURBOC__ +#define __FLAT__ +#endif +#include +#ifdef ENABLE_NLS +#include +#endif +#include +#ifdef D2U_UNICODE +#include +#endif + +#if (defined(__WATCOMC__) && defined(__NT__)) /* Watcom */ +# define WIN32 1 +#endif + +#if defined(__WATCOMC__) && defined(__I86__) /* Watcom C, 16 bit Intel */ +#define MSDOS 1 +#endif + +#if defined(__WATCOMC__) && defined(__DOS__) /* Watcom C, 32 bit DOS */ +#define MSDOS 1 +#endif + +#if defined(WIN32) && !defined(__CYGWIN__) /* Windows */ +#define MSDOS 1 +#endif + +#if defined(__TURBOC__) || defined(DJGPP) || defined(__MINGW32__) +/* Some compilers have no mkstemp(). + * Use mktemp() instead. + * BORLANDC, DJGPP, MINGW32 */ +#define NO_MKSTEMP 1 +#endif + +#if defined(__TURBOC__) || defined(DJGPP) || defined(__MINGW32__) || defined(__WATCOMC__) +/* Some compilers have no chown(). */ +#define NO_CHOWN 1 +#endif + +/* Watcom C defines S_ISLNK */ +#ifdef __WATCOMC__ +#undef S_ISLNK +#endif + +#if defined(MSDOS) || defined(__OS2__) +/* Systems without soft links use 'stat' instead of 'lstat'. */ +#define STAT stat +#else +#define STAT lstat +#endif + +#if defined(MSDOS) || defined(__OS2__) +/* On some systems rename() will always fail if target file already exists. */ +#define NEED_REMOVE 1 +#endif + +#if defined(MSDOS) || defined(__CYGWIN__) || defined(__OS2__) /* DJGPP, MINGW32 and OS/2 */ +/* required for setmode() and O_BINARY */ +#include +#include +#endif + +#if defined(MSDOS) || defined(__CYGWIN__) || defined(__OS2__) + #define R_CNTRL "rb" + #define W_CNTRL "wb" +#else + #define R_CNTRL "r" + #define W_CNTRL "w" +#endif + +#define BINARY_FILE 0x1 +#define NO_REGFILE 0x2 +#define WRONG_CODEPAGE 0x4 +#define OUTPUTFILE_SYMLINK 0x8 +#define INPUT_TARGET_NO_REGFILE 0x10 +#define OUTPUT_TARGET_NO_REGFILE 0x20 +#define LOCALE_NOT_UTF8 0x40 +#define WCHAR_T_TOO_SMALL 0x80 +#define UNICODE_CONVERSION_ERROR 0x100 + +#define CONVMODE_ASCII 0 +#define CONVMODE_7BIT 1 +#define CONVMODE_437 437 +#define CONVMODE_850 850 +#define CONVMODE_860 860 +#define CONVMODE_863 863 +#define CONVMODE_865 865 +#define CONVMODE_1252 1252 + +#define FROMTO_DOS2UNIX 0 +#define FROMTO_MAC2UNIX 1 +#define FROMTO_UNIX2DOS 0 +#define FROMTO_UNIX2MAC 1 + +#define SYMLINK_SKIP 0 +#define SYMLINK_FOLLOW 1 +#define SYMLINK_REPLACE 2 + +#define FILE_MBS 0 /* Multi-byte string or 8-bit char */ +#define FILE_UTF16LE 1 /* UTF-16 Little Endian */ +#define FILE_UTF16BE 2 /* UTF-16 Big Endian */ +#define FILE_UTF8 3 /* UTF-8 */ + +typedef struct +{ + int NewFile; /* is in new file mode? */ + int Quiet; /* is in quiet mode? */ + int KeepDate; /* should keep date stamp? */ + int ConvMode; /* 0: ascii, 1: 7bit, 2: iso */ + int FromToMode; /* 0: dos2unix/unix2dos, 1: mac2unix/unix2mac */ + int NewLine; /* if TRUE, then additional newline */ + int Force; /* if TRUE, force conversion of all files. */ + int Follow; /* 0: skip symlink, 1: follow symbolic link, 2: replace symlink. */ + int status; + int stdio_mode; /* if TRUE, stdio mode */ + int error; /* an error occurred */ + int bomtype; /* byte order mark */ + int add_bom; /* 1: write BOM */ +} CFlag; + + +int symbolic_link(char *path); +int regfile(char *path, int allowSymlinks, CFlag *ipFlag, char *progname); +int regfile_target(char *path, CFlag *ipFlag, char *progname); +void PrintUsage(char *progname); +void PrintBSDLicense(void); +void PrintVersion(char *progname); +#ifdef ENABLE_NLS +void PrintLocaledir(char *localedir); +#endif +FILE* OpenInFile(char *ipFN); +FILE* OpenOutFile(int fd); +#if defined(__TURBOC__) || defined(__MSYS__) +char *dirname(char *path); +#endif +#ifdef NO_MKSTEMP +FILE* MakeTempFileFrom(const char *OutFN, char **fname_ret); +#else +int MakeTempFileFrom(const char *OutFN, char **fname_ret); +#endif +int ResolveSymbolicLink(char *lFN, char **rFN, CFlag *ipFlag, char *progname); +FILE *read_bom (FILE *f, int *bomtype); +#ifdef D2U_UNICODE +wint_t d2u_getwc(FILE *f, int bomtype); +wint_t d2u_ungetwc(wint_t wc, FILE *f, int bomtype); +wint_t d2u_putwc(wint_t wc, FILE *f, CFlag *ipFlag); +#endif + diff --git a/djgpp.mak b/djgpp.mak new file mode 100644 index 0000000..25c0954 --- /dev/null +++ b/djgpp.mak @@ -0,0 +1,36 @@ + +# Author: Erwin Waterlander +# Copyright (C) 2009-2012 Erwin Waterlander +# This file is distributed under the same license as the dos2unix package. + +prefix=c:/djgpp +#ENABLE_NLS=1 +ENABLE_NLS= +VERSIONSUFFIX=-dos32 + +ifdef ENABLE_NLS +LDFLAGS_EXTRA = -lintl -liconv +endif +ZIPOBJ_EXTRA = bin/cwsdpmi.exe + +all: + $(MAKE) all EXE=.exe ENABLE_NLS=$(ENABLE_NLS) LDFLAGS_EXTRA="$(LDFLAGS_EXTRA)" prefix=$(prefix) LINK_MAN="cp -f" docsubdir=dos2unix EO_XNOTATION=1 UCS= + +install: + $(MAKE) install EXE=.exe ENABLE_NLS=$(ENABLE_NLS) LDFLAGS_EXTRA="$(LDFLAGS_EXTRA)" prefix=$(prefix) LINK_MAN="cp -f" docsubdir=dos2unix EO_XNOTATION=1 UCS= + +uninstall: + $(MAKE) uninstall EXE=.exe prefix=$(prefix) docsubdir=dos2unix + +clean: + $(MAKE) clean EXE=.exe ENABLE_NLS=$(ENABLE_NLS) prefix=$(prefix) + +mostlyclean: + $(MAKE) mostlyclean EXE=.exe ENABLE_NLS=$(ENABLE_NLS) prefix=$(prefix) + +dist: + $(MAKE) dist-zip EXE=.exe prefix=$(prefix) VERSIONSUFFIX="$(VERSIONSUFFIX)" ZIPOBJ_EXTRA="${ZIPOBJ_EXTRA}" ENABLE_NLS=$(ENABLE_NLS) docsubdir=dos2unix + +strip: + $(MAKE) strip LINK_MAN="cp -f" EXE=.exe + diff --git a/dos16_gnu.mak b/dos16_gnu.mak new file mode 100644 index 0000000..4c53b29 --- /dev/null +++ b/dos16_gnu.mak @@ -0,0 +1,32 @@ + +# Author: Erwin Waterlander +# Copyright (C) 2009-2011 Erwin Waterlander +# This file is distributed under the same license as the dos2unix package. + +include version.mk + +prefix=c:/dos16 +ENABLE_NLS= + +ifdef ENABLE_NLS +LDFLAGS_EXTRA = -lintl -liconv +endif + +all: + wmake -f wccdos16.mak + +install: + $(MAKE) install EXE=.exe ENABLE_NLS=$(ENABLE_NLS) LDFLAGS_EXTRA="$(LDFLAGS_EXTRA)" prefix=$(prefix) LINK="cp -f" docsubdir=dos2unix + +uninstall: + $(MAKE) uninstall EXE=.exe prefix=$(prefix) docsubdir=dos2unix + +clean: + $(MAKE) clean EXE=.exe ENABLE_NLS=$(ENABLE_NLS) prefix=$(prefix) + +dist: + $(MAKE) dist-zip EXE=.exe prefix=$(prefix) ZIPOBJ_EXTRA="${ZIPOBJ_EXTRA}" ENABLE_NLS=$(ENABLE_NLS) docsubdir=dos2unix ZIPFILE=d2u$(DOS2UNIX_VERSION_SHORT)b.zip + +strip: + wmake -f wccdos16.mak strip + diff --git a/dos2unix.c b/dos2unix.c new file mode 100644 index 0000000..88d3354 --- /dev/null +++ b/dos2unix.c @@ -0,0 +1,1181 @@ +/* + * Name: dos2unix + * Documentation: + * Remove cr ('\x0d') characters from a file. + * + * The dos2unix package is distributed under FreeBSD style license. + * See also http://www.freebsd.org/copyright/freebsd-license.html + * -------- + * + * Copyright (C) 2009-2012 Erwin Waterlander + * Copyright (C) 1998 Christian Wurll + * Copyright (C) 1998 Bernd Johannes Wuebben + * Copyright (C) 1994-1995 Benjamin Lin. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice in the documentation and/or other materials provided with + * the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * == 1.0 == 1989.10.04 == John Birchfield (jb@koko.csustan.edu) + * == 1.1 == 1994.12.20 == Benjamin Lin (blin@socs.uts.edu.au) + * Cleaned up for Borland C/C++ 4.02 + * == 1.2 == 1995.03.16 == Benjamin Lin (blin@socs.uts.edu.au) + * Modified to more conform to UNIX style. + * == 2.0 == 1995.03.19 == Benjamin Lin (blin@socs.uts.edu.au) + * Rewritten from scratch. + * == 2.1 == 1995.03.29 == Benjamin Lin (blin@socs.uts.edu.au) + * Conversion to SunOS charset implemented. + * == 2.2 == 1995.03.30 == Benjamin Lin (blin@socs.uts.edu.au) + * Fixed a bug in 2.1 where in new file mode, if outfile already exists + * conversion can not be completed properly. + * + * Added Mac text file translation, i.e. \r to \n conversion + * Bernd Johannes Wuebben, wuebben@kde.org + * Wed Feb 4 19:12:58 EST 1998 + * + * Added extra newline if ^M occurs + * Christian Wurll, wurll@ira.uka.de + * Thu Nov 19 1998 + * + * See ChangeLog.txt for complete version history. + * + */ + + +/* #define DEBUG 1 */ + +#include "common.h" +#include "dos2unix.h" +#include "querycp.h" +#ifdef D2U_UNICODE +#ifndef MSDOS /* Unix, Cygwin */ +# include +#endif +#endif + +void PrintLicense(void) +{ + fprintf(stderr, "%s", _("\ +Copyright (C) 2009-2012 Erwin Waterlander\n\ +Copyright (C) 1998 Christian Wurll (Version 3.1)\n\ +Copyright (C) 1998 Bernd Johannes Wuebben (Version 3.0)\n\ +Copyright (C) 1994-1995 Benjamin Lin\n\ +All rights reserved.\n\n")); + PrintBSDLicense(); +} + +#ifdef D2U_UNICODE +void StripDelimiterW(FILE* ipInF, FILE* ipOutF, CFlag *ipFlag, wint_t CurChar) +{ + wint_t TempNextChar; + /* CurChar is always CR (x0d) */ + /* In normal dos2unix mode put nothing (skip CR). */ + /* Don't modify Mac files when in dos2unix mode. */ + if ( (TempNextChar = d2u_getwc(ipInF, ipFlag->bomtype)) != WEOF) { + d2u_ungetwc( TempNextChar, ipInF, ipFlag->bomtype); /* put back peek char */ + if ( TempNextChar != 0x0a ) { + d2u_putwc( CurChar, ipOutF, ipFlag); /* Mac line, put back CR */ + } + } + else if ( CurChar == 0x0d ) { /* EOF: last Mac line delimiter (CR)? */ + d2u_putwc( CurChar, ipOutF, ipFlag); + } + if (ipFlag->NewLine) { /* add additional LF? */ + d2u_putwc(0x0a, ipOutF, ipFlag); + } +} +#endif + +void StripDelimiter(FILE* ipInF, FILE* ipOutF, CFlag *ipFlag, int CurChar) +{ + int TempNextChar; + /* CurChar is always CR (x0d) */ + /* In normal dos2unix mode put nothing (skip CR). */ + /* Don't modify Mac files when in dos2unix mode. */ + if ( (TempNextChar = fgetc(ipInF)) != EOF) { + ungetc( TempNextChar, ipInF ); /* put back peek char */ + if ( TempNextChar != '\x0a' ) { + fputc( CurChar, ipOutF ); /* Mac line, put back CR */ + } + } + else if ( CurChar == '\x0d' ) { /* EOF: last Mac line delimiter (CR)? */ + fputc( CurChar, ipOutF ); + } + if (ipFlag->NewLine) { /* add additional LF? */ + fputc('\x0a', ipOutF); + } +} + +/* converts stream ipInF to UNIX format text and write to stream ipOutF + * RetVal: 0 if success + * -1 otherwise + */ +#ifdef D2U_UNICODE +int ConvertDosToUnixW(FILE* ipInF, FILE* ipOutF, CFlag *ipFlag, char *progname) +{ + int RetVal = 0; + wint_t TempChar; + wint_t TempNextChar; + + ipFlag->status = 0; + + /* CR-LF -> LF */ + /* LF -> LF, in case the input file is a Unix text file */ + /* CR -> CR, in dos2unix mode (don't modify Mac file) */ + /* CR -> LF, in Mac mode */ + /* \x0a = Newline/Line Feed (LF) */ + /* \x0d = Carriage Return (CR) */ + + switch (ipFlag->FromToMode) + { + case FROMTO_DOS2UNIX: /* dos2unix */ + while ((TempChar = d2u_getwc(ipInF, ipFlag->bomtype)) != WEOF) { /* get character */ + if ((ipFlag->Force == 0) && + (TempChar < 32) && + (TempChar != 0x0a) && /* Not an LF */ + (TempChar != 0x0d) && /* Not a CR */ + (TempChar != 0x09) && /* Not a TAB */ + (TempChar != 0x0c)) { /* Not a form feed */ + RetVal = -1; + ipFlag->status |= BINARY_FILE ; + break; + } + if (TempChar != 0x0d) { + if (d2u_putwc(TempChar, ipOutF, ipFlag) == WEOF) { + RetVal = -1; + if (!ipFlag->Quiet) + { + if (!(ipFlag->status & UNICODE_CONVERSION_ERROR)) + { + fprintf(stderr, "%s: ", progname); + fprintf(stderr, "%s", _("can not write to output file\n")); + } + } + break; + } + } else { + StripDelimiterW( ipInF, ipOutF, ipFlag, TempChar ); + } + } + break; + case FROMTO_MAC2UNIX: /* mac2unix */ + while ((TempChar = d2u_getwc(ipInF, ipFlag->bomtype)) != WEOF) { + if ((ipFlag->Force == 0) && + (TempChar < 32) && + (TempChar != 0x0a) && /* Not an LF */ + (TempChar != 0x0d) && /* Not a CR */ + (TempChar != 0x09) && /* Not a TAB */ + (TempChar != 0x0c)) { /* Not a form feed */ + RetVal = -1; + ipFlag->status |= BINARY_FILE ; + break; + } + if ((TempChar != 0x0d)) + { + if(d2u_putwc(TempChar, ipOutF, ipFlag) == WEOF){ + RetVal = -1; + if (!ipFlag->Quiet) + { + if (!(ipFlag->status & UNICODE_CONVERSION_ERROR)) + { + fprintf(stderr, "%s: ", progname); + fprintf(stderr, "%s", _("can not write to output file\n")); + } + } + break; + } + } + else{ + /* TempChar is a CR */ + if ( (TempNextChar = d2u_getwc(ipInF, ipFlag->bomtype)) != WEOF) { + ungetc( TempNextChar, ipInF ); /* put back peek char */ + /* Don't touch this delimiter if it's a CR,LF pair. */ + if ( TempNextChar == 0x0a ) { + d2u_putwc(0x0d, ipOutF, ipFlag); /* put CR, part of DOS CR-LF */ + continue; + } + } + if (d2u_putwc(0x0a, ipOutF, ipFlag) == WEOF) /* MAC line end (CR). Put LF */ + { + RetVal = -1; + if (!ipFlag->Quiet) + { + if (!(ipFlag->status & UNICODE_CONVERSION_ERROR)) + { + fprintf(stderr, "%s: ", progname); + fprintf(stderr, "%s", _("can not write to output file\n")); + } + } + break; + } + if (ipFlag->NewLine) { /* add additional LF? */ + d2u_putwc(0x0a, ipOutF, ipFlag); + } + } + } + break; + default: /* unknown FromToMode */ + ; +#if DEBUG + fprintf(stderr, "%s: ", progname); + fprintf(stderr, _("program error, invalid conversion mode %d\n"),ipFlag->FromToMode); + exit(1); +#endif + } + return RetVal; +} +#endif + +/* converts stream ipInF to UNIX format text and write to stream ipOutF + * RetVal: 0 if success + * -1 otherwise + */ +int ConvertDosToUnix(FILE* ipInF, FILE* ipOutF, CFlag *ipFlag, char *progname) +{ + int RetVal = 0; + int TempChar; + int TempNextChar; + int *ConvTable; + + ipFlag->status = 0; + + switch (ipFlag->ConvMode) + { + case CONVMODE_ASCII: /* ascii */ + ConvTable = D2UAsciiTable; + break; + case CONVMODE_7BIT: /* 7bit */ + ConvTable = D2U7BitTable; + break; + case CONVMODE_437: /* iso */ + ConvTable = D2UIso437Table; + break; + case CONVMODE_850: /* iso */ + ConvTable = D2UIso850Table; + break; + case CONVMODE_860: /* iso */ + ConvTable = D2UIso860Table; + break; + case CONVMODE_863: /* iso */ + ConvTable = D2UIso863Table; + break; + case CONVMODE_865: /* iso */ + ConvTable = D2UIso865Table; + break; + case CONVMODE_1252: /* iso */ + ConvTable = D2UIso1252Table; + break; + default: /* unknown convmode */ + ipFlag->status |= WRONG_CODEPAGE ; + return(-1); + } + if ((ipFlag->ConvMode > 1) && (!ipFlag->Quiet)) /* not ascii or 7bit */ + { + fprintf(stderr, "%s: ", progname); + fprintf(stderr, _("using code page %d.\n"), ipFlag->ConvMode); + } + + /* CR-LF -> LF */ + /* LF -> LF, in case the input file is a Unix text file */ + /* CR -> CR, in dos2unix mode (don't modify Mac file) */ + /* CR -> LF, in Mac mode */ + /* \x0a = Newline/Line Feed (LF) */ + /* \x0d = Carriage Return (CR) */ + + switch (ipFlag->FromToMode) + { + case FROMTO_DOS2UNIX: /* dos2unix */ + while ((TempChar = fgetc(ipInF)) != EOF) { /* get character */ + if ((ipFlag->Force == 0) && + (TempChar < 32) && + (TempChar != '\x0a') && /* Not an LF */ + (TempChar != '\x0d') && /* Not a CR */ + (TempChar != '\x09') && /* Not a TAB */ + (TempChar != '\x0c')) { /* Not a form feed */ + RetVal = -1; + ipFlag->status |= BINARY_FILE ; + break; + } + if (TempChar != '\x0d') { + if (fputc(ConvTable[TempChar], ipOutF) == EOF) { + RetVal = -1; + if (!ipFlag->Quiet) + { + fprintf(stderr, "%s: ", progname); + fprintf(stderr, "%s", _("can not write to output file\n")); + } + break; + } + } else { + StripDelimiter( ipInF, ipOutF, ipFlag, TempChar ); + } + } + break; + case FROMTO_MAC2UNIX: /* mac2unix */ + while ((TempChar = fgetc(ipInF)) != EOF) { + if ((ipFlag->Force == 0) && + (TempChar < 32) && + (TempChar != '\x0a') && /* Not an LF */ + (TempChar != '\x0d') && /* Not a CR */ + (TempChar != '\x09') && /* Not a TAB */ + (TempChar != '\x0c')) { /* Not a form feed */ + RetVal = -1; + ipFlag->status |= BINARY_FILE ; + break; + } + if ((TempChar != '\x0d')) + { + if(fputc(ConvTable[TempChar], ipOutF) == EOF){ + RetVal = -1; + if (!ipFlag->Quiet) + { + fprintf(stderr, "%s: ", progname); + fprintf(stderr, "%s", _("can not write to output file\n")); + } + break; + } + } + else{ + /* TempChar is a CR */ + if ( (TempNextChar = fgetc(ipInF)) != EOF) { + ungetc( TempNextChar, ipInF ); /* put back peek char */ + /* Don't touch this delimiter if it's a CR,LF pair. */ + if ( TempNextChar == '\x0a' ) { + fputc('\x0d', ipOutF); /* put CR, part of DOS CR-LF */ + continue; + } + } + if (fputc('\x0a', ipOutF) == EOF) /* MAC line end (CR). Put LF */ + { + RetVal = -1; + if (!ipFlag->Quiet) + { + fprintf(stderr, "%s: ", progname); + fprintf(stderr, "%s", _("can not write to output file\n")); + } + break; + } + if (ipFlag->NewLine) { /* add additional LF? */ + fputc('\x0a', ipOutF); + } + } + } + break; + default: /* unknown FromToMode */ + ; +#if DEBUG + fprintf(stderr, "%s: ", progname); + fprintf(stderr, _("program error, invalid conversion mode %d\n"),ipFlag->FromToMode); + exit(1); +#endif + } + return RetVal; +} + +/* convert file ipInFN to UNIX format text and write to file ipOutFN + * RetVal: 0 if success + * -1 otherwise + */ +int ConvertDosToUnixNewFile(char *ipInFN, char *ipOutFN, CFlag *ipFlag, char *progname) +{ + int RetVal = 0; + FILE *InF = NULL; + FILE *TempF = NULL; + char *TempPath; + char *errstr; + struct stat StatBuf; + struct utimbuf UTimeBuf; +#ifndef NO_CHMOD + mode_t mask; +#endif +#ifdef NO_MKSTEMP + FILE* fd; +#else + int fd; +#endif + char *TargetFN = NULL; + int ResolveSymlinkResult = 0; + + ipFlag->status = 0 ; + + /* Test if output file is a symbolic link */ + if (symbolic_link(ipOutFN) && !ipFlag->Follow) + { + ipFlag->status |= OUTPUTFILE_SYMLINK ; + /* Not a failure, skipping input file according spec. (keep symbolic link unchanged) */ + return -1; + } + + /* Test if input file is a regular file or symbolic link */ + if (regfile(ipInFN, 1, ipFlag, progname)) + { + ipFlag->status |= NO_REGFILE ; + /* Not a failure, skipping non-regular input file according spec. */ + return -1; + } + + /* Test if input file target is a regular file */ + if (symbolic_link(ipInFN) && regfile_target(ipInFN, ipFlag,progname)) + { + ipFlag->status |= INPUT_TARGET_NO_REGFILE ; + /* Not a failure, skipping non-regular input file according spec. */ + return -1; + } + + /* Test if output file target is a regular file */ + if (symbolic_link(ipOutFN) && (ipFlag->Follow == SYMLINK_FOLLOW) && regfile_target(ipOutFN, ipFlag,progname)) + { + ipFlag->status |= OUTPUT_TARGET_NO_REGFILE ; + /* Failure, input is regular, cannot produce output. */ + if (!ipFlag->error) ipFlag->error = 1; + return -1; + } + + /* retrieve ipInFN file date stamp */ + if (stat(ipInFN, &StatBuf)) + { + if (!ipFlag->Quiet) + { + ipFlag->error = errno; + errstr = strerror(errno); + fprintf(stderr, "%s: %s: %s\n", progname, ipInFN, errstr); + } + RetVal = -1; + } + +#ifdef NO_MKSTEMP + if((fd = MakeTempFileFrom(ipOutFN, &TempPath))==NULL) { +#else + if((fd = MakeTempFileFrom (ipOutFN, &TempPath)) < 0) { +#endif + if (!ipFlag->Quiet) + { + ipFlag->error = errno; + errstr = strerror(errno); + fprintf(stderr, "%s: ", progname); + fprintf(stderr, _("Failed to open temporary output file: %s\n"), errstr); + } + RetVal = -1; + } + +#if DEBUG + fprintf(stderr, "%s: ", progname); + fprintf(stderr, _("using %s as temporary file\n"), TempPath); +#endif + + /* can open in file? */ + if (!RetVal) + { + InF=OpenInFile(ipInFN); + if (InF == NULL) + { + ipFlag->error = errno; + errstr = strerror(errno); + fprintf(stderr, "%s: %s: %s\n", progname, ipInFN, errstr); + RetVal = -1; + } + } + + /* can open output file? */ + if ((!RetVal) && (InF)) + { +#ifdef NO_MKSTEMP + if ((TempF=fd) == NULL) + { +#else + if ((TempF=OpenOutFile(fd)) == NULL) + { + ipFlag->error = errno; + errstr = strerror(errno); + fprintf(stderr, "%s: %s\n", progname, errstr); +#endif + fclose (InF); + InF = NULL; + RetVal = -1; + } + } + + InF = read_bom(InF, &ipFlag->bomtype); + +#ifdef D2U_UNICODE +#ifndef MSDOS /* Unix, Cygwin */ + if ((ipFlag->bomtype == FILE_UTF16LE) || (ipFlag->bomtype == FILE_UTF16BE)) + { + if (strcmp(nl_langinfo(CODESET), "UTF-8") != 0) + { + /* Don't convert UTF-16 files when the locale encoding is not UTF-8 + * to prevent loss of characters. */ + ipFlag->status |= LOCALE_NOT_UTF8 ; + if (!ipFlag->error) ipFlag->error = 1; + RetVal = -1; + } + } +#endif +#if !defined(WIN32) && !defined(__CYGWIN__) /* Not Windows or Cygwin */ + if ((ipFlag->bomtype == FILE_UTF16LE) || (ipFlag->bomtype == FILE_UTF16BE)) + { + if (sizeof(wchar_t) < 4) + { + /* A decoded UTF-16 surrogate pair must fit in a wchar_t */ + ipFlag->status |= WCHAR_T_TOO_SMALL ; + if (!ipFlag->error) ipFlag->error = 1; + RetVal = -1; + } + } +#endif +#endif + + if (ipFlag->add_bom) + fprintf(TempF, "%s", "\xEF\xBB\xBF"); /* UTF-8 BOM */ + + /* Turn off ISO and 7-bit conversion for Unicode text files */ + if (ipFlag->bomtype > 0) + ipFlag->ConvMode = CONVMODE_ASCII; + + /* conversion sucessful? */ +#ifdef D2U_UNICODE + if ((ipFlag->bomtype == FILE_UTF16LE) || (ipFlag->bomtype == FILE_UTF16BE)) + { + if ((!RetVal) && (ConvertDosToUnixW(InF, TempF, ipFlag, progname))) + RetVal = -1; + if (ipFlag->status & UNICODE_CONVERSION_ERROR) + { + if (!ipFlag->error) ipFlag->error = 1; + RetVal = -1; + } + } else { + if ((!RetVal) && (ConvertDosToUnix(InF, TempF, ipFlag, progname))) + RetVal = -1; + } +#else + if ((!RetVal) && (ConvertDosToUnix(InF, TempF, ipFlag, progname))) + RetVal = -1; +#endif + + /* can close in file? */ + if ((InF) && (fclose(InF) == EOF)) + RetVal = -1; + + /* can close output file? */ + if ((TempF) && (fclose(TempF) == EOF)) + RetVal = -1; + +#ifdef NO_MKSTEMP + if(fd!=NULL) + fclose(fd); +#else + if(fd>=0) + close(fd); +#endif + +#ifndef NO_CHMOD + if (!RetVal) + { + if (ipFlag->NewFile == 0) /* old file mode */ + { + RetVal = chmod (TempPath, StatBuf.st_mode); /* set original permissions */ + } + else + { + mask = umask(0); /* get process's umask */ + umask(mask); /* set umask back to original */ + RetVal = chmod(TempPath, StatBuf.st_mode & ~mask); /* set original permissions, minus umask */ + } + + if (RetVal) + { + if (!ipFlag->Quiet) + { + ipFlag->error = errno; + errstr = strerror(errno); + fprintf(stderr, "%s: ", progname); + fprintf(stderr, _("Failed to change the permissions of temporary output file %s: %s\n"), TempPath, errstr); + } + } + } +#endif + +#ifndef NO_CHOWN + if (!RetVal && (ipFlag->NewFile == 0)) /* old file mode */ + { + /* Change owner and group of the the tempory output file to the original file's uid and gid. */ + /* Required when a different user (e.g. root) has write permission on the original file. */ + /* Make sure that the original owner can still access the file. */ + if (chown(TempPath, StatBuf.st_uid, StatBuf.st_gid)) + { + if (!ipFlag->Quiet) + { + ipFlag->error = errno; + errstr = strerror(errno); + fprintf(stderr, "%s: ", progname); + fprintf(stderr, _("Failed to change the owner and group of temporary output file %s: %s\n"), TempPath, errstr); + } + RetVal = -1; + } + } +#endif + + if ((!RetVal) && (ipFlag->KeepDate)) + { + UTimeBuf.actime = StatBuf.st_atime; + UTimeBuf.modtime = StatBuf.st_mtime; + /* can change output file time to in file time? */ + if (utime(TempPath, &UTimeBuf) == -1) + { + if (!ipFlag->Quiet) + { + ipFlag->error = errno; + errstr = strerror(errno); + fprintf(stderr, "%s: %s: %s\n", progname, TempPath, errstr); + } + RetVal = -1; + } + } + + /* any error? cleanup the temp file */ + if (RetVal && (TempPath != NULL)) + { + if (unlink(TempPath) && (errno != ENOENT)) + { + if (!ipFlag->Quiet) + { + ipFlag->error = errno; + errstr = strerror(errno); + fprintf(stderr, "%s: %s: %s\n", progname, TempPath, errstr); + } + RetVal = -1; + } + } + + /* If output file is a symbolic link, optional resolve the link and modify */ + /* the target, instead of removing the link and creating a new regular file */ + TargetFN = ipOutFN; + if (symbolic_link(ipOutFN) && !RetVal) + { + ResolveSymlinkResult = 0; /* indicates that TargetFN need not be freed */ + if (ipFlag->Follow == SYMLINK_FOLLOW) + { + ResolveSymlinkResult = ResolveSymbolicLink(ipOutFN, &TargetFN, ipFlag, progname); + if (ResolveSymlinkResult < 0) + { + if (!ipFlag->Quiet) + { + fprintf(stderr, "%s: ", progname); + fprintf(stderr, _("problems resolving symbolic link '%s'\n"), ipOutFN); + fprintf(stderr, _(" output file remains in '%s'\n"), TempPath); + } + RetVal = -1; + } + } + } + + /* can rename temporary file to output file? */ + if (!RetVal) + { +#ifdef NEED_REMOVE + if (unlink(TargetFN) && (errno != ENOENT)) + { + if (!ipFlag->Quiet) + { + ipFlag->error = errno; + errstr = strerror(errno); + fprintf(stderr, "%s: %s: %s\n", progname, TargetFN, errstr); + } + RetVal = -1; + } +#endif + if (rename(TempPath, TargetFN) == -1) + { + if (!ipFlag->Quiet) + { + ipFlag->error = errno; + errstr = strerror(errno); + fprintf(stderr, "%s: ", progname); + fprintf(stderr, _("problems renaming '%s' to '%s': %s\n"), TempPath, TargetFN, errstr); +#ifdef S_ISLNK + if (ResolveSymlinkResult > 0) + fprintf(stderr, _(" which is the target of symbolic link '%s'\n"), ipOutFN); +#endif + fprintf(stderr, _(" output file remains in '%s'\n"), TempPath); + } + RetVal = -1; + } + + if (ResolveSymlinkResult > 0) + free(TargetFN); + } + free(TempPath); + return RetVal; +} + +/* convert stdin to UNIX format text and write to stdout + * RetVal: 0 if success + * -1 otherwise + */ +int ConvertDosToUnixStdio(CFlag *ipFlag, char *progname) +{ + ipFlag->NewFile = 1; + ipFlag->Quiet = 1; + ipFlag->KeepDate = 0; + ipFlag->Force = 1; + +#if defined(WIN32) && !defined(__CYGWIN__) + + /* stdin and stdout are by default text streams. We need + * to set them to binary mode. Otherwise an LF will + * automatically be converted to CR-LF on DOS/Windows. + * Erwin */ + + /* 'setmode' was deprecated by MicroSoft + * since Visual C++ 2005. Use '_setmode' instead. */ + + _setmode(fileno(stdout), O_BINARY); + _setmode(fileno(stdin), O_BINARY); +#elif defined(MSDOS) || defined(__CYGWIN__) || defined(__OS2__) + setmode(fileno(stdout), O_BINARY); + setmode(fileno(stdin), O_BINARY); +#endif + + read_bom(stdin, &ipFlag->bomtype); + + if (ipFlag->add_bom) + fprintf(stdout, "%s", "\xEF\xBB\xBF"); /* UTF-8 BOM */ + +#ifdef D2U_UNICODE + if ((ipFlag->bomtype == FILE_UTF16LE) || (ipFlag->bomtype == FILE_UTF16BE)) + { + return (ConvertDosToUnixW(stdin, stdout, ipFlag, progname)); + } else { + return (ConvertDosToUnix(stdin, stdout, ipFlag, progname)); + } +#else + return (ConvertDosToUnix(stdin, stdout, ipFlag, progname)); +#endif +} + + +int main (int argc, char *argv[]) +{ + /* variable declarations */ + char progname[9]; + int ArgIdx; + int CanSwitchFileMode; + int ShouldExit; + int RetVal = 0; + int process_options = 1; + CFlag *pFlag; + char *ptr; +#ifdef ENABLE_NLS + char localedir[1024]; +#endif +# ifdef __MINGW64__ + int _dowildcard = -1; /* enable wildcard expansion for Win64 */ +# endif + + progname[8] = '\0'; + strcpy(progname,"dos2unix"); + +#ifdef ENABLE_NLS + ptr = getenv("DOS2UNIX_LOCALEDIR"); + if (ptr == NULL) + strcpy(localedir,LOCALEDIR); + else + { + if (strlen(ptr) < sizeof(localedir)) + strcpy(localedir,ptr); + else + { + fprintf(stderr,"%s: ",progname); + fprintf(stderr, "%s", _("error: Value of environment variable DOS2UNIX_LOCALEDIR is too long.\n")); + strcpy(localedir,LOCALEDIR); + } + } + + setlocale (LC_ALL, ""); + bindtextdomain (PACKAGE, localedir); + textdomain (PACKAGE); +#endif + + + /* variable initialisations */ + ArgIdx = 0; + CanSwitchFileMode = 1; + ShouldExit = 0; + pFlag = (CFlag*)malloc(sizeof(CFlag)); + pFlag->NewFile = 0; + pFlag->Quiet = 0; + pFlag->KeepDate = 0; + pFlag->ConvMode = CONVMODE_ASCII; /* default ascii */ + pFlag->FromToMode = FROMTO_DOS2UNIX; /* default dos2unix */ + pFlag->NewLine = 0; + pFlag->Force = 0; + pFlag->Follow = SYMLINK_SKIP; + pFlag->status = 0; + pFlag->stdio_mode = 1; + pFlag->error = 0; +#ifdef D2U_UNICODE + pFlag->bomtype = FILE_MBS; +#endif + pFlag->add_bom = 0; + + if ( ((ptr=strrchr(argv[0],'/')) == NULL) && ((ptr=strrchr(argv[0],'\\')) == NULL) ) + ptr = argv[0]; + else + ptr++; + + if ((strcmpi("mac2unix", ptr) == 0) || (strcmpi("mac2unix.exe", ptr) == 0)) + { + pFlag->FromToMode = FROMTO_MAC2UNIX; + strcpy(progname,"mac2unix"); + } + + while ((++ArgIdx < argc) && (!ShouldExit)) + { + /* is it an option? */ + if ((argv[ArgIdx][0] == '-') && process_options) + { + /* an option */ + if (strcmp(argv[ArgIdx],"--") == 0) + process_options = 0; + else if ((strcmp(argv[ArgIdx],"-h") == 0) || (strcmp(argv[ArgIdx],"--help") == 0)) + { + PrintUsage(progname); + return(pFlag->error); + } + else if ((strcmp(argv[ArgIdx],"-k") == 0) || (strcmp(argv[ArgIdx],"--keepdate") == 0)) + pFlag->KeepDate = 1; + else if ((strcmp(argv[ArgIdx],"-f") == 0) || (strcmp(argv[ArgIdx],"--force") == 0)) + pFlag->Force = 1; + else if ((strcmp(argv[ArgIdx],"-s") == 0) || (strcmp(argv[ArgIdx],"--safe") == 0)) + pFlag->Force = 0; + else if ((strcmp(argv[ArgIdx],"-q") == 0) || (strcmp(argv[ArgIdx],"--quiet") == 0)) + pFlag->Quiet = 1; + else if ((strcmp(argv[ArgIdx],"-l") == 0) || (strcmp(argv[ArgIdx],"--newline") == 0)) + pFlag->NewLine = 1; + else if ((strcmp(argv[ArgIdx],"-m") == 0) || (strcmp(argv[ArgIdx],"--add-bom") == 0)) + pFlag->add_bom = 1; + else if ((strcmp(argv[ArgIdx],"-S") == 0) || (strcmp(argv[ArgIdx],"--skip-symlink") == 0)) + pFlag->Follow = SYMLINK_SKIP; + else if ((strcmp(argv[ArgIdx],"-F") == 0) || (strcmp(argv[ArgIdx],"--follow-symlink") == 0)) + pFlag->Follow = SYMLINK_FOLLOW; + else if ((strcmp(argv[ArgIdx],"-R") == 0) || (strcmp(argv[ArgIdx],"--replace-symlink") == 0)) + pFlag->Follow = SYMLINK_REPLACE; + else if ((strcmp(argv[ArgIdx],"-V") == 0) || (strcmp(argv[ArgIdx],"--version") == 0)) + { + PrintVersion(progname); +#ifdef ENABLE_NLS + PrintLocaledir(localedir); +#endif + return(pFlag->error); + } + else if ((strcmp(argv[ArgIdx],"-L") == 0) || (strcmp(argv[ArgIdx],"--license") == 0)) + { + PrintLicense(); + return(pFlag->error); + } + else if (strcmp(argv[ArgIdx],"-ascii") == 0) /* SunOS compatible options */ + pFlag->ConvMode = CONVMODE_ASCII; + else if (strcmp(argv[ArgIdx],"-7") == 0) + pFlag->ConvMode = CONVMODE_7BIT; + else if (strcmp(argv[ArgIdx],"-iso") == 0) + { + pFlag->ConvMode = (int)query_con_codepage(); + if (!pFlag->Quiet) + { + fprintf(stderr,"%s: ",progname); + fprintf(stderr,_("active code page: %d\n"), pFlag->ConvMode); + } + if (pFlag->ConvMode < 2) + pFlag->ConvMode = CONVMODE_437; + } + else if (strcmp(argv[ArgIdx],"-437") == 0) + pFlag->ConvMode = CONVMODE_437; + else if (strcmp(argv[ArgIdx],"-850") == 0) + pFlag->ConvMode = CONVMODE_850; + else if (strcmp(argv[ArgIdx],"-860") == 0) + pFlag->ConvMode = CONVMODE_860; + else if (strcmp(argv[ArgIdx],"-863") == 0) + pFlag->ConvMode = CONVMODE_863; + else if (strcmp(argv[ArgIdx],"-865") == 0) + pFlag->ConvMode = CONVMODE_865; + else if (strcmp(argv[ArgIdx],"-1252") == 0) + pFlag->ConvMode = CONVMODE_1252; + else if ((strcmp(argv[ArgIdx],"-c") == 0) || (strcmp(argv[ArgIdx],"--convmode") == 0)) + { + if (++ArgIdx < argc) + { + if (strcmpi(argv[ArgIdx],"ascii") == 0) /* Benjamin Lin's legacy options */ + pFlag->ConvMode = CONVMODE_ASCII; + else if (strcmpi(argv[ArgIdx], "7bit") == 0) + pFlag->ConvMode = CONVMODE_7BIT; + else if (strcmpi(argv[ArgIdx], "iso") == 0) + { + pFlag->ConvMode = (int)query_con_codepage(); + if (!pFlag->Quiet) + { + fprintf(stderr,"%s: ",progname); + fprintf(stderr,_("active code page: %d\n"), pFlag->ConvMode); + } + if (pFlag->ConvMode < 2) + pFlag->ConvMode = CONVMODE_437; + } + else if (strcmpi(argv[ArgIdx], "mac") == 0) + pFlag->FromToMode = FROMTO_MAC2UNIX; + else + { + fprintf(stderr,"%s: ",progname); + fprintf(stderr, _("invalid %s conversion mode specified\n"),argv[ArgIdx]); + pFlag->error = 1; + ShouldExit = 1; + pFlag->stdio_mode = 0; + } + } + else + { + ArgIdx--; + fprintf(stderr,"%s: ",progname); + fprintf(stderr,_("option '%s' requires an argument\n"),argv[ArgIdx]); + pFlag->error = 1; + ShouldExit = 1; + pFlag->stdio_mode = 0; + } + } + + else if ((strcmp(argv[ArgIdx],"-o") == 0) || (strcmp(argv[ArgIdx],"--oldfile") == 0)) + { + /* last convert not paired */ + if (!CanSwitchFileMode) + { + fprintf(stderr,"%s: ",progname); + fprintf(stderr, _("target of file %s not specified in new file mode\n"), argv[ArgIdx-1]); + pFlag->error = 1; + ShouldExit = 1; + pFlag->stdio_mode = 0; + } + pFlag->NewFile = 0; + } + + else if ((strcmp(argv[ArgIdx],"-n") == 0) || (strcmp(argv[ArgIdx],"--newfile") == 0)) + { + /* last convert not paired */ + if (!CanSwitchFileMode) + { + fprintf(stderr,"%s: ",progname); + fprintf(stderr, _("target of file %s not specified in new file mode\n"), argv[ArgIdx-1]); + pFlag->error = 1; + ShouldExit = 1; + pFlag->stdio_mode = 0; + } + pFlag->NewFile = 1; + } + else { /* wrong option */ + PrintUsage(progname); + ShouldExit = 1; + pFlag->error = 1; + pFlag->stdio_mode = 0; + } + } + else + { + pFlag->stdio_mode = 0; + /* not an option */ + if (pFlag->NewFile) + { + if (CanSwitchFileMode) + CanSwitchFileMode = 0; + else + { + RetVal = ConvertDosToUnixNewFile(argv[ArgIdx-1], argv[ArgIdx], pFlag, progname); + if (pFlag->status & NO_REGFILE) + { + if (!pFlag->Quiet) + { + fprintf(stderr,"%s: ",progname); + fprintf(stderr, _("Skipping %s, not a regular file.\n"), argv[ArgIdx-1]); + } + } else if (pFlag->status & OUTPUTFILE_SYMLINK) + { + if (!pFlag->Quiet) + { + fprintf(stderr,"%s: ",progname); + fprintf(stderr, _("Skipping %s, output file %s is a symbolic link.\n"), argv[ArgIdx-1], argv[ArgIdx]); + } + } else if (pFlag->status & INPUT_TARGET_NO_REGFILE) + { + if (!pFlag->Quiet) + { + fprintf(stderr,"%s: ",progname); + fprintf(stderr, _("Skipping symbolic link %s, target is not a regular file.\n"), argv[ArgIdx-1]); + } + } else if (pFlag->status & OUTPUT_TARGET_NO_REGFILE) + { + if (!pFlag->Quiet) + { + fprintf(stderr,"%s: ",progname); + fprintf(stderr, _("Skipping %s, target of symbolic link %s is not a regular file.\n"), argv[ArgIdx-1], argv[ArgIdx]); + } + } else if (pFlag->status & BINARY_FILE) + { + if (!pFlag->Quiet) + { + fprintf(stderr,"%s: ",progname); + fprintf(stderr, _("Skipping binary file %s\n"), argv[ArgIdx-1]); + } + } else if (pFlag->status & WRONG_CODEPAGE) + { + if (!pFlag->Quiet) + { + fprintf(stderr,"%s: ",progname); + fprintf(stderr, _("code page %d is not supported.\n"), pFlag->ConvMode); + } + } else if (pFlag->status & LOCALE_NOT_UTF8) + { + if (!pFlag->Quiet) + { + fprintf(stderr,"%s: ",progname); + fprintf(stderr, _("Skipping UTF-16 file %s, the current locale character encoding is not UTF-8.\n"), argv[ArgIdx-1]); + } + } else if (pFlag->status & WCHAR_T_TOO_SMALL) + { + if (!pFlag->Quiet) + { + fprintf(stderr,"%s: ",progname); + fprintf(stderr, _("Skipping UTF-16 file %s, the size of wchar_t is %d bytes.\n"), argv[ArgIdx-1], (int)sizeof(wchar_t)); + } + } else if (pFlag->status & UNICODE_CONVERSION_ERROR) + { + if (!pFlag->Quiet) + { + fprintf(stderr,"%s: ",progname); + fprintf(stderr, _("Skipping UTF-16 file %s, an UTF-16 conversion error occurred.\n"), argv[ArgIdx-1]); + } + } else { + if (!pFlag->Quiet) + { + fprintf(stderr,"%s: ",progname); + fprintf(stderr, _("converting file %s to file %s in Unix format ...\n"), argv[ArgIdx-1], argv[ArgIdx]); + } + if (RetVal) + { + if (!pFlag->Quiet) + { + fprintf(stderr,"%s: ",progname); + fprintf(stderr, _("problems converting file %s to file %s\n"), argv[ArgIdx-1], argv[ArgIdx]); + } + } + } + CanSwitchFileMode = 1; + } + } + else + { + RetVal = ConvertDosToUnixNewFile(argv[ArgIdx], argv[ArgIdx], pFlag, progname); + if (pFlag->status & NO_REGFILE) + { + if (!pFlag->Quiet) + { + fprintf(stderr,"%s: ",progname); + fprintf(stderr, _("Skipping %s, not a regular file.\n"), argv[ArgIdx]); + } + } else if (pFlag->status & OUTPUTFILE_SYMLINK) + { + if (!pFlag->Quiet) + { + fprintf(stderr,"%s: ",progname); + fprintf(stderr, _("Skipping symbolic link %s.\n"), argv[ArgIdx]); + } + } else if (pFlag->status & INPUT_TARGET_NO_REGFILE) + { + if (!pFlag->Quiet) + { + fprintf(stderr,"%s: ",progname); + fprintf(stderr, _("Skipping symbolic link %s, target is not a regular file.\n"), argv[ArgIdx]); + } + } else if (pFlag->status & BINARY_FILE) + { + if (!pFlag->Quiet) + { + fprintf(stderr,"%s: ",progname); + fprintf(stderr, _("Skipping binary file %s\n"), argv[ArgIdx]); + } + } else if (pFlag->status & WRONG_CODEPAGE) + { + if (!pFlag->Quiet) + { + fprintf(stderr,"%s: ",progname); + fprintf(stderr, _("code page %d is not supported.\n"), pFlag->ConvMode); + } + } else if (pFlag->status & LOCALE_NOT_UTF8) + { + if (!pFlag->Quiet) + { + fprintf(stderr,"%s: ",progname); + fprintf(stderr, _("Skipping UTF-16 file %s, the current locale character encoding is not UTF-8.\n"), argv[ArgIdx]); + } + } else if (pFlag->status & WCHAR_T_TOO_SMALL) + { + if (!pFlag->Quiet) + { + fprintf(stderr,"%s: ",progname); + fprintf(stderr, _("Skipping UTF-16 file %s, the size of wchar_t is %d bytes.\n"), argv[ArgIdx], (int)sizeof(wchar_t)); + } + } else if (pFlag->status & UNICODE_CONVERSION_ERROR) + { + if (!pFlag->Quiet) + { + fprintf(stderr,"%s: ",progname); + fprintf(stderr, _("Skipping UTF-16 file %s, an UTF-16 conversion error occurred.\n"), argv[ArgIdx]); + } + } else { + if (!pFlag->Quiet) + { + fprintf(stderr,"%s: ",progname); + fprintf(stderr, _("converting file %s to Unix format ...\n"), argv[ArgIdx]); + } + if (RetVal) + { + if (!pFlag->Quiet) + { + fprintf(stderr,"%s: ",progname); + fprintf(stderr, _("problems converting file %s\n"), argv[ArgIdx]); + } + } + } + } + } + } + + /* no file argument, use stdin and stdout */ + if (pFlag->stdio_mode) + { + exit(ConvertDosToUnixStdio(pFlag, progname)); + } + + + if (!CanSwitchFileMode) + { + fprintf(stderr,"%s: ",progname); + fprintf(stderr, _("target of file %s not specified in new file mode\n"), argv[ArgIdx-1]); + pFlag->error = 1; + } + return (pFlag->error); +} + diff --git a/dos2unix.h b/dos2unix.h new file mode 100644 index 0000000..247d6a5 --- /dev/null +++ b/dos2unix.h @@ -0,0 +1,222 @@ +/* + * Copyright (C) 2009-2011 Erwin Waterlander + * Copyright (C) 1994-1995 Benjamin Lin. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice in the documentation and/or other materials provided with + * the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef __DOS2UNIX_H +#define __DOS2UNIX_H + +#ifdef __GNUC__ +#ifndef strcmpi +# define strcmpi(s1, s2) strcasecmp(s1, s2) +#endif +#endif + +/* ASCII mode. No conversion. */ + +static int D2UAsciiTable[256] = +{ + '\x00', '\x01', '\x02', '\x03', '\x04', '\x05', '\x06', '\x07', '\x08', '\x09', '\x0a', '\x0b', '\x0c', '\x0d', '\x0e', '\x0f', + '\x10', '\x11', '\x12', '\x13', '\x14', '\x15', '\x16', '\x17', '\x18', '\x19', '\x1a', '\x1b', '\x1c', '\x1d', '\x1e', '\x1f', + '\x20', '\x21', '\x22', '\x23', '\x24', '\x25', '\x26', '\x27', '\x28', '\x29', '\x2a', '\x2b', '\x2c', '\x2d', '\x2e', '\x2f', + '\x30', '\x31', '\x32', '\x33', '\x34', '\x35', '\x36', '\x37', '\x38', '\x39', '\x3a', '\x3b', '\x3c', '\x3d', '\x3e', '\x3f', + '\x40', '\x41', '\x42', '\x43', '\x44', '\x45', '\x46', '\x47', '\x48', '\x49', '\x4a', '\x4b', '\x4c', '\x4d', '\x4e', '\x4f', + '\x50', '\x51', '\x52', '\x53', '\x54', '\x55', '\x56', '\x57', '\x58', '\x59', '\x5a', '\x5b', '\x5c', '\x5d', '\x5e', '\x5f', + '\x60', '\x61', '\x62', '\x63', '\x64', '\x65', '\x66', '\x67', '\x68', '\x69', '\x6a', '\x6b', '\x6c', '\x6d', '\x6e', '\x6f', + '\x70', '\x71', '\x72', '\x73', '\x74', '\x75', '\x76', '\x77', '\x78', '\x79', '\x7a', '\x7b', '\x7c', '\x7d', '\x7e', '\x7f', + '\x80', '\x81', '\x82', '\x83', '\x84', '\x85', '\x86', '\x87', '\x88', '\x89', '\x8a', '\x8b', '\x8c', '\x8d', '\x8e', '\x8f', + '\x90', '\x91', '\x92', '\x93', '\x94', '\x95', '\x96', '\x97', '\x98', '\x99', '\x9a', '\x9b', '\x9c', '\x9d', '\x9e', '\x9f', + '\xa0', '\xa1', '\xa2', '\xa3', '\xa4', '\xa5', '\xa6', '\xa7', '\xa8', '\xa9', '\xaa', '\xab', '\xac', '\xad', '\xae', '\xaf', + '\xb0', '\xb1', '\xb2', '\xb3', '\xb4', '\xb5', '\xb6', '\xb7', '\xb8', '\xb9', '\xba', '\xbb', '\xbc', '\xbd', '\xbe', '\xbf', + '\xc0', '\xc1', '\xc2', '\xc3', '\xc4', '\xc5', '\xc6', '\xc7', '\xc8', '\xc9', '\xca', '\xcb', '\xcc', '\xcd', '\xce', '\xcf', + '\xd0', '\xd1', '\xd2', '\xd3', '\xd4', '\xd5', '\xd6', '\xd7', '\xd8', '\xd9', '\xda', '\xdb', '\xdc', '\xdd', '\xde', '\xdf', + '\xe0', '\xe1', '\xe2', '\xe3', '\xe4', '\xe5', '\xe6', '\xe7', '\xe8', '\xe9', '\xea', '\xeb', '\xec', '\xed', '\xee', '\xef', + '\xf0', '\xf1', '\xf2', '\xf3', '\xf4', '\xf5', '\xf6', '\xf7', '\xf8', '\xf9', '\xfa', '\xfb', '\xfc', '\xfd', '\xfe', '\xff', +}; + + +/* 7bit mode. */ +/* All 8 bit non-ASCII characters are converted to a space (\x20) */ + +static int D2U7BitTable[256] = +{ + '\x00', '\x01', '\x02', '\x03', '\x04', '\x05', '\x06', '\x07', '\x08', '\x09', '\x0a', '\x0b', '\x0c', '\x0d', '\x0e', '\x0f', + '\x10', '\x11', '\x12', '\x13', '\x14', '\x15', '\x16', '\x17', '\x18', '\x19', '\x1a', '\x1b', '\x1c', '\x1d', '\x1e', '\x1f', + '\x20', '\x21', '\x22', '\x23', '\x24', '\x25', '\x26', '\x27', '\x28', '\x29', '\x2a', '\x2b', '\x2c', '\x2d', '\x2e', '\x2f', + '\x30', '\x31', '\x32', '\x33', '\x34', '\x35', '\x36', '\x37', '\x38', '\x39', '\x3a', '\x3b', '\x3c', '\x3d', '\x3e', '\x3f', + '\x40', '\x41', '\x42', '\x43', '\x44', '\x45', '\x46', '\x47', '\x48', '\x49', '\x4a', '\x4b', '\x4c', '\x4d', '\x4e', '\x4f', + '\x50', '\x51', '\x52', '\x53', '\x54', '\x55', '\x56', '\x57', '\x58', '\x59', '\x5a', '\x5b', '\x5c', '\x5d', '\x5e', '\x5f', + '\x60', '\x61', '\x62', '\x63', '\x64', '\x65', '\x66', '\x67', '\x68', '\x69', '\x6a', '\x6b', '\x6c', '\x6d', '\x6e', '\x6f', + '\x70', '\x71', '\x72', '\x73', '\x74', '\x75', '\x76', '\x77', '\x78', '\x79', '\x7a', '\x7b', '\x7c', '\x7d', '\x7e', '\x7f', + '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', + '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', + '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', + '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', + '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', + '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', + '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', + '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', +}; + + +/* CP437 -> ISO-8859-1 */ +/* Non-convertable characters are converted to a dot (\x2e) */ + +static int D2UIso437Table[256] = +{ + '\x00', '\x01', '\x02', '\x03', '\x04', '\x05', '\x06', '\x07', '\x08', '\x09', '\x0a', '\x0b', '\x0c', '\x0d', '\x0e', '\x0f', + '\x10', '\x11', '\x12', '\x13', '\x14', '\x15', '\x16', '\x17', '\x18', '\x19', '\x1a', '\x1b', '\x1c', '\x1d', '\x1e', '\x1f', + '\x20', '\x21', '\x22', '\x23', '\x24', '\x25', '\x26', '\x27', '\x28', '\x29', '\x2a', '\x2b', '\x2c', '\x2d', '\x2e', '\x2f', + '\x30', '\x31', '\x32', '\x33', '\x34', '\x35', '\x36', '\x37', '\x38', '\x39', '\x3a', '\x3b', '\x3c', '\x3d', '\x3e', '\x3f', + '\x40', '\x41', '\x42', '\x43', '\x44', '\x45', '\x46', '\x47', '\x48', '\x49', '\x4a', '\x4b', '\x4c', '\x4d', '\x4e', '\x4f', + '\x50', '\x51', '\x52', '\x53', '\x54', '\x55', '\x56', '\x57', '\x58', '\x59', '\x5a', '\x5b', '\x5c', '\x5d', '\x5e', '\x5f', + '\x60', '\x61', '\x62', '\x63', '\x64', '\x65', '\x66', '\x67', '\x68', '\x69', '\x6a', '\x6b', '\x6c', '\x6d', '\x6e', '\x6f', + '\x70', '\x71', '\x72', '\x73', '\x74', '\x75', '\x76', '\x77', '\x78', '\x79', '\x7a', '\x7b', '\x7c', '\x7d', '\x7e', '\x7f', + '\xc7', '\xfc', '\xe9', '\xe2', '\xe4', '\xe0', '\xe5', '\xe7', '\xea', '\xeb', '\xe8', '\xef', '\xee', '\xec', '\xc4', '\xc5', + '\xc9', '\xe6', '\xc6', '\xf4', '\xf6', '\xf2', '\xfb', '\xf9', '\xff', '\xd6', '\xdc', '\xa2', '\xa3', '\xa5', '\x2e', '\x2e', + '\xe1', '\xed', '\xf3', '\xfa', '\xf1', '\xd1', '\xaa', '\xba', '\xbf', '\x2e', '\xac', '\xbd', '\xbc', '\xa1', '\xab', '\xbb', + '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', + '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', + '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', + '\x2e', '\xdf', '\x2e', '\x2e', '\x2e', '\x2e', '\xb5', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', + '\x2e', '\xb1', '\x2e', '\x2e', '\x2e', '\x2e', '\xf7', '\x2e', '\xb0', '\x2e', '\xb7', '\x2e', '\x2e', '\xb2', '\x2e', '\xa0', +}; + +/* CP850 -> ISO-8859-1 */ +/* Non-convertable characters are converted to a dot (\x2e) */ + +static int D2UIso850Table[256] = +{ + '\x00', '\x01', '\x02', '\x03', '\x04', '\x05', '\x06', '\x07', '\x08', '\x09', '\x0a', '\x0b', '\x0c', '\x0d', '\x0e', '\x0f', + '\x10', '\x11', '\x12', '\x13', '\x14', '\x15', '\x16', '\x17', '\x18', '\x19', '\x1a', '\x1b', '\x1c', '\x1d', '\x1e', '\x1f', + '\x20', '\x21', '\x22', '\x23', '\x24', '\x25', '\x26', '\x27', '\x28', '\x29', '\x2a', '\x2b', '\x2c', '\x2d', '\x2e', '\x2f', + '\x30', '\x31', '\x32', '\x33', '\x34', '\x35', '\x36', '\x37', '\x38', '\x39', '\x3a', '\x3b', '\x3c', '\x3d', '\x3e', '\x3f', + '\x40', '\x41', '\x42', '\x43', '\x44', '\x45', '\x46', '\x47', '\x48', '\x49', '\x4a', '\x4b', '\x4c', '\x4d', '\x4e', '\x4f', + '\x50', '\x51', '\x52', '\x53', '\x54', '\x55', '\x56', '\x57', '\x58', '\x59', '\x5a', '\x5b', '\x5c', '\x5d', '\x5e', '\x5f', + '\x60', '\x61', '\x62', '\x63', '\x64', '\x65', '\x66', '\x67', '\x68', '\x69', '\x6a', '\x6b', '\x6c', '\x6d', '\x6e', '\x6f', + '\x70', '\x71', '\x72', '\x73', '\x74', '\x75', '\x76', '\x77', '\x78', '\x79', '\x7a', '\x7b', '\x7c', '\x7d', '\x7e', '\x7f', + '\xc7', '\xfc', '\xe9', '\xe2', '\xe4', '\xe0', '\xe5', '\xe7', '\xea', '\xeb', '\xe8', '\xef', '\xee', '\xec', '\xc4', '\xc5', + '\xc9', '\xe6', '\xc6', '\xf4', '\xf6', '\xf2', '\xfb', '\xf9', '\xff', '\xd6', '\xdc', '\xf8', '\xa3', '\xd8', '\xd7', '\x2e', + '\xe1', '\xed', '\xf3', '\xfa', '\xf1', '\xd1', '\xaa', '\xba', '\xbf', '\xae', '\xac', '\xbd', '\xbc', '\xa1', '\xab', '\xbb', + '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\xc1', '\xc2', '\xc0', '\xa9', '\x2e', '\x2e', '\x2e', '\x2e', '\xa2', '\xa5', '\x2e', + '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\xe3', '\xc3', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\xa4', + '\xf0', '\xd0', '\xca', '\xcb', '\xc8', '\x2e', '\xcd', '\xce', '\xcf', '\x2e', '\x2e', '\x2e', '\x2e', '\xa6', '\xcc', '\x2e', + '\xd3', '\xdf', '\xd4', '\xd2', '\xf5', '\xd5', '\xb5', '\xfe', '\xde', '\xda', '\xdb', '\xd9', '\xfd', '\xdd', '\xaf', '\xb4', + '\xad', '\xb1', '\x2e', '\xbe', '\xb6', '\xa7', '\xf7', '\xb8', '\xb0', '\xa8', '\xb7', '\xb9', '\xb3', '\xb2', '\x2e', '\xa0', +}; + +/* CP860 -> ISO-8859-1 */ +/* Non-convertable characters are converted to a dot (\x2e) */ + +static int D2UIso860Table[256] = +{ + '\x00', '\x01', '\x02', '\x03', '\x04', '\x05', '\x06', '\x07', '\x08', '\x09', '\x0a', '\x0b', '\x0c', '\x0d', '\x0e', '\x0f', + '\x10', '\x11', '\x12', '\x13', '\x14', '\x15', '\x16', '\x17', '\x18', '\x19', '\x1a', '\x1b', '\x1c', '\x1d', '\x1e', '\x1f', + '\x20', '\x21', '\x22', '\x23', '\x24', '\x25', '\x26', '\x27', '\x28', '\x29', '\x2a', '\x2b', '\x2c', '\x2d', '\x2e', '\x2f', + '\x30', '\x31', '\x32', '\x33', '\x34', '\x35', '\x36', '\x37', '\x38', '\x39', '\x3a', '\x3b', '\x3c', '\x3d', '\x3e', '\x3f', + '\x40', '\x41', '\x42', '\x43', '\x44', '\x45', '\x46', '\x47', '\x48', '\x49', '\x4a', '\x4b', '\x4c', '\x4d', '\x4e', '\x4f', + '\x50', '\x51', '\x52', '\x53', '\x54', '\x55', '\x56', '\x57', '\x58', '\x59', '\x5a', '\x5b', '\x5c', '\x5d', '\x5e', '\x5f', + '\x60', '\x61', '\x62', '\x63', '\x64', '\x65', '\x66', '\x67', '\x68', '\x69', '\x6a', '\x6b', '\x6c', '\x6d', '\x6e', '\x6f', + '\x70', '\x71', '\x72', '\x73', '\x74', '\x75', '\x76', '\x77', '\x78', '\x79', '\x7a', '\x7b', '\x7c', '\x7d', '\x7e', '\x7f', + '\xc7', '\xfc', '\xe9', '\xe2', '\xe3', '\xe0', '\xc1', '\xe7', '\xea', '\xca', '\xe8', '\xcd', '\xd4', '\xec', '\xc3', '\xc2', + '\xc9', '\xc0', '\xc8', '\xf4', '\xf5', '\xf2', '\xda', '\xf9', '\xcc', '\xd5', '\xdc', '\xa2', '\xa3', '\xd9', '\x2e', '\xd3', + '\xe1', '\xed', '\xf3', '\xfa', '\xf1', '\xd1', '\xaa', '\xba', '\xbf', '\xd2', '\xac', '\xbd', '\xbc', '\xa1', '\xab', '\xbb', + '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', + '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', + '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', + '\x2e', '\xdf', '\x2e', '\x2e', '\x2e', '\x2e', '\xb5', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', + '\x2e', '\xb1', '\x2e', '\x2e', '\x2e', '\x2e', '\xf7', '\x2e', '\xb0', '\x2e', '\xb7', '\x2e', '\x2e', '\xb2', '\x2e', '\xa0', +}; + +/* CP863 -> ISO-8859-1 */ +/* Non-convertable characters are converted to a dot (\x2e) */ + +static int D2UIso863Table[256] = +{ + '\x00', '\x01', '\x02', '\x03', '\x04', '\x05', '\x06', '\x07', '\x08', '\x09', '\x0a', '\x0b', '\x0c', '\x0d', '\x0e', '\x0f', + '\x10', '\x11', '\x12', '\x13', '\x14', '\x15', '\x16', '\x17', '\x18', '\x19', '\x1a', '\x1b', '\x1c', '\x1d', '\x1e', '\x1f', + '\x20', '\x21', '\x22', '\x23', '\x24', '\x25', '\x26', '\x27', '\x28', '\x29', '\x2a', '\x2b', '\x2c', '\x2d', '\x2e', '\x2f', + '\x30', '\x31', '\x32', '\x33', '\x34', '\x35', '\x36', '\x37', '\x38', '\x39', '\x3a', '\x3b', '\x3c', '\x3d', '\x3e', '\x3f', + '\x40', '\x41', '\x42', '\x43', '\x44', '\x45', '\x46', '\x47', '\x48', '\x49', '\x4a', '\x4b', '\x4c', '\x4d', '\x4e', '\x4f', + '\x50', '\x51', '\x52', '\x53', '\x54', '\x55', '\x56', '\x57', '\x58', '\x59', '\x5a', '\x5b', '\x5c', '\x5d', '\x5e', '\x5f', + '\x60', '\x61', '\x62', '\x63', '\x64', '\x65', '\x66', '\x67', '\x68', '\x69', '\x6a', '\x6b', '\x6c', '\x6d', '\x6e', '\x6f', + '\x70', '\x71', '\x72', '\x73', '\x74', '\x75', '\x76', '\x77', '\x78', '\x79', '\x7a', '\x7b', '\x7c', '\x7d', '\x7e', '\x7f', + '\xc7', '\xfc', '\xe9', '\xe2', '\xc2', '\xe0', '\xb6', '\xe7', '\xea', '\xeb', '\xe8', '\xef', '\xee', '\x2e', '\xc0', '\xa7', + '\xc9', '\xc8', '\xca', '\xf4', '\xcb', '\xcf', '\xfb', '\xf9', '\xa4', '\xd4', '\xdc', '\xa2', '\xa3', '\xd9', '\xdb', '\x2e', + '\xa6', '\xb4', '\xf3', '\xfa', '\xa8', '\xb8', '\xb3', '\xaf', '\xce', '\x2e', '\xac', '\xbd', '\xbc', '\xbe', '\xab', '\xbb', + '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', + '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', + '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', + '\x2e', '\xdf', '\x2e', '\x2e', '\x2e', '\x2e', '\xb5', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', + '\x2e', '\xb1', '\x2e', '\x2e', '\x2e', '\x2e', '\xf7', '\x2e', '\xb0', '\x2e', '\xb7', '\x2e', '\x2e', '\xb2', '\x2e', '\xa0', +}; + +/* CP865 -> ISO-8859-1 */ +/* Non-convertable characters are converted to a dot (\x2e) */ + +static int D2UIso865Table[256] = +{ + '\x00', '\x01', '\x02', '\x03', '\x04', '\x05', '\x06', '\x07', '\x08', '\x09', '\x0a', '\x0b', '\x0c', '\x0d', '\x0e', '\x0f', + '\x10', '\x11', '\x12', '\x13', '\x14', '\x15', '\x16', '\x17', '\x18', '\x19', '\x1a', '\x1b', '\x1c', '\x1d', '\x1e', '\x1f', + '\x20', '\x21', '\x22', '\x23', '\x24', '\x25', '\x26', '\x27', '\x28', '\x29', '\x2a', '\x2b', '\x2c', '\x2d', '\x2e', '\x2f', + '\x30', '\x31', '\x32', '\x33', '\x34', '\x35', '\x36', '\x37', '\x38', '\x39', '\x3a', '\x3b', '\x3c', '\x3d', '\x3e', '\x3f', + '\x40', '\x41', '\x42', '\x43', '\x44', '\x45', '\x46', '\x47', '\x48', '\x49', '\x4a', '\x4b', '\x4c', '\x4d', '\x4e', '\x4f', + '\x50', '\x51', '\x52', '\x53', '\x54', '\x55', '\x56', '\x57', '\x58', '\x59', '\x5a', '\x5b', '\x5c', '\x5d', '\x5e', '\x5f', + '\x60', '\x61', '\x62', '\x63', '\x64', '\x65', '\x66', '\x67', '\x68', '\x69', '\x6a', '\x6b', '\x6c', '\x6d', '\x6e', '\x6f', + '\x70', '\x71', '\x72', '\x73', '\x74', '\x75', '\x76', '\x77', '\x78', '\x79', '\x7a', '\x7b', '\x7c', '\x7d', '\x7e', '\x7f', + '\xc7', '\xfc', '\xe9', '\xe2', '\xe4', '\xe0', '\xe5', '\xe7', '\xea', '\xeb', '\xe8', '\xef', '\xee', '\xec', '\xc4', '\xc5', + '\xc9', '\xe6', '\xc6', '\xf4', '\xf6', '\xf2', '\xfb', '\xf9', '\xff', '\xd6', '\xdc', '\xf8', '\xa3', '\xd8', '\x2e', '\x2e', + '\xe1', '\xed', '\xf3', '\xfa', '\xf1', '\xd1', '\xaa', '\xba', '\xbf', '\x2e', '\xac', '\xbd', '\xbc', '\xa1', '\xab', '\xa4', + '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', + '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', + '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', + '\x2e', '\xdf', '\x2e', '\x2e', '\x2e', '\x2e', '\xb5', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', + '\x2e', '\xb1', '\x2e', '\x2e', '\x2e', '\x2e', '\xf7', '\x2e', '\xb0', '\x2e', '\xb7', '\x2e', '\x2e', '\xb2', '\x2e', '\xa0', +}; + +/* CP1252 -> ISO-8859-1 */ +/* Non-convertable characters are converted to a dot (\x2e) */ + +static int D2UIso1252Table[256] = +{ + '\x00', '\x01', '\x02', '\x03', '\x04', '\x05', '\x06', '\x07', '\x08', '\x09', '\x0a', '\x0b', '\x0c', '\x0d', '\x0e', '\x0f', + '\x10', '\x11', '\x12', '\x13', '\x14', '\x15', '\x16', '\x17', '\x18', '\x19', '\x1a', '\x1b', '\x1c', '\x1d', '\x1e', '\x1f', + '\x20', '\x21', '\x22', '\x23', '\x24', '\x25', '\x26', '\x27', '\x28', '\x29', '\x2a', '\x2b', '\x2c', '\x2d', '\x2e', '\x2f', + '\x30', '\x31', '\x32', '\x33', '\x34', '\x35', '\x36', '\x37', '\x38', '\x39', '\x3a', '\x3b', '\x3c', '\x3d', '\x3e', '\x3f', + '\x40', '\x41', '\x42', '\x43', '\x44', '\x45', '\x46', '\x47', '\x48', '\x49', '\x4a', '\x4b', '\x4c', '\x4d', '\x4e', '\x4f', + '\x50', '\x51', '\x52', '\x53', '\x54', '\x55', '\x56', '\x57', '\x58', '\x59', '\x5a', '\x5b', '\x5c', '\x5d', '\x5e', '\x5f', + '\x60', '\x61', '\x62', '\x63', '\x64', '\x65', '\x66', '\x67', '\x68', '\x69', '\x6a', '\x6b', '\x6c', '\x6d', '\x6e', '\x6f', + '\x70', '\x71', '\x72', '\x73', '\x74', '\x75', '\x76', '\x77', '\x78', '\x79', '\x7a', '\x7b', '\x7c', '\x7d', '\x7e', '\x7f', + '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', + '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', + '\xa0', '\xa1', '\xa2', '\xa3', '\xa4', '\xa5', '\xa6', '\xa7', '\xa8', '\xa9', '\xaa', '\xab', '\xac', '\xad', '\xae', '\xaf', + '\xb0', '\xb1', '\xb2', '\xb3', '\xb4', '\xb5', '\xb6', '\xb7', '\xb8', '\xb9', '\xba', '\xbb', '\xbc', '\xbd', '\xbe', '\xbf', + '\xc0', '\xc1', '\xc2', '\xc3', '\xc4', '\xc5', '\xc6', '\xc7', '\xc8', '\xc9', '\xca', '\xcb', '\xcc', '\xcd', '\xce', '\xcf', + '\xd0', '\xd1', '\xd2', '\xd3', '\xd4', '\xd5', '\xd6', '\xd7', '\xd8', '\xd9', '\xda', '\xdb', '\xdc', '\xdd', '\xde', '\xdf', + '\xe0', '\xe1', '\xe2', '\xe3', '\xe4', '\xe5', '\xe6', '\xe7', '\xe8', '\xe9', '\xea', '\xeb', '\xec', '\xed', '\xee', '\xef', + '\xf0', '\xf1', '\xf2', '\xf3', '\xf4', '\xf5', '\xf6', '\xf7', '\xf8', '\xf9', '\xfa', '\xfb', '\xfc', '\xfd', '\xfe', '\xff', +}; + +#endif diff --git a/man/es/man1/dos2unix.pod b/man/es/man1/dos2unix.pod new file mode 100755 index 0000000..3144580 --- /dev/null +++ b/man/es/man1/dos2unix.pod @@ -0,0 +1,548 @@ +/* +# +# Spanish tranlation by: Julio A. Freyre-Gonzalez 2011, 2012 +# +# Copyright and License +# +# Copyright (C) 2009-2012 Erwin Waterlander +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice in the documentation and/or other materials provided with +# the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY +# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT +# OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR +# BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE +# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +# IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# Descripción +# +# Para saber cual sección de NIVEL SUPERIOR usar en las páginas del manual, +# véase el estándar POSIX/Susv y "Utility Description Defaults" en +# http://www.opengroup.org/onlinepubs/009695399/utilities/xcu_chap01.html#tag_01_11 +# +# Éste es el manual en formato POD de Perl. Lease más en +# http://perldoc.perl.org/perlpod.html o ejecute el comando: +# +# perldoc perlpod | less +# +# Para revisar la sintaxis: +# +# podchecker *.pod +# +# Cree el manual con el comando: +# +# pod2man PAGE.N.pod > PAGE.N +*/ + +=pod + +=head1 NOMBRE + +dos2unix - Convertidor de archivos de texto de formato DOS/Mac a Unix y viceversa + +=head1 SINOPSIS + + dos2unix [parámetros] [ARCHIVO ...] [-n ARCH_DE_ENTRADA ARCH_DE_SALIDA ...] + unix2dos [parámetros] [ARCHIVO ...] [-n ARCH_DE_ENTRADA ARCH_DE_SALIDA ...] + +=head1 DESCRIPCIÓN + +El paquete Dos2unix incluye las utilerías C y C para +convertir archivos de texto plano en formato DOS o Mac a formato Unix y viceversa. + +En archivos de texto DOS/Windows, un salto de línea, también conocido como nueva +línea, es una combinación de dos caracteres: un retorno de carro (CR) seguido +por un salto de línea (LF). En archivos de texto Unix, un salto de línea es +solamente un carácter: el salto de línea (LF). En archivos de texto Mac, antes +de Mac OS X, un salto de línea era sólo un carácter retorno de carro (CR). +Actualmente, Mac OS usa el estilo Unix de saltos de línea (LF). + +Los archivos binarios son ignorados automáticamente, a menos que se fuerce su +conversión. + +Los archivos no regulares, tales como directorios y FIFO, son ignorados +automáticamente. + +Los enlaces simbólicos y sus destinos no son modificados por defecto. +Los enlaces simbólicos pueden opcionalmente ser reemplazados, o la salida puede +ser escrita al archivo destino del enlace. +Los enlaces simbólicos en Windows no están soportados. Estos son siempre +reemplazados, sin que se alteren sus destinos. + +Dos2unix fue moldeado a partir del dos2unix que existe en SunOS/Solaris y tiene +modos de conversión similares. + +=head1 PARÁMETROS + +=over 4 + +=item B<--> + +Todos los parámetros siguientes son tratados como nombres de archivo. Use este +parámetro si desea convertir archivos cuyos nombres inician con un guión. Por +ejemplo para convertir un archivo llamado "-foo", use este comando: + + dos2unix -- -foo + +O en modo de archivo nuevo: + + dos2unix -n -- -foo out.txt + +=item B<-ascii> + +Sólo convierte los salto de línea. Éste es el modo de conversión por defecto. + +=item B<-iso> + +Conversión entre el conjunto de caracteres DOS e ISO-8859-1. Véase también la +sección MODOS DE CONVERSIÓN. + +=item B<-1252> + +Usa la página de códigos Windows 1252 (Europa Occidental). + +=item B<-437> + +Usa la página de códigos DOS 437 (EE. UU.). Está es la página de códigos usada +por defecto para conversión ISO. + +=item B<-850> + +Usa la página de códigos DOS 850 (Europa Occidental). + +=item B<-860> + +Usa la página de códigos DOS 860 (Portugués). + +=item B<-863> + +Usa la página de códigos DOS 863 (Francocanadiense). + +=item B<-865> + +Usa la página de códigos DOS 865 (Nórdico). + +=item B<-7> + +Convierte caracteres de 8 bits al espacio de 7 bits. + +=item B<-c, --convmode CONVMODE> + +Establece el modo de conversión, Donde CONVMODE puede ser: +I, I<7bit>, I, I +siendo ascii el valor por defecto. + +=item B<-f, --force> + +Fuerza la conversión de archivos binarios. + +=item B<-h, --help> + +Despiega la ayuda y termina el programa. + +=item B<-k, --keepdate> + +Mantiene la fecha del archivo de salida igual a la del archivo de entrada. + +=item B<-L, --license> + +Muestra la licencia del programa. + +=item B<-l, --newline> + +Añade salto de línea adicional. + +B: Sólo los saltos de línea DOS son cambiados por dos saltos de línea +Unix. +En modo Mac sólo los saltos de línea Mac son cambiados por dos saltos de línea +Unix. + +B: Sólo los saltos de línea Unix son cambiados por dos saltos de línea +DOS. +En modo Mac los saltos de línea Unix son cambiados por dos saltos de línea Mac. + +=item B<-m, --add-bom> + +Write an UTF-8 Byte Order Mark in the output file. Never use this option when +the output encoding is other than UTF-8. See also section UNICODE. + +=item B<-n, --newfile ARCH_DE_ENTRADA ARCH_DE_SALIDA ...> + +Modo de archivo nuevo. Convierte el archivo ARCH_DE_ENTRADA y escribe la salida +al archivo ARCH_DE_SALIDA. +Los nombres de archivo deben ser dados en pares y los comodines I deben ser +usados o I sus archivos. + +=item B<-o, --oldfile ARCHIVO ...> + +Modo de archivo viejo. Convierte el archivo ARCHIVO y lo sobrescribe con la salida. +El programa por defecto se ejecuta en este modo. Sí se pueden emplear comodines. + +=item B<-q, --quiet> + +Modo silencioso. Suprime todas las advertencias y mensajes. El valor retornado +es cero. Excepto cuando se emplean parámetros incorrectos. + +=item B<-s, --safe> + +Ignora los archivos binarios (por defecto). + +=item B<-F, --follow-symlink> + +Sigue los enlaces simbólicos y convierte los destinos. + +=item B<-R, --replace-symlink> + +Reemplaza los enlaces simbólicos con los archivos convertidos +(los archivos destino originales no se alteran). + +=item B<-S, --skip-symlink> + +No altera los enlaces simbólicos ni sus destinos (por defecto). + +=item B<-V, --version> + +Despiega la información de la versión y termina el programa. + +=back + +=head1 MODO MAC + +En modo normal los saltos de línea son convertidos de DOS a Unix y viceversa. +Los saltos de línea Mac no son convertidos. + +En modo Mac los saltos de línea son convertidos de Mac a Unix y viceversa. Los +saltos de línea DOS no son modificados. + +Para ejecutar en modo Mac use el modificador C<-c mac> o use los comandos +C o C. + +=head1 MODOS DE CONVERSIÓN + +Los modos de conversión I, I<7bit>, e I son similares a los de +los comandos dos2unix/unix2dos de SunOS/Solaris. + +=over 4 + +=item B + +En modo C sólo los saltos de línea son convertidos. Éste es el modo de +conversión por defecto. + +Aunque el nombre de este modo es ASCII, el cual es un estándar de 7 bits, éste +emplea 8 bits. Siempre use este modo cuando convierta archivos en Unicode UTF-8. + +=item B<7bit> + +En este modo todos los caracteres no ASCII de 8 bits (con valores de 128 a 255) +son convertidos al espacio de 7 bits. + +=item B + +Los caracteres son convertidos entre un conjunto de caracteres DOS (página de +códigos) y el conjunto de caracteres ISO-8859-1 (Latín-1) de Unix. Los +caracteres DOS sin equivalente ISO-8859-1, para los cuales la conversión es +imposible, son convertidos en un punto. Lo mismo se aplica para caracteres +ISO-8859-1 sin contraparte DOS. + +Cuando sólo se emplea el parámetro C<-iso>, dos2unix intentará determinar la +página de códigos activa. Cuando esto no sea posible, dos2unix utilizará la +página de códigos 437 por defecto, la cual es empleada principalmente en EE. UU. +Para forzar una página de códigos específica emplee los parámetros +C<-437> (EE. UU.), C<-850> (Europa Occidental), C<-860> (Portugués), +C<-863> (Francocanadiense), o C<-865> (Nórdico). La página de códigos Windows +1252 (Europa Occidental) también está soportada con el parámetro C<-1252>. Para +acceder a otras páginas de códigos use dos2unix en combinación con iconv(1). +Iconv puede convertir entre una larga lista de codificaciones de caracteres. + +Never use ISO converion on Unicode text files. It will corrupt UTF-8 encoded files. + +Algunos ejemplos: + +Convierte de la página de códigos por defecto de DOS a Latín-1 de Unix. + + dos2unix -iso -n in.txt out.txt + +Convierte de DOS 850 a Unix Latín-1. + + dos2unix -850 -n in.txt out.txt + +Convierte de Windows 1252 a Unix Latín-1. + + dos2unix -1252 -n in.txt out.txt + +Convierte de Windows 1252 a Unix UTF-8 (Unicode). + + iconv -f CP1252 -t UTF-8 in.txt | dos2unix > out.txt + +Convierte de Unix Latín-1 a la página de códigos por defecto de DOS. + + unix2dos -iso -n in.txt out.txt + +Convierte de Unix Latín-1 a DOS 850. + + unix2dos -850 -n in.txt out.txt + +Convierte de Unix Latín-1 a Windows 1252. + + unix2dos -1252 -n in.txt out.txt + +Convierte de Unix UTF-8 (Unicode) a Windows 1252. + + unix2dos < in.txt | iconv -f UTF-8 -t CP1252 > out.txt + +Véase también L +y L. + +=back + +=head1 UNICODE + +=head2 Encodings + +There exist different Unicode encodings. On Unix and Linux Unicode files are +typically encoded in UTF-8 encoding. On Windows Unicode text files can be +encoded in UTF-8, UTF-16, or UTF-16 big endian, but are mostly encoded in +UTF-16 format. + +=head2 Conversion + +Unicode text files can have DOS, Unix or Mac line breaks, like regular text +files. + +All versions of dos2unix and unix2dos can convert UTF-8 encoded files, because +UTF-8 was designed for backward compatiblity with ASCII. + +Dos2unix and unix2dos with Unicode UTF-16 support, can read little and big +endian UTF-16 encoded text files. To see if dos2unix was built with UTF-16 +support type C. + +The Windows versions of dos2unix and unix2dos convert UTF-16 encoded files +always to UTF-8 encoded files. Unix versions of dos2unix/unix2dos convert +UTF-16 encoded files to the locale character encoding when it is set to UTF-8. +Use the locale(1) command to find out what the locale character encoding is. + +Because UTF-8 formatted text files are well supported on both Windows and Unix, +dos2unix and unix2dos have no option to write UTF-16 files. All UTF-16 +characters can be encoded in UTF-8. Conversion from UTF-16 to UTF-8 is without +loss. UTF-16 files will be skipped on Unix when the locale character encoding +is not UTF-8, to prevent accidental loss of text. When an UTF-16 to UTF-8 +conversion error occurs, for instance when the UTF-16 input file contains +an error, the file will be skipped. + +ISO and 7-bit mode conversion do not work on UTF-16 files. + +=head2 Byte Order Mark + +On Windows Unicode text files typically have a Byte Order Mark (BOM), because +many Windows programs (including Notepad) add BOMs by default. See also +L. + +On Unix Unicode files typically don't have a BOM. It is assumed that text files +are encoded in the locale character encoding. + +Dos2unix can only detect if a file is in UTF-16 format if the file has a BOM. +When an UTF-16 file doesn't have a BOM, dos2unix will see the file as a binary +file. + +Use dos2unix in combination with iconv(1) to convert an UTF-16 file without +BOM. + +Dos2unix never writes a BOM in the output file, unless you use option C<-m>. + +Unix2dos writes a BOM in the output file when the input file has a BOM, or +when option C<-m> is used. + +=head2 Unicode examples + +Convert from Windows UTF-16 (with BOM) to Unix UTF-8 + + dos2unix -n in.txt out.txt + +Convert from Windows UTF-16 (without BOM) to Unix UTF-8 + + iconv -f UTF-16 -t UTF-8 in.txt | dos2unix > out.txt + +Convert from Unix UTF-8 to Windows UTF-8 with BOM + + unix2dos -m -n in.txt out.txt + +Convert from Unix UTF-8 to Windows UTF-16 + + unix2dos < in.txt | iconv -f UTF-8 -t UTF-16 > out.txt + +=head1 EJEMPLOS + +Lee la entrada desde 'stdin' y escribe la salida a 'stdout'. + + dos2unix + dos2unix -l -c mac + +Convierte y reemplaza a.txt. Convierte y reemplaza b.txt. + + dos2unix a.txt b.txt + dos2unix -o a.txt b.txt + +Convierte y reemplaza a.txt empleando modo de conversión ascii. + + dos2unix a.txt + +Convierte y reemplaza a.txt empleando modo de conversión ascii. +Convierte y reemplaza b.txt empleando modo de conversión de 7bits. + + dos2unix a.txt -c 7bit b.txt + dos2unix -c ascii a.txt -c 7bit b.txt + dos2unix -ascii a.txt -7 b.txt + +Convierte a.txt del formato de Mac a Unix. + + dos2unix -c mac a.txt + mac2unix a.txt + +Convierte a.txt del formato de Unix a Mac. + + unix2dos -c mac a.txt + unix2mac a.txt + +Convierte y reemplaza a.txt manteniendo la fecha del archivo original. + + dos2unix -k a.txt + dos2unix -k -o a.txt + +Convierte a.txt y escribe la salida a e.txt. + + dos2unix -n a.txt e.txt + +Convierte a.txt y escribe la salida a e.txt, manteniendo la fecha de e.txt +igual a la de a.txt. + + dos2unix -k -n a.txt e.txt + +Convierte y reemplaza a.txt. Convierte b.txt y escribe a e.txt. + + dos2unix a.txt -n b.txt e.txt + dos2unix -o a.txt -n b.txt e.txt + +Convierte c.txt y escribe a e.txt. Convierte y reemplaza a.txt. +Convierte y reemplaza b.txt. Convierte d.txt y escribe a f.txt. + + dos2unix -n c.txt e.txt -o a.txt b.txt -n d.txt f.txt + +=head1 RECURSIVE CONVERSION + +Use dos2unix in combination with the find(1) and xargs(1) commands to +recursively convert text files in a directory tree structure. For instance to +convert all .txt files in the directory tree under the current directory type: + + find . -name *.txt |xargs dos2unix + + +=head1 INTERNACIONALIZACIÓN + +=over 4 + +=item B + +El idioma principal se selecciona con la variable de entorno LANG. La variable +LANG consiste de varias partes. La primer parte es el código del idioma en +minúsculas. La segunda es opcional y es el código del país en mayúsculas, +precedido por un guión bajo. Existe también una tercera parte opcional: la +codificación de caracteres, precedida por un punto. Unos cuantos ejemplos para +intérpretes de comandos tipo POSIX estándar: + + export LANG=nl Neerlandés + export LANG=nl_NL Neerlandés, Países Bajos + export LANG=nl_BE Neerlandés, Bélgica + export LANG=es_ES Español, España + export LANG=es_MX Español, México + export LANG=en_US.iso88591 Ingles, EE. UU., codificación Latín-1 + export LANG=en_GB.UTF-8 Ingles, Reino Unido, codificación UTF-8 + +Para una lista completa de códigos de idioma y país véase el manual de gettext: +L + +En sistemas Unix puede emplear el comando locale(1) para obtener información +específica del locale. + +=item B + +Con la variable de entorno LANGUAGE puede especificar una lista de prioridad +de los idiomas, separados por dos puntos. Dos2unix da preferencia a LANGUAGE +por encima de LANG. Por ejemplo, primero neerlandés y entonces alemán: +C. Antes de que pueda usar una lista de prioridad de idiomas a +través de la variable LANGUAGE, primero tiene que habilitar la +internacionalización, mediante asignar un valor distinto de "C" a LANG +(o LC_ALL). Véase también el manual de gettext: +L + +Si selecciona un idioma que no está disponible el programa funcionará en ingles. + +=item B + +Con la variable de entorno DOS2UNIX_LOCALEDIR el LOCALEDIR asignado durante +la compilación puede ser modificado. LOCALEDIR es usado para encontrar los +archivos de idioma. El valor por defecto de GNU es C. +El parámetro B<--version> desplegará el LOCALEDIR en uso. + +Ejemplo (intérprete de comandos POSIX): + + export DOS2UNIX_LOCALEDIR=$HOME/share/locale + +=back + + +=head1 VALOR DE RETORNO + +Se regresa cero cuando el programa termina exitosamente. Cuando ocurre un error +del sistema se regresará el último número de error del sistema. Para otros errores se +regresa 1. + +El valor de retorno es siempre cero en modo silencioso, excepto cuando se +emplean parámetros incorrectos. + +=head1 ESTÁNDARES + +L + +L + +L + +L + +=head1 AUTORES + +Benjamin Lin - +Bernd Johannes Wuebben (modo mac2unix) - , +Christian Wurll (añadió el salto de línea extra) - , +Erwin Waterlander - (Mantenimiento) + +Página del proyecto: L + +Página de SourceForge: L + +Freshmeat: L + +=head1 VÉASE TAMBIÉN + +file(1) +find(1) +iconv(1) +locale(1) +xargs(1) + +=cut diff --git a/man/man1/Makefile b/man/man1/Makefile new file mode 100644 index 0000000..28b67a9 --- /dev/null +++ b/man/man1/Makefile @@ -0,0 +1,101 @@ +# pod2man.mk -- Makefile portion to convert *.pod files to manual pages +# +# Copyright information +# +# Copyright (C) 2010 Jari Aalto +# +# License +# +# Redistribution and use in source and binary forms, with or +# without modification, are permitted provided that the +# following conditions are met: +# +# 1. Redistributions of source code must retain the above +# copyright notice, this list of conditions and the following +# disclaimer. +# +# 2. Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following +# disclaimer in the documentation and/or other materials +# provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR +# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR(S) OF THIS +# FILE OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +# GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH +# DAMAGE. +# +# The license text is copy of the FreeBSD License available at +# with following +# modifications: wording "THIS SOFTWARE IS PROVIDED BY THE +# FREEBSD PROJECT" was changed to "THIS SOFTWARE IS PROVIDED 'AS +# IS'" and wording "IN NO EVENT SHALL THE FREEBSD PROJECT" was +# changed to "IN NO EVENT SHALL THE AUTHOR(S)" +# +# Description +# +# Convert *.pod files to manual pages. + +ifneq (,) + This makefile requires GNU Make. +endif + +# This variable *must* be set when calling +PACKAGE ?= dos2unix + +# Optional variables to set +MANSECT ?= 1 +PODCENTER ?= $$(date "+%Y-%m-%d") + +# Directories +MANSRC = +MANDEST = $(MANSRC) + +MANPOD = $(MANSRC)$(PACKAGE).pod +MANPAGE = $(MANDEST)$(PACKAGE).$(MANSECT) + +POD2MAN = pod2man +POD2MAN_FLAGS = + +PODFILES = $(wildcard ../*/man1/dos2unix.pod) +MAN_OBJECTS = dos2unix.1 $(patsubst %.pod,%.1,$(PODFILES)) + +all: $(MAN_OBJECTS) + +%.1 : %.pod + # make target - create manual page from a *.pod page + podchecker $< + LC_CTYPE=C $(POD2MAN) $(POD2MAN_FLAGS) \ + --center="$(PODCENTER)" \ + --name="$(PACKAGE)" \ + --section="$(MANSECT)" \ + $< \ + | sed 's,[Pp]erl v[0-9.]\+,$(PACKAGE),' \ + > $@ && \ + rm -f pod*.tmp +# fix for bug http://rt.perl.org/rt3//Public/Bug/Display.html?id=79410 +# "Pod2man creates wrong ROFF esc sequences for Latin-1 characters." +# Create groff (specific) escape sequences which work also on DOS/Windows. +# See also: https://rt.cpan.org/Public/Bug/Display.html?id=73804 + perl -pli.bak \ + -e s/A\\\\\\*\'/\\\\[\'A]/g\; \ + -e s/a\\\\\\*\'/\\\\[\'a]/g\; \ + -e s/E\\\\\\*\'/\\\\[\'E]/g\; \ + -e s/e\\\\\\*:/\\\\[:e]/g\; \ + -e s/e\\\\\\*\'/\\\\[\'e]/g\; \ + -e s/i\\\\\\*\'/\\\\[\'i]/g\; \ + -e s/n\\\\\\*~/\\\\[~n]/g\; \ + -e s/O\\\\\\*\'/\\\\[\'O]/g\; \ + -e s/o\\\\\\*\'/\\\\[\'o]/g\; \ + -e s/u\\\\\\*\'/\\\\[\'u]/g\; \ + $@ + +# End of of Makefile part diff --git a/man/man1/dos2unix.pod b/man/man1/dos2unix.pod new file mode 100644 index 0000000..4793aa4 --- /dev/null +++ b/man/man1/dos2unix.pod @@ -0,0 +1,535 @@ +/* +# Copyright and License +# +# Copyright (C) 2009-2012 Erwin Waterlander +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice in the documentation and/or other materials provided with +# the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY +# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT +# OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR +# BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE +# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +# IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# Description +# +# To learn what TOP LEVEL section to use in manual pages, +# see POSIX/Susv standard and "Utility Description Defaults" at +# http://www.opengroup.org/onlinepubs/009695399/utilities/xcu_chap01.html#tag_01_11 +# +# This is manual page in Perl POD format. Read more at +# http://perldoc.perl.org/perlpod.html or run command: +# +# perldoc perlpod | less +# +# To check the syntax: +# +# podchecker *.pod +# +# Create manual page with command: +# +# pod2man PAGE.N.pod > PAGE.N +*/ + +=pod + +=head1 NAME + +dos2unix - DOS/Mac to Unix and vice versa text file format converter + +=head1 SYNOPSIS + + dos2unix [options] [FILE ...] [-n INFILE OUTFILE ...] + unix2dos [options] [FILE ...] [-n INFILE OUTFILE ...] + +=head1 DESCRIPTION + +The Dos2unix package includes utilities C and C to convert +plain text files in DOS or Mac format to Unix format and vice versa. + +In DOS/Windows text files a line break, also known as newline, is a combination +of two characters: a Carriage Return (CR) followed by a Line Feed (LF). In Unix +text files a line break is a single character: the Line Feed (LF). In Mac text +files, prior to Mac OS X, a line break was single Carriage Return (CR) +character. Nowadays Mac OS uses Unix style (LF) line breaks. + +Binary files are automatically skipped, unless conversion is forced. + +Non-regular files, such as directories and FIFOs, are automatically skipped. + +Symbolic links and their targets are by default kept untouched. +Symbolic links can optionally be replaced, or the output can be written +to the symbolic link target. +Symbolic links on Windows are not supported. Windows symbolic links +always replaced, keeping the targets unchanged. + +Dos2unix was modelled after dos2unix under SunOS/Solaris and has similar +conversion modes. + +=head1 OPTIONS + +=over 4 + +=item B<--> + +Treat all following options as file names. Use this option if you want to +convert files whose names start with a dash. For instance to convert +a file named "-foo", you can use this command: + + dos2unix -- -foo + +Or in new file mode: + + dos2unix -n -- -foo out.txt + +=item B<-ascii> + +Convert only line breaks. This is the default conversion mode. + +=item B<-iso> + +Conversion between DOS and ISO-8859-1 character set. See also section +CONVERSION MODES. + +=item B<-1252> + +Use Windows code page 1252 (Western European). + +=item B<-437> + +Use DOS code page 437 (US). This is the default code page used for ISO conversion. + +=item B<-850> + +Use DOS code page 850 (Western European). + +=item B<-860> + +Use DOS code page 860 (Portuguese). + +=item B<-863> + +Use DOS code page 863 (French Canadian). + +=item B<-865> + +Use DOS code page 865 (Nordic). + +=item B<-7> + +Convert 8 bit characters to 7 bit space. + +=item B<-c, --convmode CONVMODE> + +Set conversion mode. Where CONVMODE is one of: +I, I<7bit>, I, I +with ascii being the default. + +=item B<-f, --force> + +Force conversion of binary files. + +=item B<-h, --help> + +Display help and exit. + +=item B<-k, --keepdate> + +Keep the date stamp of output file same as input file. + +=item B<-L, --license> + +Display program's license. + +=item B<-l, --newline> + +Add additional newline. + +B: Only DOS line breaks are changed to two Unix line breaks. +In Mac mode only Mac line breaks are changed to two Unix +line breaks. + +B: Only Unix line breaks are changed to two DOS line breaks. +In Mac mode Unix line breaks are changed to two Mac line breaks. + +=item B<-m, --add-bom> + +Write an UTF-8 Byte Order Mark in the output file. Never use this option when +the output encoding is other than UTF-8. See also section UNICODE. + +=item B<-n, --newfile INFILE OUTFILE ...> + +New file mode. Convert file INFILE and write output to file OUTFILE. +File names must be given in pairs and wildcard names should I be +used or you I lose your files. + +=item B<-o, --oldfile FILE ...> + +Old file mode. Convert file FILE and overwrite output to it. The program +default to run in this mode. Wildcard names may be used. + +=item B<-q, --quiet> + +Quiet mode. Suppress all warnings and messages. The return value is zero. +Except when wrong command-line options are used. + +=item B<-s, --safe> + +Skip binary files (default). + +=item B<-F, --follow-symlink> + +Follow symbolic links and convert the targets. + +=item B<-R, --replace-symlink> + +Replace symbolic links with converted files +(original target files remain unchanged). + +=item B<-S, --skip-symlink> + +Keep symbolic links and targets unchanged (default). + +=item B<-V, --version> + +Display version information and exit. + +=back + +=head1 MAC MODE + +In normal mode line breaks are converted from DOS to Unix and vice versa. +Mac line breaks are not converted. + +In Mac mode line breaks are converted from Mac to Unix and vice versa. DOS +line breaks are not changed. + +To run in Mac mode use the command-line option C<-c mac> or use the +commands C or C. + +=head1 CONVERSION MODES + +Conversion modes I, I<7bit>, and I +are similar to those of dos2unix/unix2dos under SunOS/Solaris. + +=over 4 + +=item B + +In mode C only line breaks are converted. This is the default +conversion mode. + +Although the name of this mode is ASCII, which is a 7 bit standard, the +actual mode is 8 bit. Use always this mode when converting Unicode UTF-8 +files. + +=item B<7bit> + +In this mode all 8 bit non-ASCII characters (with values from 128 to 255) +are converted to a 7 bit space. + +=item B + +Characters are converted between a DOS character set (code page) and ISO +character set ISO-8859-1 (Latin-1) on Unix. DOS characters without ISO-8859-1 +equivalent, for which conversion is not possible, are converted to a dot. The +same counts for ISO-8859-1 characters without DOS counterpart. + +When only option C<-iso> is used dos2unix will try to determine the active code +page. When this is not possible dos2unix will use default code page CP437, +which is mainly used in the USA. To force a specific code page use options +C<-437> (US), C<-850> (Western European), C<-860> (Portuguese), C<-863> (French +Canadian), or C<-865> (Nordic). Windows code page CP1252 (Western European) is +also supported with option C<-1252>. For other code pages use dos2unix in +combination with iconv(1). Iconv can convert between a long list of character +encodings. + +Never use ISO converion on Unicode text files. It will corrupt UTF-8 encoded files. + +Some examples: + +Convert from DOS default code page to Unix Latin-1 + + dos2unix -iso -n in.txt out.txt + +Convert from DOS CP850 to Unix Latin-1 + + dos2unix -850 -n in.txt out.txt + +Convert from Windows CP1252 to Unix Latin-1 + + dos2unix -1252 -n in.txt out.txt + +Convert from Windows CP1252 to Unix UTF-8 (Unicode) + + iconv -f CP1252 -t UTF-8 in.txt | dos2unix > out.txt + +Convert from Unix Latin-1 to DOS default code page. + + unix2dos -iso -n in.txt out.txt + +Convert from Unix Latin-1 to DOS CP850 + + unix2dos -850 -n in.txt out.txt + +Convert from Unix Latin-1 to Windows CP1252 + + unix2dos -1252 -n in.txt out.txt + +Convert from Unix UTF-8 (Unicode) to Windows CP1252 + + unix2dos < in.txt | iconv -f UTF-8 -t CP1252 > out.txt + +See also L +and L. + +=back + +=head1 UNICODE + +=head2 Encodings + +There exist different Unicode encodings. On Unix and Linux Unicode files are +typically encoded in UTF-8 encoding. On Windows Unicode text files can be +encoded in UTF-8, UTF-16, or UTF-16 big endian, but are mostly encoded in +UTF-16 format. + +=head2 Conversion + +Unicode text files can have DOS, Unix or Mac line breaks, like regular text +files. + +All versions of dos2unix and unix2dos can convert UTF-8 encoded files, because +UTF-8 was designed for backward compatiblity with ASCII. + +Dos2unix and unix2dos with Unicode UTF-16 support, can read little and big +endian UTF-16 encoded text files. To see if dos2unix was built with UTF-16 +support type C. + +The Windows versions of dos2unix and unix2dos convert UTF-16 encoded files +always to UTF-8 encoded files. Unix versions of dos2unix/unix2dos convert +UTF-16 encoded files to the locale character encoding when it is set to UTF-8. +Use the locale(1) command to find out what the locale character encoding is. + +Because UTF-8 formatted text files are well supported on both Windows and Unix, +dos2unix and unix2dos have no option to write UTF-16 files. All UTF-16 +characters can be encoded in UTF-8. Conversion from UTF-16 to UTF-8 is without +loss. UTF-16 files will be skipped on Unix when the locale character encoding +is not UTF-8, to prevent accidental loss of text. When an UTF-16 to UTF-8 +conversion error occurs, for instance when the UTF-16 input file contains +an error, the file will be skipped. + +ISO and 7-bit mode conversion do not work on UTF-16 files. + +=head2 Byte Order Mark + +On Windows Unicode text files typically have a Byte Order Mark (BOM), because +many Windows programs (including Notepad) add BOMs by default. See also +L. + +On Unix Unicode files typically don't have a BOM. It is assumed that text files +are encoded in the locale character encoding. + +Dos2unix can only detect if a file is in UTF-16 format if the file has a BOM. +When an UTF-16 file doesn't have a BOM, dos2unix will see the file as a binary +file. + +Use dos2unix in combination with iconv(1) to convert an UTF-16 file without +BOM. + +Dos2unix never writes a BOM in the output file, unless you use option C<-m>. + +Unix2dos writes a BOM in the output file when the input file has a BOM, or +when option C<-m> is used. + +=head2 Unicode examples + +Convert from Windows UTF-16 (with BOM) to Unix UTF-8 + + dos2unix -n in.txt out.txt + +Convert from Windows UTF-16 (without BOM) to Unix UTF-8 + + iconv -f UTF-16 -t UTF-8 in.txt | dos2unix > out.txt + +Convert from Unix UTF-8 to Windows UTF-8 with BOM + + unix2dos -m -n in.txt out.txt + +Convert from Unix UTF-8 to Windows UTF-16 + + unix2dos < in.txt | iconv -f UTF-8 -t UTF-16 > out.txt + +=head1 EXAMPLES + +Read input from 'stdin' and write output to 'stdout'. + + dos2unix + dos2unix -l -c mac + +Convert and replace a.txt. Convert and replace b.txt. + + dos2unix a.txt b.txt + dos2unix -o a.txt b.txt + +Convert and replace a.txt in ascii conversion mode. + + dos2unix a.txt + +Convert and replace a.txt in ascii conversion mode. +Convert and replace b.txt in 7bit conversion mode. + + dos2unix a.txt -c 7bit b.txt + dos2unix -c ascii a.txt -c 7bit b.txt + dos2unix -ascii a.txt -7 b.txt + +Convert a.txt from Mac to Unix format. + + dos2unix -c mac a.txt + mac2unix a.txt + +Convert a.txt from Unix to Mac format. + + unix2dos -c mac a.txt + unix2mac a.txt + +Convert and replace a.txt while keeping original date stamp. + + dos2unix -k a.txt + dos2unix -k -o a.txt + +Convert a.txt and write to e.txt. + + dos2unix -n a.txt e.txt + +Convert a.txt and write to e.txt, keep date stamp of e.txt same as a.txt. + + dos2unix -k -n a.txt e.txt + +Convert and replace a.txt. Convert b.txt and write to e.txt. + + dos2unix a.txt -n b.txt e.txt + dos2unix -o a.txt -n b.txt e.txt + +Convert c.txt and write to e.txt. Convert and replace a.txt. +Convert and replace b.txt. Convert d.txt and write to f.txt. + + dos2unix -n c.txt e.txt -o a.txt b.txt -n d.txt f.txt + +=head1 RECURSIVE CONVERSION + +Use dos2unix in combination with the find(1) and xargs(1) commands to +recursively convert text files in a directory tree structure. For instance to +convert all .txt files in the directory tree under the current directory type: + + find . -name *.txt |xargs dos2unix + +=head1 LOCALIZATION + +=over 4 + +=item B + +The primary language is selected with the environment variable LANG. The LANG +variable consists out of several parts. The first part is in small letters the +language code. The second is optional and is the country code in capital +letters, preceded with an underscore. There is also an optional third part: +character encoding, preceded with a dot. A few examples for POSIX standard type +shells: + + export LANG=nl Dutch + export LANG=nl_NL Dutch, The Netherlands + export LANG=nl_BE Dutch, Belgium + export LANG=es_ES Spanish, Spain + export LANG=es_MX Spanish, Mexico + export LANG=en_US.iso88591 English, USA, Latin-1 encoding + export LANG=en_GB.UTF-8 English, UK, UTF-8 encoding + +For a complete list of language and country codes see the gettext manual: +L + +On Unix systems you can use to command locale(1) to get locale specific +information. + +=item B + +With the LANGUAGE environment variable you can specify a priority list of +languages, separated by colons. Dos2unix gives preference to LANGUAGE over LANG. +For instance, first Dutch and then German: C. You have to first +enable localization, by setting LANG (or LC_ALL) to a value other than +"C", before you can use a language priority list through the LANGUAGE +variable. See also the gettext manual: +L + +If you select a language which is not available you will get the +standard English messages. + + +=item B + +With the environment variable DOS2UNIX_LOCALEDIR the LOCALEDIR set +during compilation can be overruled. LOCALEDIR is used to find the +language files. The GNU default value is C. +Option B<--version> will display the LOCALEDIR that is used. + +Example (POSIX shell): + + export DOS2UNIX_LOCALEDIR=$HOME/share/locale + +=back + + +=head1 RETURN VALUE + +On success, zero is returned. When a system error occurs the last system error will be +returned. For other errors 1 is returned. + +The return value is always zero in quiet mode, except when wrong command-line options +are used. + +=head1 STANDARDS + +L + +L + +L + +L + +=head1 AUTHORS + +Benjamin Lin - +Bernd Johannes Wuebben (mac2unix mode) - , +Christian Wurll (add extra newline) - , +Erwin Waterlander - (Maintainer) + +Project page: L + +SourceForge page: L + +Freecode: L + +=head1 SEE ALSO + +file(1) +find(1) +iconv(1) +locale(1) +xargs(1) + +=cut diff --git a/man/nl/man1/dos2unix.pod b/man/nl/man1/dos2unix.pod new file mode 100644 index 0000000..81b97dc --- /dev/null +++ b/man/nl/man1/dos2unix.pod @@ -0,0 +1,539 @@ +/* +# Copyright and License +# +# Copyright (C) 2009-2012 Erwin Waterlander +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice in the documentation and/or other materials provided with +# the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY +# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT +# OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR +# BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE +# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +# IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# Description +# +# To learn what TOP LEVEL section to use in manual pages, +# see POSIX/Susv standard and "Utility Description Defaults" at +# http://www.opengroup.org/onlinepubs/009695399/utilities/xcu_chap01.html#tag_01_11 +# +# This is manual page in Perl POD format. Read more at +# http://perldoc.perl.org/perlpod.html or run command: +# +# perldoc perlpod | less +# +# To check the syntax: +# +# podchecker *.pod +# +# Create manual page with command: +# +# pod2man PAGE.N.pod > PAGE.N +*/ +=pod + +=head1 NAAM + +dos2unix - DOS/Mac naar Unix en vice versa tekstbestand formaat omzetter + +=head1 OVERZICHT + + dos2unix [opties] [BESTAND ...] [-n INVOERBESTAND UITVOERBESTAND ...] + unix2dos [opties] [BESTAND ...] [-n INVOERBESTAND UITVOERBESTAND ...] + +=head1 BESCHRIJVING + +Het Dos2unix pakket bevat toepassingen C en C om +platte tekstbestanden in DOS of Mac formaat naar Unix om te zetten en +vice versa. + +In DOS/Windows tekstbestanden bestaat een regeleinde uit een combinatie van +twee tekens: een 'Carriage Return' (CR) gevolgd door een 'Line Feed' (LF). In +Unix tekstbestanden bestaat een regeleinde uit een enkel 'Newline' teken die +gelijk is aan een DOS 'Line Feed' (LF) teken. In Mac tekst bestanden, voor Mac +OS X, bestaan regeleindes uit een enkel 'Carriage Return' teken. Mac OS X is +Unix gebaseerd en heeft dezelfde regeleindes als Unix. + +Binaire bestanden worden automatisch overgeslagen, behalve als de omzetting +geforceerd wordt. + +Niet-reguliere bestanden, zoals mappen en FIFOs, worden automatisch overgeslagen. + +Symbolische koppelingen en hun doelen blijven standaard onaangeroerd. +Optioneel kunnen symbolische koppelingen worden vervangen, of de uitvoer +kan naar het doel van de symbolische koppeling worden geschreven. +Symbolische koppelingen op Windows worden niet ondersteund. Windows +symbolische koppelingen worden altijd vervangen, de doelen onaangeroerd +gelaten. + + +Dos2unix is gemodelleerd naar dos2unix onder SunOS/Solaris en heeft gelijke conversiemodi. + +=head1 OPTIES + +=over 4 + +=item B<--> + +Behandel alle volgende opties als bestandsnamen. Gebruik deze optie +als je bestanden wil converteren wiens naam met een streepje begint. +Bijvoorbeeld, om een bestand genaamd "-foo" om te zetten, gebruik je +de volgende opdracht: + + dos2unix -- -foo + +Of in nieuw-bestand-modus: + + dos2unix -n -- -foo uit.txt + +=item B<-ascii> + +Converteer alleen regeleindes. Dit is de standaard conversiemodus. + +=item B<-iso> + +Conversie tussen DOS en ISO-8859-1 lettertekenreeks. Zie ook paragraaf +CONVERSIEMODI. + +=item B<-1252> + +Gebruik Windows codetabel 1252 (West-Europees). + +=item B<-437> + +Gebruik DOS codetabel 437 (VS). Dit is de standaard codetabel die gebruikt wordt bij ISO conversie. + +=item B<-850> + +Gebruik DOS codetabel 850 (West-Europees). + +=item B<-860> + +Gebruik DOS codetabel 860 (Portugees). + +=item B<-863> + +Gebruik DOS codetabel 863 (Canadees Frans). + +=item B<-865> + +Gebruik DOS codetabel 865 (Scandinavisch). + +=item B<-7> + +Converteer 8 bit lettertekens naar 7 bit spatie. + +=item B<-c, --convmode CONVMODUS> + +Stel conversiemodus in. Waarbij CONVMODUS een is van: +I, I<7bit>, I, I +met ascii als standaard instelling. + +=item B<-f, --force> + +Forceer omzetting van binaire bestanden. + +=item B<-h, --help> + +Laat help tekst zien. + +=item B<-k, --keepdate> + +Behoud de datum van het invoerbestand in het uitvoerbestand. + +=item B<-L, --license> + +Laat de software licentie zien. + +=item B<-l, --newline> + +Voeg een extra regeleinde toe. + +B: Alleen DOS regeleindes worden omgezet naar twee Unix regeleindes. +In Mac modus worden alleen Mac regeleindes omgezet naar twee Unix regeleindes. + +B: Aleen Unix regeleindes worden omgezet naar twee DOS regeleindes. +In Mac modus worden Unix regeleindes omgezet naar twee Mac regeleindes. + +=item B<-m, --add-bom> + +Schrijf een UTF-8 Byte Order Mark in het uitvoerbestand. Gebruik deze optie +nooit als de codering het van uitvoerbestand geen UTF-8 is. Zie ook paragraaf +UNICODE. + +=item B<-n, --newfile INVOERBESTAND UITVOERBESTAND ...> + +Nieuw-bestand-modus. Converteer bestand INVOERBESTAND en schrijf naar bestand +UITVOERBESTAND. Bestandsnamen moeten opgegeven worden in paren. Jokertekens +moeten NIET gebruikt worden, anders verlies je bestanden. + +=item B<-o, --oldfile BESTAND ...> + +Oud-bestand-modus. Converteer bestand BESTAND en overschrijf het. +Dit is de standaard modus. Jokertekens kunnen gebruikt worden. + +=item B<-q, --quiet> + +Stille werking. Onderdruk alle waarschuwingen. De teruggave waarde is nul. +Behalve wanneer verkeerde opties worden gegeven. + +=item B<-s, --safe> + +Sla binaire bestanden over (standaard). + +=item B<-F, --follow-symlink> + +Volg symbolische koppelingen en coverteer de doelen. + +=item B<-R, --replace-symlink> + +Vervang symbolische koppelingen door geconverteerde bestanden +(originele doelbestanden blijven ongewijzigd). + +=item B<-S, --skip-symlink> + +Laat symbolische koppelingen en doelen ongewijzigd (standaard). + +=item B<-V, --version> + +Laat versie informatie zien. + +=back + +=head1 MAC MODUS + +In normale modus worden DOS regeleindes naar Unix omgezet en vice versa. Mac regeleindes worden niet omgezet. + +In Mac modus worden Mac regeleindes naar Unix omgezet en vice versa. DOS regeleindes blijven ongewijzigd. + +Om in Mac modus te draaien gebruik de schakeloptie C<-c mac> of gebruik de opdrachten C of C. + +=head1 CONVERSIEMODI + +Conversie-modi I, I<7bit>, en I +zijn gelijk aan die van dos2unix/unix2dos onder SunOS/Solaris. + +=over 4 + +=item B + +In modus C worden alleen regeleindes omgezet. Dit is de standaard modus. + +Hoewel de naam van deze modus ASCII is, wat een 7 bit standaard is, is de +werkelijke modus 8 bit. Gebruik altijd deze modus wanneer u Unicode UTF-8 +bestanden omzet. + +=item B<7bit> + +Alle 8 bit niet-ASCII lettertekens (met waardes van 128 t/m 255) worden +omgezet naar een 7 bit spatie. + +=item B + +Lettertekens worden omgezet tussen een DOS lettertekenreeks (codetabel) en ISO +lettertekenreeks ISO-8859-1 op Unix. DOS lettertekens zonder gelijkwaardig +ISO-8859-1 teken, waarvoor geen omzetting mogelijk is, worden omgezet in een +punt. Het zelfde geldt voor ISO-8859-1 tekens zonder DOS tegenhanger. + +Wanneer alleen optie C<-iso> gebruikt wordt, zal dos2unix proberen de actieve +codetabel te gebruiken. Als dat niet mogelijk is wordt codetabel CP437 +gebruikt, die met name in de VS gebruikt word. Om een bepaalde codetabel te +forceren gebruik opties C<-850> (West-Europees), C<-860> (Portugees), C<-863> +(Canadees Frans) of C<-865> (Scandinavisch). Windows codetabel CP1252 +(West-Europees) wordt ook ondersteund met optie C<-1252>. Gebruik voor andere +codetabellen dos2unix in combinatie met iconv(1). Iconv kan omzetten tussen een +lange lijst letterteken-coderingen. + +Gebruik ISO conversie nooit op Unicode tekst bestanden. Het zal UTF-8 +gecodeerde bestanden verminken. + +Enkele voorbeelden: + +Omzetten van DOS standaard codetabel naar Unix Latin-1 + + dos2unix -iso -n in.txt uit.txt + +Omzetten van DOS CP850 naar Unix Latin-1 + + dos2unix -850 -n in.txt uit.txt + +Omzetten van Windows CP1252 naar Unix Latin-1 + + dos2unix -1252 -n in.txt uit.txt + +Omzetten van Windows CP1252 naar Unix UTF-8 (Unicode) + + iconv -f CP1252 -t UTF-8 in.txt | dos2unix > uit.txt + +Omzetten van Unix Latin-1 naar DOS standaard code tabel + + unix2dos -iso -n in.txt uit.txt + +Omzetten van Unix Latin-1 naar DOS CP850 + + unix2dos -850 -n in.txt uit.txt + +Omzetten van Unix Latin-1 naar Windows CP1252 + + unix2dos -1252 -n in.txt uit.txt + +Omzetten van Unix UTF-8 (Unicode) naar Windows CP1252 + + unix2dos < in.txt | iconv -f UTF-8 -t CP1252 > uit.txt + +Zie ook L +en L. + +=back + +=head1 UNICODE + +=head2 Coderingen + +Er bestaan verschillende Unicode coderingen. Op Unix en Linux zijn Unicode +bestanden typisch gecodeerd in UTF-8. Op Windows kunnen Unicode tekst bestanden +gecodeerd zijn in UTF-8, UTF-16 of UTF-16 big endian, maar meestal zijn ze +gecodeerd in UTF-16 formaat. + +=head2 Conversie + +Unicode tekst bestanden kunnen DOS, Unix of Mac regeleindes hebben, net +als reguliere tekst bestanden. + +Alle versies van dos2unix en unix2dos kunnen UTF-8 gecodeerde bestanden +omzetten, want UTF-8 is ontworpen op compatibiliteit met ASCII. + +Dos2unix en unix2dos met Unicode UTF-16 ondersteuning, kunnen little en big +endian UTF-16 gecodeerde tekst bestanden lezen. Om er achter te komen of +dos2unix gebouwd is met UTF-16 ondersteuning type C. + +De Windows versies van dos2unix en unix2dos converteren UTF-16 gecodeerde +bestanden altijd naar UTF-8 gecondeerde bestanden. Unix versies van +dos2unix/unix2dos zetten UTF-16 gecodeerde bestanden om naar de lokale +karakter codering als die gelijk is aan UTF-8. Gebruik de opdracht +locale(1) om uit te vinden wat de lokale karakter codering is. + +Omdat UTF-8 geformateerde tekstbestanden zowel op Windows en Unix goed +ondersteund worden, hebben dos2unix en unix2dos geen optie om UTF-16 bestanden +te schrijven. Alle UTF-16 karakters kunnen worden omgezet naar UTF-8. De +omzetting van UTF-16 naar UTF-8 is verliesvrij. Op Unix worden UTF-16 bestanden +overgeslagen als de locale karakter codering ongelijk is aan UTF-8, om te +voorkomen dat er per ongeluk tekst verloren gaat. Wanneer een UTF-16 naar +UTF-8 conversiefout optreedt, bijvoorbeeld wanneer het UTF-16 invoerbestand +een fout bevat, wordt het bestand overgeslagen. + +ISO en 7-bit conversie werkt niet op UTF-16 bestanden. + +=head2 Byte Order Mark + +Op Windows hebben Unicode tekstbestanden typisch een Byte Order Mark (BOM), +omdat veel Windows programma's (inclusief Kladblok) standaard een BOM +toevoegen. Zie ook L. + +Op Unix hebben Unicode tekstbestanden typisch geen BOM. Er wordt aangenomen +dat de codering van tekstbestanden gelijk is aan de lokale karakter +codering. + +Dos2unix kan alleen detecteren of een bestand in UTF-16 formaat is als het +bestand een BOM heeft. Wanneer een UTF-16 bestand geen BOM heeft, ziet +dos2unix het bestand als een binair bestand. + +Gebruik dos2unix in combinatie met iconv(1) om een UTF-16 bestand zonder BOM om +te zetten. + +Dos2unix schrijft nooit een BOM in het uitvoerbestand, tenzij optie C<-m> +gebruikt wordt. + +Unix2dos schrijft een BOM in het uitvoerbestand wanneer het invoerbestand +een BOM heeft, of wanneer optie C<-m> gebruikt is. + +=head2 Unicode voorbeelden + +Omzetten van Windows UTF-16 (met BOM) naar Unix UTF-8 + + dos2unix -n in.txt uit.txt + +Omzetten van Windows UTF-16 (zonder BOM) naar Unix UTF-8 + + iconv -f UTF-16 -t UTF-8 in.txt | dos2unix > uit.txt + +Omzetten van Unix UTF-8 naar Windows UTF-8 met BOM + + unix2dos -m -n in.txt uit.txt + +Omzetten van Unix UTF-8 naar Windows UTF-16 + + unix2dos < in.txt | iconv -f UTF-8 -t UTF-16 > uit.txt + +=head1 VOORBEELDEN + +Lees invoer van 'stdin' en schrijf uitvoer naar 'stdout'. + + dos2unix + dos2unix -l -c mac + +Omzetten en vervangen a.txt. Omzetten en vervangen b.txt. + + dos2unix a.txt b.txt + dos2unix -o a.txt b.txt + +Omzetten en vervangen a.txt in ascii conversiemodus. + + dos2unix a.txt + +Omzetten en vervangen a.txt in ascii conversiemodus. +Omzetten en vervangen b.txt in 7bit conversiemodus. + + dos2unix a.txt -c 7bit b.txt + dos2unix -c ascii a.txt -c 7bit b.txt + dos2unix -ascii a.txt -7 b.txt + +Omzetten a.txt van Mac naar Unix format. + + dos2unix -c mac a.txt + mac2unix a.txt + +Omzetten a.txt van Unix naar Mac format. + + unix2dos -c mac a.txt + unix2mac a.txt + +Omzetten en vervangen a.txt met behoud van originele datum. + + dos2unix -k a.txt + dos2unix -k -o a.txt + +Omzetten a.txt en schrijf naar e.txt. + + dos2unix -n a.txt e.txt + +Omzetten a.txt en schrijf naar e.txt, behoud datum e.txt gelijk aan a.txt. + + dos2unix -k -n a.txt e.txt + +Omzetten en vervangen a.txt. Omzetten b.txt en schrijf naar e.txt. + + dos2unix a.txt -n b.txt e.txt + dos2unix -o a.txt -n b.txt e.txt + +Omzetten c.txt en schrijf naar e.txt. Omzetten en vervangen a.txt. +Omzetten en vervangen b.txt. Omzetten d.txt en schrijf naar f.txt. + + dos2unix -n c.txt e.txt -o a.txt b.txt -n d.txt f.txt + +=head1 RECURSIEVE CONVERSIE + +Gebruik dos2unix in combinatie met de find(1) en xargs(1) opdrachten om +tekstbestanden in een directoryboomstructuur recursief om te zetten. +Bijvoorbeeld om alle .txt bestanden in de directoryboom onder de huidige +map te converteren type: + + find . -name *.txt |xargs dos2unix + +=head1 LOKALISATIE + +=over 4 + +=item B + +The primaire taal wordt geselecteerd met de omgevingsvariabele LANG. De LANG +variabele bestaat uit verschillende onderdelen. Het eerste deel is in kleine +letters de taalcode. Het tweede deel is optioneel en is de landcode in +hoofdletters, voorafgegaan door een laag streepje. Er is ook een optioneel +derde deel: lettertekenreeks-codering, voorafgegaan door een punt. Enkele voorbeelden +voor een POSIX staandaard shell: + + export LANG=nl Nederlands + export LANG=nl_NL Nederlands, Nederland + export LANG=nl_BE Nederlands, België + export LANG=es_ES Spaans, Spanje + export LANG=es_MX Spaans, Mexico + export LANG=en_US.iso88591 Engels, VS, Latin-1 codering + export LANG=en_GB.UTF-8 Engels, GB, UTF-8 codering + +Voor een complete lijst van taal- en landcodes zie de gettext handleiding: +L + +Op Unix systemen kunt u de opdracht locale(1) gebruiken om specifieke +lokalisatie informatie te verkrijgen. + +=item B + +Met de omgevingsvariabele LANGUAGE kunt u een prioriteitenlijst specificeren +van talen, gescheiden door dubbele punten. Dos2unix geeft voorkeur aan +LANGUAGE boven LANG. Bijvoorbeeld, eerst Nederlands en dan Duits: C. +U moet eerst lokalisatie in werking stellen, met het instellen van LANG (of LC_ALL) +in een waarde ongelijk aan "C", voordat u een talen prioriteitenlijst kunt +gebruiken via de LANGUAGE variabele. Zie ook de gettext handleiding: +L + +Als u een taal kiest die niet beschikbaar is worden de standaard +Engelse berichten gebruikt. + +=item B + +Met de omgevingsvariabele DOS2UNIX_LOCALEDIR kan de LOCALEDIR gebruikt tijdens +compilatie worden overstemd. LOCALEDIR wordt gebruikt om de taalbestanden te +vinden. De GNU staandaard waarde is C. De optie "-V" +laat de gebruikte LOCALEDIR zien. + +Voorbeeld (POSIX shell): + + export DOS2UNIX_LOCALEDIR=$HOME/share/locale + +=back + +=head1 TERUGGAVE WAARDE + +Bij succes wordt nul terug gegeven. Wanneer een systeemfout optreedt wordt +het laatste systeemfoutnummer terug gegeven. Bij andere fouten wordt 1 terug gegeven. + +De teruggave is altijd nul in de modus stille werking, behalve wanneer verkeerde +opties worden gegeven. + +=head1 STANDAARDEN + +L + +L + +L + +L + +=head1 AUTEURS + +Benjamin Lin - , +Bernd Johannes Wuebben (mac2unix modus) - , +Christian Wurll (voeg extra regeleinde toe) - , +Erwin Waterlander - + +Project pagina: L + +SourceForge pagina: L + +Freshmeat: L + +=head1 ZIE OOK + +file(1) +find(1) +iconv(1) +locale(1) +xargs(1) + +=cut diff --git a/mingw.mak b/mingw.mak new file mode 100644 index 0000000..bf030c2 --- /dev/null +++ b/mingw.mak @@ -0,0 +1,37 @@ + +# Author: Erwin Waterlander +# Copyright (C) 2009 Erwin Waterlander +# This file is distributed under the same license as the dos2unix package. + +prefix=c:/usr/local +ENABLE_NLS=1 + +ifdef ENABLE_NLS +LDFLAGS_EXTRA = -lintl -liconv +# Using GnuWin32 gettext,iconv +#ZIPOBJ_EXTRA = bin/libintl3.dll bin/libiconv2.dll +# Using MinGW gettext,iconv +ZIPOBJ_EXTRA = bin/libintl-8.dll bin/libiconv-2.dll +endif + +all: + $(MAKE) all EXE=.exe ENABLE_NLS=$(ENABLE_NLS) LDFLAGS_EXTRA="$(LDFLAGS_EXTRA)" prefix=$(prefix) LINK="cp -f" EO_XNOTATION=1 + +install: + $(MAKE) install EXE=.exe ENABLE_NLS=$(ENABLE_NLS) LDFLAGS_EXTRA="$(LDFLAGS_EXTRA)" prefix=$(prefix) LINK="cp -f" EO_XNOTATION=1 + +uninstall: + $(MAKE) uninstall EXE=.exe prefix=$(prefix) + +clean: + $(MAKE) clean EXE=.exe ENABLE_NLS=$(ENABLE_NLS) prefix=$(prefix) + +mostlyclean: + $(MAKE) mostlyclean EXE=.exe ENABLE_NLS=$(ENABLE_NLS) prefix=$(prefix) + +dist: + $(MAKE) dist-zip EXE=.exe prefix=$(prefix) VERSIONSUFFIX="-win32" ZIPOBJ_EXTRA="${ZIPOBJ_EXTRA}" ENABLE_NLS=$(ENABLE_NLS) + +strip: + $(MAKE) strip LINK="cp -f" EXE=.exe + diff --git a/mingw64.mak b/mingw64.mak new file mode 100644 index 0000000..32f9e6a --- /dev/null +++ b/mingw64.mak @@ -0,0 +1,40 @@ + +# Author: Erwin Waterlander +# Copyright (C) 2012 Erwin Waterlander +# This file is distributed under the same license as the dos2unix package. + +CC = x86_64-w64-mingw32-gcc +STRIP = x86_64-w64-mingw32-strip +CRT_GLOB_OBJ = C:/mingw64/mingw/lib/CRT_glob.o + +prefix=c:/usr/local64 +ENABLE_NLS= + +ifdef ENABLE_NLS +LDFLAGS_EXTRA = -lintl -liconv +# Using MinGW gettext,iconv +#ZIPOBJ_EXTRA = bin/libintl-8.dll bin/libiconv-2.dll +endif +LDFLAGS_EXTRA += $(CRT_GLOB_OBJ) + +all: + $(MAKE) all EXE=.exe ENABLE_NLS=$(ENABLE_NLS) LDFLAGS_EXTRA="$(LDFLAGS_EXTRA)" prefix=$(prefix) LINK="cp -f" CC=$(CC) EO_XNOTATION=1 + +install: + $(MAKE) install EXE=.exe ENABLE_NLS=$(ENABLE_NLS) LDFLAGS_EXTRA="$(LDFLAGS_EXTRA)" prefix=$(prefix) LINK="cp -f" CC=$(CC) EO_XNOTATION=1 + +uninstall: + $(MAKE) uninstall EXE=.exe prefix=$(prefix) + +clean: + $(MAKE) clean EXE=.exe ENABLE_NLS=$(ENABLE_NLS) prefix=$(prefix) + +mostlyclean: + $(MAKE) mostlyclean EXE=.exe ENABLE_NLS=$(ENABLE_NLS) prefix=$(prefix) + +dist: + $(MAKE) dist-zip EXE=.exe prefix=$(prefix) VERSIONSUFFIX="-win64" ZIPOBJ_EXTRA="${ZIPOBJ_EXTRA}" ENABLE_NLS=$(ENABLE_NLS) + +strip: + $(MAKE) strip LINK="cp -f" EXE=.exe STRIP=$(STRIP) + diff --git a/os2.mak b/os2.mak new file mode 100644 index 0000000..99fa4a0 --- /dev/null +++ b/os2.mak @@ -0,0 +1,35 @@ + +# Author: Erwin Waterlander +# Copyright (C) 2009-2012 Erwin Waterlander +# This file is distributed under the same license as the dos2unix package. + +prefix=c:/usr +ENABLE_NLS=1 +LDFLAGS_EXTRA = -Zargs-wild + +ifdef ENABLE_NLS +LDFLAGS_EXTRA += -lintl -liconv +endif +ZIPOBJ_EXTRA = + +all: + $(MAKE) all EXE=.exe ENABLE_NLS=$(ENABLE_NLS) LDFLAGS_EXTRA="$(LDFLAGS_EXTRA)" prefix=$(prefix) LINK="cp -f" EO_XNOTATION=1 UCS= + +install: + $(MAKE) install EXE=.exe ENABLE_NLS=$(ENABLE_NLS) LDFLAGS_EXTRA="$(LDFLAGS_EXTRA)" prefix=$(prefix) LINK="cp -f" EO_XNOTATION=1 UCS= + +uninstall: + $(MAKE) uninstall EXE=.exe prefix=$(prefix) + +clean: + $(MAKE) clean EXE=.exe ENABLE_NLS=$(ENABLE_NLS) prefix=$(prefix) + +mostlyclean: + $(MAKE) mostlyclean EXE=.exe ENABLE_NLS=$(ENABLE_NLS) prefix=$(prefix) + +dist: + $(MAKE) dist-zip EXE=.exe prefix=$(prefix) VERSIONSUFFIX="-os2" ZIPOBJ_EXTRA="${ZIPOBJ_EXTRA}" ENABLE_NLS=$(ENABLE_NLS) + +strip: + $(MAKE) strip LINK="cp -f" EXE=.exe + diff --git a/po/de.po b/po/de.po new file mode 100644 index 0000000..0c8e9d8 --- /dev/null +++ b/po/de.po @@ -0,0 +1,411 @@ +# German messages for dos2unix +# Copyright (C) 2009-2012 +# This file is distributed under the same license as the dos2unix package. +# +# Philipp Thomas , 2009, 2010, 2011. +# Philipp Thomas , 2009,2010, 2011. +msgid "" +msgstr "" +"Project-Id-Version: dos2unix 5.2\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2012-03-30 09:25+0200\n" +"PO-Revision-Date: 2010-01-24 09:00+0100\n" +"Last-Translator: Philipp Thomas \n" +"Language-Team: German \n" +"Language: de\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: Lokalize 1.0\n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" + +#: dos2unix.c:76 +msgid "" +"Copyright (C) 2009-2012 Erwin Waterlander\n" +"Copyright (C) 1998 Christian Wurll (Version 3.1)\n" +"Copyright (C) 1998 Bernd Johannes Wuebben (Version 3.0)\n" +"Copyright (C) 1994-1995 Benjamin Lin\n" +"All rights reserved.\n" +"\n" +msgstr "" +"Copyright © 2009-2012 Erwin Waterlander\n" +"Copyright © 1998 Christian Wurll (Version 3.1)\n" +"Copyright © 1998 Bernd Johannes Wuebben (Version 3.0)\n" +"Copyright © 1994,1995 Benjamin Lin\n" +"Alle Rechte vorbehalten.\n" +"\n" + +#: dos2unix.c:169 dos2unix.c:200 dos2unix.c:224 dos2unix.c:323 dos2unix.c:351 +#: dos2unix.c:372 unix2dos.c:152 unix2dos.c:183 unix2dos.c:202 unix2dos.c:219 +#: unix2dos.c:331 unix2dos.c:359 unix2dos.c:375 unix2dos.c:389 +msgid "can not write to output file\n" +msgstr "In die Ausgabedatei kann nicht geschrieben werden\n" + +#: dos2unix.c:239 dos2unix.c:386 unix2dos.c:234 unix2dos.c:403 +#, c-format +msgid "program error, invalid conversion mode %d\n" +msgstr "Programmfehler, der Konvertierungsmodus %d ist unzulässig\n" + +#: dos2unix.c:293 unix2dos.c:288 +#, c-format +msgid "using code page %d.\n" +msgstr "Codepage %d wird verwendet.\n" + +#: dos2unix.c:474 unix2dos.c:491 +#, c-format +msgid "Failed to open temporary output file: %s\n" +msgstr "Die temporäre Ausgabedatei konnte nicht geöffnet werden: %s\n" + +#: dos2unix.c:481 unix2dos.c:498 +#, c-format +msgid "using %s as temporary file\n" +msgstr "%s wird als temporäre Datei verwendet\n" + +#: dos2unix.c:610 unix2dos.c:627 +#, c-format +msgid "Failed to change the permissions of temporary output file %s: %s\n" +msgstr "Das Ändern der Rechte der temporären Ausgabedatei %s scheiterte: %s\n" + +#: dos2unix.c:629 unix2dos.c:646 +#, c-format +msgid "Failed to change the owner and group of temporary output file %s: %s\n" +msgstr "" +"Das Ändern des Eigentümers und der Gruppe der temporären Ausgabedatei %s " +"scheiterte: %s\n" + +#: dos2unix.c:682 unix2dos.c:699 +#, c-format +msgid "problems resolving symbolic link '%s'\n" +msgstr "es gab Probleme beim Auflösen der symbolischen Verknüpfung »%s«\n" + +#: dos2unix.c:683 dos2unix.c:717 unix2dos.c:700 unix2dos.c:734 +#, c-format +msgid " output file remains in '%s'\n" +msgstr " Die Ausgabedatei verbleibt in »%s«\n" + +#: dos2unix.c:712 unix2dos.c:729 +#, c-format +msgid "problems renaming '%s' to '%s': %s\n" +msgstr "Beim Umbenennen von »%s« zu »%s« sind Probleme aufgetreten: %s\n" + +#: dos2unix.c:715 unix2dos.c:732 +#, c-format +msgid " which is the target of symbolic link '%s'\n" +msgstr " welche das Ziel der symbolischen Verknüpfung »%s« ist\n" + +#: dos2unix.c:807 unix2dos.c:824 +msgid "error: Value of environment variable DOS2UNIX_LOCALEDIR is too long.\n" +msgstr "" +"Fehler: Der Inhalt der Umgebungsvariablen DOS2UNIX_LOCALEDIR ist zu lang.\n" + +#: dos2unix.c:904 dos2unix.c:935 unix2dos.c:921 unix2dos.c:952 +#, c-format +msgid "active code page: %d\n" +msgstr "aktive Codepage: %d\n" + +#: dos2unix.c:945 unix2dos.c:962 +#, c-format +msgid "invalid %s conversion mode specified\n" +msgstr "Der angegebene Konvertierungsmodus %s ist unzulässig\n" + +#: dos2unix.c:955 unix2dos.c:972 +#, c-format +msgid "option '%s' requires an argument\n" +msgstr "Die Option »%s« benötigt ein Argument\n" + +#: dos2unix.c:968 dos2unix.c:982 dos2unix.c:1176 unix2dos.c:985 unix2dos.c:999 +#: unix2dos.c:1199 +#, c-format +msgid "target of file %s not specified in new file mode\n" +msgstr "Das Ziel der Datei %s wurde für den Neudatei-Modus nicht angegeben\n" + +#: dos2unix.c:1012 dos2unix.c:1096 unix2dos.c:1029 unix2dos.c:1116 +#, c-format +msgid "Skipping %s, not a regular file.\n" +msgstr "%s wird übersprungen, da es keine reguläre Datei ist\n" + +#: dos2unix.c:1019 unix2dos.c:1036 +#, c-format +msgid "Skipping %s, output file %s is a symbolic link.\n" +msgstr "" +"%s wird übersprungen, Ausgabedatei %s ist eine symbolische Verknüpfung.\n" + +#: dos2unix.c:1026 dos2unix.c:1110 unix2dos.c:1043 unix2dos.c:1130 +#, c-format +msgid "Skipping symbolic link %s, target is not a regular file.\n" +msgstr "" +"Symbolische Verknüpfung %s wird übersprungen da das Ziel keine reguläre " +"Datei ist.\n" + +#: dos2unix.c:1033 unix2dos.c:1050 +#, c-format +msgid "Skipping %s, target of symbolic link %s is not a regular file.\n" +msgstr "" +"%s wird übersprungen, das Ziel der symbolischen Verknüpfung %s ist keine " +"reguläre Datei.\n" + +#: dos2unix.c:1040 dos2unix.c:1117 unix2dos.c:1057 unix2dos.c:1137 +#, c-format +msgid "Skipping binary file %s\n" +msgstr "binäre Datei %s wird übersprungen\n" + +#: dos2unix.c:1047 dos2unix.c:1124 unix2dos.c:1064 unix2dos.c:1144 +#, c-format +msgid "code page %d is not supported.\n" +msgstr "Codepage %d wird nicht unterstützt.\n" + +#: dos2unix.c:1054 dos2unix.c:1131 unix2dos.c:1071 unix2dos.c:1151 +#, c-format +msgid "" +"Skipping UTF-16 file %s, the current locale character encoding is not " +"UTF-8.\n" +msgstr "UTF-16 Datei %s wird übersprungen, da die derzeitige Zeichenkodierung nicht UTF-8 ist.\n" + +#: dos2unix.c:1061 dos2unix.c:1138 unix2dos.c:1078 unix2dos.c:1158 +#, c-format +msgid "Skipping UTF-16 file %s, the size of wchar_t is %d bytes.\n" +msgstr "UTF-16 Datei %s wird übersprungen, da wchar_t %d Bytes groß ist.\n" + +#: dos2unix.c:1068 dos2unix.c:1145 unix2dos.c:1085 unix2dos.c:1165 +#, c-format +msgid "Skipping UTF-16 file %s, an UTF-16 conversion error occurred.\n" +msgstr "UTF-16 Datei %s wird übersprungen, da beim Umwandeln ein Fehler auftrat.\n" + +#: dos2unix.c:1074 +#, c-format +msgid "converting file %s to file %s in Unix format ...\n" +msgstr "Datei %s wird zu Datei %s im Unix-Format umgewandelt ...\n" + +#: dos2unix.c:1081 unix2dos.c:1101 +#, c-format +msgid "problems converting file %s to file %s\n" +msgstr "Beim Konvertieren von Datei %s zu Datei %s sind Probleme aufgetreten\n" + +#: dos2unix.c:1103 unix2dos.c:1123 +#, c-format +msgid "Skipping symbolic link %s.\n" +msgstr "Symbolische Verknüpfung %s wird übersprungen.\n" + +#: dos2unix.c:1151 +#, c-format +msgid "converting file %s to Unix format ...\n" +msgstr "Datei %s wird ins Unix-Format umgewandelt ...\n" + +#: dos2unix.c:1158 unix2dos.c:1181 +#, c-format +msgid "problems converting file %s\n" +msgstr "Beim Umwandeln von Datei %s sind Probleme aufgetreten\n" + +#: unix2dos.c:66 +msgid "" +"Copyright (C) 2009-2012 Erwin Waterlander\n" +"Copyright (C) 1994-1995 Benjamin Lin\n" +"All rights reserved.\n" +"\n" +msgstr "" +"Copyright © 2009-2012 Erwin Waterlander\n" +"Copyright © 1994,1995 Benjamin Lin\n" +"Alle Rechte vorbehalten.\n" +"\n" + +#: unix2dos.c:1092 +#, c-format +msgid "converting file %s to file %s in Mac format ...\n" +msgstr "Datei %s wird in Datei %s im Mac-Format konvertiert ...\n" + +#: unix2dos.c:1094 +#, c-format +msgid "converting file %s to file %s in DOS format ...\n" +msgstr "Datei %s wird in Datei %s im DOS-Format konvertiert ...\n" + +#: unix2dos.c:1172 +#, c-format +msgid "converting file %s to Mac format ...\n" +msgstr "Datei %s wird ins Mac-Format konvertiert ...\n" + +#: unix2dos.c:1174 +#, c-format +msgid "converting file %s to DOS format ...\n" +msgstr "Datei %s wird ins DOS-Format konvertiert ...\n" + +#: common.c:167 +msgid "" +"Redistribution and use in source and binary forms, with or without\n" +"modification, are permitted provided that the following conditions\n" +"are met:\n" +"1. Redistributions of source code must retain the above copyright\n" +" notice, this list of conditions and the following disclaimer.\n" +"2. Redistributions in binary form must reproduce the above copyright\n" +" notice in the documentation and/or other materials provided with\n" +" the distribution.\n" +"\n" +"THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY\n" +"EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n" +"IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\n" +"PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE\n" +"FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n" +"CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT\n" +"OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR\n" +"BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n" +"WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE\n" +"OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN\n" +"IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n" +msgstr "" +"Verbreitung und Verwendung als Quelltext oder Binärdatei, in geänderter\n" +"oder ungeänderter Form sind gestattet, soweit die folgenden Bedingungen\n" +"eingehalten werden:\n" +"1. Weiterverbreitung des Quellcodes muss den obigen Copyrightshinweis,\n" +" Diese Liste von Bedingungen sowie den folgenden Haftungsausschlus\n" +" beibehalten.\n" +"2. Weiterverbreitung in binärer Form muss den obigen Copyright-Hinweis\n" +" in der Dokumentation oder anderem der Distribution beiliegenden\n" +" Material wiedergeben.\n" +"\n" +"DIESE SOFTWARE WIRD VOM AUTHOR WIE VORLIEGT ZUR VERFÜGUNG GESTELLT\n" +"UND JEGLICHE AUSDRÜCKLICH GENANNTEN ODER IMPLIZITEN GARANTIEN,\n" +"EINSCHLIESLICH, ABER NICHT DARAUF BESCHRÄNKT, DER GARANTIE DER\n" +"HANDELBARKEIT UND DER EIGNUNG FÜR EINEN BESTIMMTEN ZWECK WERDEN\n" +"HIERMIT AUSGESCHLOSSEN. IN KEINEM WIE AUCH IMMER GELAGERTEN FALL KANN\n" +"DER AUTHOR FÜR IRGENDWELCHE DIREKTEN ODER INDIREKTEN, ZUFÄLLIGEN,\n" +"BESONDEREN ODER BEISPIELHAFTEN SCHÄDEN (EINSCHLIESSLICH ABER NICHT\n" +"AUSSCHLIESSLICH DER LIEFERUNG VON ERSATZGÜTERN ODER DIENSTEN;VERLUST\n" +"DER NUTZBARKEIT, DER DATEN ODER DER GEWINNE ODER ETWAIGEN VERDIENST-\n" +"AUSFALL-ENTSCHÄDIGUNGEN) HAFTBAR GEMACHT WERDEN, WIE AUCH IMMER SIE\n" +"VERURSACHT WURDEN UND WELCHE HAFTUNGSMÖGLICHKEIT ZUGRUNDE GELEGT WIRD,\n" +"SEI ES DURCH VERTRAG, VERBINDLICHKEIT ODER SCHADEN (EINSCHLIESSLICH\n" +"FAHRLÄSSIGKEIT), DIE AUS DER VERWENDUNG DIESER SOFTWARE ERWÄCHST,\n" +"SELBST WENN AUF DIE MÖGLICHKIET SOLCHER SCHÄDEN HINGEWIESEN WURDE.\n" + +#: common.c:193 +#, c-format +msgid "" +"%s %s (%s)\n" +"Usage: %s [options] [file ...] [-n infile outfile ...]\n" +" -ascii convert only line breaks (default)\n" +" -iso conversion between DOS and ISO-8859-1 character set\n" +" -1252 Use Windows code page 1252 (Western European)\n" +" -437 Use DOS code page 437 (US) (default)\n" +" -850 Use DOS code page 850 (Western European)\n" +" -860 Use DOS code page 860 (Portuguese)\n" +" -863 Use DOS code page 863 (French Canadian)\n" +" -865 Use DOS code page 865 (Nordic)\n" +" -7 Convert 8 bit characters to 7 bit space\n" +" -c, --convmode conversion mode\n" +" convmode ascii, 7bit, iso, mac, default to ascii\n" +" -f, --force force conversion of binary files\n" +" -h, --help give this help\n" +" -k, --keepdate keep output file date\n" +" -L, --license display software license\n" +" -l, --newline add additional newline\n" +" -m, --add-bom add UTF-8 Byte Order Mark\n" +" -n, --newfile write to new file\n" +" infile original file in new file mode\n" +" outfile output file in new file mode\n" +" -o, --oldfile write to old file\n" +" file ... files to convert in old file mode\n" +" -q, --quiet quiet mode, suppress all warnings\n" +" always on in stdio mode\n" +" -s, --safe skip binary files (default)\n" +msgstr "" +"%s %s (%s)\n" +"Aufruf: %s [Optionen] [Datei ...] [-n Eingabedatei Ausgabedatei ...]\n" +" -ascii nur Zeilenumbrüche konvertieren (Vorgabe)\n" +" -iso Konvertierung zwischen DOS und ISO-8859-1 " +"Zeichensatz\n" +" -1252 Windows Codepage 1252 verwenden (Westeuropäisch)\n" +" -437 DOS Codepage 437 verwenden (US) (Vorgabe)\n" +" -850 DOS Codepage 850 verwenden (Westeuropäisch)\n" +" -860 DOS Codepage 860 verwenden (Portugiesisch)\n" +" -863 DOS Codepage 863 verwenden (Kanadisches Französisch)\n" +" -865 DOS Codepage 865 verwenden (Nordisch)\n" +" -7 8Bit Zeichen in solche aus dem 7Bit Raum " +"konvertieren\n" +" -c, --convmode Konvertierungsmodus angeben\n" +" convmode ascii, 7bit, iso, mac, Standard ist nach ascii\n" +" -f, --force erzwingt die Umwandlung binärer Dateien\n" +" -h, --help gibt diese Hilfe\n" +" -k, --keepdate Datum der Ausgabedatei bleibt erhalten\n" +" -L, --license Ausgabe der Software-Lizenz\n" +" -l, --newline fügt einen Zeilenumbruch hinzu\n" +" -m, --add-bom UTF-8 Byte Order Mark hinzufügen\n" +" -n, --newfile eine neue Datei wird erzeugt\n" +" Eingabedatei Originaldatei im neue Datei Modus\n" +" Ausgabedatei Ausgabedatei im neue Datei Modus\n" +" -o, --oldfile überschreibt die alte Datei\n" +" Datei ... Die im alte Datei Modus zu konvertierenden Dateien\n" +" -q, --quiet ruhiger Modus, unterdrückt alle Warnungen\n" +" ist im stdio Modus immer aktiv\n" +" -s, --safe überspringt binäre Dateien (Vorgabe)\n" + +#: common.c:223 +#, c-format +msgid "" +" -F, --follow-symlink follow symbolic links and convert the targets\n" +" -R, --replace-symlink replace symbolic links with converted files\n" +" (original target files remain unchanged)\n" +" -S, --skip-symlink keep symbolic links and targets unchanged (default)\n" +msgstr "" +" -F, --follow-symlink folgt symbolischen Verknüpfungen und wandelt die " +"Ziele um\n" +" -R, --replace-symlink ersetzt symbolische Verknüpfungen durch die " +"umgewandelten\n" +" Dateien (die Originale Ziele bleiben unangetastet)\n" +" -S, --skip-symlink symbolische Verknüpfungen und deren Ziele bleiben\n" +" unangetastet (Vorgabe)\n" + +#: common.c:229 +#, c-format +msgid " -V, --version display version number\n" +msgstr " -V, --version gibt die Versionsnummer aus\n" + +#: common.c:241 +msgid "DOS 16 bit version (WATCOMC).\n" +msgstr "DOS 16 bit Version (WATCOMC).\n" + +#: common.c:243 +msgid "DOS 16 bit version (TURBOC).\n" +msgstr "DOS 16 bit Version (TURBOC).\n" + +#: common.c:245 +msgid "DOS 32 bit version (WATCOMC).\n" +msgstr "DOS 32 bit Version (WATCOMC).\n" + +#: common.c:247 +msgid "DOS 32 bit version (DJGPP).\n" +msgstr "DOS 32 bit Version (DJGPP).\n" + +#: common.c:249 +msgid "MSYS version.\n" +msgstr "MSYS Version.\n" + +#: common.c:251 +msgid "Cygwin version.\n" +msgstr "Cygwin Version.\n" + +#: common.c:253 +msgid "Windows 64 bit version (MinGW-w64).\n" +msgstr "Windows 64 bit Version (MinGW-w64).\n" + +#: common.c:255 +msgid "Windows 32 bit version (WATCOMC).\n" +msgstr "Windows 32 bit Version (WATCOMC).\n" + +#: common.c:257 +msgid "Windows 32 bit version (MinGW).\n" +msgstr "Windows 32 bit Version (MinGW).\n" + +#: common.c:259 +msgid "OS/2 version.\n" +msgstr "OS/2 Version.\n" + +#: common.c:262 +msgid "With Unicode UTF-16 support.\n" +msgstr "Mit Unterstützung für Unicode UTF-16.\n" + +#: common.c:264 +msgid "Without Unicode UTF-16 support.\n" +msgstr "Ohne Unterstützung für Unicode UTF-16.\n" + +#: common.c:267 +msgid "With native language support.\n" +msgstr "Mit Unterstützung von Landessprachen.\n" diff --git a/po/dos2unix.pot b/po/dos2unix.pot new file mode 100644 index 0000000..be5427c --- /dev/null +++ b/po/dos2unix.pot @@ -0,0 +1,331 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2012-05-06 12:13+0200\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=CHARSET\n" +"Content-Transfer-Encoding: 8bit\n" + +#: dos2unix.c:76 +msgid "" +"Copyright (C) 2009-2012 Erwin Waterlander\n" +"Copyright (C) 1998 Christian Wurll (Version 3.1)\n" +"Copyright (C) 1998 Bernd Johannes Wuebben (Version 3.0)\n" +"Copyright (C) 1994-1995 Benjamin Lin\n" +"All rights reserved.\n" +"\n" +msgstr "" + +#: dos2unix.c:169 dos2unix.c:200 dos2unix.c:224 dos2unix.c:323 dos2unix.c:351 +#: dos2unix.c:372 unix2dos.c:152 unix2dos.c:183 unix2dos.c:202 unix2dos.c:219 +#: unix2dos.c:331 unix2dos.c:359 unix2dos.c:375 unix2dos.c:389 +msgid "can not write to output file\n" +msgstr "" + +#: dos2unix.c:239 dos2unix.c:386 unix2dos.c:234 unix2dos.c:403 +#, c-format +msgid "program error, invalid conversion mode %d\n" +msgstr "" + +#: dos2unix.c:293 unix2dos.c:288 +#, c-format +msgid "using code page %d.\n" +msgstr "" + +#: dos2unix.c:474 unix2dos.c:491 +#, c-format +msgid "Failed to open temporary output file: %s\n" +msgstr "" + +#: dos2unix.c:481 unix2dos.c:498 +#, c-format +msgid "using %s as temporary file\n" +msgstr "" + +#: dos2unix.c:610 unix2dos.c:627 +#, c-format +msgid "Failed to change the permissions of temporary output file %s: %s\n" +msgstr "" + +#: dos2unix.c:629 unix2dos.c:646 +#, c-format +msgid "Failed to change the owner and group of temporary output file %s: %s\n" +msgstr "" + +#: dos2unix.c:682 unix2dos.c:699 +#, c-format +msgid "problems resolving symbolic link '%s'\n" +msgstr "" + +#: dos2unix.c:683 dos2unix.c:717 unix2dos.c:700 unix2dos.c:734 +#, c-format +msgid " output file remains in '%s'\n" +msgstr "" + +#: dos2unix.c:712 unix2dos.c:729 +#, c-format +msgid "problems renaming '%s' to '%s': %s\n" +msgstr "" + +#: dos2unix.c:715 unix2dos.c:732 +#, c-format +msgid " which is the target of symbolic link '%s'\n" +msgstr "" + +#: dos2unix.c:807 unix2dos.c:824 +msgid "error: Value of environment variable DOS2UNIX_LOCALEDIR is too long.\n" +msgstr "" + +#: dos2unix.c:904 dos2unix.c:935 unix2dos.c:921 unix2dos.c:952 +#, c-format +msgid "active code page: %d\n" +msgstr "" + +#: dos2unix.c:945 unix2dos.c:962 +#, c-format +msgid "invalid %s conversion mode specified\n" +msgstr "" + +#: dos2unix.c:955 unix2dos.c:972 +#, c-format +msgid "option '%s' requires an argument\n" +msgstr "" + +#: dos2unix.c:968 dos2unix.c:982 dos2unix.c:1176 unix2dos.c:985 unix2dos.c:999 +#: unix2dos.c:1199 +#, c-format +msgid "target of file %s not specified in new file mode\n" +msgstr "" + +#: dos2unix.c:1012 dos2unix.c:1096 unix2dos.c:1029 unix2dos.c:1116 +#, c-format +msgid "Skipping %s, not a regular file.\n" +msgstr "" + +#: dos2unix.c:1019 unix2dos.c:1036 +#, c-format +msgid "Skipping %s, output file %s is a symbolic link.\n" +msgstr "" + +#: dos2unix.c:1026 dos2unix.c:1110 unix2dos.c:1043 unix2dos.c:1130 +#, c-format +msgid "Skipping symbolic link %s, target is not a regular file.\n" +msgstr "" + +#: dos2unix.c:1033 unix2dos.c:1050 +#, c-format +msgid "Skipping %s, target of symbolic link %s is not a regular file.\n" +msgstr "" + +#: dos2unix.c:1040 dos2unix.c:1117 unix2dos.c:1057 unix2dos.c:1137 +#, c-format +msgid "Skipping binary file %s\n" +msgstr "" + +#: dos2unix.c:1047 dos2unix.c:1124 unix2dos.c:1064 unix2dos.c:1144 +#, c-format +msgid "code page %d is not supported.\n" +msgstr "" + +#: dos2unix.c:1054 dos2unix.c:1131 unix2dos.c:1071 unix2dos.c:1151 +#, c-format +msgid "" +"Skipping UTF-16 file %s, the current locale character encoding is not " +"UTF-8.\n" +msgstr "" + +#: dos2unix.c:1061 dos2unix.c:1138 unix2dos.c:1078 unix2dos.c:1158 +#, c-format +msgid "Skipping UTF-16 file %s, the size of wchar_t is %d bytes.\n" +msgstr "" + +#: dos2unix.c:1068 dos2unix.c:1145 unix2dos.c:1085 unix2dos.c:1165 +#, c-format +msgid "Skipping UTF-16 file %s, an UTF-16 conversion error occurred.\n" +msgstr "" + +#: dos2unix.c:1074 +#, c-format +msgid "converting file %s to file %s in Unix format ...\n" +msgstr "" + +#: dos2unix.c:1081 unix2dos.c:1101 +#, c-format +msgid "problems converting file %s to file %s\n" +msgstr "" + +#: dos2unix.c:1103 unix2dos.c:1123 +#, c-format +msgid "Skipping symbolic link %s.\n" +msgstr "" + +#: dos2unix.c:1151 +#, c-format +msgid "converting file %s to Unix format ...\n" +msgstr "" + +#: dos2unix.c:1158 unix2dos.c:1181 +#, c-format +msgid "problems converting file %s\n" +msgstr "" + +#: unix2dos.c:66 +msgid "" +"Copyright (C) 2009-2012 Erwin Waterlander\n" +"Copyright (C) 1994-1995 Benjamin Lin\n" +"All rights reserved.\n" +"\n" +msgstr "" + +#: unix2dos.c:1092 +#, c-format +msgid "converting file %s to file %s in Mac format ...\n" +msgstr "" + +#: unix2dos.c:1094 +#, c-format +msgid "converting file %s to file %s in DOS format ...\n" +msgstr "" + +#: unix2dos.c:1172 +#, c-format +msgid "converting file %s to Mac format ...\n" +msgstr "" + +#: unix2dos.c:1174 +#, c-format +msgid "converting file %s to DOS format ...\n" +msgstr "" + +#: common.c:167 +msgid "" +"Redistribution and use in source and binary forms, with or without\n" +"modification, are permitted provided that the following conditions\n" +"are met:\n" +"1. Redistributions of source code must retain the above copyright\n" +" notice, this list of conditions and the following disclaimer.\n" +"2. Redistributions in binary form must reproduce the above copyright\n" +" notice in the documentation and/or other materials provided with\n" +" the distribution.\n" +"\n" +"THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY\n" +"EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n" +"IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\n" +"PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE\n" +"FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n" +"CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT\n" +"OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR\n" +"BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n" +"WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE\n" +"OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN\n" +"IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n" +msgstr "" + +#: common.c:193 +#, c-format +msgid "" +"%s %s (%s)\n" +"Usage: %s [options] [file ...] [-n infile outfile ...]\n" +" -ascii convert only line breaks (default)\n" +" -iso conversion between DOS and ISO-8859-1 character set\n" +" -1252 Use Windows code page 1252 (Western European)\n" +" -437 Use DOS code page 437 (US) (default)\n" +" -850 Use DOS code page 850 (Western European)\n" +" -860 Use DOS code page 860 (Portuguese)\n" +" -863 Use DOS code page 863 (French Canadian)\n" +" -865 Use DOS code page 865 (Nordic)\n" +" -7 Convert 8 bit characters to 7 bit space\n" +" -c, --convmode conversion mode\n" +" convmode ascii, 7bit, iso, mac, default to ascii\n" +" -f, --force force conversion of binary files\n" +" -h, --help give this help\n" +" -k, --keepdate keep output file date\n" +" -L, --license display software license\n" +" -l, --newline add additional newline\n" +" -m, --add-bom add UTF-8 Byte Order Mark\n" +" -n, --newfile write to new file\n" +" infile original file in new file mode\n" +" outfile output file in new file mode\n" +" -o, --oldfile write to old file\n" +" file ... files to convert in old file mode\n" +" -q, --quiet quiet mode, suppress all warnings\n" +" always on in stdio mode\n" +" -s, --safe skip binary files (default)\n" +msgstr "" + +#: common.c:223 +#, c-format +msgid "" +" -F, --follow-symlink follow symbolic links and convert the targets\n" +" -R, --replace-symlink replace symbolic links with converted files\n" +" (original target files remain unchanged)\n" +" -S, --skip-symlink keep symbolic links and targets unchanged (default)\n" +msgstr "" + +#: common.c:229 +#, c-format +msgid " -V, --version display version number\n" +msgstr "" + +#: common.c:241 +msgid "DOS 16 bit version (WATCOMC).\n" +msgstr "" + +#: common.c:243 +msgid "DOS 16 bit version (TURBOC).\n" +msgstr "" + +#: common.c:245 +msgid "DOS 32 bit version (WATCOMC).\n" +msgstr "" + +#: common.c:247 +msgid "DOS 32 bit version (DJGPP).\n" +msgstr "" + +#: common.c:249 +msgid "MSYS version.\n" +msgstr "" + +#: common.c:251 +msgid "Cygwin version.\n" +msgstr "" + +#: common.c:253 +msgid "Windows 64 bit version (MinGW-w64).\n" +msgstr "" + +#: common.c:255 +msgid "Windows 32 bit version (WATCOMC).\n" +msgstr "" + +#: common.c:257 +msgid "Windows 32 bit version (MinGW).\n" +msgstr "" + +#: common.c:259 +msgid "OS/2 version.\n" +msgstr "" + +#: common.c:262 +msgid "With Unicode UTF-16 support.\n" +msgstr "" + +#: common.c:264 +msgid "Without Unicode UTF-16 support.\n" +msgstr "" + +#: common.c:267 +msgid "With native language support.\n" +msgstr "" diff --git a/po/eo-x.po b/po/eo-x.po new file mode 100644 index 0000000..2bd61a1 --- /dev/null +++ b/po/eo-x.po @@ -0,0 +1,367 @@ +# Esperanto translations for dos2unix package. +# Copyright (C) 2009-2012 THE dos2unix's COPYRIGHT HOLDER +# This file is distributed under the same license as the dos2unix package. +# waterlan , 2009-2012. +# +msgid "" +msgstr "" +"Project-Id-Version: dos2unix 5.3.1\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2012-03-30 09:25+0200\n" +"PO-Revision-Date: 2010-03-07 19:50+0100\n" +"Last-Translator: Rugxulo \n" +"Language-Team: Esperanto \n" +"Language: eo\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: dos2unix.c:76 +msgid "" +"Copyright (C) 2009-2012 Erwin Waterlander\n" +"Copyright (C) 1998 Christian Wurll (Version 3.1)\n" +"Copyright (C) 1998 Bernd Johannes Wuebben (Version 3.0)\n" +"Copyright (C) 1994-1995 Benjamin Lin\n" +"All rights reserved.\n" +"\n" +msgstr "" + +#: dos2unix.c:169 dos2unix.c:200 dos2unix.c:224 dos2unix.c:323 dos2unix.c:351 +#: dos2unix.c:372 unix2dos.c:152 unix2dos.c:183 unix2dos.c:202 unix2dos.c:219 +#: unix2dos.c:331 unix2dos.c:359 unix2dos.c:375 unix2dos.c:389 +msgid "can not write to output file\n" +msgstr "ne povas registri dosieren\n" + +#: dos2unix.c:239 dos2unix.c:386 unix2dos.c:234 unix2dos.c:403 +#, c-format +msgid "program error, invalid conversion mode %d\n" +msgstr "programa eraro, negxustan sxangxmodon %d\n" + +#: dos2unix.c:293 unix2dos.c:288 +#, c-format +msgid "using code page %d.\n" +msgstr "uzante kodpagxon %d.\n" + +#: dos2unix.c:474 unix2dos.c:491 +#, c-format +msgid "Failed to open temporary output file: %s\n" +msgstr "malsukcesis malfermi provizoran dosieron registran: %s\n" + +#: dos2unix.c:481 unix2dos.c:498 +#, c-format +msgid "using %s as temporary file\n" +msgstr "uzante %s kiel provizora dosiero\n" + +#: dos2unix.c:610 unix2dos.c:627 +#, c-format +msgid "Failed to change the permissions of temporary output file %s: %s\n" +msgstr "" +"Malsukcesis sxangxi la permesajxojn de la provizora eldona dosiero %s: %s\n" + +#: dos2unix.c:629 unix2dos.c:646 +#, c-format +msgid "Failed to change the owner and group of temporary output file %s: %s\n" +msgstr "" +"Malsukcesis sxangxi la proprietulon kaj grupon de la provizora eldona " +"dosiero %s: %s\n" + +#: dos2unix.c:682 unix2dos.c:699 +#, c-format +msgid "problems resolving symbolic link '%s'\n" +msgstr "erarojn legante dosieran cxeneron '%s'\n" + +#: dos2unix.c:683 dos2unix.c:717 unix2dos.c:700 unix2dos.c:734 +#, c-format +msgid " output file remains in '%s'\n" +msgstr " kreatan dosieron restas en '%s'\n" + +#: dos2unix.c:712 unix2dos.c:729 +#, c-format +msgid "problems renaming '%s' to '%s': %s\n" +msgstr "problemojn trovitajn renomigi '%s' al '%s': %s\n" + +#: dos2unix.c:715 unix2dos.c:732 +#, c-format +msgid " which is the target of symbolic link '%s'\n" +msgstr " kiu estas la atingon de dosiera cxenero '%s'\n" + +#: dos2unix.c:807 unix2dos.c:824 +msgid "error: Value of environment variable DOS2UNIX_LOCALEDIR is too long.\n" +msgstr "eraro: DOS2UNIX_LOCALEDIR tro longigxis.\n" + +#: dos2unix.c:904 dos2unix.c:935 unix2dos.c:921 unix2dos.c:952 +#, c-format +msgid "active code page: %d\n" +msgstr "nuntempa kodpagxo: %d\n" + +#: dos2unix.c:945 unix2dos.c:962 +#, c-format +msgid "invalid %s conversion mode specified\n" +msgstr "neuzebla %s sxangxmodo menciita\n" + +#: dos2unix.c:955 unix2dos.c:972 +#, c-format +msgid "option '%s' requires an argument\n" +msgstr "elekto '%s' bezonas elekto-vorton\n" + +#: dos2unix.c:968 dos2unix.c:982 dos2unix.c:1176 unix2dos.c:985 unix2dos.c:999 +#: unix2dos.c:1199 +#, c-format +msgid "target of file %s not specified in new file mode\n" +msgstr "ejon de dosiero %s ne menciita en novmodo dosiera\n" + +#: dos2unix.c:1012 dos2unix.c:1096 unix2dos.c:1029 unix2dos.c:1116 +#, c-format +msgid "Skipping %s, not a regular file.\n" +msgstr "Pasante %s, dosiero ne taugxa.\n" + +#: dos2unix.c:1019 unix2dos.c:1036 +#, c-format +msgid "Skipping %s, output file %s is a symbolic link.\n" +msgstr "Evitante %s, atingan dosieron %s jam estas dosiera cxenero.\n" + +#: dos2unix.c:1026 dos2unix.c:1110 unix2dos.c:1043 unix2dos.c:1130 +#, c-format +msgid "Skipping symbolic link %s, target is not a regular file.\n" +msgstr "Evitante dosieran cxeneron %s, atingon ne estas normala dosiero.\n" + +#: dos2unix.c:1033 unix2dos.c:1050 +#, c-format +msgid "Skipping %s, target of symbolic link %s is not a regular file.\n" +msgstr "Evitante %s, atingon de dosiera cxenero %s ne estas normala dosiero.\n" + +#: dos2unix.c:1040 dos2unix.c:1117 unix2dos.c:1057 unix2dos.c:1137 +#, c-format +msgid "Skipping binary file %s\n" +msgstr "Pasante ne-tekstan dosieron %s\n" + +#: dos2unix.c:1047 dos2unix.c:1124 unix2dos.c:1064 unix2dos.c:1144 +#, c-format +msgid "code page %d is not supported.\n" +msgstr "kodpagxo %d ne estas konvertebla.\n" + +#: dos2unix.c:1054 dos2unix.c:1131 unix2dos.c:1071 unix2dos.c:1151 +#, c-format +msgid "" +"Skipping UTF-16 file %s, the current locale character encoding is not " +"UTF-8.\n" +msgstr "Evitante UTF-16 dosieron %s, la nuntempa lingvo-loka litero-enkodigxo ne egalas UTF-8.\n" + +#: dos2unix.c:1061 dos2unix.c:1138 unix2dos.c:1078 unix2dos.c:1158 +#, c-format +msgid "Skipping UTF-16 file %s, the size of wchar_t is %d bytes.\n" +msgstr "Evitante UTF-16 dosieron %s, la mezuro da wchar_t estas %d okopoj.\n" + +#: dos2unix.c:1068 dos2unix.c:1145 unix2dos.c:1085 unix2dos.c:1165 +#, c-format +msgid "Skipping UTF-16 file %s, an UTF-16 conversion error occurred.\n" +msgstr "Evitante UTF-16 dosieron %s, eraro de UTF-16 tradukigxo okazis.\n" + +#: dos2unix.c:1074 +#, c-format +msgid "converting file %s to file %s in Unix format ...\n" +msgstr "sxangxante dosieron %s al dosiero %s Unix-en ...\n" + +#: dos2unix.c:1081 unix2dos.c:1101 +#, c-format +msgid "problems converting file %s to file %s\n" +msgstr "problemojn trovitajn dum sxangxi dosiero %s al dosiero %s\n" + +#: dos2unix.c:1103 unix2dos.c:1123 +#, c-format +msgid "Skipping symbolic link %s.\n" +msgstr "Evitante dosieran cxeneron %s.\n" + +#: dos2unix.c:1151 +#, c-format +msgid "converting file %s to Unix format ...\n" +msgstr "sxangxante dosiero %s Unix-en ...\n" + +#: dos2unix.c:1158 unix2dos.c:1181 +#, c-format +msgid "problems converting file %s\n" +msgstr "problemojn dum sxangxi dosiero %s\n" + +#: unix2dos.c:66 +msgid "" +"Copyright (C) 2009-2012 Erwin Waterlander\n" +"Copyright (C) 1994-1995 Benjamin Lin\n" +"All rights reserved.\n" +"\n" +msgstr "" + +#: unix2dos.c:1092 +#, c-format +msgid "converting file %s to file %s in Mac format ...\n" +msgstr "sxangxante dosiero %s al dosiero %s Mac-en ...\n" + +#: unix2dos.c:1094 +#, c-format +msgid "converting file %s to file %s in DOS format ...\n" +msgstr "sxangxante dosiero %s al dosiero %s DOS-en ...\n" + +#: unix2dos.c:1172 +#, c-format +msgid "converting file %s to Mac format ...\n" +msgstr "sxangxante dosiero %s Mac-en ...\n" + +#: unix2dos.c:1174 +#, c-format +msgid "converting file %s to DOS format ...\n" +msgstr "sxangxante dosiero %s DOS-en ...\n" + +#: common.c:167 +msgid "" +"Redistribution and use in source and binary forms, with or without\n" +"modification, are permitted provided that the following conditions\n" +"are met:\n" +"1. Redistributions of source code must retain the above copyright\n" +" notice, this list of conditions and the following disclaimer.\n" +"2. Redistributions in binary form must reproduce the above copyright\n" +" notice in the documentation and/or other materials provided with\n" +" the distribution.\n" +"\n" +"THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY\n" +"EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n" +"IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\n" +"PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE\n" +"FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n" +"CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT\n" +"OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR\n" +"BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n" +"WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE\n" +"OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN\n" +"IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n" +msgstr "" + +#: common.c:193 +#, c-format +msgid "" +"%s %s (%s)\n" +"Usage: %s [options] [file ...] [-n infile outfile ...]\n" +" -ascii convert only line breaks (default)\n" +" -iso conversion between DOS and ISO-8859-1 character set\n" +" -1252 Use Windows code page 1252 (Western European)\n" +" -437 Use DOS code page 437 (US) (default)\n" +" -850 Use DOS code page 850 (Western European)\n" +" -860 Use DOS code page 860 (Portuguese)\n" +" -863 Use DOS code page 863 (French Canadian)\n" +" -865 Use DOS code page 865 (Nordic)\n" +" -7 Convert 8 bit characters to 7 bit space\n" +" -c, --convmode conversion mode\n" +" convmode ascii, 7bit, iso, mac, default to ascii\n" +" -f, --force force conversion of binary files\n" +" -h, --help give this help\n" +" -k, --keepdate keep output file date\n" +" -L, --license display software license\n" +" -l, --newline add additional newline\n" +" -m, --add-bom add UTF-8 Byte Order Mark\n" +" -n, --newfile write to new file\n" +" infile original file in new file mode\n" +" outfile output file in new file mode\n" +" -o, --oldfile write to old file\n" +" file ... files to convert in old file mode\n" +" -q, --quiet quiet mode, suppress all warnings\n" +" always on in stdio mode\n" +" -s, --safe skip binary files (default)\n" +msgstr "" +"%s %s (%s)\n" +"Uzado: %s [elektojn] [dosiero ...] [-n antauxajxo kreajxo ...]\n" +" -ascii nur traduku linio-finojn (jam ensxaltita)\n" +" -iso traduku inter DOS kaj ISO-8859-1 literaro\n" +" -1252 Uzu Vindozan kodpagxon 1252 (Okcident-Euxropa)\n" +" -437 Uzu DOS kodpagxon 437 (Usona) (jam ensxaltita)\n" +" -850 Uzu DOS kodpagxon 850 (Okcident-Euxropa)\n" +" -860 Uzu DOS kodpagxon 860 (Portugala)\n" +" -863 Uzu DOS kodpagxon 863 (Kebekia)\n" +" -865 Uzu DOS kodpagxon 865 (Nordlandaj)\n" +" -7 Traduku de 8-bitaj literoj en blankspacon\n" +" -c, --convmode modo de sxangxo\n" +" sxangxmodo ascii, 7bit, iso, mac, provizore elektita ascii\n" +" -f, --force forte konvertado de netekstaj dosieroj\n" +" -h, --help diri cxi tiun mesagxon\n" +" -k, --keepdate konservi dato-tempon dosieran\n" +" -L, --license eldiru permesilon tekstan\n" +" -l, --newline aldoni markon linian finan\n" +" -m, --aldoni-bom aldoni UTF-8 internan ordo-markon\n" +" -n, --newfile registri novan dosieron\n" +" antauxajxo al antauxa dosiero metita novmoden\n" +" kreajxo al dosiero registrita novmoden\n" +" -o, --oldfile registri malnovan dosieron\n" +" dosiero... dosiero(j)n por registri per malnova modo\n" +" -q, --quiet silente eviti avertojn\n" +" cxiam ensxaltata dum stdio modo\n" +" -s, --safe evitu netekstajn dosierojn (jam sxaltita)\n" + +#: common.c:223 +#, c-format +msgid "" +" -F, --follow-symlink follow symbolic links and convert the targets\n" +" -R, --replace-symlink replace symbolic links with converted files\n" +" (original target files remain unchanged)\n" +" -S, --skip-symlink keep symbolic links and targets unchanged (default)\n" +msgstr "" +" -F, --follow-symlink legu dosierajn cxenerojn kaj konverti la atingojn\n" +" -R, --replace-symlink anstatauxe registru dosierajn cxenerojn per " +"konvertotaj dosieroj\n" +" (ne-cxeneraj atingaj dosieroj restas nesxangxitaj)\n" +" -S, --skip-symlink retenu dosierajn cxenerojn kaj atingojn nesxangxataj " +"(jam sxaltita)\n" + +#: common.c:229 +#, c-format +msgid " -V, --version display version number\n" +msgstr " -V, --version diri eldono-numeron\n" + +#: common.c:241 +msgid "DOS 16 bit version (WATCOMC).\n" +msgstr "DOS-16 eldono (WATCOMC).\n" + +#: common.c:243 +msgid "DOS 16 bit version (TURBOC).\n" +msgstr "DOS-16 eldono (TURBOC).\n" + +#: common.c:245 +msgid "DOS 32 bit version (WATCOMC).\n" +msgstr "DOS-32 eldono (WATCOMC).\n" + +#: common.c:247 +msgid "DOS 32 bit version (DJGPP).\n" +msgstr "DOS-32 eldono (DJGPP).\n" + +#: common.c:249 +msgid "MSYS version.\n" +msgstr "MSYS eldono.\n" + +#: common.c:251 +msgid "Cygwin version.\n" +msgstr "Cygwin eldono.\n" + +#: common.c:253 +msgid "Windows 64 bit version (MinGW-w64).\n" +msgstr "Windows-64 eldono (MinGW-w64).\n" + +#: common.c:255 +msgid "Windows 32 bit version (WATCOMC).\n" +msgstr "Windows-32 eldono (WATCOMC).\n" + +#: common.c:257 +msgid "Windows 32 bit version (MinGW).\n" +msgstr "Windows-32 eldono (MinGW).\n" + +#: common.c:259 +msgid "OS/2 version.\n" +msgstr "OS/2 eldono.\n" + +#: common.c:262 +msgid "With Unicode UTF-16 support.\n" +msgstr "Kun subteno de Unikodo da UTF-16.\n" + +#: common.c:264 +msgid "Without Unicode UTF-16 support.\n" +msgstr "Sen subteno de Unikodo da UTF-16.\n" + +#: common.c:267 +msgid "With native language support.\n" +msgstr "Uzante denaskan lingvon sistemon.\n" diff --git a/po/eo.po b/po/eo.po new file mode 100644 index 0000000..5bd7fe8 --- /dev/null +++ b/po/eo.po @@ -0,0 +1,367 @@ +# Esperanto translations for dos2unix package. +# Copyright (C) 2009-2012 THE dos2unix's COPYRIGHT HOLDER +# This file is distributed under the same license as the dos2unix package. +# waterlan , 2009-2012. +# +msgid "" +msgstr "" +"Project-Id-Version: dos2unix 5.3.1\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2012-03-30 09:25+0200\n" +"PO-Revision-Date: 2010-03-07 19:50+0100\n" +"Last-Translator: Ruĝulo \n" +"Language-Team: Esperanto \n" +"Language: eo\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: dos2unix.c:76 +msgid "" +"Copyright (C) 2009-2012 Erwin Waterlander\n" +"Copyright (C) 1998 Christian Wurll (Version 3.1)\n" +"Copyright (C) 1998 Bernd Johannes Wuebben (Version 3.0)\n" +"Copyright (C) 1994-1995 Benjamin Lin\n" +"All rights reserved.\n" +"\n" +msgstr "" + +#: dos2unix.c:169 dos2unix.c:200 dos2unix.c:224 dos2unix.c:323 dos2unix.c:351 +#: dos2unix.c:372 unix2dos.c:152 unix2dos.c:183 unix2dos.c:202 unix2dos.c:219 +#: unix2dos.c:331 unix2dos.c:359 unix2dos.c:375 unix2dos.c:389 +msgid "can not write to output file\n" +msgstr "ne povas registri dosieren\n" + +#: dos2unix.c:239 dos2unix.c:386 unix2dos.c:234 unix2dos.c:403 +#, c-format +msgid "program error, invalid conversion mode %d\n" +msgstr "programa eraro, neĝustan ŝanĝmodon %d\n" + +#: dos2unix.c:293 unix2dos.c:288 +#, c-format +msgid "using code page %d.\n" +msgstr "uzante kodpaĝon %d.\n" + +#: dos2unix.c:474 unix2dos.c:491 +#, c-format +msgid "Failed to open temporary output file: %s\n" +msgstr "malsukcesis malfermi provizoran dosieron registran: %s\n" + +#: dos2unix.c:481 unix2dos.c:498 +#, c-format +msgid "using %s as temporary file\n" +msgstr "uzante %s kiel provizora dosiero\n" + +#: dos2unix.c:610 unix2dos.c:627 +#, c-format +msgid "Failed to change the permissions of temporary output file %s: %s\n" +msgstr "" +"Malsukcesis ŝanĝi la permesaĵojn de la provizora eldona dosiero %s: %s\n" + +#: dos2unix.c:629 unix2dos.c:646 +#, c-format +msgid "Failed to change the owner and group of temporary output file %s: %s\n" +msgstr "" +"Malsukcesis ŝanĝi la proprietulon kaj grupon de la provizora eldona dosiero " +"%s: %s\n" + +#: dos2unix.c:682 unix2dos.c:699 +#, c-format +msgid "problems resolving symbolic link '%s'\n" +msgstr "erarojn legante dosieran ĉeneron '%s'\n" + +#: dos2unix.c:683 dos2unix.c:717 unix2dos.c:700 unix2dos.c:734 +#, c-format +msgid " output file remains in '%s'\n" +msgstr " kreatan dosieron restas en '%s'\n" + +#: dos2unix.c:712 unix2dos.c:729 +#, c-format +msgid "problems renaming '%s' to '%s': %s\n" +msgstr "problemojn trovitajn renomigi '%s' al '%s': %s\n" + +#: dos2unix.c:715 unix2dos.c:732 +#, c-format +msgid " which is the target of symbolic link '%s'\n" +msgstr " kiu estas la atingon de dosiera ĉenero '%s'\n" + +#: dos2unix.c:807 unix2dos.c:824 +msgid "error: Value of environment variable DOS2UNIX_LOCALEDIR is too long.\n" +msgstr "eraro: DOS2UNIX_LOCALEDIR tro longiĝis.\n" + +#: dos2unix.c:904 dos2unix.c:935 unix2dos.c:921 unix2dos.c:952 +#, c-format +msgid "active code page: %d\n" +msgstr "nuntempa kodpaĝo: %d\n" + +#: dos2unix.c:945 unix2dos.c:962 +#, c-format +msgid "invalid %s conversion mode specified\n" +msgstr "neuzebla %s ŝanĝmodo menciita\n" + +#: dos2unix.c:955 unix2dos.c:972 +#, c-format +msgid "option '%s' requires an argument\n" +msgstr "elekto '%s' bezonas elekto-vorton\n" + +#: dos2unix.c:968 dos2unix.c:982 dos2unix.c:1176 unix2dos.c:985 unix2dos.c:999 +#: unix2dos.c:1199 +#, c-format +msgid "target of file %s not specified in new file mode\n" +msgstr "ejon de dosiero %s ne menciita en novmodo dosiera\n" + +#: dos2unix.c:1012 dos2unix.c:1096 unix2dos.c:1029 unix2dos.c:1116 +#, c-format +msgid "Skipping %s, not a regular file.\n" +msgstr "Pasante %s, dosiero ne tauĝa.\n" + +#: dos2unix.c:1019 unix2dos.c:1036 +#, c-format +msgid "Skipping %s, output file %s is a symbolic link.\n" +msgstr "Evitante %s, atingan dosieron %s jam estas dosiera ĉenero.\n" + +#: dos2unix.c:1026 dos2unix.c:1110 unix2dos.c:1043 unix2dos.c:1130 +#, c-format +msgid "Skipping symbolic link %s, target is not a regular file.\n" +msgstr "Evitante dosieran ĉeneron %s, atingon ne estas normala dosiero.\n" + +#: dos2unix.c:1033 unix2dos.c:1050 +#, c-format +msgid "Skipping %s, target of symbolic link %s is not a regular file.\n" +msgstr "Evitante %s, atingon de dosiera ĉenero %s ne estas normala dosiero.\n" + +#: dos2unix.c:1040 dos2unix.c:1117 unix2dos.c:1057 unix2dos.c:1137 +#, c-format +msgid "Skipping binary file %s\n" +msgstr "Pasante ne-tekstan dosieron %s\n" + +#: dos2unix.c:1047 dos2unix.c:1124 unix2dos.c:1064 unix2dos.c:1144 +#, c-format +msgid "code page %d is not supported.\n" +msgstr "kodpaĝo %d ne estas konvertebla.\n" + +#: dos2unix.c:1054 dos2unix.c:1131 unix2dos.c:1071 unix2dos.c:1151 +#, c-format +msgid "" +"Skipping UTF-16 file %s, the current locale character encoding is not " +"UTF-8.\n" +msgstr "Evitante UTF-16 dosieron %s, la nuntempa lingvo-loka litero-enkodiĝo ne egalas UTF-8.\n" + +#: dos2unix.c:1061 dos2unix.c:1138 unix2dos.c:1078 unix2dos.c:1158 +#, c-format +msgid "Skipping UTF-16 file %s, the size of wchar_t is %d bytes.\n" +msgstr "Evitante UTF-16 dosieron %s, la mezuro da wchar_t estas %d okopoj.\n" + +#: dos2unix.c:1068 dos2unix.c:1145 unix2dos.c:1085 unix2dos.c:1165 +#, c-format +msgid "Skipping UTF-16 file %s, an UTF-16 conversion error occurred.\n" +msgstr "Evitante UTF-16 dosieron %s, eraro de UTF-16 tradukiĝo okazis.\n" + +#: dos2unix.c:1074 +#, c-format +msgid "converting file %s to file %s in Unix format ...\n" +msgstr "ŝanĝante dosieron %s al dosiero %s Unix-en ...\n" + +#: dos2unix.c:1081 unix2dos.c:1101 +#, c-format +msgid "problems converting file %s to file %s\n" +msgstr "problemojn trovitajn dum ŝanĝi dosiero %s al dosiero %s\n" + +#: dos2unix.c:1103 unix2dos.c:1123 +#, c-format +msgid "Skipping symbolic link %s.\n" +msgstr "Evitante dosieran ĉeneron %s.\n" + +#: dos2unix.c:1151 +#, c-format +msgid "converting file %s to Unix format ...\n" +msgstr "ŝanĝante dosiero %s Unix-en ...\n" + +#: dos2unix.c:1158 unix2dos.c:1181 +#, c-format +msgid "problems converting file %s\n" +msgstr "problemojn dum ŝanĝi dosiero %s\n" + +#: unix2dos.c:66 +msgid "" +"Copyright (C) 2009-2012 Erwin Waterlander\n" +"Copyright (C) 1994-1995 Benjamin Lin\n" +"All rights reserved.\n" +"\n" +msgstr "" + +#: unix2dos.c:1092 +#, c-format +msgid "converting file %s to file %s in Mac format ...\n" +msgstr "ŝanĝante dosiero %s al dosiero %s Mac-en ...\n" + +#: unix2dos.c:1094 +#, c-format +msgid "converting file %s to file %s in DOS format ...\n" +msgstr "ŝanĝante dosiero %s al dosiero %s DOS-en ...\n" + +#: unix2dos.c:1172 +#, c-format +msgid "converting file %s to Mac format ...\n" +msgstr "ŝanĝante dosiero %s Mac-en ...\n" + +#: unix2dos.c:1174 +#, c-format +msgid "converting file %s to DOS format ...\n" +msgstr "ŝanĝante dosiero %s DOS-en ...\n" + +#: common.c:167 +msgid "" +"Redistribution and use in source and binary forms, with or without\n" +"modification, are permitted provided that the following conditions\n" +"are met:\n" +"1. Redistributions of source code must retain the above copyright\n" +" notice, this list of conditions and the following disclaimer.\n" +"2. Redistributions in binary form must reproduce the above copyright\n" +" notice in the documentation and/or other materials provided with\n" +" the distribution.\n" +"\n" +"THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY\n" +"EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n" +"IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\n" +"PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE\n" +"FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n" +"CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT\n" +"OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR\n" +"BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n" +"WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE\n" +"OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN\n" +"IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n" +msgstr "" + +#: common.c:193 +#, c-format +msgid "" +"%s %s (%s)\n" +"Usage: %s [options] [file ...] [-n infile outfile ...]\n" +" -ascii convert only line breaks (default)\n" +" -iso conversion between DOS and ISO-8859-1 character set\n" +" -1252 Use Windows code page 1252 (Western European)\n" +" -437 Use DOS code page 437 (US) (default)\n" +" -850 Use DOS code page 850 (Western European)\n" +" -860 Use DOS code page 860 (Portuguese)\n" +" -863 Use DOS code page 863 (French Canadian)\n" +" -865 Use DOS code page 865 (Nordic)\n" +" -7 Convert 8 bit characters to 7 bit space\n" +" -c, --convmode conversion mode\n" +" convmode ascii, 7bit, iso, mac, default to ascii\n" +" -f, --force force conversion of binary files\n" +" -h, --help give this help\n" +" -k, --keepdate keep output file date\n" +" -L, --license display software license\n" +" -l, --newline add additional newline\n" +" -m, --add-bom add UTF-8 Byte Order Mark\n" +" -n, --newfile write to new file\n" +" infile original file in new file mode\n" +" outfile output file in new file mode\n" +" -o, --oldfile write to old file\n" +" file ... files to convert in old file mode\n" +" -q, --quiet quiet mode, suppress all warnings\n" +" always on in stdio mode\n" +" -s, --safe skip binary files (default)\n" +msgstr "" +"%s %s (%s)\n" +"Uzado: %s [elektojn] [dosiero ...] [-n antaÅ­aĵo kreaĵo ...]\n" +" -ascii nur traduku linio-finojn (jam enŝaltita)\n" +" -iso traduku inter DOS kaj ISO-8859-1 literaro\n" +" -1252 Uzu Vindozan kodpaĝon 1252 (Okcident-EÅ­ropa)\n" +" -437 Uzu DOS kodpaĝon 437 (Usona) (jam enŝaltita)\n" +" -850 Uzu DOS kodpaĝon 850 (Okcident-EÅ­ropa)\n" +" -860 Uzu DOS kodpaĝon 860 (Portugala)\n" +" -863 Uzu DOS kodpaĝon 863 (Kebekia)\n" +" -865 Uzu DOS kodpaĝon 865 (Nordlandaj)\n" +" -7 Traduku de 8-bitaj literoj en blankspacon\n" +" -c, --convmode modo de ŝanĝo\n" +" ŝanĝmodo ascii, 7bit, iso, mac, provizore elektita ascii\n" +" -f, --force forte konvertado de netekstaj dosieroj\n" +" -h, --help diri ĉi tiun mesaĝon\n" +" -k, --keepdate konservi dato-tempon dosieran\n" +" -L, --license eldiru permesilon tekstan\n" +" -l, --newline aldoni markon linian finan\n" +" -m, --aldoni-bom aldoni UTF-8 internan ordo-markon\n" +" -n, --newfile registri novan dosieron\n" +" antaÅ­aĵo al antaÅ­a dosiero metita novmoden\n" +" kreaĵo al dosiero registrita novmoden\n" +" -o, --oldfile registri malnovan dosieron\n" +" dosiero... dosiero(j)n por registri per malnova modo\n" +" -q, --quiet silente eviti avertojn\n" +" ĉiam enŝaltata dum stdio modo\n" +" -s, --safe evitu netekstajn dosierojn (jam ŝaltita)\n" + +#: common.c:223 +#, c-format +msgid "" +" -F, --follow-symlink follow symbolic links and convert the targets\n" +" -R, --replace-symlink replace symbolic links with converted files\n" +" (original target files remain unchanged)\n" +" -S, --skip-symlink keep symbolic links and targets unchanged (default)\n" +msgstr "" +" -F, --follow-symlink legu dosierajn ĉenerojn kaj konverti la atingojn\n" +" -R, --replace-symlink anstataÅ­e registru dosierajn ĉenerojn per konvertotaj " +"dosieroj\n" +" (ne-ĉeneraj atingaj dosieroj restas neŝanĝitaj)\n" +" -S, --skip-symlink retenu dosierajn ĉenerojn kaj atingojn neŝanĝataj " +"(jam ŝaltita)\n" + +#: common.c:229 +#, c-format +msgid " -V, --version display version number\n" +msgstr " -V, --version diri eldono-numeron\n" + +#: common.c:241 +msgid "DOS 16 bit version (WATCOMC).\n" +msgstr "DOS-16 eldono (WATCOMC).\n" + +#: common.c:243 +msgid "DOS 16 bit version (TURBOC).\n" +msgstr "DOS-16 eldono (TURBOC).\n" + +#: common.c:245 +msgid "DOS 32 bit version (WATCOMC).\n" +msgstr "DOS-32 eldono (WATCOMC).\n" + +#: common.c:247 +msgid "DOS 32 bit version (DJGPP).\n" +msgstr "DOS-32 eldono (DJGPP).\n" + +#: common.c:249 +msgid "MSYS version.\n" +msgstr "MSYS eldono.\n" + +#: common.c:251 +msgid "Cygwin version.\n" +msgstr "Cygwin eldono.\n" + +#: common.c:253 +msgid "Windows 64 bit version (MinGW-w64).\n" +msgstr "Windows-64 eldono (MinGW-w64).\n" + +#: common.c:255 +msgid "Windows 32 bit version (WATCOMC).\n" +msgstr "Windows-32 eldono (WATCOMC).\n" + +#: common.c:257 +msgid "Windows 32 bit version (MinGW).\n" +msgstr "Windows-32 eldono (MinGW).\n" + +#: common.c:259 +msgid "OS/2 version.\n" +msgstr "OS/2 eldono.\n" + +#: common.c:262 +msgid "With Unicode UTF-16 support.\n" +msgstr "Kun subteno de Unikodo da UTF-16.\n" + +#: common.c:264 +msgid "Without Unicode UTF-16 support.\n" +msgstr "Sen subteno de Unikodo da UTF-16.\n" + +#: common.c:267 +msgid "With native language support.\n" +msgstr "Uzante denaskan lingvon sistemon.\n" diff --git a/po/es.po b/po/es.po new file mode 100644 index 0000000..139492f --- /dev/null +++ b/po/es.po @@ -0,0 +1,378 @@ +# Spanish translations for dos2unix package +# Traducciones al español para el paquete dos2unix. +# Copyright (C) 2011,2012 THE dos2unix'S COPYRIGHT HOLDER +# This file is distributed under the same license as the dos2unix package. +# Julio A. Freyre-Gonzalez , 2011. +# +msgid "" +msgstr "" +"Project-Id-Version: dos2unix\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2012-03-30 09:25+0200\n" +"PO-Revision-Date: 2011-06-20 09:13+0200\n" +"Last-Translator: \n" +"Language-Team: Spanish\n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=ISO-8859-1\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: dos2unix.c:76 +msgid "" +"Copyright (C) 2009-2012 Erwin Waterlander\n" +"Copyright (C) 1998 Christian Wurll (Version 3.1)\n" +"Copyright (C) 1998 Bernd Johannes Wuebben (Version 3.0)\n" +"Copyright (C) 1994-1995 Benjamin Lin\n" +"All rights reserved.\n" +"\n" +msgstr "" + +#: dos2unix.c:169 dos2unix.c:200 dos2unix.c:224 dos2unix.c:323 dos2unix.c:351 +#: dos2unix.c:372 unix2dos.c:152 unix2dos.c:183 unix2dos.c:202 unix2dos.c:219 +#: unix2dos.c:331 unix2dos.c:359 unix2dos.c:375 unix2dos.c:389 +msgid "can not write to output file\n" +msgstr "no puedo escribir al archivo de salida\n" + +#: dos2unix.c:239 dos2unix.c:386 unix2dos.c:234 unix2dos.c:403 +#, c-format +msgid "program error, invalid conversion mode %d\n" +msgstr "error, modo de conversión %d inválido\n" + +#: dos2unix.c:293 unix2dos.c:288 +#, c-format +msgid "using code page %d.\n" +msgstr "usando página de códigos %d.\n" + +#: dos2unix.c:474 unix2dos.c:491 +#, c-format +msgid "Failed to open temporary output file: %s\n" +msgstr "Falló al abrir el archivo de salida temporal: %s\n" + +#: dos2unix.c:481 unix2dos.c:498 +#, c-format +msgid "using %s as temporary file\n" +msgstr "usando %s como archivo temporal\n" + +#: dos2unix.c:610 unix2dos.c:627 +#, c-format +msgid "Failed to change the permissions of temporary output file %s: %s\n" +msgstr "Error al cambiar los permisos del archivo temporal de salida %s: %s\n" + +#: dos2unix.c:629 unix2dos.c:646 +#, c-format +msgid "Failed to change the owner and group of temporary output file %s: %s\n" +msgstr "" +"Error al cambiar el propietario y grupo del archivo temporal de salida %s: " +"%s\n" + +#: dos2unix.c:682 unix2dos.c:699 +#, c-format +msgid "problems resolving symbolic link '%s'\n" +msgstr "problemas al resolver el enlace simbólico '%s'\n" + +#: dos2unix.c:683 dos2unix.c:717 unix2dos.c:700 unix2dos.c:734 +#, c-format +msgid " output file remains in '%s'\n" +msgstr " el archivo de salida permanece en '%s'\n" + +#: dos2unix.c:712 unix2dos.c:729 +#, c-format +msgid "problems renaming '%s' to '%s': %s\n" +msgstr "problemas al renombrar '%s' como '%s': %s\n" + +#: dos2unix.c:715 unix2dos.c:732 +#, c-format +msgid " which is the target of symbolic link '%s'\n" +msgstr " cual es el destino del enlace simbólico '%s'\n" + +#: dos2unix.c:807 unix2dos.c:824 +msgid "error: Value of environment variable DOS2UNIX_LOCALEDIR is too long.\n" +msgstr "" +"error: El valor de la variable de entorno DOS2UNIX_LOCALEDIR es demasiado " +"largo.\n" + +#: dos2unix.c:904 dos2unix.c:935 unix2dos.c:921 unix2dos.c:952 +#, c-format +msgid "active code page: %d\n" +msgstr "Página de códigos activa: %d\n" + +#: dos2unix.c:945 unix2dos.c:962 +#, c-format +msgid "invalid %s conversion mode specified\n" +msgstr "modo de conversión %s especificado es inválido\n" + +#: dos2unix.c:955 unix2dos.c:972 +#, c-format +msgid "option '%s' requires an argument\n" +msgstr "el parámetro '%s' requiere un argumento\n" + +#: dos2unix.c:968 dos2unix.c:982 dos2unix.c:1176 unix2dos.c:985 unix2dos.c:999 +#: unix2dos.c:1199 +#, c-format +msgid "target of file %s not specified in new file mode\n" +msgstr "" +"el destino del archivo %s no se especificó en el modo de archivo nuevo\n" + +#: dos2unix.c:1012 dos2unix.c:1096 unix2dos.c:1029 unix2dos.c:1116 +#, c-format +msgid "Skipping %s, not a regular file.\n" +msgstr "Ignorando %s, no es un archivo regular.\n" + +#: dos2unix.c:1019 unix2dos.c:1036 +#, c-format +msgid "Skipping %s, output file %s is a symbolic link.\n" +msgstr "Ignorando %s, el archivo de salida %s es un enlace simbólico.\n" + +#: dos2unix.c:1026 dos2unix.c:1110 unix2dos.c:1043 unix2dos.c:1130 +#, c-format +msgid "Skipping symbolic link %s, target is not a regular file.\n" +msgstr "Ignorando enlace simbólico %s, el destino no es un archivo regular.\n" + +#: dos2unix.c:1033 unix2dos.c:1050 +#, c-format +msgid "Skipping %s, target of symbolic link %s is not a regular file.\n" +msgstr "" +"Ignorando %s, el destino del enlace simbólico %s no es un archivo regular.\n" + +#: dos2unix.c:1040 dos2unix.c:1117 unix2dos.c:1057 unix2dos.c:1137 +#, c-format +msgid "Skipping binary file %s\n" +msgstr "Ignorando archivo binario %s\n" + +#: dos2unix.c:1047 dos2unix.c:1124 unix2dos.c:1064 unix2dos.c:1144 +#, c-format +msgid "code page %d is not supported.\n" +msgstr "La página de códigos %d no está soportada.\n" + +#: dos2unix.c:1054 dos2unix.c:1131 unix2dos.c:1071 unix2dos.c:1151 +#, c-format +msgid "" +"Skipping UTF-16 file %s, the current locale character encoding is not " +"UTF-8.\n" +msgstr "" + +#: dos2unix.c:1061 dos2unix.c:1138 unix2dos.c:1078 unix2dos.c:1158 +#, c-format +msgid "Skipping UTF-16 file %s, the size of wchar_t is %d bytes.\n" +msgstr "" + +#: dos2unix.c:1068 dos2unix.c:1145 unix2dos.c:1085 unix2dos.c:1165 +#, c-format +msgid "Skipping UTF-16 file %s, an UTF-16 conversion error occurred.\n" +msgstr "" + +#: dos2unix.c:1074 +#, c-format +msgid "converting file %s to file %s in Unix format ...\n" +msgstr "convirtiendo archivo %s a %s in formato Unix ...\n" + +#: dos2unix.c:1081 unix2dos.c:1101 +#, c-format +msgid "problems converting file %s to file %s\n" +msgstr "problemas al convertir el archivo %s a %s\n" + +#: dos2unix.c:1103 unix2dos.c:1123 +#, c-format +msgid "Skipping symbolic link %s.\n" +msgstr "Ignorando enlace simbólico %s.\n" + +#: dos2unix.c:1151 +#, c-format +msgid "converting file %s to Unix format ...\n" +msgstr "convirtiendo archivo %s a formato Unix ...\n" + +#: dos2unix.c:1158 unix2dos.c:1181 +#, c-format +msgid "problems converting file %s\n" +msgstr "problemas convirtiendo el archivo %s\n" + +#: unix2dos.c:66 +msgid "" +"Copyright (C) 2009-2012 Erwin Waterlander\n" +"Copyright (C) 1994-1995 Benjamin Lin\n" +"All rights reserved.\n" +"\n" +msgstr "" + +#: unix2dos.c:1092 +#, c-format +msgid "converting file %s to file %s in Mac format ...\n" +msgstr "convirtiendo archivo %s a %s in formato Mac ...\n" + +#: unix2dos.c:1094 +#, c-format +msgid "converting file %s to file %s in DOS format ...\n" +msgstr "convirtiendo archivo %s a %s en formato DOS ...\n" + +#: unix2dos.c:1172 +#, c-format +msgid "converting file %s to Mac format ...\n" +msgstr "convirtiendo archivo %s a formato Mac ...\n" + +#: unix2dos.c:1174 +#, c-format +msgid "converting file %s to DOS format ...\n" +msgstr "convirtiendo archivo %s a formato DOS ...\n" + +#: common.c:167 +msgid "" +"Redistribution and use in source and binary forms, with or without\n" +"modification, are permitted provided that the following conditions\n" +"are met:\n" +"1. Redistributions of source code must retain the above copyright\n" +" notice, this list of conditions and the following disclaimer.\n" +"2. Redistributions in binary form must reproduce the above copyright\n" +" notice in the documentation and/or other materials provided with\n" +" the distribution.\n" +"\n" +"THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY\n" +"EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n" +"IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\n" +"PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE\n" +"FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n" +"CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT\n" +"OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR\n" +"BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n" +"WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE\n" +"OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN\n" +"IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n" +msgstr "" + +#: common.c:193 +#, fuzzy, c-format +msgid "" +"%s %s (%s)\n" +"Usage: %s [options] [file ...] [-n infile outfile ...]\n" +" -ascii convert only line breaks (default)\n" +" -iso conversion between DOS and ISO-8859-1 character set\n" +" -1252 Use Windows code page 1252 (Western European)\n" +" -437 Use DOS code page 437 (US) (default)\n" +" -850 Use DOS code page 850 (Western European)\n" +" -860 Use DOS code page 860 (Portuguese)\n" +" -863 Use DOS code page 863 (French Canadian)\n" +" -865 Use DOS code page 865 (Nordic)\n" +" -7 Convert 8 bit characters to 7 bit space\n" +" -c, --convmode conversion mode\n" +" convmode ascii, 7bit, iso, mac, default to ascii\n" +" -f, --force force conversion of binary files\n" +" -h, --help give this help\n" +" -k, --keepdate keep output file date\n" +" -L, --license display software license\n" +" -l, --newline add additional newline\n" +" -m, --add-bom add UTF-8 Byte Order Mark\n" +" -n, --newfile write to new file\n" +" infile original file in new file mode\n" +" outfile output file in new file mode\n" +" -o, --oldfile write to old file\n" +" file ... files to convert in old file mode\n" +" -q, --quiet quiet mode, suppress all warnings\n" +" always on in stdio mode\n" +" -s, --safe skip binary files (default)\n" +msgstr "" +"%s %s (%s)\n" +"Uso: %s [parámetros] [archivo ...] [-n archivo_de_entrada " +"archivo_de_salida ...]\n" +" -ascii solamente convierte los saltos de línea (por " +"defecto)\n" +" -iso conversión entre DOS y el conjunto de caracteres " +"ISO-8859-1\n" +" -1252 Usa la página de códigos Windows 1252 (Europa " +"Occidental)\n" +" -437 Usa la página de códigos DOS 437 (EE. UU.) (por " +"defecto)\n" +" -850 Usa la página de códigos DOS 850 (Europa Occidental)\n" +" -860 Usa la página de códigos DOS 860 (Portugués)\n" +" -863 Usa la página de códigos DOS 863 (Francocanadiense)\n" +" -865 Usa la página de códigos DOS 865 (Nórdico)\n" +" -7 Convierte caracteres de 8 bits al espacio de 7 bits\n" +" -c, --convmode modo de conversión\n" +" modo_de_conversion ascii, 7bit, iso, mac, por defecto es ascii\n" +" -f, --force fuerza la conversión de archivos binarios\n" +" -h, --help arroja esta ayuda\n" +" -k, --keepdate conserva la fecha en el archivo de salida\n" +" -L, --license muestra la licencia del programa\n" +" -l, --newline añade salto de línea adicional\n" +" -n, --newfile escribe a un nuevo archivo\n" +" archivo_de_entrada archivo original en el modo de archivo nuevo\n" +" archivo_de_salida archivo de salida en el modo de archivo nuevo\n" +" -o, --oldfile escribe al archivo antiguo\n" +" archivo ... archivos a convertir en el modo de archivo antiguo\n" +" -q, --quiet modo silencioso, suprime todas las advertencias\n" +" siempre en modo stdio\n" +" -s, --safe ignora archivos binarios (por defecto)\n" + +#: common.c:223 +#, c-format +msgid "" +" -F, --follow-symlink follow symbolic links and convert the targets\n" +" -R, --replace-symlink replace symbolic links with converted files\n" +" (original target files remain unchanged)\n" +" -S, --skip-symlink keep symbolic links and targets unchanged (default)\n" +msgstr "" +" -F, --follow-symlink sigue los enlaces simbólicos y convierte los " +"destinos\n" +" -R, --replace-symlink reemplaza los enlaces simbólicos con los archivos " +"convertidos\n" +" (los archivos destino originales no son alterados)\n" +" -S, --skip-symlink no altera los enlaces simbólicos ni sus destinos (por " +"defecto)\n" + +#: common.c:229 +#, c-format +msgid " -V, --version display version number\n" +msgstr " -V, --version despliega el número de versión\n" + +#: common.c:241 +msgid "DOS 16 bit version (WATCOMC).\n" +msgstr "Versión DOS de 16 bit (WATCOMC).\n" + +#: common.c:243 +msgid "DOS 16 bit version (TURBOC).\n" +msgstr "Versión DOS de 16 bit (TURBOC).\n" + +#: common.c:245 +msgid "DOS 32 bit version (WATCOMC).\n" +msgstr "Versión DOS de 32 bit (WATCOMC).\n" + +#: common.c:247 +msgid "DOS 32 bit version (DJGPP).\n" +msgstr "Versión DOS de 32 bit (DJGPP).\n" + +#: common.c:249 +msgid "MSYS version.\n" +msgstr "Versión para MSYS.\n" + +#: common.c:251 +msgid "Cygwin version.\n" +msgstr "Versión para Cygwin.\n" + +#: common.c:253 +msgid "Windows 64 bit version (MinGW-w64).\n" +msgstr "Versión Windows de 64 bit (MinGW-w64).\n" + +#: common.c:255 +msgid "Windows 32 bit version (WATCOMC).\n" +msgstr "Versión Windows de 32 bit (WATCOMC).\n" + +#: common.c:257 +msgid "Windows 32 bit version (MinGW).\n" +msgstr "Versión Windows de 32 bit (MinGW).\n" + +#: common.c:259 +msgid "OS/2 version.\n" +msgstr "Versión para OS/2.\n" + +#: common.c:262 +#, fuzzy +msgid "With Unicode UTF-16 support.\n" +msgstr "Con soporte de idioma materno.\n" + +#: common.c:264 +#, fuzzy +msgid "Without Unicode UTF-16 support.\n" +msgstr "Con soporte de idioma materno.\n" + +#: common.c:267 +msgid "With native language support.\n" +msgstr "Con soporte de idioma materno.\n" diff --git a/po/nl.po b/po/nl.po new file mode 100644 index 0000000..28ba94d --- /dev/null +++ b/po/nl.po @@ -0,0 +1,378 @@ +# dos2unix, DOS/MAC to UNIX text file format converter. +# Copyright (C) 2009-2012 +# This file is distributed under the same license as the dos2unix package. +# Erwin Waterlander , 2009-2012. +# +msgid "" +msgstr "" +"Project-Id-Version: dos2unix 5.3.1\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2012-03-30 09:25+0200\n" +"PO-Revision-Date: 2009-12-08 21:59+0100\n" +"Last-Translator: Erwin Waterlander \n" +"Language-Team: Dutch \n" +"Language: nl\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=ISO-8859-1\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: dos2unix.c:76 +msgid "" +"Copyright (C) 2009-2012 Erwin Waterlander\n" +"Copyright (C) 1998 Christian Wurll (Version 3.1)\n" +"Copyright (C) 1998 Bernd Johannes Wuebben (Version 3.0)\n" +"Copyright (C) 1994-1995 Benjamin Lin\n" +"All rights reserved.\n" +"\n" +msgstr "" + +#: dos2unix.c:169 dos2unix.c:200 dos2unix.c:224 dos2unix.c:323 dos2unix.c:351 +#: dos2unix.c:372 unix2dos.c:152 unix2dos.c:183 unix2dos.c:202 unix2dos.c:219 +#: unix2dos.c:331 unix2dos.c:359 unix2dos.c:375 unix2dos.c:389 +msgid "can not write to output file\n" +msgstr "kan niet schrijven naar uitvoerbestand\n" + +#: dos2unix.c:239 dos2unix.c:386 unix2dos.c:234 unix2dos.c:403 +#, c-format +msgid "program error, invalid conversion mode %d\n" +msgstr "programma fout, ongeldige conversie modus %d\n" + +#: dos2unix.c:293 unix2dos.c:288 +#, c-format +msgid "using code page %d.\n" +msgstr "codetabel %d wordt gebruikt.\n" + +#: dos2unix.c:474 unix2dos.c:491 +#, c-format +msgid "Failed to open temporary output file: %s\n" +msgstr "Niet gelukt om tijdelijk uitvoerbestand te openen: %s\n" + +#: dos2unix.c:481 unix2dos.c:498 +#, c-format +msgid "using %s as temporary file\n" +msgstr "%s wordt als tijdelijk bestand gebruikt\n" + +#: dos2unix.c:610 unix2dos.c:627 +#, c-format +msgid "Failed to change the permissions of temporary output file %s: %s\n" +msgstr "" +"Niet gelukt om de permissies van tijdelijk uitvoerbestand %s te wijzigen: " +"%s\n" + +#: dos2unix.c:629 unix2dos.c:646 +#, c-format +msgid "Failed to change the owner and group of temporary output file %s: %s\n" +msgstr "" +"Niet gelukt om de eigenaar en groep van tijdelijk uitvoerbestand %s te " +"wijzigen: %s\n" + +#: dos2unix.c:682 unix2dos.c:699 +#, c-format +msgid "problems resolving symbolic link '%s'\n" +msgstr "problemen met het herleiden van symbolische koppeling '%s'\n" + +#: dos2unix.c:683 dos2unix.c:717 unix2dos.c:700 unix2dos.c:734 +#, c-format +msgid " output file remains in '%s'\n" +msgstr " uitvoerbestand blijft in '%s'\n" + +#: dos2unix.c:712 unix2dos.c:729 +#, c-format +msgid "problems renaming '%s' to '%s': %s\n" +msgstr "problemen met hernoemen van '%s' naar '%s': %s\n" + +#: dos2unix.c:715 unix2dos.c:732 +#, c-format +msgid " which is the target of symbolic link '%s'\n" +msgstr " welke het doel is van symbolische koppeling '%s'\n" + +#: dos2unix.c:807 unix2dos.c:824 +msgid "error: Value of environment variable DOS2UNIX_LOCALEDIR is too long.\n" +msgstr "fout: Waarde van omgevingsvariabele DOS2UNIX_LOCALEDIR is te lang.\n" + +#: dos2unix.c:904 dos2unix.c:935 unix2dos.c:921 unix2dos.c:952 +#, c-format +msgid "active code page: %d\n" +msgstr "actieve code tabel: %d\n" + +#: dos2unix.c:945 unix2dos.c:962 +#, c-format +msgid "invalid %s conversion mode specified\n" +msgstr "ongeldige %s conversie modus gespecificeerd\n" + +#: dos2unix.c:955 unix2dos.c:972 +#, c-format +msgid "option '%s' requires an argument\n" +msgstr "optie '%s' heeft een argument nodig\n" + +#: dos2unix.c:968 dos2unix.c:982 dos2unix.c:1176 unix2dos.c:985 unix2dos.c:999 +#: unix2dos.c:1199 +#, c-format +msgid "target of file %s not specified in new file mode\n" +msgstr "doel van bestand %s is niet gespecificeerd in 'nieuw bestand modus'\n" + +#: dos2unix.c:1012 dos2unix.c:1096 unix2dos.c:1029 unix2dos.c:1116 +#, c-format +msgid "Skipping %s, not a regular file.\n" +msgstr "%s wordt overgeslagen, omdat het geen regulier bestand is.\n" + +#: dos2unix.c:1019 unix2dos.c:1036 +#, c-format +msgid "Skipping %s, output file %s is a symbolic link.\n" +msgstr "" +"%s wordt overgeslagen, uitvoerbestand %s is een symbolische koppeling.\n" + +#: dos2unix.c:1026 dos2unix.c:1110 unix2dos.c:1043 unix2dos.c:1130 +#, c-format +msgid "Skipping symbolic link %s, target is not a regular file.\n" +msgstr "" +"Symbolische koppeling %s wordt overgeslagen, omdat het doel geen regulier " +"bestand is.\n" + +#: dos2unix.c:1033 unix2dos.c:1050 +#, c-format +msgid "Skipping %s, target of symbolic link %s is not a regular file.\n" +msgstr "" +"%s wordt overgeslagen, omdat het doel van symbolische koppeling %s geen " +"regulier bestand is.\n" + +#: dos2unix.c:1040 dos2unix.c:1117 unix2dos.c:1057 unix2dos.c:1137 +#, c-format +msgid "Skipping binary file %s\n" +msgstr "Binair bestand %s wordt overgeslagen\n" + +#: dos2unix.c:1047 dos2unix.c:1124 unix2dos.c:1064 unix2dos.c:1144 +#, c-format +msgid "code page %d is not supported.\n" +msgstr "codetabel %d wordt niet ondersteund.\n" + +#: dos2unix.c:1054 dos2unix.c:1131 unix2dos.c:1071 unix2dos.c:1151 +#, c-format +msgid "" +"Skipping UTF-16 file %s, the current locale character encoding is not " +"UTF-8.\n" +msgstr "" +"UTF-16 bestand %s wordt overgeslagen, de huidige lokale karakter codering is " +"niet UTF-8.\n" + +#: dos2unix.c:1061 dos2unix.c:1138 unix2dos.c:1078 unix2dos.c:1158 +#, c-format +msgid "Skipping UTF-16 file %s, the size of wchar_t is %d bytes.\n" +msgstr "" +"UTF-16 bestand %s wordt overgeslagen, de grootte van wchar_t is %d bytes.\n" + +#: dos2unix.c:1068 dos2unix.c:1145 unix2dos.c:1085 unix2dos.c:1165 +#, c-format +msgid "Skipping UTF-16 file %s, an UTF-16 conversion error occurred.\n" +msgstr "" +"UTF-16 bestand %s wordt overgeslagen, een UTF-16 conversie fout is " +"opgetreden.\n" + +#: dos2unix.c:1074 +#, c-format +msgid "converting file %s to file %s in Unix format ...\n" +msgstr "converteren bestand %s naar bestand %s in Unix formaat ...\n" + +#: dos2unix.c:1081 unix2dos.c:1101 +#, c-format +msgid "problems converting file %s to file %s\n" +msgstr "problemen met conversie van bestand %s naar bestand %s\n" + +#: dos2unix.c:1103 unix2dos.c:1123 +#, c-format +msgid "Skipping symbolic link %s.\n" +msgstr "Symbolische koppeling %s wordt overgeslagen.\n" + +#: dos2unix.c:1151 +#, c-format +msgid "converting file %s to Unix format ...\n" +msgstr "converteren bestand %s naar Unix formaat ...\n" + +#: dos2unix.c:1158 unix2dos.c:1181 +#, c-format +msgid "problems converting file %s\n" +msgstr "problemen met conversie van bestand %s\n" + +#: unix2dos.c:66 +msgid "" +"Copyright (C) 2009-2012 Erwin Waterlander\n" +"Copyright (C) 1994-1995 Benjamin Lin\n" +"All rights reserved.\n" +"\n" +msgstr "" + +#: unix2dos.c:1092 +#, c-format +msgid "converting file %s to file %s in Mac format ...\n" +msgstr "converteren bestand %s naar bestand %s in Mac formaat ...\n" + +#: unix2dos.c:1094 +#, c-format +msgid "converting file %s to file %s in DOS format ...\n" +msgstr "converteren bestand %s naar bestand %s in DOS formaat ...\n" + +#: unix2dos.c:1172 +#, c-format +msgid "converting file %s to Mac format ...\n" +msgstr "converteren bestand %s naar Mac formaat ...\n" + +#: unix2dos.c:1174 +#, c-format +msgid "converting file %s to DOS format ...\n" +msgstr "converteren bestand %s naar DOS formaat ...\n" + +#: common.c:167 +msgid "" +"Redistribution and use in source and binary forms, with or without\n" +"modification, are permitted provided that the following conditions\n" +"are met:\n" +"1. Redistributions of source code must retain the above copyright\n" +" notice, this list of conditions and the following disclaimer.\n" +"2. Redistributions in binary form must reproduce the above copyright\n" +" notice in the documentation and/or other materials provided with\n" +" the distribution.\n" +"\n" +"THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY\n" +"EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n" +"IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\n" +"PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE\n" +"FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n" +"CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT\n" +"OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR\n" +"BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n" +"WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE\n" +"OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN\n" +"IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n" +msgstr "" + +#: common.c:193 +#, c-format +msgid "" +"%s %s (%s)\n" +"Usage: %s [options] [file ...] [-n infile outfile ...]\n" +" -ascii convert only line breaks (default)\n" +" -iso conversion between DOS and ISO-8859-1 character set\n" +" -1252 Use Windows code page 1252 (Western European)\n" +" -437 Use DOS code page 437 (US) (default)\n" +" -850 Use DOS code page 850 (Western European)\n" +" -860 Use DOS code page 860 (Portuguese)\n" +" -863 Use DOS code page 863 (French Canadian)\n" +" -865 Use DOS code page 865 (Nordic)\n" +" -7 Convert 8 bit characters to 7 bit space\n" +" -c, --convmode conversion mode\n" +" convmode ascii, 7bit, iso, mac, default to ascii\n" +" -f, --force force conversion of binary files\n" +" -h, --help give this help\n" +" -k, --keepdate keep output file date\n" +" -L, --license display software license\n" +" -l, --newline add additional newline\n" +" -m, --add-bom add UTF-8 Byte Order Mark\n" +" -n, --newfile write to new file\n" +" infile original file in new file mode\n" +" outfile output file in new file mode\n" +" -o, --oldfile write to old file\n" +" file ... files to convert in old file mode\n" +" -q, --quiet quiet mode, suppress all warnings\n" +" always on in stdio mode\n" +" -s, --safe skip binary files (default)\n" +msgstr "" +"%s %s (%s)\n" +"Usage: %s [opties] [bestand ...] [-n invoerbestand uitvoerbestand ...]\n" +" -ascii converteer alleen regeleindes (standaard)\n" +" -iso conversie tussen DOS en ISO-8859-1 lettertekenreeks\n" +" -1252 Gebruik Windows codetabel 1252 (West-Europees)\n" +" -437 Gebruik DOS codetabel 437 (VS) (standaard)\n" +" -850 Gebruik DOS codetabel 850 (West-Europees)\n" +" -860 Gebruik DOS codetabel 860 (Portugees)\n" +" -863 Gebruik DOS codetabel 863 (Canadees Frans)\n" +" -865 Gebruik DOS codetabel 865 (Scandinavisch)\n" +" -7 Converteer 8 bit lettertekens naar 7 bit spatie\n" +" -c, --convmode conversiemodus\n" +" conversiemodus ascii, 7bit, iso, mac, standaard is ascii\n" +" -f, --force forceer conversie van binaire bestanden\n" +" -h, --help toon deze help tekst\n" +" -k, --keepdate behoud datum uitvoerbestand\n" +" -L, --license toon software licentie\n" +" -l, --newline voeg extra regeleinde toe\n" +" -m, --add-bom voeg UTF-8 Byte Order Mark toe\n" +" -n, --newfile schrijf naar nieuw bestand\n" +" invoerbestand origineel bestand in nieuw-bestand-modus\n" +" uitvoerbestand uitvoerbestand in nieuw-bestand-modus\n" +" -o, --oldfile overschrijf oud bestand\n" +" bestand ... te converteren bestanden in oud-bestand-modus\n" +" -q, --quiet stille werking, onderdruk alle waarschuwingen\n" +" altijd aan in stdio modus\n" +" -s, --safe sla binaire bestanden over (standaard)\n" + +#: common.c:223 +#, c-format +msgid "" +" -F, --follow-symlink follow symbolic links and convert the targets\n" +" -R, --replace-symlink replace symbolic links with converted files\n" +" (original target files remain unchanged)\n" +" -S, --skip-symlink keep symbolic links and targets unchanged (default)\n" +msgstr "" +" -F, --follow-symlink volg symbolische koppelingen en converteer de doelen\n" +" -R, --replace-symlink vervang symbolische koppelingen door geconverteerde " +"bestanden\n" +" (originele doelbestanden blijven ongewijzigd)\n" +" -S, --skip-symlink laat symbolische koppelingen en doelen ongewijzigd " +"(standaard)\n" + +#: common.c:229 +#, c-format +msgid " -V, --version display version number\n" +msgstr " -V, --version toon versie nummer\n" + +#: common.c:241 +msgid "DOS 16 bit version (WATCOMC).\n" +msgstr "DOS 16 bit versie (WATCOMC).\n" + +#: common.c:243 +msgid "DOS 16 bit version (TURBOC).\n" +msgstr "DOS 16 bit versie (TURBOC).\n" + +#: common.c:245 +msgid "DOS 32 bit version (WATCOMC).\n" +msgstr "DOS 32 bit versie (WATCOMC).\n" + +#: common.c:247 +msgid "DOS 32 bit version (DJGPP).\n" +msgstr "DOS 32 bit versie (DJGPP).\n" + +#: common.c:249 +msgid "MSYS version.\n" +msgstr "MSYS versie.\n" + +#: common.c:251 +msgid "Cygwin version.\n" +msgstr "Cygwin versie.\n" + +#: common.c:253 +msgid "Windows 64 bit version (MinGW-w64).\n" +msgstr "Windows 64 bit versie (MinGW-w64).\n" + +#: common.c:255 +msgid "Windows 32 bit version (WATCOMC).\n" +msgstr "Windows 32 bit versie (WATCOMC).\n" + +#: common.c:257 +msgid "Windows 32 bit version (MinGW).\n" +msgstr "Windows 32 bit versie (MinGW).\n" + +#: common.c:259 +msgid "OS/2 version.\n" +msgstr "OS/2 versie.\n" + +#: common.c:262 +msgid "With Unicode UTF-16 support.\n" +msgstr "Met Unicode UTF-16 ondersteuning.\n" + +#: common.c:264 +msgid "Without Unicode UTF-16 support.\n" +msgstr "Zonder Unicode UTF-16 ondersteuning.\n" + +#: common.c:267 +msgid "With native language support.\n" +msgstr "Met moedertaal ondersteuning.\n" diff --git a/querycp.c b/querycp.c new file mode 100644 index 0000000..82bf58c --- /dev/null +++ b/querycp.c @@ -0,0 +1,196 @@ +/* The code in this file is Public Domain */ + +#if (defined(__WATCOMC__) && defined(__NT__)) +# define WIN32 +#endif + +#ifdef DJGPP + +#include +#include +#include + +/* + ---------------------------------------------------------------------- + Tuesday, May 5, 2009 1:40pm + rugxulo _AT_ gmail _DOT_ com + + This file is (obviously?) not copyrighted, "nenies proprajxo" !! + + Tested successfully on DR-DOS 7.03, FreeDOS 1.0++, and MS-DOS 6.22. + (Doesn't work on XP or Vista, though.) + ---------------------------------------------------------------------- + + unsigned short query_con_codepage(void); + + gets currently selected display CON codepage + + int 21h, 6601h ("chcp") needs NLSFUNC.EXE + COUNTRY.SYS, but many + obscure codepages (e.g. FD's cp853 from EGA.CPX (CPIX.ZIP) or + Kosta Kostis' cp913 from ISOLATIN.CPI (ISOCP101.ZIP) have no + relevant data inside COUNTRY.SYS. + + int 21h, 440Ch 6Ah only works in MS-DOS and DR-DOS (not FreeDOS) because + FreeDOS DISPLAY is an .EXE TSR, not a device driver, and hence doesn't + fully support IOCTL, so they use the undocumented int 2Fh, 0AD02h + (which doesn't work in DR-DOS!). But DR-DOS' DISPLAY doesn't respond + to the typical install check i.d. anyways. FreeDOS currently only + supports COUNTRY.SYS in their "unstable" kernel 2037, but at least + their KEYB, "gxoje", supports cp853 too (thanks, Henrique!). + + P.S. For MS or DR: ren ega.cpx *.com ; upx -d ega.com ; ren ega.com *.cpi + + ADDENDUM (2011): + Latest "stable" FreeDOS kernel is 2040, it now includes COUNTRY.SYS + support by default, but NLSFUNC (CHCP) 'system code page' support is + partially unimplemented (lacking some int 2Fh calls, yet Eduardo + Casino didn't seem too worried, so I dunno, nag him if necessary, + heh). + ---------------------------------------------------------------------- +*/ + +unsigned short query_con_codepage(void) { + __dpmi_regs regs; + + unsigned short param_block[2] = { 0, 437 }; + + regs.d.eax = 0x440C; /* GENERIC IO FOR HANDLES */ + regs.d.ebx = 1; /* STDOUT */ + regs.d.ecx = 0x036A; /* 3 = CON, 0x6A = QUERY SELECTED CP */ + regs.x.ds = __tb >> 4; /* using transfer buffer for low mem. */ + regs.x.dx = __tb & 0x0F; /* (suggested by DJGPP FAQ, hi Eli!) */ + regs.x.flags |= 1; /* preset carry for potential failure */ + __dpmi_int (0x21, ®s); + + if (!(regs.x.flags & 1)) /* if succeed (carry flag not set) */ + dosmemget( __tb, 4, param_block); + else { /* (undocumented method) */ + regs.x.ax = 0xAD02; /* 440C -> MS-DOS or DR-DOS only */ + regs.x.bx = 0xFFFE; /* AD02 -> MS-DOS or FreeDOS only */ + regs.x.flags |= 1; + __dpmi_int(0x2F, ®s); + + if ((!(regs.x.flags & 1)) && (regs.x.bx < 0xFFFE)) + param_block[1] = regs.x.bx; + } + + return param_block[1]; +} +#elif defined(__WATCOMC__) && defined(__I86__) /* Watcom C, 16 bit Intel */ + +/* rugxulo _AT_ gmail _DOT_ com */ + +#include +#include +#include + +unsigned short query_con_codepage(void) { + union REGS regs; + unsigned short param_block[2] = { 0, 437 }; + + regs.x.ax = 0x440C; /* GENERIC IO FOR HANDLES */ + regs.x.bx = 1; /* STDOUT */ + regs.x.cx = 0x036A; /* 3 = CON, 0x6A = QUERY SELECTED CP */ + regs.x.dx = (unsigned short)param_block; + regs.x.cflag |= 1; /* preset carry for potential failure */ + int86(0x21, ®s, ®s); + + if (regs.x.cflag) /* if not succeed (carry flag set) */ + { + regs.x.ax = 0xAD02; /* 440C -> MS-DOS or DR-DOS only */ + regs.x.bx = 0xFFFE; /* AD02 -> MS-DOS or FreeDOS only */ + regs.x.cflag |= 1; + int86(0x2F, ®s, ®s); + } + + if ((!(regs.x.cflag)) && (regs.x.bx < 0xFFFE)) + param_block[1] = regs.x.bx; + + return param_block[1]; + +} + +#elif defined(__WATCOMC__) && defined(__DOS__) /* Watcom C, 32 bit DOS */ + +/* rugxulo _AT_ gmail _DOT_ com */ + +#include +#include +#include + +unsigned short query_con_codepage(void) { + union REGS regs; + unsigned short param_block[2] = { 0, 437 }; + + regs.x.eax = 0x440C; /* GENERIC IO FOR HANDLES */ + regs.x.ebx = 1; /* STDOUT */ + regs.x.ecx = 0x036A; /* 3 = CON, 0x6A = QUERY SELECTED CP */ + regs.x.edx = (unsigned short)param_block; + regs.x.cflag |= 1; /* preset carry for potential failure */ + int386(0x21, ®s, ®s); + + if (regs.x.cflag) /* if not succeed (carry flag set) */ + { + regs.x.eax = 0xAD02; /* 440C -> MS-DOS or DR-DOS only */ + regs.x.ebx = 0xFFFE; /* AD02 -> MS-DOS or FreeDOS only */ + regs.x.cflag |= 1; + int386(0x2F, ®s, ®s); + } + + if ((!(regs.x.cflag)) && (regs.x.ebx < 0xFFFE)) + param_block[1] = regs.x.ebx; + + return param_block[1]; + +} + + +#elif defined (WIN32) && !defined(__CYGWIN__) /* Windows, not Cygwin */ + +/* Erwin Waterlander */ + +#include +unsigned short query_con_codepage(void) { + + /* Dos2unix is modelled after dos2unix under SunOS/Solaris. + * The original dos2unix ISO mode on SunOS supported code + * pages CP437, CP850, CP860, CP863, and CP865, which + * are DOS code pages. Therefore we request here the DOS + * code page of the Console. The DOS code page is used + * by DOS programs, for instance text editor 'edit'. + */ + + /* Get the console's DOS code page */ + return((unsigned short)GetConsoleOutputCP()); + + /* Get the system's ANSI code page */ + /* return((unsigned short)GetACP()); */ + +} + +#elif defined (__OS2__) /* OS/2 Warp */ + +#define INCL_DOS +#include + +unsigned short query_con_codepage(void) { + ULONG cp[3]; + ULONG cplen; + + DosQueryCp(sizeof(cp), cp, &cplen); + return((unsigned short)cp[0]); +} + +#else /* Unix, other */ +unsigned short query_con_codepage(void) { + return(0); +} +#endif + +#ifdef TEST +int main() { + printf("\nCP%u\n",query_con_codepage() ); /* should be same result as */ + return 0; /* "mode con cp /status" */ +} +#endif + diff --git a/querycp.h b/querycp.h new file mode 100644 index 0000000..7264d2b --- /dev/null +++ b/querycp.h @@ -0,0 +1,3 @@ +/* The code in this file code is Public Domain */ + +unsigned short query_con_codepage(void); diff --git a/unix2dos.c b/unix2dos.c new file mode 100644 index 0000000..7088d02 --- /dev/null +++ b/unix2dos.c @@ -0,0 +1,1204 @@ +/* + * Name: unix2dos + * Documentation: + * Convert lf ('\x0a') characters in a file to cr lf ('\x0d' '\x0a') + * combinations. + * + * The dos2unix package is distributed under FreeBSD style license. + * See also http://www.freebsd.org/copyright/freebsd-license.html + * -------- + * + * Copyright (C) 2009-2012 Erwin Waterlander + * Copyright (C) 1994-1995 Benjamin Lin. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice in the documentation and/or other materials provided with + * the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * == 1.0 == 1989.10.04 == John Birchfield (jb@koko.csustan.edu) + * == 1.1 == 1994.12.20 == Benjamin Lin (blin@socs.uts.edu.au) + * Cleaned up for Borland C/C++ 4.02 + * == 1.2 == 1995.03.09 == Benjamin Lin (blin@socs.uts.edu.au) + * Fixed minor typo error + * == 1.3 == 1995.03.16 == Benjamin Lin (blin@socs.uts.edu.au) + * Modified to more conform to UNIX style. + * == 2.0 == 1995.03.19 == Benjamin Lin (blin@socs.uts.edu.au) + * Rewritten from scratch. + * == 2.2 == 1995.03.30 == Benjamin Lin (blin@socs.uts.edu.au) + * Conversion from SunOS charset implemented. + * + * See ChangeLog.txt for complete version history. + * + */ + + +/* #define DEBUG 1 */ + +#include "common.h" +#include "unix2dos.h" +#include "querycp.h" +#ifdef D2U_UNICODE +#ifndef MSDOS /* Unix, Cygwin */ +# include +#endif +#endif + +void PrintLicense(void) +{ + fprintf(stderr, "%s", _("\ +Copyright (C) 2009-2012 Erwin Waterlander\n\ +Copyright (C) 1994-1995 Benjamin Lin\n\ +All rights reserved.\n\n")); + PrintBSDLicense(); +} + +#ifdef D2U_UNICODE +void AddDOSNewLineW(FILE* ipOutF, CFlag *ipFlag, wint_t CurChar, wint_t PrevChar) +{ + if (ipFlag->NewLine) { /* add additional CR-LF? */ + /* Don't add line ending if it is a DOS line ending. Only in case of Unix line ending. */ + if ((CurChar == 0x0a) && (PrevChar != 0x0d)) { + d2u_putwc(0x0d, ipOutF, ipFlag); + d2u_putwc(0x0a, ipOutF, ipFlag); + } + } +} +#endif + +void AddDOSNewLine(FILE* ipOutF, CFlag *ipFlag, int CurChar, int PrevChar) +{ + if (ipFlag->NewLine) { /* add additional CR-LF? */ + /* Don't add line ending if it is a DOS line ending. Only in case of Unix line ending. */ + if ((CurChar == '\x0a') && (PrevChar != '\x0d')) { + fputc('\x0d', ipOutF); + fputc('\x0a', ipOutF); + } + } +} + +/* converts stream ipInF to DOS format text and write to stream ipOutF + * RetVal: 0 if success + * -1 otherwise + */ +#ifdef D2U_UNICODE +int ConvertUnixToDosW(FILE* ipInF, FILE* ipOutF, CFlag *ipFlag, char *progname) +{ + int RetVal = 0; + wint_t TempChar; + wint_t PreviousChar = 0; + + ipFlag->status = 0; + + /* LF -> CR-LF */ + /* CR-LF -> CR-LF, in case the input file is a DOS text file */ + /* \x0a = Newline/Line Feed (LF) */ + /* \x0d = Carriage Return (CR) */ + + switch (ipFlag->FromToMode) + { + case FROMTO_UNIX2DOS: /* unix2dos */ + while ((TempChar = d2u_getwc(ipInF, ipFlag->bomtype)) != WEOF) { /* get character */ + if ((ipFlag->Force == 0) && + (TempChar < 32) && + (TempChar != 0x0a) && /* Not an LF */ + (TempChar != 0x0d) && /* Not a CR */ + (TempChar != 0x09) && /* Not a TAB */ + (TempChar != 0x0c)) { /* Not a form feed */ + RetVal = -1; + ipFlag->status |= BINARY_FILE ; + break; + } + if (TempChar == 0x0a) + { + d2u_putwc(0x0d, ipOutF, ipFlag); /* got LF, put CR */ + } else { + if (TempChar == 0x0d) /* got CR */ + { + if ((TempChar = d2u_getwc(ipInF, ipFlag->bomtype)) == WEOF) /* get next char */ + TempChar = 0x0d; /* Read error, or end of file. */ + else + { + d2u_putwc(0x0d, ipOutF, ipFlag); /* put CR */ + PreviousChar = 0x0d; + } + } + } + if (d2u_putwc(TempChar, ipOutF, ipFlag) == WEOF) + { + RetVal = -1; + if (!ipFlag->Quiet) + { + if (!(ipFlag->status & UNICODE_CONVERSION_ERROR)) + { + fprintf(stderr, "%s: ", progname); + fprintf(stderr, "%s", _("can not write to output file\n")); + } + } + break; + } else { + AddDOSNewLineW( ipOutF, ipFlag, TempChar, PreviousChar); + } + PreviousChar = TempChar; + } + break; + case FROMTO_UNIX2MAC: /* unix2mac */ + while ((TempChar = d2u_getwc(ipInF, ipFlag->bomtype)) != WEOF) { + if ((ipFlag->Force == 0) && + (TempChar < 32) && + (TempChar != 0x0a) && /* Not an LF */ + (TempChar != 0x0d) && /* Not a CR */ + (TempChar != 0x09) && /* Not a TAB */ + (TempChar != 0x0c)) { /* Not a form feed */ + RetVal = -1; + ipFlag->status |= BINARY_FILE ; + break; + } + if ((TempChar != 0x0a)) /* Not an LF */ + { + if(d2u_putwc(TempChar, ipOutF, ipFlag) == WEOF){ + RetVal = -1; + if (!ipFlag->Quiet) + { + if (!(ipFlag->status & UNICODE_CONVERSION_ERROR)) + { + fprintf(stderr, "%s: ", progname); + fprintf(stderr, "%s", _("can not write to output file\n")); + } + } + break; + } + PreviousChar = TempChar; + } + else{ + /* TempChar is an LF */ + /* Don't touch this delimiter if it's a CR,LF pair. */ + if ( PreviousChar == 0x0d ) { + if (d2u_putwc(0x0a, ipOutF, ipFlag) == WEOF) /* CR,LF pair. Put LF */ + { + RetVal = -1; + if (!ipFlag->Quiet) + { + if (!(ipFlag->status & UNICODE_CONVERSION_ERROR)) + { + fprintf(stderr, "%s: ", progname); + fprintf(stderr, "%s", _("can not write to output file\n")); + } + } + break; + } + PreviousChar = TempChar; + continue; + } + PreviousChar = TempChar; + if (d2u_putwc(0x0d, ipOutF, ipFlag) == WEOF) /* Unix line end (LF). Put CR */ + { + RetVal = -1; + if (!ipFlag->Quiet) + { + if (!(ipFlag->status & UNICODE_CONVERSION_ERROR)) + { + fprintf(stderr, "%s: ", progname); + fprintf(stderr, "%s", _("can not write to output file\n")); + } + } + break; + } + if (ipFlag->NewLine) { /* add additional CR? */ + d2u_putwc(0x0d, ipOutF, ipFlag); + } + } + } + break; + default: /* unknown FromToMode */ + ; +#if DEBUG + fprintf(stderr, "%s: ", progname); + fprintf(stderr, _("program error, invalid conversion mode %d\n"),ipFlag->FromToMode); + exit(1); +#endif + } + return RetVal; +} +#endif + +/* converts stream ipInF to DOS format text and write to stream ipOutF + * RetVal: 0 if success + * -1 otherwise + */ +int ConvertUnixToDos(FILE* ipInF, FILE* ipOutF, CFlag *ipFlag, char *progname) +{ + int RetVal = 0; + int TempChar; + int PreviousChar = 0; + int *ConvTable; + + ipFlag->status = 0; + + switch (ipFlag->ConvMode) + { + case CONVMODE_ASCII: /* ascii */ + ConvTable = U2DAsciiTable; + break; + case CONVMODE_7BIT: /* 7bit */ + ConvTable = U2D7BitTable; + break; + case CONVMODE_437: /* iso */ + ConvTable = U2DIso437Table; + break; + case CONVMODE_850: /* iso */ + ConvTable = U2DIso850Table; + break; + case CONVMODE_860: /* iso */ + ConvTable = U2DIso860Table; + break; + case CONVMODE_863: /* iso */ + ConvTable = U2DIso863Table; + break; + case CONVMODE_865: /* iso */ + ConvTable = U2DIso865Table; + break; + case CONVMODE_1252: /* iso */ + ConvTable = U2DIso1252Table; + break; + default: /* unknown convmode */ + ipFlag->status |= WRONG_CODEPAGE ; + return(-1); + } + if ((ipFlag->ConvMode > 1) && (!ipFlag->Quiet)) /* not ascii or 7bit */ + { + fprintf(stderr, "%s: ", progname); + fprintf(stderr, _("using code page %d.\n"), ipFlag->ConvMode); + } + + /* LF -> CR-LF */ + /* CR-LF -> CR-LF, in case the input file is a DOS text file */ + /* \x0a = Newline/Line Feed (LF) */ + /* \x0d = Carriage Return (CR) */ + + switch (ipFlag->FromToMode) + { + case FROMTO_UNIX2DOS: /* unix2dos */ + while ((TempChar = fgetc(ipInF)) != EOF) { /* get character */ + if ((ipFlag->Force == 0) && + (TempChar < 32) && + (TempChar != '\x0a') && /* Not an LF */ + (TempChar != '\x0d') && /* Not a CR */ + (TempChar != '\x09') && /* Not a TAB */ + (TempChar != '\x0c')) { /* Not a form feed */ + RetVal = -1; + ipFlag->status |= BINARY_FILE ; + break; + } + if (TempChar == '\x0a') + { + fputc('\x0d', ipOutF); /* got LF, put CR */ + } else { + if (TempChar == '\x0d') /* got CR */ + { + if ((TempChar = fgetc(ipInF)) == EOF) /* get next char */ + TempChar = '\x0d'; /* Read error, or end of file. */ + else + { + fputc('\x0d', ipOutF); /* put CR */ + PreviousChar = '\x0d'; + } + } + } + if (fputc(ConvTable[TempChar], ipOutF) == EOF) + { + RetVal = -1; + if (!ipFlag->Quiet) + { + fprintf(stderr, "%s: ", progname); + fprintf(stderr, "%s", _("can not write to output file\n")); + } + break; + } else { + AddDOSNewLine( ipOutF, ipFlag, TempChar, PreviousChar); + } + PreviousChar = TempChar; + } + break; + case FROMTO_UNIX2MAC: /* unix2mac */ + while ((TempChar = fgetc(ipInF)) != EOF) { + if ((ipFlag->Force == 0) && + (TempChar < 32) && + (TempChar != '\x0a') && /* Not an LF */ + (TempChar != '\x0d') && /* Not a CR */ + (TempChar != '\x09') && /* Not a TAB */ + (TempChar != '\x0c')) { /* Not a form feed */ + RetVal = -1; + ipFlag->status |= BINARY_FILE ; + break; + } + if ((TempChar != '\x0a')) /* Not an LF */ + { + if(fputc(ConvTable[TempChar], ipOutF) == EOF){ + RetVal = -1; + if (!ipFlag->Quiet) + { + fprintf(stderr, "%s: ", progname); + fprintf(stderr, "%s", _("can not write to output file\n")); + } + break; + } + PreviousChar = TempChar; + } + else{ + /* TempChar is an LF */ + /* Don't touch this delimiter if it's a CR,LF pair. */ + if ( PreviousChar == '\x0d' ) { + if (fputc('\x0a', ipOutF) == EOF) /* CR,LF pair. Put LF */ + { + RetVal = -1; + if (!ipFlag->Quiet) + { + fprintf(stderr, "%s: ", progname); + fprintf(stderr, "%s", _("can not write to output file\n")); + } + break; + } + PreviousChar = TempChar; + continue; + } + PreviousChar = TempChar; + if (fputc('\x0d', ipOutF) == EOF) /* Unix line end (LF). Put CR */ + { + RetVal = -1; + if (!ipFlag->Quiet) + { + fprintf(stderr, "%s: ", progname); + fprintf(stderr, "%s", _("can not write to output file\n")); + } + break; + } + if (ipFlag->NewLine) { /* add additional CR? */ + fputc('\x0d', ipOutF); + } + } + } + break; + default: /* unknown FromToMode */ + ; +#if DEBUG + fprintf(stderr, "%s: ", progname); + fprintf(stderr, _("program error, invalid conversion mode %d\n"),ipFlag->FromToMode); + exit(1); +#endif + } + return RetVal; +} + +/* convert file ipInFN to DOS format text and write to file ipOutFN + * RetVal: 0 if success + * -1 otherwise + */ +int ConvertUnixToDosNewFile(char *ipInFN, char *ipOutFN, CFlag *ipFlag, char *progname) +{ + int RetVal = 0; + FILE *InF = NULL; + FILE *TempF = NULL; + char *TempPath; + char *errstr; + struct stat StatBuf; + struct utimbuf UTimeBuf; +#ifndef NO_CHMOD + mode_t mask; +#endif +#ifdef NO_MKSTEMP + FILE* fd; +#else + int fd; +#endif + char *TargetFN = NULL; + int ResolveSymlinkResult = 0; + + ipFlag->status = 0 ; + + /* Test if output file is a symbolic link */ + if (symbolic_link(ipOutFN) && !ipFlag->Follow) + { + ipFlag->status |= OUTPUTFILE_SYMLINK ; + /* Not a failure, skipping input file according spec. (keep symbolic link unchanged) */ + return -1; + } + + /* Test if input file is a regular file or symbolic link */ + if (regfile(ipInFN, 1, ipFlag, progname)) + { + ipFlag->status |= NO_REGFILE ; + /* Not a failure, skipping non-regular input file according spec. */ + return -1; + } + + /* Test if input file target is a regular file */ + if (symbolic_link(ipInFN) && regfile_target(ipInFN, ipFlag,progname)) + { + ipFlag->status |= INPUT_TARGET_NO_REGFILE ; + /* Not a failure, skipping non-regular input file according spec. */ + return -1; + } + + /* Test if output file target is a regular file */ + if (symbolic_link(ipOutFN) && (ipFlag->Follow == SYMLINK_FOLLOW) && regfile_target(ipOutFN, ipFlag,progname)) + { + ipFlag->status |= OUTPUT_TARGET_NO_REGFILE ; + /* Failure, input is regular, cannot produce output. */ + if (!ipFlag->error) ipFlag->error = 1; + return -1; + } + + /* retrieve ipInFN file date stamp */ + if (stat(ipInFN, &StatBuf)) + { + if (!ipFlag->Quiet) + { + ipFlag->error = errno; + errstr = strerror(errno); + fprintf(stderr, "%s: %s: %s\n", progname, ipInFN, errstr); + } + RetVal = -1; + } + +#ifdef NO_MKSTEMP + if((fd = MakeTempFileFrom(ipOutFN, &TempPath))==NULL) { +#else + if((fd = MakeTempFileFrom (ipOutFN, &TempPath)) < 0) { +#endif + if (!ipFlag->Quiet) + { + ipFlag->error = errno; + errstr = strerror(errno); + fprintf(stderr, "%s: ", progname); + fprintf(stderr, _("Failed to open temporary output file: %s\n"), errstr); + } + RetVal = -1; + } + +#if DEBUG + fprintf(stderr, "%s: ", progname); + fprintf(stderr, _("using %s as temporary file\n"), TempPath); +#endif + + /* can open in file? */ + if (!RetVal) + { + InF=OpenInFile(ipInFN); + if (InF == NULL) + { + ipFlag->error = errno; + errstr = strerror(errno); + fprintf(stderr, "%s: %s: %s\n", progname, ipInFN, errstr); + RetVal = -1; + } + } + + /* can open output file? */ + if ((!RetVal) && (InF)) + { +#ifdef NO_MKSTEMP + if ((TempF=fd) == NULL) + { +#else + if ((TempF=OpenOutFile(fd)) == NULL) + { + ipFlag->error = errno; + errstr = strerror(errno); + fprintf(stderr, "%s: %s\n", progname, errstr); +#endif + fclose (InF); + InF = NULL; + RetVal = -1; + } + } + + InF = read_bom(InF, &ipFlag->bomtype); + +#ifdef D2U_UNICODE +#ifndef MSDOS /* Unix, Cygwin */ + if ((ipFlag->bomtype == FILE_UTF16LE) || (ipFlag->bomtype == FILE_UTF16BE)) + { + if (strcmp(nl_langinfo(CODESET), "UTF-8") != 0) + { + /* Don't convert UTF-16 files when the locale encoding is not UTF-8 + * to prevent loss of characters. */ + ipFlag->status |= LOCALE_NOT_UTF8 ; + if (!ipFlag->error) ipFlag->error = 1; + RetVal = -1; + } + } +#endif +#if !defined(WIN32) && !defined(__CYGWIN__) /* Not Windows or Cygwin */ + if ((ipFlag->bomtype == FILE_UTF16LE) || (ipFlag->bomtype == FILE_UTF16BE)) + { + if (sizeof(wchar_t) < 4) + { + /* A decoded UTF-16 surrogate pair must fit in a wchar_t */ + ipFlag->status |= WCHAR_T_TOO_SMALL ; + if (!ipFlag->error) ipFlag->error = 1; + RetVal = -1; + } + } +#endif +#endif + + if ((ipFlag->add_bom) || (ipFlag->bomtype > 0)) + fprintf(TempF, "%s", "\xEF\xBB\xBF"); /* UTF-8 BOM */ + + /* Turn off ISO and 7-bit conversion for Unicode text files */ + if (ipFlag->bomtype > 0) + ipFlag->ConvMode = CONVMODE_ASCII; + + /* conversion sucessful? */ +#ifdef D2U_UNICODE + if ((ipFlag->bomtype == FILE_UTF16LE) || (ipFlag->bomtype == FILE_UTF16BE)) + { + if ((!RetVal) && (ConvertUnixToDosW(InF, TempF, ipFlag, progname))) + RetVal = -1; + if (ipFlag->status & UNICODE_CONVERSION_ERROR) + { + if (!ipFlag->error) ipFlag->error = 1; + RetVal = -1; + } + } else { + if ((!RetVal) && (ConvertUnixToDos(InF, TempF, ipFlag, progname))) + RetVal = -1; + } +#else + if ((!RetVal) && (ConvertUnixToDos(InF, TempF, ipFlag, progname))) + RetVal = -1; +#endif + + /* can close in file? */ + if ((InF) && (fclose(InF) == EOF)) + RetVal = -1; + + /* can close output file? */ + if ((TempF) && (fclose(TempF) == EOF)) + RetVal = -1; + +#ifdef NO_MKSTEMP + if(fd!=NULL) + fclose(fd); +#else + if(fd>=0) + close(fd); +#endif + +#ifndef NO_CHMOD + if (!RetVal) + { + if (ipFlag->NewFile == 0) /* old file mode */ + { + RetVal = chmod (TempPath, StatBuf.st_mode); /* set original permissions */ + } + else + { + mask = umask(0); /* get process's umask */ + umask(mask); /* set umask back to original */ + RetVal = chmod(TempPath, StatBuf.st_mode & ~mask); /* set original permissions, minus umask */ + } + + if (RetVal) + { + if (!ipFlag->Quiet) + { + ipFlag->error = errno; + errstr = strerror(errno); + fprintf(stderr, "%s: ", progname); + fprintf(stderr, _("Failed to change the permissions of temporary output file %s: %s\n"), TempPath, errstr); + } + } + } +#endif + +#ifndef NO_CHOWN + if (!RetVal && (ipFlag->NewFile == 0)) /* old file mode */ + { + /* Change owner and group of the the tempory output file to the original file's uid and gid. */ + /* Required when a different user (e.g. root) has write permission on the original file. */ + /* Make sure that the original owner can still access the file. */ + if (chown(TempPath, StatBuf.st_uid, StatBuf.st_gid)) + { + if (!ipFlag->Quiet) + { + ipFlag->error = errno; + errstr = strerror(errno); + fprintf(stderr, "%s: ", progname); + fprintf(stderr, _("Failed to change the owner and group of temporary output file %s: %s\n"), TempPath, errstr); + } + RetVal = -1; + } + } +#endif + + if ((!RetVal) && (ipFlag->KeepDate)) + { + UTimeBuf.actime = StatBuf.st_atime; + UTimeBuf.modtime = StatBuf.st_mtime; + /* can change output file time to in file time? */ + if (utime(TempPath, &UTimeBuf) == -1) + { + if (!ipFlag->Quiet) + { + ipFlag->error = errno; + errstr = strerror(errno); + fprintf(stderr, "%s: %s: %s\n", progname, TempPath, errstr); + } + RetVal = -1; + } + } + + /* any error? cleanup the temp file */ + if (RetVal && (TempPath != NULL)) + { + if (unlink(TempPath) && (errno != ENOENT)) + { + if (!ipFlag->Quiet) + { + ipFlag->error = errno; + errstr = strerror(errno); + fprintf(stderr, "%s: %s: %s\n", progname, TempPath, errstr); + } + RetVal = -1; + } + } + + /* If output file is a symbolic link, optional resolve the link and modify */ + /* the target, instead of removing the link and creating a new regular file */ + TargetFN = ipOutFN; + if (symbolic_link(ipOutFN) && !RetVal) + { + ResolveSymlinkResult = 0; /* indicates that TargetFN need not be freed */ + if (ipFlag->Follow == SYMLINK_FOLLOW) + { + ResolveSymlinkResult = ResolveSymbolicLink(ipOutFN, &TargetFN, ipFlag, progname); + if (ResolveSymlinkResult < 0) + { + if (!ipFlag->Quiet) + { + fprintf(stderr, "%s: ", progname); + fprintf(stderr, _("problems resolving symbolic link '%s'\n"), ipOutFN); + fprintf(stderr, _(" output file remains in '%s'\n"), TempPath); + } + RetVal = -1; + } + } + } + + /* can rename temporary file to output file? */ + if (!RetVal) + { +#ifdef NEED_REMOVE + if (unlink(TargetFN) && (errno != ENOENT)) + { + if (!ipFlag->Quiet) + { + ipFlag->error = errno; + errstr = strerror(errno); + fprintf(stderr, "%s: %s: %s\n", progname, TargetFN, errstr); + } + RetVal = -1; + } +#endif + if (rename(TempPath, TargetFN) == -1) + { + if (!ipFlag->Quiet) + { + ipFlag->error = errno; + errstr = strerror(errno); + fprintf(stderr, "%s: ", progname); + fprintf(stderr, _("problems renaming '%s' to '%s': %s\n"), TempPath, TargetFN, errstr); +#ifdef S_ISLNK + if (ResolveSymlinkResult > 0) + fprintf(stderr, _(" which is the target of symbolic link '%s'\n"), ipOutFN); +#endif + fprintf(stderr, _(" output file remains in '%s'\n"), TempPath); + } + RetVal = -1; + } + + if (ResolveSymlinkResult > 0) + free(TargetFN); + } + free(TempPath); + return RetVal; +} + +/* convert stdin to DOS format text and write to stdout + * RetVal: 0 if success + * -1 otherwise + */ +int ConvertUnixToDosStdio(CFlag *ipFlag, char *progname) +{ + ipFlag->NewFile = 1; + ipFlag->Quiet = 1; + ipFlag->KeepDate = 0; + ipFlag->Force = 1; + +#if defined(WIN32) && !defined(__CYGWIN__) + + /* stdin and stdout are by default text streams. We need + * to set them to binary mode. Otherwise an LF will + * automatically be converted to CR-LF on DOS/Windows. + * Erwin */ + + /* 'setmode' was deprecated by MicroSoft + * since Visual C++ 2005. Use '_setmode' instead. */ + + _setmode(fileno(stdout), O_BINARY); + _setmode(fileno(stdin), O_BINARY); +#elif defined(MSDOS) || defined(__CYGWIN__) || defined(__OS2__) + setmode(fileno(stdout), O_BINARY); + setmode(fileno(stdin), O_BINARY); +#endif + + read_bom(stdin, &ipFlag->bomtype); + + if ((ipFlag->add_bom) || (ipFlag->bomtype > 0)) + fprintf(stdout, "%s", "\xEF\xBB\xBF"); /* UTF-8 BOM */ + +#ifdef D2U_UNICODE + if ((ipFlag->bomtype == FILE_UTF16LE) || (ipFlag->bomtype == FILE_UTF16BE)) + { + return (ConvertUnixToDosW(stdin, stdout, ipFlag, progname)); + } else { + return (ConvertUnixToDos(stdin, stdout, ipFlag, progname)); + } +#else + return (ConvertUnixToDos(stdin, stdout, ipFlag, progname)); +#endif +} + + +int main (int argc, char *argv[]) +{ + /* variable declarations */ + char progname[9]; + int ArgIdx; + int CanSwitchFileMode; + int ShouldExit; + int RetVal = 0; + int process_options = 1; + CFlag *pFlag; + char *ptr; +#ifdef ENABLE_NLS + char localedir[1024]; +#endif +# ifdef __MINGW64__ + int _dowildcard = -1; /* enable wildcard expansion for Win64 */ +# endif + + progname[8] = '\0'; + strcpy(progname,"unix2dos"); + +#ifdef ENABLE_NLS + ptr = getenv("DOS2UNIX_LOCALEDIR"); + if (ptr == NULL) + strcpy(localedir,LOCALEDIR); + else + { + if (strlen(ptr) < sizeof(localedir)) + strcpy(localedir,ptr); + else + { + fprintf(stderr,"%s: ",progname); + fprintf(stderr, "%s", _("error: Value of environment variable DOS2UNIX_LOCALEDIR is too long.\n")); + strcpy(localedir,LOCALEDIR); + } + } + + setlocale (LC_ALL, ""); + bindtextdomain (PACKAGE, localedir); + textdomain (PACKAGE); +#endif + + + /* variable initialisations */ + ArgIdx = 0; + CanSwitchFileMode = 1; + ShouldExit = 0; + pFlag = (CFlag*)malloc(sizeof(CFlag)); + pFlag->NewFile = 0; + pFlag->Quiet = 0; + pFlag->KeepDate = 0; + pFlag->ConvMode = CONVMODE_ASCII; /* default ascii */ + pFlag->FromToMode = FROMTO_UNIX2DOS; /* default unix2dos */ + pFlag->NewLine = 0; + pFlag->Force = 0; + pFlag->Follow = SYMLINK_SKIP; + pFlag->status = 0; + pFlag->stdio_mode = 1; + pFlag->error = 0; +#ifdef D2U_UNICODE + pFlag->bomtype = FILE_MBS; +#endif + pFlag->add_bom = 0; + + if ( ((ptr=strrchr(argv[0],'/')) == NULL) && ((ptr=strrchr(argv[0],'\\')) == NULL) ) + ptr = argv[0]; + else + ptr++; + + if ((strcmpi("unix2mac", ptr) == 0) || (strcmpi("unix2mac.exe", ptr) == 0)) + { + pFlag->FromToMode = FROMTO_UNIX2MAC; + strcpy(progname,"unix2mac"); + } + + while ((++ArgIdx < argc) && (!ShouldExit)) + { + /* is it an option? */ + if ((argv[ArgIdx][0] == '-') && process_options) + { + /* an option */ + if (strcmp(argv[ArgIdx],"--") == 0) + process_options = 0; + else if ((strcmp(argv[ArgIdx],"-h") == 0) || (strcmp(argv[ArgIdx],"--help") == 0)) + { + PrintUsage(progname); + return(pFlag->error); + } + else if ((strcmp(argv[ArgIdx],"-k") == 0) || (strcmp(argv[ArgIdx],"--keepdate") == 0)) + pFlag->KeepDate = 1; + else if ((strcmp(argv[ArgIdx],"-f") == 0) || (strcmp(argv[ArgIdx],"--force") == 0)) + pFlag->Force = 1; + else if ((strcmp(argv[ArgIdx],"-s") == 0) || (strcmp(argv[ArgIdx],"--safe") == 0)) + pFlag->Force = 0; + else if ((strcmp(argv[ArgIdx],"-q") == 0) || (strcmp(argv[ArgIdx],"--quiet") == 0)) + pFlag->Quiet = 1; + else if ((strcmp(argv[ArgIdx],"-l") == 0) || (strcmp(argv[ArgIdx],"--newline") == 0)) + pFlag->NewLine = 1; + else if ((strcmp(argv[ArgIdx],"-m") == 0) || (strcmp(argv[ArgIdx],"--add-bom") == 0)) + pFlag->add_bom = 1; + else if ((strcmp(argv[ArgIdx],"-S") == 0) || (strcmp(argv[ArgIdx],"--skip-symlink") == 0)) + pFlag->Follow = SYMLINK_SKIP; + else if ((strcmp(argv[ArgIdx],"-F") == 0) || (strcmp(argv[ArgIdx],"--follow-symlink") == 0)) + pFlag->Follow = SYMLINK_FOLLOW; + else if ((strcmp(argv[ArgIdx],"-R") == 0) || (strcmp(argv[ArgIdx],"--replace-symlink") == 0)) + pFlag->Follow = SYMLINK_REPLACE; + else if ((strcmp(argv[ArgIdx],"-V") == 0) || (strcmp(argv[ArgIdx],"--version") == 0)) + { + PrintVersion(progname); +#ifdef ENABLE_NLS + PrintLocaledir(localedir); +#endif + return(pFlag->error); + } + else if ((strcmp(argv[ArgIdx],"-L") == 0) || (strcmp(argv[ArgIdx],"--license") == 0)) + { + PrintLicense(); + return(pFlag->error); + } + else if (strcmp(argv[ArgIdx],"-ascii") == 0) /* SunOS compatible options */ + pFlag->ConvMode = CONVMODE_ASCII; + else if (strcmp(argv[ArgIdx],"-7") == 0) + pFlag->ConvMode = CONVMODE_7BIT; + else if (strcmp(argv[ArgIdx],"-iso") == 0) + { + pFlag->ConvMode = (int)query_con_codepage(); + if (!pFlag->Quiet) + { + fprintf(stderr,"%s: ",progname); + fprintf(stderr,_("active code page: %d\n"), pFlag->ConvMode); + } + if (pFlag->ConvMode < 2) + pFlag->ConvMode = CONVMODE_437; + } + else if (strcmp(argv[ArgIdx],"-437") == 0) + pFlag->ConvMode = CONVMODE_437; + else if (strcmp(argv[ArgIdx],"-850") == 0) + pFlag->ConvMode = CONVMODE_850; + else if (strcmp(argv[ArgIdx],"-860") == 0) + pFlag->ConvMode = CONVMODE_860; + else if (strcmp(argv[ArgIdx],"-863") == 0) + pFlag->ConvMode = CONVMODE_863; + else if (strcmp(argv[ArgIdx],"-865") == 0) + pFlag->ConvMode = CONVMODE_865; + else if (strcmp(argv[ArgIdx],"-1252") == 0) + pFlag->ConvMode = CONVMODE_1252; + else if ((strcmp(argv[ArgIdx],"-c") == 0) || (strcmp(argv[ArgIdx],"--convmode") == 0)) + { + if (++ArgIdx < argc) + { + if (strcmpi(argv[ArgIdx],"ascii") == 0) /* Benjamin Lin's legacy options */ + pFlag->ConvMode = CONVMODE_ASCII; + else if (strcmpi(argv[ArgIdx], "7bit") == 0) + pFlag->ConvMode = CONVMODE_7BIT; + else if (strcmpi(argv[ArgIdx], "iso") == 0) + { + pFlag->ConvMode = (int)query_con_codepage(); + if (!pFlag->Quiet) + { + fprintf(stderr,"%s: ",progname); + fprintf(stderr,_("active code page: %d\n"), pFlag->ConvMode); + } + if (pFlag->ConvMode < 2) + pFlag->ConvMode = CONVMODE_437; + } + else if (strcmpi(argv[ArgIdx], "mac") == 0) + pFlag->FromToMode = FROMTO_UNIX2MAC; + else + { + fprintf(stderr,"%s: ",progname); + fprintf(stderr, _("invalid %s conversion mode specified\n"),argv[ArgIdx]); + pFlag->error = 1; + ShouldExit = 1; + pFlag->stdio_mode = 0; + } + } + else + { + ArgIdx--; + fprintf(stderr,"%s: ",progname); + fprintf(stderr,_("option '%s' requires an argument\n"),argv[ArgIdx]); + pFlag->error = 1; + ShouldExit = 1; + pFlag->stdio_mode = 0; + } + } + + else if ((strcmp(argv[ArgIdx],"-o") == 0) || (strcmp(argv[ArgIdx],"--oldfile") == 0)) + { + /* last convert not paired */ + if (!CanSwitchFileMode) + { + fprintf(stderr,"%s: ",progname); + fprintf(stderr, _("target of file %s not specified in new file mode\n"), argv[ArgIdx-1]); + pFlag->error = 1; + ShouldExit = 1; + pFlag->stdio_mode = 0; + } + pFlag->NewFile = 0; + } + + else if ((strcmp(argv[ArgIdx],"-n") == 0) || (strcmp(argv[ArgIdx],"--newfile") == 0)) + { + /* last convert not paired */ + if (!CanSwitchFileMode) + { + fprintf(stderr,"%s: ",progname); + fprintf(stderr, _("target of file %s not specified in new file mode\n"), argv[ArgIdx-1]); + pFlag->error = 1; + ShouldExit = 1; + pFlag->stdio_mode = 0; + } + pFlag->NewFile = 1; + } + else { /* wrong option */ + PrintUsage(progname); + ShouldExit = 1; + pFlag->error = 1; + pFlag->stdio_mode = 0; + } + } + else + { + pFlag->stdio_mode = 0; + /* not an option */ + if (pFlag->NewFile) + { + if (CanSwitchFileMode) + CanSwitchFileMode = 0; + else + { + RetVal = ConvertUnixToDosNewFile(argv[ArgIdx-1], argv[ArgIdx], pFlag, progname); + if (pFlag->status & NO_REGFILE) + { + if (!pFlag->Quiet) + { + fprintf(stderr,"%s: ",progname); + fprintf(stderr, _("Skipping %s, not a regular file.\n"), argv[ArgIdx-1]); + } + } else if (pFlag->status & OUTPUTFILE_SYMLINK) + { + if (!pFlag->Quiet) + { + fprintf(stderr,"%s: ",progname); + fprintf(stderr, _("Skipping %s, output file %s is a symbolic link.\n"), argv[ArgIdx-1], argv[ArgIdx]); + } + } else if (pFlag->status & INPUT_TARGET_NO_REGFILE) + { + if (!pFlag->Quiet) + { + fprintf(stderr,"%s: ",progname); + fprintf(stderr, _("Skipping symbolic link %s, target is not a regular file.\n"), argv[ArgIdx-1]); + } + } else if (pFlag->status & OUTPUT_TARGET_NO_REGFILE) + { + if (!pFlag->Quiet) + { + fprintf(stderr,"%s: ",progname); + fprintf(stderr, _("Skipping %s, target of symbolic link %s is not a regular file.\n"), argv[ArgIdx-1], argv[ArgIdx]); + } + } else if (pFlag->status & BINARY_FILE) + { + if (!pFlag->Quiet) + { + fprintf(stderr,"%s: ",progname); + fprintf(stderr, _("Skipping binary file %s\n"), argv[ArgIdx-1]); + } + } else if (pFlag->status & WRONG_CODEPAGE) + { + if (!pFlag->Quiet) + { + fprintf(stderr,"%s: ",progname); + fprintf(stderr, _("code page %d is not supported.\n"), pFlag->ConvMode); + } + } else if (pFlag->status & LOCALE_NOT_UTF8) + { + if (!pFlag->Quiet) + { + fprintf(stderr,"%s: ",progname); + fprintf(stderr, _("Skipping UTF-16 file %s, the current locale character encoding is not UTF-8.\n"), argv[ArgIdx-1]); + } + } else if (pFlag->status & WCHAR_T_TOO_SMALL) + { + if (!pFlag->Quiet) + { + fprintf(stderr,"%s: ",progname); + fprintf(stderr, _("Skipping UTF-16 file %s, the size of wchar_t is %d bytes.\n"), argv[ArgIdx-1], (int)sizeof(wchar_t)); + } + } else if (pFlag->status & UNICODE_CONVERSION_ERROR) + { + if (!pFlag->Quiet) + { + fprintf(stderr,"%s: ",progname); + fprintf(stderr, _("Skipping UTF-16 file %s, an UTF-16 conversion error occurred.\n"), argv[ArgIdx-1]); + } + } else { + if (!pFlag->Quiet) + { + fprintf(stderr,"%s: ",progname); + if (pFlag->FromToMode == FROMTO_UNIX2MAC) + fprintf(stderr, _("converting file %s to file %s in Mac format ...\n"), argv[ArgIdx-1], argv[ArgIdx]); + else + fprintf(stderr, _("converting file %s to file %s in DOS format ...\n"), argv[ArgIdx-1], argv[ArgIdx]); + } + if (RetVal) + { + if (!pFlag->Quiet) + { + fprintf(stderr,"%s: ",progname); + fprintf(stderr, _("problems converting file %s to file %s\n"), argv[ArgIdx-1], argv[ArgIdx]); + } + } + } + CanSwitchFileMode = 1; + } + } + else + { + RetVal = ConvertUnixToDosNewFile(argv[ArgIdx], argv[ArgIdx], pFlag, progname); + if (pFlag->status & NO_REGFILE) + { + if (!pFlag->Quiet) + { + fprintf(stderr,"%s: ",progname); + fprintf(stderr, _("Skipping %s, not a regular file.\n"), argv[ArgIdx]); + } + } else if (pFlag->status & OUTPUTFILE_SYMLINK) + { + if (!pFlag->Quiet) + { + fprintf(stderr,"%s: ",progname); + fprintf(stderr, _("Skipping symbolic link %s.\n"), argv[ArgIdx]); + } + } else if (pFlag->status & INPUT_TARGET_NO_REGFILE) + { + if (!pFlag->Quiet) + { + fprintf(stderr,"%s: ",progname); + fprintf(stderr, _("Skipping symbolic link %s, target is not a regular file.\n"), argv[ArgIdx]); + } + } else if (pFlag->status & BINARY_FILE) + { + if (!pFlag->Quiet) + { + fprintf(stderr,"%s: ",progname); + fprintf(stderr, _("Skipping binary file %s\n"), argv[ArgIdx]); + } + } else if (pFlag->status & WRONG_CODEPAGE) + { + if (!pFlag->Quiet) + { + fprintf(stderr,"%s: ",progname); + fprintf(stderr, _("code page %d is not supported.\n"), pFlag->ConvMode); + } + } else if (pFlag->status & LOCALE_NOT_UTF8) + { + if (!pFlag->Quiet) + { + fprintf(stderr,"%s: ",progname); + fprintf(stderr, _("Skipping UTF-16 file %s, the current locale character encoding is not UTF-8.\n"), argv[ArgIdx]); + } + } else if (pFlag->status & WCHAR_T_TOO_SMALL) + { + if (!pFlag->Quiet) + { + fprintf(stderr,"%s: ",progname); + fprintf(stderr, _("Skipping UTF-16 file %s, the size of wchar_t is %d bytes.\n"), argv[ArgIdx], (int)sizeof(wchar_t)); + } + } else if (pFlag->status & UNICODE_CONVERSION_ERROR) + { + if (!pFlag->Quiet) + { + fprintf(stderr,"%s: ",progname); + fprintf(stderr, _("Skipping UTF-16 file %s, an UTF-16 conversion error occurred.\n"), argv[ArgIdx]); + } + } else { + if (!pFlag->Quiet) + { + fprintf(stderr,"%s: ",progname); + if (pFlag->FromToMode == FROMTO_UNIX2MAC) + fprintf(stderr, _("converting file %s to Mac format ...\n"), argv[ArgIdx]); + else + fprintf(stderr, _("converting file %s to DOS format ...\n"), argv[ArgIdx]); + } + if (RetVal) + { + if (!pFlag->Quiet) + { + fprintf(stderr,"%s: ",progname); + fprintf(stderr, _("problems converting file %s\n"), argv[ArgIdx]); + } + } + } + } + } + } + + /* no file argument, use stdin and stdout */ + if (pFlag->stdio_mode) + { + exit(ConvertUnixToDosStdio(pFlag, progname)); + } + + + if (!CanSwitchFileMode) + { + fprintf(stderr,"%s: ",progname); + fprintf(stderr, _("target of file %s not specified in new file mode\n"), argv[ArgIdx-1]); + pFlag->error = 1; + } + return (pFlag->error); +} + diff --git a/unix2dos.h b/unix2dos.h new file mode 100644 index 0000000..db31730 --- /dev/null +++ b/unix2dos.h @@ -0,0 +1,222 @@ +/* + * Copyright (C) 2009-2011 Erwin Waterlander + * Copyright (C) 1994-1995 Benjamin Lin. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice in the documentation and/or other materials provided with + * the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef __UNIX2DOS_H +#define __UNIX2DOS_H + +#ifdef __GNUC__ +#ifndef strcmpi +# define strcmpi(s1, s2) strcasecmp(s1, s2) +#endif +#endif + +/* ASCII mode. No conversion. */ + +static int U2DAsciiTable[256] = +{ + '\x00', '\x01', '\x02', '\x03', '\x04', '\x05', '\x06', '\x07', '\x08', '\x09', '\x0a', '\x0b', '\x0c', '\x0d', '\x0e', '\x0f', + '\x10', '\x11', '\x12', '\x13', '\x14', '\x15', '\x16', '\x17', '\x18', '\x19', '\x1a', '\x1b', '\x1c', '\x1d', '\x1e', '\x1f', + '\x20', '\x21', '\x22', '\x23', '\x24', '\x25', '\x26', '\x27', '\x28', '\x29', '\x2a', '\x2b', '\x2c', '\x2d', '\x2e', '\x2f', + '\x30', '\x31', '\x32', '\x33', '\x34', '\x35', '\x36', '\x37', '\x38', '\x39', '\x3a', '\x3b', '\x3c', '\x3d', '\x3e', '\x3f', + '\x40', '\x41', '\x42', '\x43', '\x44', '\x45', '\x46', '\x47', '\x48', '\x49', '\x4a', '\x4b', '\x4c', '\x4d', '\x4e', '\x4f', + '\x50', '\x51', '\x52', '\x53', '\x54', '\x55', '\x56', '\x57', '\x58', '\x59', '\x5a', '\x5b', '\x5c', '\x5d', '\x5e', '\x5f', + '\x60', '\x61', '\x62', '\x63', '\x64', '\x65', '\x66', '\x67', '\x68', '\x69', '\x6a', '\x6b', '\x6c', '\x6d', '\x6e', '\x6f', + '\x70', '\x71', '\x72', '\x73', '\x74', '\x75', '\x76', '\x77', '\x78', '\x79', '\x7a', '\x7b', '\x7c', '\x7d', '\x7e', '\x7f', + '\x80', '\x81', '\x82', '\x83', '\x84', '\x85', '\x86', '\x87', '\x88', '\x89', '\x8a', '\x8b', '\x8c', '\x8d', '\x8e', '\x8f', + '\x90', '\x91', '\x92', '\x93', '\x94', '\x95', '\x96', '\x97', '\x98', '\x99', '\x9a', '\x9b', '\x9c', '\x9d', '\x9e', '\x9f', + '\xa0', '\xa1', '\xa2', '\xa3', '\xa4', '\xa5', '\xa6', '\xa7', '\xa8', '\xa9', '\xaa', '\xab', '\xac', '\xad', '\xae', '\xaf', + '\xb0', '\xb1', '\xb2', '\xb3', '\xb4', '\xb5', '\xb6', '\xb7', '\xb8', '\xb9', '\xba', '\xbb', '\xbc', '\xbd', '\xbe', '\xbf', + '\xc0', '\xc1', '\xc2', '\xc3', '\xc4', '\xc5', '\xc6', '\xc7', '\xc8', '\xc9', '\xca', '\xcb', '\xcc', '\xcd', '\xce', '\xcf', + '\xd0', '\xd1', '\xd2', '\xd3', '\xd4', '\xd5', '\xd6', '\xd7', '\xd8', '\xd9', '\xda', '\xdb', '\xdc', '\xdd', '\xde', '\xdf', + '\xe0', '\xe1', '\xe2', '\xe3', '\xe4', '\xe5', '\xe6', '\xe7', '\xe8', '\xe9', '\xea', '\xeb', '\xec', '\xed', '\xee', '\xef', + '\xf0', '\xf1', '\xf2', '\xf3', '\xf4', '\xf5', '\xf6', '\xf7', '\xf8', '\xf9', '\xfa', '\xfb', '\xfc', '\xfd', '\xfe', '\xff', +}; + + +/* 7bit mode. */ +/* All 8 bit non-ASCII characters are converted to a space (\x20) */ + +static int U2D7BitTable [256] = +{ + '\x00', '\x01', '\x02', '\x03', '\x04', '\x05', '\x06', '\x07', '\x08', '\x09', '\x0a', '\x0b', '\x0c', '\x0d', '\x0e', '\x0f', + '\x10', '\x11', '\x12', '\x13', '\x14', '\x15', '\x16', '\x17', '\x18', '\x19', '\x1a', '\x1b', '\x1c', '\x1d', '\x1e', '\x1f', + '\x20', '\x21', '\x22', '\x23', '\x24', '\x25', '\x26', '\x27', '\x28', '\x29', '\x2a', '\x2b', '\x2c', '\x2d', '\x2e', '\x2f', + '\x30', '\x31', '\x32', '\x33', '\x34', '\x35', '\x36', '\x37', '\x38', '\x39', '\x3a', '\x3b', '\x3c', '\x3d', '\x3e', '\x3f', + '\x40', '\x41', '\x42', '\x43', '\x44', '\x45', '\x46', '\x47', '\x48', '\x49', '\x4a', '\x4b', '\x4c', '\x4d', '\x4e', '\x4f', + '\x50', '\x51', '\x52', '\x53', '\x54', '\x55', '\x56', '\x57', '\x58', '\x59', '\x5a', '\x5b', '\x5c', '\x5d', '\x5e', '\x5f', + '\x60', '\x61', '\x62', '\x63', '\x64', '\x65', '\x66', '\x67', '\x68', '\x69', '\x6a', '\x6b', '\x6c', '\x6d', '\x6e', '\x6f', + '\x70', '\x71', '\x72', '\x73', '\x74', '\x75', '\x76', '\x77', '\x78', '\x79', '\x7a', '\x7b', '\x7c', '\x7d', '\x7e', '\x7f', + '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', + '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', + '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', + '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', + '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', + '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', + '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', + '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', '\x20', +}; + + +/* ISO mode. ISO-8859-1 -> CP437 */ +/* Non-convertable characters are converted to a dot (\x2e) */ + +static int U2DIso437Table[256] = +{ + '\x00', '\x01', '\x02', '\x03', '\x04', '\x05', '\x06', '\x07', '\x08', '\x09', '\x0a', '\x0b', '\x0c', '\x0d', '\x0e', '\x0f', + '\x10', '\x11', '\x12', '\x13', '\x14', '\x15', '\x16', '\x17', '\x18', '\x19', '\x1a', '\x1b', '\x1c', '\x1d', '\x1e', '\x1f', + '\x20', '\x21', '\x22', '\x23', '\x24', '\x25', '\x26', '\x27', '\x28', '\x29', '\x2a', '\x2b', '\x2c', '\x2d', '\x2e', '\x2f', + '\x30', '\x31', '\x32', '\x33', '\x34', '\x35', '\x36', '\x37', '\x38', '\x39', '\x3a', '\x3b', '\x3c', '\x3d', '\x3e', '\x3f', + '\x40', '\x41', '\x42', '\x43', '\x44', '\x45', '\x46', '\x47', '\x48', '\x49', '\x4a', '\x4b', '\x4c', '\x4d', '\x4e', '\x4f', + '\x50', '\x51', '\x52', '\x53', '\x54', '\x55', '\x56', '\x57', '\x58', '\x59', '\x5a', '\x5b', '\x5c', '\x5d', '\x5e', '\x5f', + '\x60', '\x61', '\x62', '\x63', '\x64', '\x65', '\x66', '\x67', '\x68', '\x69', '\x6a', '\x6b', '\x6c', '\x6d', '\x6e', '\x6f', + '\x70', '\x71', '\x72', '\x73', '\x74', '\x75', '\x76', '\x77', '\x78', '\x79', '\x7a', '\x7b', '\x7c', '\x7d', '\x7e', '\x7f', + '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', + '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', + '\xff', '\xad', '\x9b', '\x9c', '\x2e', '\x9d', '\x2e', '\x2e', '\x2e', '\x2e', '\xa6', '\xae', '\xaa', '\x2e', '\x2e', '\x2e', + '\xf8', '\xf1', '\xfd', '\x2e', '\x2e', '\xe6', '\x2e', '\xfa', '\x2e', '\x2e', '\xa7', '\xaf', '\xac', '\xab', '\x2e', '\xa8', + '\x2e', '\x2e', '\x2e', '\x2e', '\x8e', '\x8f', '\x92', '\x80', '\x2e', '\x90', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', + '\x2e', '\xa5', '\x2e', '\x2e', '\x2e', '\x2e', '\x99', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x9a', '\x2e', '\x2e', '\xe1', + '\x85', '\xa0', '\x83', '\x2e', '\x84', '\x86', '\x91', '\x87', '\x8a', '\x82', '\x88', '\x89', '\x8d', '\xa1', '\x8c', '\x8b', + '\x2e', '\xa4', '\x95', '\xa2', '\x93', '\x2e', '\x94', '\xf6', '\x2e', '\x97', '\xa3', '\x96', '\x81', '\x2e', '\x2e', '\x98', +}; + +/* ISO mode. ISO-8859-1 -> CP850 */ +/* Non-convertable characters are converted to a dot (\x2e) */ + +static int U2DIso850Table[256] = +{ + '\x00', '\x01', '\x02', '\x03', '\x04', '\x05', '\x06', '\x07', '\x08', '\x09', '\x0a', '\x0b', '\x0c', '\x0d', '\x0e', '\x0f', + '\x10', '\x11', '\x12', '\x13', '\x14', '\x15', '\x16', '\x17', '\x18', '\x19', '\x1a', '\x1b', '\x1c', '\x1d', '\x1e', '\x1f', + '\x20', '\x21', '\x22', '\x23', '\x24', '\x25', '\x26', '\x27', '\x28', '\x29', '\x2a', '\x2b', '\x2c', '\x2d', '\x2e', '\x2f', + '\x30', '\x31', '\x32', '\x33', '\x34', '\x35', '\x36', '\x37', '\x38', '\x39', '\x3a', '\x3b', '\x3c', '\x3d', '\x3e', '\x3f', + '\x40', '\x41', '\x42', '\x43', '\x44', '\x45', '\x46', '\x47', '\x48', '\x49', '\x4a', '\x4b', '\x4c', '\x4d', '\x4e', '\x4f', + '\x50', '\x51', '\x52', '\x53', '\x54', '\x55', '\x56', '\x57', '\x58', '\x59', '\x5a', '\x5b', '\x5c', '\x5d', '\x5e', '\x5f', + '\x60', '\x61', '\x62', '\x63', '\x64', '\x65', '\x66', '\x67', '\x68', '\x69', '\x6a', '\x6b', '\x6c', '\x6d', '\x6e', '\x6f', + '\x70', '\x71', '\x72', '\x73', '\x74', '\x75', '\x76', '\x77', '\x78', '\x79', '\x7a', '\x7b', '\x7c', '\x7d', '\x7e', '\x7f', + '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', + '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', + '\xff', '\xad', '\xbd', '\x9c', '\xcf', '\xbe', '\xdd', '\xf5', '\xf9', '\xb8', '\xa6', '\xae', '\xaa', '\xf0', '\xa9', '\xee', + '\xf8', '\xf1', '\xfd', '\xfc', '\xef', '\xe6', '\xf4', '\xfa', '\xf7', '\xfb', '\xa7', '\xaf', '\xac', '\xab', '\xf3', '\xa8', + '\xb7', '\xb5', '\xb6', '\xc7', '\x8e', '\x8f', '\x92', '\x80', '\xd4', '\x90', '\xd2', '\xd3', '\xde', '\xd6', '\xd7', '\xd8', + '\xd1', '\xa5', '\xe3', '\xe0', '\xe2', '\xe5', '\x99', '\x9e', '\x9d', '\xeb', '\xe9', '\xea', '\x9a', '\xed', '\xe8', '\xe1', + '\x85', '\xa0', '\x83', '\xc6', '\x84', '\x86', '\x91', '\x87', '\x8a', '\x82', '\x88', '\x89', '\x8d', '\xa1', '\x8c', '\x8b', + '\xd0', '\xa4', '\x95', '\xa2', '\x93', '\xe4', '\x94', '\xf6', '\x9b', '\x97', '\xa3', '\x96', '\x81', '\xec', '\xe7', '\x98', +}; + +/* ISO mode. ISO-8859-1 -> CP860 */ +/* Non-convertable characters are converted to a dot (\x2e) */ + +static int U2DIso860Table[256] = +{ + '\x00', '\x01', '\x02', '\x03', '\x04', '\x05', '\x06', '\x07', '\x08', '\x09', '\x0a', '\x0b', '\x0c', '\x0d', '\x0e', '\x0f', + '\x10', '\x11', '\x12', '\x13', '\x14', '\x15', '\x16', '\x17', '\x18', '\x19', '\x1a', '\x1b', '\x1c', '\x1d', '\x1e', '\x1f', + '\x20', '\x21', '\x22', '\x23', '\x24', '\x25', '\x26', '\x27', '\x28', '\x29', '\x2a', '\x2b', '\x2c', '\x2d', '\x2e', '\x2f', + '\x30', '\x31', '\x32', '\x33', '\x34', '\x35', '\x36', '\x37', '\x38', '\x39', '\x3a', '\x3b', '\x3c', '\x3d', '\x3e', '\x3f', + '\x40', '\x41', '\x42', '\x43', '\x44', '\x45', '\x46', '\x47', '\x48', '\x49', '\x4a', '\x4b', '\x4c', '\x4d', '\x4e', '\x4f', + '\x50', '\x51', '\x52', '\x53', '\x54', '\x55', '\x56', '\x57', '\x58', '\x59', '\x5a', '\x5b', '\x5c', '\x5d', '\x5e', '\x5f', + '\x60', '\x61', '\x62', '\x63', '\x64', '\x65', '\x66', '\x67', '\x68', '\x69', '\x6a', '\x6b', '\x6c', '\x6d', '\x6e', '\x6f', + '\x70', '\x71', '\x72', '\x73', '\x74', '\x75', '\x76', '\x77', '\x78', '\x79', '\x7a', '\x7b', '\x7c', '\x7d', '\x7e', '\x7f', + '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', + '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', + '\xff', '\xad', '\x9b', '\x9c', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\xa6', '\xae', '\xaa', '\x2e', '\x2e', '\x2e', + '\xf8', '\xf1', '\xfd', '\x2e', '\x2e', '\xe6', '\x2e', '\xfa', '\x2e', '\x2e', '\xa7', '\xaf', '\xac', '\xab', '\x2e', '\xa8', + '\x91', '\x86', '\x8f', '\x8e', '\x2e', '\x2e', '\x2e', '\x80', '\x92', '\x90', '\x89', '\x2e', '\x98', '\x8b', '\x2e', '\x2e', + '\x2e', '\xa5', '\xa9', '\x9f', '\x8c', '\x99', '\x2e', '\x2e', '\x2e', '\x9d', '\x96', '\x2e', '\x9a', '\x2e', '\x2e', '\xe1', + '\x85', '\xa0', '\x83', '\x84', '\x2e', '\x2e', '\x2e', '\x87', '\x8a', '\x82', '\x88', '\x2e', '\x8d', '\xa1', '\x2e', '\x2e', + '\x2e', '\xa4', '\x95', '\xa2', '\x93', '\x94', '\x2e', '\xf6', '\x2e', '\x97', '\xa3', '\x2e', '\x81', '\x2e', '\x2e', '\x2e', +}; + +/* ISO mode. ISO-8859-1 -> CP863 */ +/* Non-convertable characters are converted to a dot (\x2e) */ + +static int U2DIso863Table[256] = +{ + '\x00', '\x01', '\x02', '\x03', '\x04', '\x05', '\x06', '\x07', '\x08', '\x09', '\x0a', '\x0b', '\x0c', '\x0d', '\x0e', '\x0f', + '\x10', '\x11', '\x12', '\x13', '\x14', '\x15', '\x16', '\x17', '\x18', '\x19', '\x1a', '\x1b', '\x1c', '\x1d', '\x1e', '\x1f', + '\x20', '\x21', '\x22', '\x23', '\x24', '\x25', '\x26', '\x27', '\x28', '\x29', '\x2a', '\x2b', '\x2c', '\x2d', '\x2e', '\x2f', + '\x30', '\x31', '\x32', '\x33', '\x34', '\x35', '\x36', '\x37', '\x38', '\x39', '\x3a', '\x3b', '\x3c', '\x3d', '\x3e', '\x3f', + '\x40', '\x41', '\x42', '\x43', '\x44', '\x45', '\x46', '\x47', '\x48', '\x49', '\x4a', '\x4b', '\x4c', '\x4d', '\x4e', '\x4f', + '\x50', '\x51', '\x52', '\x53', '\x54', '\x55', '\x56', '\x57', '\x58', '\x59', '\x5a', '\x5b', '\x5c', '\x5d', '\x5e', '\x5f', + '\x60', '\x61', '\x62', '\x63', '\x64', '\x65', '\x66', '\x67', '\x68', '\x69', '\x6a', '\x6b', '\x6c', '\x6d', '\x6e', '\x6f', + '\x70', '\x71', '\x72', '\x73', '\x74', '\x75', '\x76', '\x77', '\x78', '\x79', '\x7a', '\x7b', '\x7c', '\x7d', '\x7e', '\x7f', + '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', + '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', + '\xff', '\xad', '\x9b', '\x9c', '\x98', '\x9d', '\xa0', '\x8f', '\xa4', '\x2e', '\xa6', '\xae', '\xaa', '\x2e', '\x2e', '\xa7', + '\xf8', '\xf1', '\xfd', '\xa6', '\xa1', '\xe6', '\x86', '\xfa', '\xa5', '\x2e', '\xa7', '\xaf', '\xac', '\xab', '\xad', '\xa8', + '\x8e', '\x2e', '\x84', '\x2e', '\x8e', '\x8f', '\x92', '\x80', '\x91', '\x90', '\x92', '\x94', '\x2e', '\x2e', '\xa8', '\x95', + '\x2e', '\xa5', '\x2e', '\x2e', '\x99', '\x2e', '\x99', '\x2e', '\x2e', '\x9d', '\x2e', '\x9e', '\x9a', '\x2e', '\x2e', '\xe1', + '\x85', '\xa0', '\x83', '\x2e', '\x84', '\x86', '\x91', '\x87', '\x8a', '\x82', '\x88', '\x89', '\x8d', '\xa1', '\x8c', '\x8b', + '\x2e', '\xa4', '\x95', '\xa2', '\x93', '\x2e', '\x94', '\xf6', '\x2e', '\x97', '\xa3', '\x96', '\x81', '\x2e', '\x2e', '\x98', +}; + +/* ISO mode. ISO-8859-1 -> CP865 */ +/* Non-convertable characters are converted to a dot (\x2e) */ + +static int U2DIso865Table[256] = +{ + '\x00', '\x01', '\x02', '\x03', '\x04', '\x05', '\x06', '\x07', '\x08', '\x09', '\x0a', '\x0b', '\x0c', '\x0d', '\x0e', '\x0f', + '\x10', '\x11', '\x12', '\x13', '\x14', '\x15', '\x16', '\x17', '\x18', '\x19', '\x1a', '\x1b', '\x1c', '\x1d', '\x1e', '\x1f', + '\x20', '\x21', '\x22', '\x23', '\x24', '\x25', '\x26', '\x27', '\x28', '\x29', '\x2a', '\x2b', '\x2c', '\x2d', '\x2e', '\x2f', + '\x30', '\x31', '\x32', '\x33', '\x34', '\x35', '\x36', '\x37', '\x38', '\x39', '\x3a', '\x3b', '\x3c', '\x3d', '\x3e', '\x3f', + '\x40', '\x41', '\x42', '\x43', '\x44', '\x45', '\x46', '\x47', '\x48', '\x49', '\x4a', '\x4b', '\x4c', '\x4d', '\x4e', '\x4f', + '\x50', '\x51', '\x52', '\x53', '\x54', '\x55', '\x56', '\x57', '\x58', '\x59', '\x5a', '\x5b', '\x5c', '\x5d', '\x5e', '\x5f', + '\x60', '\x61', '\x62', '\x63', '\x64', '\x65', '\x66', '\x67', '\x68', '\x69', '\x6a', '\x6b', '\x6c', '\x6d', '\x6e', '\x6f', + '\x70', '\x71', '\x72', '\x73', '\x74', '\x75', '\x76', '\x77', '\x78', '\x79', '\x7a', '\x7b', '\x7c', '\x7d', '\x7e', '\x7f', + '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', + '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', + '\xff', '\xad', '\x2e', '\x9c', '\xaf', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\xa6', '\xae', '\xaa', '\x2e', '\x2e', '\x2e', + '\xf8', '\xf1', '\xfd', '\x2e', '\x2e', '\xe6', '\x2e', '\xfa', '\x2e', '\x2e', '\xa7', '\x2e', '\xac', '\xab', '\x2e', '\xa8', + '\x2e', '\x2e', '\x2e', '\x2e', '\x8e', '\x8f', '\x92', '\x80', '\x2e', '\x90', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', + '\x2e', '\xa5', '\x2e', '\x2e', '\x2e', '\x2e', '\x99', '\x2e', '\x9d', '\x2e', '\x2e', '\x2e', '\x9a', '\x2e', '\x2e', '\xe1', + '\x85', '\xa0', '\x83', '\x2e', '\x84', '\x86', '\x91', '\x87', '\x8a', '\x82', '\x88', '\x89', '\x8d', '\xa1', '\x8c', '\x8b', + '\x2e', '\xa4', '\x95', '\xa2', '\x93', '\x2e', '\x94', '\xf6', '\x9b', '\x97', '\xa3', '\x96', '\x81', '\x2e', '\x2e', '\x98', +}; + +/* ISO-8859-1 -> CP1252 */ +/* Non-convertable characters are converted to a dot (\x2e) */ + +static int U2DIso1252Table[256] = +{ + '\x00', '\x01', '\x02', '\x03', '\x04', '\x05', '\x06', '\x07', '\x08', '\x09', '\x0a', '\x0b', '\x0c', '\x0d', '\x0e', '\x0f', + '\x10', '\x11', '\x12', '\x13', '\x14', '\x15', '\x16', '\x17', '\x18', '\x19', '\x1a', '\x1b', '\x1c', '\x1d', '\x1e', '\x1f', + '\x20', '\x21', '\x22', '\x23', '\x24', '\x25', '\x26', '\x27', '\x28', '\x29', '\x2a', '\x2b', '\x2c', '\x2d', '\x2e', '\x2f', + '\x30', '\x31', '\x32', '\x33', '\x34', '\x35', '\x36', '\x37', '\x38', '\x39', '\x3a', '\x3b', '\x3c', '\x3d', '\x3e', '\x3f', + '\x40', '\x41', '\x42', '\x43', '\x44', '\x45', '\x46', '\x47', '\x48', '\x49', '\x4a', '\x4b', '\x4c', '\x4d', '\x4e', '\x4f', + '\x50', '\x51', '\x52', '\x53', '\x54', '\x55', '\x56', '\x57', '\x58', '\x59', '\x5a', '\x5b', '\x5c', '\x5d', '\x5e', '\x5f', + '\x60', '\x61', '\x62', '\x63', '\x64', '\x65', '\x66', '\x67', '\x68', '\x69', '\x6a', '\x6b', '\x6c', '\x6d', '\x6e', '\x6f', + '\x70', '\x71', '\x72', '\x73', '\x74', '\x75', '\x76', '\x77', '\x78', '\x79', '\x7a', '\x7b', '\x7c', '\x7d', '\x7e', '\x7f', + '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', + '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', '\x2e', + '\xa0', '\xa1', '\xa2', '\xa3', '\xa4', '\xa5', '\xa6', '\xa7', '\xa8', '\xa9', '\xaa', '\xab', '\xac', '\xad', '\xae', '\xaf', + '\xb0', '\xb1', '\xb2', '\xb3', '\xb4', '\xb5', '\xb6', '\xb7', '\xb8', '\xb9', '\xba', '\xbb', '\xbc', '\xbd', '\xbe', '\xbf', + '\xc0', '\xc1', '\xc2', '\xc3', '\xc4', '\xc5', '\xc6', '\xc7', '\xc8', '\xc9', '\xca', '\xcb', '\xcc', '\xcd', '\xce', '\xcf', + '\xd0', '\xd1', '\xd2', '\xd3', '\xd4', '\xd5', '\xd6', '\xd7', '\xd8', '\xd9', '\xda', '\xdb', '\xdc', '\xdd', '\xde', '\xdf', + '\xe0', '\xe1', '\xe2', '\xe3', '\xe4', '\xe5', '\xe6', '\xe7', '\xe8', '\xe9', '\xea', '\xeb', '\xec', '\xed', '\xee', '\xef', + '\xf0', '\xf1', '\xf2', '\xf3', '\xf4', '\xf5', '\xf6', '\xf7', '\xf8', '\xf9', '\xfa', '\xfb', '\xfc', '\xfd', '\xfe', '\xff', +}; + +#endif diff --git a/version.mk b/version.mk new file mode 100644 index 0000000..ded8197 --- /dev/null +++ b/version.mk @@ -0,0 +1,4 @@ +DOS2UNIX_VERSION = 6.0 +DOS2UNIX_VERSION_SHORT = 60 +DOS2UNIX_DATE = 2012-05-06 +DOS2UNIX_AUTHOR = 'Erwin Waterlander' diff --git a/wccdos16.mak b/wccdos16.mak new file mode 100644 index 0000000..8f64e36 --- /dev/null +++ b/wccdos16.mak @@ -0,0 +1,63 @@ +!include version.mk + +CC = wcc +SRCDIR = . +DEFINES = -DMSDOS -DVER_REVISION="$(DOS2UNIX_VERSION)" -DVER_DATE="$(DOS2UNIX_DATE)" +CFLAGS = $(DEFINES) -i=$(SRCDIR) -w4 -e25 -zq -od -d2 -bt=dos -ml +WATCOMSRC = $(%WATCOM)\src\startup + +TARGET = dos + +all: dos2unix.exe unix2dos.exe mac2unix.exe unix2mac.exe + +cflags.cfg: + @%create cflags.cfg + @%append cflags.cfg $(CFLAGS) + +dos2unix.exe: dos2unix.obj querycp.obj common.obj wildargv.obj + @%create dos2unix.lnk + @%append dos2unix.lnk FIL dos2unix.obj,querycp.obj,common.obj,wildargv.obj + wlink name dos2unix d all SYS $(TARGET) op m op st=32k op maxe=25 op q op symf @dos2unix.lnk + del dos2unix.lnk + +unix2dos.exe: unix2dos.obj querycp.obj common.obj wildargv.obj + @%create unix2dos.lnk + @%append unix2dos.lnk FIL unix2dos.obj,querycp.obj,common.obj,wildargv.obj + wlink name unix2dos d all SYS $(TARGET) op m op st=32k op maxe=25 op q op symf @unix2dos.lnk + del unix2dos.lnk + + +dos2unix.obj : $(SRCDIR)\dos2unix.c $(SRCDIR)\querycp.h $(SRCDIR)\common.h cflags.cfg + $(CC) @cflags.cfg $(SRCDIR)\dos2unix.c + +unix2dos.obj : $(SRCDIR)\unix2dos.c $(SRCDIR)\querycp.h $(SRCDIR)\common.h cflags.cfg + $(CC) @cflags.cfg $(SRCDIR)\unix2dos.c + +querycp.obj : $(SRCDIR)\querycp.c $(SRCDIR)\querycp.h cflags.cfg + $(CC) @cflags.cfg $(SRCDIR)\querycp.c + +common.obj : $(SRCDIR)\common.c $(SRCDIR)\common.h cflags.cfg + $(CC) @cflags.cfg $(SRCDIR)\common.c + +wildargv.obj : $(WATCOMSRC)\wildargv.c + $(CC) @cflags.cfg $(WATCOMSRC)\wildargv.c + +mac2unix.exe : dos2unix.exe + copy /v dos2unix.exe mac2unix.exe + +unix2mac.exe : unix2dos.exe + copy /v unix2dos.exe unix2mac.exe + +strip + wstrip dos2unix.exe + wstrip unix2dos.exe + wstrip mac2unix.exe + wstrip unix2mac.exe + +clean + -del *.obj + -del *.exe + -del *.SYM + -del *.map + -del *.ilk + -del cflags.cfg diff --git a/wccdos32.mak b/wccdos32.mak new file mode 100644 index 0000000..a8fb6bd --- /dev/null +++ b/wccdos32.mak @@ -0,0 +1,63 @@ +!include version.mk + +CC = wcc386 +SRCDIR = . +DEFINES = -DVER_REVISION="$(DOS2UNIX_VERSION)" -DVER_DATE="$(DOS2UNIX_DATE)" +CFLAGS = $(DEFINES) -i=$(SRCDIR) -w4 -e25 -zq -od -d2 -5r -bt=dos -mf +WATCOMSRC = $(%WATCOM)\src\startup + +TARGET = causeway + +all: dos2unix.exe unix2dos.exe mac2unix.exe unix2mac.exe + +cflagsDS.cfg: + @%create cflagsDS.cfg + @%append cflagsDS.cfg $(CFLAGS) + +dos2unix.exe: dos2unix.obj querycp.obj common.obj wildargv.obj + @%create dos2unix.lnk + @%append dos2unix.lnk FIL dos2unix.obj,querycp.obj,common.obj,wildargv.obj + wlink name dos2unix d all SYS $(TARGET) op inc op m op st=64k op maxe=25 op q op symf @dos2unix.lnk + del dos2unix.lnk + +unix2dos.exe: unix2dos.obj querycp.obj common.obj wildargv.obj + @%create unix2dos.lnk + @%append unix2dos.lnk FIL unix2dos.obj,querycp.obj,common.obj,wildargv.obj + wlink name unix2dos d all SYS $(TARGET) op inc op m op st=64k op maxe=25 op q op symf @unix2dos.lnk + del unix2dos.lnk + + +dos2unix.obj : $(SRCDIR)\dos2unix.c $(SRCDIR)\querycp.h $(SRCDIR)\common.h cflagsDS.cfg + $(CC) @cflagsDS.cfg $(SRCDIR)\dos2unix.c + +unix2dos.obj : $(SRCDIR)\unix2dos.c $(SRCDIR)\querycp.h $(SRCDIR)\common.h cflagsDS.cfg + $(CC) @cflagsDS.cfg $(SRCDIR)\unix2dos.c + +querycp.obj : $(SRCDIR)\querycp.c $(SRCDIR)\querycp.h cflagsDS.cfg + $(CC) @cflagsDS.cfg $(SRCDIR)\querycp.c + +common.obj : $(SRCDIR)\common.c $(SRCDIR)\common.h cflagsDS.cfg + $(CC) @cflagsDS.cfg $(SRCDIR)\common.c + +wildargv.obj : $(WATCOMSRC)\wildargv.c + $(CC) @cflagsDS.cfg $(WATCOMSRC)\wildargv.c + +mac2unix.exe : dos2unix.exe + copy /v dos2unix.exe mac2unix.exe + +unix2mac.exe : unix2dos.exe + copy /v unix2dos.exe unix2mac.exe + +strip + wstrip dos2unix.exe + wstrip unix2dos.exe + wstrip mac2unix.exe + wstrip unix2mac.exe + +clean + -del *.obj + -del *.exe + -del *.SYM + -del *.map + -del *.ilk + -del cflagsDS.cfg diff --git a/wccwin32.mak b/wccwin32.mak new file mode 100644 index 0000000..2e035d3 --- /dev/null +++ b/wccwin32.mak @@ -0,0 +1,65 @@ +!include version.mk + +CC = wcc386 +SRCDIR = . +DEFINES = -DVER_REVISION="$(DOS2UNIX_VERSION)" -DVER_DATE="$(DOS2UNIX_DATE)" -DD2U_UNICODE +CFLAGS = $(DEFINES) -i=$(SRCDIR) -w4 -e25 -zq -od -d2 -5r -bt=nt -mf +WATCOMSRC = $(%WATCOM)\src\startup + +TARGET = nt + +all: dos2unix.exe unix2dos.exe mac2unix.exe unix2mac.exe + +cflags32.cfg: + @%create cflags32.cfg + @%append cflags32.cfg $(CFLAGS) + +dos2unix.exe: dos2unix.obj querycp.obj common.obj wildargv.obj + @%create dos2unix.lnk + @%append dos2unix.lnk FIL dos2unix.obj,querycp.obj,common.obj,wildargv.obj + @%append dos2unix.lnk library mpr.lib + wlink name dos2unix d all SYS $(TARGET) op inc op m op st=64k op maxe=25 op q op symf @dos2unix.lnk + del dos2unix.lnk + +unix2dos.exe: unix2dos.obj querycp.obj common.obj wildargv.obj + @%create unix2dos.lnk + @%append unix2dos.lnk FIL unix2dos.obj,querycp.obj,common.obj,wildargv.obj + @%append unix2dos.lnk library mpr.lib + wlink name unix2dos d all SYS $(TARGET) op inc op m op st=64k op maxe=25 op q op symf @unix2dos.lnk + del unix2dos.lnk + + +dos2unix.obj : $(SRCDIR)\dos2unix.c $(SRCDIR)\querycp.h $(SRCDIR)\common.h cflags32.cfg + $(CC) @cflags32.cfg $(SRCDIR)\dos2unix.c + +unix2dos.obj : $(SRCDIR)\unix2dos.c $(SRCDIR)\querycp.h $(SRCDIR)\common.h cflags32.cfg + $(CC) @cflags32.cfg $(SRCDIR)\unix2dos.c + +querycp.obj : $(SRCDIR)\querycp.c $(SRCDIR)\querycp.h cflags32.cfg + $(CC) @cflags32.cfg $(SRCDIR)\querycp.c + +common.obj : $(SRCDIR)\common.c $(SRCDIR)\common.h cflags32.cfg + $(CC) @cflags32.cfg $(SRCDIR)\common.c + +wildargv.obj : $(WATCOMSRC)\wildargv.c + $(CC) @cflags32.cfg $(WATCOMSRC)\wildargv.c + +mac2unix.exe : dos2unix.exe + copy /v dos2unix.exe mac2unix.exe + +unix2mac.exe : unix2dos.exe + copy /v unix2dos.exe unix2mac.exe + +strip + wstrip dos2unix.exe + wstrip unix2dos.exe + wstrip mac2unix.exe + wstrip unix2mac.exe + +clean + -del *.obj + -del *.exe + -del *.SYM + -del *.map + -del *.ilk + -del cflags32.cfg -- 2.7.4