summaryrefslogtreecommitdiff
path: root/app/tools
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff-webhosting.net>2018-03-19 19:55:58 +0100
committerJörg Frings-Fürst <debian@jff-webhosting.net>2018-03-19 19:55:58 +0100
commitd1a8285f818eb7e5c3d6a05709ea21a808490b8c (patch)
tree326578f0505cbed07cfe60de530022822dc237ac /app/tools
parent16e9630b79f0a7a90c6cedb6781175bb8b337dc1 (diff)
New upstream version 5.1.0upstream/5.1.0
Diffstat (limited to 'app/tools')
-rw-r--r--app/tools/CMakeLists.txt19
-rw-r--r--app/tools/addcrlf.c242
-rw-r--r--app/tools/bin2c.c126
-rw-r--r--app/tools/halibut/bk_html.c2
-rw-r--r--app/tools/listxtp.c7
-rw-r--r--app/tools/oldscripts/README4
-rw-r--r--app/tools/oldscripts/checkall10
-rw-r--r--app/tools/oldscripts/diffall37
-rw-r--r--app/tools/oldscripts/fetchall46
-rw-r--r--app/tools/oldscripts/makeall23
-rw-r--r--app/tools/oldscripts/markall17
-rw-r--r--app/tools/oldscripts/mkwinrlse34
-rw-r--r--app/tools/oldscripts/roall22
13 files changed, 14 insertions, 575 deletions
diff --git a/app/tools/CMakeLists.txt b/app/tools/CMakeLists.txt
index e6716f0..befe170 100644
--- a/app/tools/CMakeLists.txt
+++ b/app/tools/CMakeLists.txt
@@ -1,18 +1,15 @@
-ADD_EXECUTABLE(addcrlf addcrlf.c)
-ADD_EXECUTABLE(bin2c bin2c.c)
+set ( sources listxtp.c )
-SET ( SOURCES listxtp.c )
-
-IF (WIN32)
- SET ( SOURCES
- ${SOURCES}
+if (WIN32)
+ set ( sources
+ ${sources}
dirent.c)
- INCLUDE_DIRECTORIES( BEFORE ${CMAKE_CURRENT_SOURCE_DIR})
-ENDIF (WIN32)
+ include_directories( before ${CMAKE_CURRENT_SOURCE_DIR})
+endif ()
-ADD_EXECUTABLE( listxtp ${SOURCES})
+add_executable( listxtp ${sources})
-ADD_SUBDIRECTORY(halibut)
+add_subdirectory(halibut)
diff --git a/app/tools/addcrlf.c b/app/tools/addcrlf.c
deleted file mode 100644
index d36310e..0000000
--- a/app/tools/addcrlf.c
+++ /dev/null
@@ -1,242 +0,0 @@
-/**
- * \file addcrlf.c Convert text between DOS, UNIX and MAC
- *
- * $Header: /home/dmarkle/xtrkcad-fork-cvs/xtrkcad/app/tools/addcrlf.c,v 1.7 2007-02-13 19:46:25 m_fischer Exp $
- *
- * This is heavily based on flip by Craig Stuart Sapp <craig@ccrma.stanford.edu>
- * Web Address: http://www-ccrma.stanford.edu/~craig/utility/flip/flip.cpp
- */
-
-/* XTrkCad - Model Railroad CAD
- * Copyright (C) Marin Fischer 2006
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- */
-
-#include <stdlib.h>
-#include <stdio.h>
-
-void exitUsage( char *cmd );
-void translateToDos( char *infile, char *outfile );
-void translateToUnix(char* infilename, char *outfilename);
-void determineType(char* filename);
-
-int
-main( int argc, char ** argv)
-{
- char option;
-
- if( argc < 2 )
- exitUsage(argv[0]);
-
- if( argv[1][0] != '-' &&argv[1][0] != '/' )
- exitUsage(argv[0]);
-
- option = argv[1][1];
-
- if (!(option == 'u' || option == 'd' || option == 't' || option =='h' )) {
- exitUsage(argv[0]);
- }
-
- if( !((option == 't' && argc == 3)||(option !='t' && argc==4)||( option =='h' ))) {
- exitUsage(argv[0]);
- }
- switch( option )
- {
- case 'd':
- translateToDos(argv[2], argv[3]);
- break;
- case 'u':
- translateToUnix(argv[2], argv[3]);
- break;
- case 'm':
-/* translateToMacintosh(argv[i+2]); */
- break;
- case 'h':
- exitUsage(argv[0]);
- break;
- default:
- determineType(argv[2]);
- break;
- }
- return 0;
-}
-
-
-
-void
-translateToDos(char* infilename, char *outfilename)
-{
- FILE *in, *out;
- char ch, lastch;
- int peekch;
-
- in = fopen( infilename, "rb" );
- if (!in) {
- printf( "Error: cannot find file: %s\n", infilename );
- return;
- }
-
- out = fopen( outfilename, "wb" );
- if (!out) {
- printf( "Error: cannot open file: %s\n", outfilename );
- return;
- }
-
- ch = getc( in );
- lastch = ch;
-
- while( !feof( in ))
- {
- if (ch == 0x0a && lastch != 0x0d) {
- // convert newline from Unix to MS-DOS
- putc( (char)0x0d, out );
- putc( ch, out );
- lastch = ch;
- } else {
- if (ch == 0x0d) { // convert newline from Mac to MS-DOS
- peekch = getc( in ); // lookahead for following character
- ungetc( peekch, in );
-
- if (peekch != 0x0a) {
- putc( ch, out );
- putc( (char)0x0a, out );
- lastch = 0x0a;
- } else {
- lastch = 0x0d;
- // Bug fix here reported by Shelley Adams: running -d
- // twice in a row was generating Unix style newlines
- // without the following statement:
- putc( 0x0d, out );
- }
-
- } else {
- putc( ch, out );
- lastch = ch;
- }
- }
- ch = getc( in );
- }
-
- fclose( in );
- fclose( out );
-}
-
-void
-translateToUnix(char* infilename, char *outfilename)
-{
- FILE *in, *out;
- char ch, lastch;
-
- in = fopen( infilename, "rb" );
- if (!in) {
- printf( "Error: cannot find file: %s\n", infilename );
- return;
- }
-
- out = fopen( outfilename, "wb" );
- if (!out) {
- printf( "Error: cannot open file: %s\n", outfilename );
- return;
- }
-
- ch = getc( in );
- lastch = ch;
-
- while( !feof( in ))
- {
- if (ch == 0x0d) {
- putc( (char)0x0a, out );
- } else {
- if (ch == 0x0a) {
- if (lastch == 0x0d) {
- // do nothing: already converted MSDOS newline to Unix form
- } else {
- putc( (char)0x0a, out );
- }
- } else {
- putc( ch, out );
- }
- }
- lastch = ch;
- ch = getc( in );
- }
-
- fclose( in );
- fclose( out );
-}
-
-void
-determineType(char* filename)
-{
- FILE *in;
- int ch;
- int crcount = 0;
- int lfcount = 0;
-
- in = fopen( filename, "rb" );
- if (!in) {
- printf( "Error: cannot find file: %s\n", filename );
- return;
- }
-
- ch = getc( in );
- if( ch == EOF ) {
- printf( "Error: file could not be read: %s\n", filename );
- return;
- }
-
- while( !feof( in ))
- {
- if (ch == 0x0d) {
- crcount ++;
- } else {
- if (ch == 0x0a) {
- lfcount++;
- }
- }
- ch = getc( in );
- }
-
- fclose( in );
-
- if ((lfcount == crcount) && (crcount != 0)) {
- printf("%s : DOS\n", filename );
- } else if ((lfcount > 0) && (crcount == 0)) {
- printf("%s : UNIX\n", filename );
- } else if ((lfcount == 0) && (crcount > 0)) {
- printf("%s : MAC\n", filename );
- } else if ((lfcount > 0) && (crcount > 0)) {
- printf("%s : MIXED\n", filename );
- } else {
- printf("%s : UNKNOWN\n", filename );
- }
-}
-
-void
-exitUsage( char* commandName )
-{
- printf( "\nUsage: %s [-h] | [-t infile] | [[-u|-d|-m] infile outfile]\n"
- " Converts an ASCII file between Unix, MS-DOS/Windows, or Macintosh newline formats\n\n"
- " Options: \n"
- " -u = convert file to Unix newline format (newline)\n"
- " -d = convert file to MS-DOS/Windows newline format (linefeed + newline)\n"
- " -m = convert file to Macintosh newline format (linefeed)\n"
- " -t = display current file type, no file modifications\n"
- " -h = show this help\n",
- commandName );
-
- exit(1);
-}
diff --git a/app/tools/bin2c.c b/app/tools/bin2c.c
deleted file mode 100644
index bb619dc..0000000
--- a/app/tools/bin2c.c
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
-BIN2C V1.0 CODED BY CHRISTIAN PADOVANO ON 17-MAY-1995
-this little utility translates a binary file in a useful C structure
-that can be included in a C source.
-to contact me write to EMAIL: [[Email Removed]]
-*/
-
-
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <ctype.h>
-
-#define BUF_LEN 1024
-#define LINE 12
-
-/* Tell u the file size in bytes */
-
-long int filesize( FILE *fp )
-{
- long int save_pos, size_of_file;
-
- save_pos = ftell( fp );
- fseek( fp,0L, SEEK_END );
- size_of_file = ftell( fp );
- fseek( fp, save_pos, SEEK_SET );
- return( size_of_file );
-}
-
-
-/* lower chars --> upper chars */
-
-void Upper_chars(char *buffer)
-{
- unsigned int c;
-
- for (c=0; c <= strlen(buffer)-1; c++)
- *(buffer+c)=toupper( *( buffer+c) );
-}
-
-
-int main( int argc, char **argv )
-{
- FILE *source,*dest;
- char Dummy[BUF_LEN];
- int buffer;
- int c;
-
- if ( (argc < 4) )
- {
-
- if ( ( argc == 2 ) && ( strcmp(argv[1],"-h")==0 ) )
- {
- puts(" - <<< BIN2C V1.0 >>> by Christian Padovano - \n");
- puts("USAGE: bin2C <BINARY file name> <TARGET file name> <STRUCT name>");
- puts("\n <STRUCT > = name of the C structure in the destination file name.\n");
- puts(" <TARGET > = without extension '.h' it will be added by program.");
- return EXIT_SUCCESS;
- }
- else
- {
- puts("Bad arguments !!! You must give me all the parameters !!!!\n"
- "Type 'bin2c -h' to read the help !!!! ");
- return EXIT_SUCCESS;
- }
-
- }
-
- if( (source=fopen( argv[1], "rb" )) == NULL )
- {
- printf("ERROR : I can't find source file %s\n",argv[1]);
- return EXIT_FAILURE;
- }
-
- strcpy(Dummy,argv[2]);
- strcat(Dummy,".h"); /* add suffix .h to target name */
-
- if( (dest=fopen( Dummy, "wb+" )) == NULL )
- {
- printf("ERROR : I can't open destination file %s\n",Dummy);
- return EXIT_FAILURE;
- }
-
-
- strcpy(Dummy,argv[3]);
- Upper_chars(Dummy); /* lower to upper chars */
- strcat(Dummy,"_LEN"); /* add the suffix _LEN to the struct name */
- /* for the #define stantment */
-
-
- /* It writes the header information */
- fprintf( dest, "\n#define %s %ld\n\n", Dummy, filesize(source) );
- fprintf( dest, "static unsigned char %s[] = {\n ", argv[3] );
-
- if( ferror( dest ))
- {
- printf( "ERROR writing on target file: %s\n",argv[2] );
- return EXIT_FAILURE;
- }
-
-
- c = 0;
- buffer = fgetc( source );
-
- while( buffer != EOF )
- {
- fprintf(dest,"0x%02x", buffer);
-
- buffer = fgetc( source );
- if( !feof(source))
- fputc(',', dest);
-
- c++;
- if(c == LINE ) {
- fprintf(dest,"\n ");
- c = 0;
- }
-
- }
-
- fprintf(dest,"\n};\n\n");
-
- return EXIT_SUCCESS;
-}
-
-
diff --git a/app/tools/halibut/bk_html.c b/app/tools/halibut/bk_html.c
index 4f7c49b..b01d035 100644
--- a/app/tools/halibut/bk_html.c
+++ b/app/tools/halibut/bk_html.c
@@ -2222,6 +2222,8 @@ static void html_words(htmloutput *ho, word *words, int flags,
element_open(ho, "a");
c = utoa_dup(w->text, CS_ASCII);
element_attr(ho, "href", c);
+ if(!strncmp(c, "http://", strlen("http://")) || !strncmp(c, "https://", strlen("https://")))
+ element_attr(ho, "target", "_blank");
sfree(c);
}
break;
diff --git a/app/tools/listxtp.c b/app/tools/listxtp.c
index 384c0d5..35d0daa 100644
--- a/app/tools/listxtp.c
+++ b/app/tools/listxtp.c
@@ -31,6 +31,7 @@
#define TRUE 1
#define FALSE 0
+#define MAX_FILES 500
#ifdef _WIN32
#define WIKIFORMATOPTION "/w"
#pragma warning( disable : 4996 )
@@ -70,7 +71,7 @@ main( int argc, char **argv )
struct stat buf;
char filename[ 256 ];
char path[ 256 ];
- char *results[100];
+ char *results[MAX_FILES];
int cnt = 0;
int i;
int bWiki = FALSE;
@@ -115,7 +116,7 @@ main( int argc, char **argv )
/*
* get all files from the directory
*/
- while( ent = readdir( d ))
+ while((ent = readdir(d)))
{
/*
* create full file name and get the state for that file
@@ -152,7 +153,7 @@ main( int argc, char **argv )
results[ cnt ] = malloc( strlen( buffer ) + 1 );
strcpy( results[ cnt ], buffer );
cnt++;
- if( cnt == 100 ) {
+ if( cnt == MAX_FILES ) {
fprintf( stderr, "Error: too many files\n" );
exit( 1 );
}
diff --git a/app/tools/oldscripts/README b/app/tools/oldscripts/README
deleted file mode 100644
index a9ee346..0000000
--- a/app/tools/oldscripts/README
+++ /dev/null
@@ -1,4 +0,0 @@
-Not all of these scripts are fully tested. Use at your own risk.
-
-
-JBB
diff --git a/app/tools/oldscripts/checkall b/app/tools/oldscripts/checkall
deleted file mode 100644
index 51e6861..0000000
--- a/app/tools/oldscripts/checkall
+++ /dev/null
@@ -1,10 +0,0 @@
-#!/bin/sh
-cd ~/xtrkcad/src
-for d in bin help lib lib/params lib/demos lib/examples tools ; do
- rlog -R -L $d/RCS/*,v
-done
-cd ~/wlib/src
-for d in include mswlib test gtklib ; do
- rlog -R -L $d/RCS/*,v
-done
-
diff --git a/app/tools/oldscripts/diffall b/app/tools/oldscripts/diffall
deleted file mode 100644
index 0dd6695..0000000
--- a/app/tools/oldscripts/diffall
+++ /dev/null
@@ -1,37 +0,0 @@
-#!/bin/sh
-if [ $# -lt 1 ] ; then
- echo "Usage: checkall <RLSE> [<home>]"
- exit 1
-fi
-RLSE=$1
-HOMEDIR=$HOME
-if [ $# -eq 2 ] ; then
- HOMEDIR=$2
-fi
-cd ${HOMEDIR}/xtrkcad/$RLSE
-for d in bin help lib lib/params lib/demos lib/examples tools ; do
- echo === $d
- ( cd $d
- for f in `make rcssrc` ; do
- if rcsdiff -q -r$RLSE -r1. $f > /dev/null ; then
- true
- else
- echo $d/$f diffs
- fi
- done
- )
-done
-cd ${HOMEDIR}/wlib/$RLSE
-for d in include mswlib test gtklib ; do
- echo === $d
- ( cd $d
- for f in `make rcssrc` ; do
- if rcsdiff -q -r$RLSE -r1. $f > /dev/null ; then
- true
- else
- echo $d/$f diffs
- fi
- done
- )
-done
-
diff --git a/app/tools/oldscripts/fetchall b/app/tools/oldscripts/fetchall
deleted file mode 100644
index 5a88f73..0000000
--- a/app/tools/oldscripts/fetchall
+++ /dev/null
@@ -1,46 +0,0 @@
-#!/bin/sh
-
-fetchdir() {
- echo fetching $1
- mkdir $1
- ( cd $1; ln -s ../$2/src/$1/RCS . ; co -r$RLSE Makefile ; co -r$RLSE `make rcssrc` )
-}
-
-if [ $# -lt 1 ] ; then
- echo fetchall RLSE
- exit 1
-fi
-RLSE=$1
-if [ -d ~/xtrkcad/$RLSE ] ; then
- echo ~/xtrkcad/$RLSE exists
- exit 1
-fi
-if [ -d ~/wlib/$RLSE ] ; then
- echo ~/wlib/$RLSE exists
- exit 1
-fi
-
-mkdir ~/xtrkcad/$RLSE
-cd ~/xtrkcad/$RLSE
-fetchdir bin ..
-fetchdir help ..
-fetchdir lib ..
-fetchdir lib/demos ../..
-fetchdir lib/examples ../..
-fetchdir lib/params ../..
-fetchdir tools ..
-mkdir ~/wlib/$RLSE
-cd ~/wlib/$RLSE
-fetchdir include ..
-fetchdir mswlib ..
-fetchdir test ..
-fetchdir gtklib ..
-
-mkdir ~/xtrkcad/$RLSE/help/images.orig
-cp ~/xtrkcad/dev/help/images.orig/*.png ~/xtrkcad/$RLSE/help/images.orig
-cp ~/xtrkcad/dev/bin/xtrkcad.ico ~/xtrkcad/$RLSE/bin/
-cp ~/xtrkcad/dev/lib/register.* ~/xtrkcad/$RLSE/lib/
-chmod 444 ~/xtrkcad/$RLSE/lib/register.*
-cp ~/wlib/dev/test/wtest.ico ~/wlib/$RLSE/test/
-ln -s ~/wlib/$RLSE ~/xtrkcad/$RLSE/bin/wlib
-
diff --git a/app/tools/oldscripts/makeall b/app/tools/oldscripts/makeall
deleted file mode 100644
index 896cb41..0000000
--- a/app/tools/oldscripts/makeall
+++ /dev/null
@@ -1,23 +0,0 @@
-#!/bin/sh
-
-if [ $# -lt 1 ] ; then
- echo mkrlse RLSE
- exit 1
-fi
-RLSE=$1
-if [ \! -d ~/xtrkcad/$RLSE ] ; then
- echo ~/xtrkcad/$RLSE does not exist
- exit 1
-fi
-
- cd ~/wlib/$RLSE/gtklib && \
- make update && \
- cd ~/xtrkcad/$RLSE/help && \
- make pngs && \
- make && \
- cd ../lib/params && \
- make && \
- cd .. && \
- make && \
- cd ../bin && \
- make update
diff --git a/app/tools/oldscripts/markall b/app/tools/oldscripts/markall
deleted file mode 100644
index ae41d71..0000000
--- a/app/tools/oldscripts/markall
+++ /dev/null
@@ -1,17 +0,0 @@
-#!/bin/sh
-if [ $# -lt 1 ] ; then
- echo "markall TAG"
- exit 1
-fi
-TAG=$1
-cd ~/xtrkcad/src
-for d in bin help lib lib/params lib/demos lib/examples tools ; do
- echo xtrkcad/src/$d:
- (cd $d ; co Makefile ; rcs -N$TAG:1. `make rcssrc`)
-done
-cd ~/wlib/src
-for d in include mswlib test gtklib ; do
- echo wlib/src/$d
- (cd $d ; co Makefile ; rcs -N$TAG:1. `make rcssrc`)
-done
-
diff --git a/app/tools/oldscripts/mkwinrlse b/app/tools/oldscripts/mkwinrlse
deleted file mode 100644
index 15358f5..0000000
--- a/app/tools/oldscripts/mkwinrlse
+++ /dev/null
@@ -1,34 +0,0 @@
-#!/bin/sh
-
-rm -fr mswrel
-if [ -d mswrel ] ; then
- echo ./mswrel already exists
- exit 1
-fi
-
-mkdir mswrel
-mkdir mswrel/demos
-mkdir mswrel/examples
-mkdir mswrel/params
-echo lib/demos
-(cd lib/demos; for f in *.xtr ; do addcr < $f > ../../mswrel/demos/$f ; done )
-echo lib/examples
-(cd lib/examples; for f in *.xtc ; do addcr < "$f" > ../../mswrel/examples/"$f" ; done )
-echo lib/params
-(cd lib/params; for f in *.xtp ; do addcr < $f > ../../mswrel/params/$f ; done )
-echo lib
-cp bin/Release/xtrkcad.exe mswrel
-echo release
-cp bin/Debug/xtrkcad.exe mswrel/xtrkcadd.exe
-echo debug
-addcr < COPYING > mswrel/license.txt
-echo license
-addcr < lib/aareadme.txt > mswrel/aareadme.txt
-addcr < lib/xtrkcad.bug > mswrel/xtrkcad.bug
-addcr < lib/xtrkcad.enh > mswrel/xtrkcad.enh
-addcr < lib/xtrkcad.fix > mswrel/xtrkcad.fix
-addcr < lib/xtrkcad.upd > mswrel/xtrkcad.upd
-addcr < help/xtrkcad.tip > mswrel/xtrkcad.tip
-addcr < lib/xtrkcad.xtq > mswrel/xtrkcad.xtq
-chmod -w -R mswrel
-chmod +w mswrel mswrel/demos mswrel/examples mswrel/params
diff --git a/app/tools/oldscripts/roall b/app/tools/oldscripts/roall
deleted file mode 100644
index 28f156b..0000000
--- a/app/tools/oldscripts/roall
+++ /dev/null
@@ -1,22 +0,0 @@
-#!/bin/sh
-if [ $# != 1 ] ; then
- echo "Usage: roall <RLSE>"
- exit 1
-fi
-cd ~/xtrkcad/$1
-for d in bin help lib lib/params lib/demos lib/examples tools ; do
- (cd $d; for f in `make rcssrc` ; do
- if [ -w $f ] ; then
- echo $d/$f is writable
- fi
- done)
-done
-cd ~/wlib/$1
-for d in include mswlib test gtklib ; do
- (cd $d;for f in `make rcssrc` ; do
- if [ -w $f ] ; then
- echo $d/$f is writable
- fi
- done)
-done
-