.\" Automatically generated by Pod::Man 2.28 (Pod::Simple 3.30) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is turned on, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{ . if \nF \{ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "NLCVT 1" .TH NLCVT 1 "2001-06-06" "perl v5.20.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" nlcvt \- convert foreign line terminators .SH "SYNOPSIS" .IX Header "SYNOPSIS" \&\fBnlcvt\fR \fIsrc\fR2\fIdst\fR [\fIfile\fR ...] .PP \&\fBunix2mac\fR [\fIfile\fR ...] .PP \&\fBunix2cpm\fR [\fIfile\fR ...] .PP \&\fBcpm2unix\fR [\fIfile\fR ...] .PP \&\fBcpm2mac\fR [\fIfile\fR ...] .PP \&\fBmac2unix\fR [\fIfile\fR ...] .PP \&\fBmac2cpm\fR [\fIfile\fR ...] .SH "DESCRIPTION" .IX Header "DESCRIPTION" Mike O'Dell said, only half-jokingly, that "the most brilliant decision in all of Unix was the choice of a \fIsingle\fR character for the newline sequence.\*(L" But legacy systems live on past their days, and these programs can help that. Note, however, that if you've downloaded a binary file in \&\*(R"text\*(L" mode rather than \*(R"binary", your mileage may vary. .PP The \fBnlcvt\fR program, or any of its many aliases, is a filter to convert from one system's notion of proper line terminators to that of another. This usually happens because you've downloaded or otherwise directly transferred a text file in so-called \*(L"binary\*(R" rather than \*(L"text\*(R" mode. .PP Unix format considers a lone Control-J to be the end of line. Mac format considers a lone Control-M to be the end of line. The archaic \s-1CP/M\s0 format considers a Control-M and a Control-J to be the end of line. .PP This program expects its first argument to be of the form \fIsrc\fR2\fIdst\fR, where \fIsrc\fR and \fIdst\fR are both one of \fBunix\fR, \fBmac\fR, or \fBcpm\fR. (That's speaking canonically\*(--many aliases for those systems exist: call \&\fBnlcvt\fR without arguments to see what names are accepted.) The converted data is written to the standard output. \fBnlcvt\fR does \fInot\fR do destructive, in-place modification of its source files. Do this instead: .PP .Vb 2 \& cpm2unix < file.bad > file.good \& mv file.good file.bad .Ve .PP This program can also be called by the name of the conversion itself. Just create links to the \fBnlcvt\fR program for each systems, and the program use its own name to determine the conversion. For example: .PP .Vb 10 \& #!/usr/bin/perl \& # make nlcvt links \& chomp($path = \`which nlcvt\`); \& @systems = qw(unix mac cpm); \& for $src (@systems) { \& for $dst (@systems) { \& next if $src eq $dst; \& ln($path, "${src}2$dst") || die $!; \& } \& } .Ve .SH "DIAGNOSTICS" .IX Header "DIAGNOSTICS" Any of the following diagnostics cause \fBnlcvt\fR to exit non-zero. .ie n .IP """insufficient args""" 4 .el .IP "\f(CWinsufficient args\fR" 4 .IX Item "insufficient args" You called the program by its canonical name, and supplied no other arguments. You must supply a conversion argument. .ie n .IP """no conversion specified""" 4 .el .IP "\f(CWno conversion specified\fR" 4 .IX Item "no conversion specified" Neither the name of the program nor its first argument were of the form \fIsrc\fR2\fIdst\fR. .ie n .IP """unknown input format: %s""" 4 .el .IP "\f(CWunknown input format: %s\fR" 4 .IX Item "unknown input format: %s" The specified input format, \f(CW%s\fR, was unknown. Call \fBnlcvt\fR without arguments for a list of valid conversion formats. .ie n .IP """unknown output format: %s""" 4 .el .IP "\f(CWunknown output format: %s\fR" 4 .IX Item "unknown output format: %s" The specified output format, \f(CW%s\fR, was unknown. Call \fBnlcvt\fR without arguments for a list of valid conversion formats. .ie n .IP """cannot open %s: %m""" 4 .el .IP "\f(CWcannot open %s: %m\fR" 4 .IX Item "cannot open %s: %m" The input file \f(CW%s\fR could not be opened for the reason listed in \f(CW%m\fR. .ie n .IP """cannot close %s: %m""" 4 .el .IP "\f(CWcannot close %s: %m\fR" 4 .IX Item "cannot close %s: %m" The input file \f(CW%s\fR could not be close for the reason listed in \f(CW%m\fR. This error is rare. .ie n .IP """can\*(Aqt close stdout: %m""" 4 .el .IP "\f(CWcan\*(Aqt close stdout: %m\fR" 4 .IX Item "cant close stdout: %m" The filter could not finish writing to its standard output for the reason listed in \f(CW%m\fR. This could be caused by a full or temporarily unreachable file system. .ie n .IP """WARNING: last line of %s truncated, correcting""" 4 .el .IP "\f(CWWARNING: last line of %s truncated, correcting\fR" 4 .IX Item "WARNING: last line of %s truncated, correcting" Text files contain zero or more variable-length, newline-terminated records. Occasionally, the final record terminator is missing, perhaps due to an incomplete transfer, perhaps due to an aberrant \&\fIemacs\fR user. A newline sequence appropriate to the destination system is appended. This would be a valid use of a \fIunix2unix\fR conversion. And no, you can't call it as \fBemacs2vi\fR. .ie n .IP """WARNING: %s appears to be a binary file""" 4 .el .IP "\f(CWWARNING: %s appears to be a binary file\fR" 4 .IX Item "WARNING: %s appears to be a binary file" Perl's \f(CW\*(C`\-T\*(C'\fR operator did not think the input file was a text file. The conversion is still performed, but is of dubious value. If the file really was binary, the resulting output may be mangled. Garbage in, garbage out. .SH "AUTHOR" .IX Header "AUTHOR" Tom Christiansen, \fItchrist@perl.com\fR. .SH "COPYRIGHT" .IX Header "COPYRIGHT" This program is copyright (c) 1999 by Tom Christiansen. .PP This program is free and open software. You may use, copy, modify, distribute, and sell this program (and any modified variants) in any way you wish, provided you do not restrict others from doing the same.