Added unix2dos.c utility
Fixed doc typos git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@17156 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -183,6 +183,23 @@ echo Re-tarring wxAll in a subdirectory...
|
||||
cd $2
|
||||
mkdir wxWindows-${WXVER}
|
||||
cd wxWindows-${WXVER}
|
||||
|
||||
# Copy OS/2 specific configure files
|
||||
cp $1/distrib/os2/os2-specific.zip docs/os2
|
||||
|
||||
# Translate all .dsp and .dsw files to DOS format
|
||||
unix2dos --unix2dos `cat $1/distrib/msw/vc.rsp`
|
||||
|
||||
# Copy the OS/2 files which probably haven't been copied yet
|
||||
mkdir include/wx/os2
|
||||
mkdir src/os2
|
||||
cp $1/include/wx/os2/*.H include/wx/os2
|
||||
cp $1/src/os2/*.CPP src/os2
|
||||
|
||||
# Make all OS/2 files lower case
|
||||
$1/distrib/namedown include/wx/os2/*.H
|
||||
$1/distrib/namedown src/os2/*.CPP
|
||||
|
||||
$TAR xf ../wxAll-${WXVER}.tar
|
||||
cd ..
|
||||
rm -f wxAll-${WXVER}.tar
|
||||
|
@@ -75,9 +75,27 @@ cd $2
|
||||
rm -f -r wxWindows-${WXVER}
|
||||
mkdir wxWindows-${WXVER}
|
||||
cd wxWindows-${WXVER}
|
||||
|
||||
# Copy OS/2 specific configure files
|
||||
cp $1/distrib/os2/os2-specific.zip docs/os2
|
||||
|
||||
# Translate all .dsp and .dsw files to DOS format
|
||||
unix2dos --unix2dos `cat $1/distrib/msw/vc.rsp`
|
||||
|
||||
# Copy the OS/2 files which probably haven't been copied yet
|
||||
mkdir include/wx/os2
|
||||
mkdir src/os2
|
||||
cp $1/include/wx/os2/*.H include/wx/os2
|
||||
cp $1/src/os2/*.CPP src/os2
|
||||
|
||||
# Make all OS/2 files lower case
|
||||
$1/distrib/namedown include/wx/os2/*.H
|
||||
$1/distrib/namedown src/os2/*.CPP
|
||||
|
||||
$TAR xf ../wxAll-${WXVER}.tar
|
||||
cd ..
|
||||
rm -f wxAll-${WXVER}.tar
|
||||
$TAR cf $2/wxAll-${WXVER}.tar wxWindows-${WXVER}/*
|
||||
rm -f -r wxWindows-${WXVER}
|
||||
gzip $2/wxAll-${WXVER}.tar
|
||||
|
||||
|
141
distrib/msw/unix2dos.c
Normal file
141
distrib/msw/unix2dos.c
Normal file
@@ -0,0 +1,141 @@
|
||||
/*****************************************************************************
|
||||
dos2unix, unix2dos: translate unix <-> dos text files by
|
||||
-> adding a CR before each LF
|
||||
<- removing the CR from CRLF pairs
|
||||
|
||||
Use a modern compiler (gcc); name the executable either unix2dos or dos2unix,
|
||||
and link to the other name. A warning will be printed if the input of unix2dos
|
||||
contains CR's, as it may have already been a dos file (output still produced).
|
||||
The warning is not produced if input is stdin.
|
||||
Jim Martino +++++++++++++++++++++++++++++
|
||||
jrm@chow.mat.jhu.edu + PLACE COMMERCIAL HERE +
|
||||
jmartino@jhunix.hcf.jhu.edu +++++++++++++++++++++++++++++
|
||||
Modified by Julian Smart, September 2002
|
||||
*****************************************************************************/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#define CR '\015' /* define CR character */
|
||||
#define LF '\012' /* define LF character */
|
||||
|
||||
char *prog; /* global var: program name as called */
|
||||
int warning=0; /* global var: flag for unix2dos if input has CR's */
|
||||
|
||||
void usage();
|
||||
void translate(FILE *, FILE *, int unix2Dos);
|
||||
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
FILE *fp, *outFile;
|
||||
int i;
|
||||
int unix2Dos;
|
||||
|
||||
prog = argv[0]; /* program name as called */
|
||||
|
||||
unix2Dos = 1;
|
||||
|
||||
i = 1;
|
||||
if (i > argc)
|
||||
{
|
||||
if (strcmp(argv[1], "--help") == 0)
|
||||
{
|
||||
usage();
|
||||
}
|
||||
else if (strcmp(argv[1], "--dos2unix") == 0)
|
||||
{
|
||||
unix2Dos = 0;
|
||||
}
|
||||
else if (strcmp(argv[1], "--unix2dos") == 0)
|
||||
{
|
||||
unix2Dos = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
usage();
|
||||
}
|
||||
}
|
||||
else
|
||||
usage();
|
||||
|
||||
i ++;
|
||||
if (i == argc)
|
||||
translate(stdin, stdout, unix2Dos);
|
||||
else
|
||||
{
|
||||
while (i < argc)
|
||||
{
|
||||
char tmpFile[512];
|
||||
sprintf(tmpFile, "%s.tmp", argv[i]);
|
||||
|
||||
fp = fopen(argv[i], "r");
|
||||
outFile = fopen(tmpFile, "w");
|
||||
if (!outFile)
|
||||
{
|
||||
fprintf(stderr, "Cannot open %s.\n", tmpFile);
|
||||
exit(1);
|
||||
}
|
||||
if (!fp)
|
||||
{
|
||||
fprintf(stderr, "Cannot open %s.\n", argv[i]);
|
||||
exit(1);
|
||||
}
|
||||
translate(fp, outFile, unix2Dos);
|
||||
|
||||
if (warning) /* unix2dos acting on a possible DOS file */
|
||||
{
|
||||
fprintf(stderr,"%s: %s may have already been in DOS format.\n",
|
||||
prog, argv[i]);
|
||||
}
|
||||
fclose(fp);
|
||||
fclose(outFile);
|
||||
#ifdef _WINDOWS
|
||||
remove(argv[i]);
|
||||
#else
|
||||
unlink(argv[i]);
|
||||
#endif
|
||||
rename(tmpFile, argv[i]);
|
||||
|
||||
i ++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* translate: unix2dos-change LF to CRLF
|
||||
dos2unix-strip out CR only before LF */
|
||||
|
||||
void translate(FILE *ifp, FILE *ofp, int unix2Dos)
|
||||
{
|
||||
int c,d;
|
||||
|
||||
if (!unix2Dos)
|
||||
/* DOS2Unix */
|
||||
while ((c = getc(ifp)) != EOF){
|
||||
if (c == CR)
|
||||
switch(d = getc(ifp)){ /* check to see if LF follows */
|
||||
case LF:
|
||||
putc(d,ofp); /* if so, ignore CR */
|
||||
break;
|
||||
default:
|
||||
putc(c,ofp); /* if not, output CR and following char */
|
||||
putc(d,ofp);
|
||||
} else putc(c, ofp); /* c is not a CR */
|
||||
}
|
||||
|
||||
else
|
||||
/* Unix2DOS */
|
||||
while ((c = getc(ifp)) != EOF){
|
||||
if (c == CR)
|
||||
warning = 1; /* set warning flag: input file may be a DOS file */
|
||||
if (c == LF)
|
||||
putc(CR, ofp); /* add CR before each LF */
|
||||
putc(c, ofp);
|
||||
}
|
||||
}
|
||||
|
||||
void usage()
|
||||
{
|
||||
fprintf(stderr, "Usage:\n%s [--dos2unix] [--unix2dos] file1 file2 ...\nor\n%s [--dos2unix] [--unix2dos] < infile > outfile\n", prog, prog);
|
||||
exit(0);
|
||||
}
|
@@ -87,7 +87,7 @@ functions that take a \helpref{wxTreeEvent}{wxtreeevent} argument.
|
||||
\twocolitem{{\bf EVT\_TREE\_SEL\_CHANGED(id, func)}}{Selection has changed.}
|
||||
\twocolitem{{\bf EVT\_TREE\_SEL\_CHANGING(id, func)}}{Selection is changing. This can be prevented by calling \helpref{Veto()}{wxnotifyeventveto}.}
|
||||
\twocolitem{{\bf EVT\_TREE\_KEY\_DOWN(id, func)}}{A key has been pressed.}
|
||||
\end{twocollist}%
|
||||
\end{twocollist}
|
||||
|
||||
\wxheading{See also}
|
||||
|
||||
|
@@ -20,12 +20,10 @@ Non-Microsoft:
|
||||
comp.programming
|
||||
comp.os.linux.development.apps
|
||||
comp.os.linux.announce
|
||||
comp.sys.mac.programmer.info
|
||||
comp.sys.mac.programmer.tools
|
||||
comp.software-eng
|
||||
comp.lang.c++
|
||||
|
||||
comp.windows.misc
|
||||
comp.windows.x
|
||||
comp.windows.x.announce
|
||||
comp.windows.x.motif
|
||||
|
Reference in New Issue
Block a user