I did a script that will make an INI file from a list of files that are named in a file called sections.txt

you invoke it thusly ./make_ini -o yourinifile ( dont add the file extension it will be added)

Oh and dont add a CRLF after the last entry in sections.txt. Its a bug I dont know how to fix.//It will run but not exit until you hit cntrl C.


On 2014-02-12 19:26, Marius Liebenberg wrote:
I also call in a whole lot of HAL files. I found that works well for me
to keep thing together that belong together. Big HAL files are more
confusing than complicated INI files.

There are two ideas entered here that I think has merit
One being the cat function and
Two the tk script that combines the various INI files

I am going to test both approaches and see what suits me better. I like
the idea of building an library of ini files that can be strung together
with a script.

The ultimate would be to use the script that Dewey made but to use an
input file that contains the file names of the ini files or sections
that you want to use and in the order that you would use them. That way
you can still control the order of the ini structured file. Although his
script is magic one has to make sure that only the sections that you
want to use are in the directory.


On 2014-02-12 19:14, Jon Elson wrote:
On 02/11/2014 11:34 PM, Marius Liebenberg wrote:
Hi Chris
The reason I would like to think I need it is because I test a lot of
different configs and code on the same machine (hardware ) for instance.
This means that I have to redo the INI file for every test. I normally
end up being frustrated (due to own stupidity) by not getting everything
right first time. Things like paths etc..
I do something similar.  I just copy the whole configs/xxx
directory,
with the .ini, .hal, .tbl  and .var files, and then edit
what needs to be
changed.  I have found that works pretty easily.

I do have it set up so the .ini file calls in a bunch of
.hal files
which are broken up by function, such as motion, I/O, pendant,
etc.

Jon

------------------------------------------------------------------------------
Android apps run on BlackBerry 10
Introducing the new BlackBerry 10.2.1 Runtime for Android apps.
Now with support for Jelly Bean, Bluetooth, Mapview and more.
Get your Android app in front of a whole new audience.  Start now.
http://pubads.g.doubleclick.net/gampad/clk?id=124407151&iu=/4140/ostg.clktrk
_______________________________________________
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users


--

Regards /Groete

Marius D. Liebenberg
+27 82 698 3251
+27 12 743 6064

#!/bin/bash

#       -------------------------------------------------------------------
#
#       Shell program to create links in a linuxcnc RIP environment to 
excisting 
# components. This way you can recover your components after an upgrade..
#
#       Copyright 2013, marius,,, <mar...@mastercut.co.za>.
#
#       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.
#
#       Description:
#
#
#
#       Usage:
#
#               components [ -h | --help ] [-o oname]
#
#       Options:
#
#               -h, --help      Display this help message and exit.
#               -d  dname       directory of your dev environment. The root 
please.
#
#
#       Revision History:
#
#       08/31/2013      File created by new_script ver. 2.1.0
#
#       -------------------------------------------------------------------


#       -------------------------------------------------------------------
#       Constants
#       -------------------------------------------------------------------

        PROGNAME=$(basename $0)
        VERSION="0.0.1"



#       -------------------------------------------------------------------
#       Functions
#       -------------------------------------------------------------------


function clean_up
{

#       -----------------------------------------------------------------------
#       Function to remove temporary files and other housekeeping
#               No arguments
#       -----------------------------------------------------------------------

        rm -f ${TEMP_FILE1}
}


function error_exit
{

#       -----------------------------------------------------------------------
#       Function for exit due to fatal program error
#               Accepts 1 argument:
#                       string containing descriptive error message
#       -----------------------------------------------------------------------


        echo "${PROGNAME}: ${1:-"Unknown Error"}" >&2
        clean_up
        exit 1
}


function graceful_exit
{

#       -----------------------------------------------------------------------
#       Function called for a graceful exit
#               No arguments
#       -----------------------------------------------------------------------

        clean_up
        exit
}


function signal_exit
{

#       -----------------------------------------------------------------------
#       Function to handle termination signals
#               Accepts 1 argument:
#                       signal_spec
#       -----------------------------------------------------------------------

        case $1 in
                INT)    echo "$PROGNAME: Program aborted by user" >&2
                        clean_up
                        exit
                        ;;
                TERM)   echo "$PROGNAME: Program terminated" >&2
                        clean_up
                        exit
                        ;;
                *)      error_exit "$PROGNAME: Terminating on unknown signal"
                        ;;
        esac
}


function make_temp_files
{

#       -----------------------------------------------------------------------
#       Function to create temporary files
#               No arguments
#       -----------------------------------------------------------------------

        # Use user's local tmp directory if it exists

        if [ -d ~/tmp ]; then
                TEMP_DIR=~/tmp
        else
                TEMP_DIR=/tmp
        fi

        # Temp file for this script, using paranoid method of creation to
        # insure that file name is not predictable.  This is for security to
        # avoid "tmp race" attacks.  If more files are needed, create using
        # the same form.

        TEMP_FILE1=$(mktemp -q "${TEMP_DIR}/${PROGNAME}.$$.XXXXXX")
        if [ "$TEMP_FILE1" = "" ]; then
                error_exit "cannot create temp file!"
        fi
}


function usage
{

#       -----------------------------------------------------------------------
#       Function to display usage message (does not exit)
#               No arguments
#       -----------------------------------------------------------------------

        echo "Usage: ${PROGNAME} [-h | --help] [-o outfile]"
}


function helptext
{

#       -----------------------------------------------------------------------
#       Function to display help message for program
#               No arguments
#       -----------------------------------------------------------------------

        local tab=$(echo -en "\t\t")

        cat <<- -EOF-

        ${PROGNAME} ver. ${VERSION}
        This is a program to create links in a linuxcnc RIP environment to 
excisting 
        components. This way you can recover your components after an upgrade..

        $(usage)

        Options:

        -h, --help      Display this help message and exit.
        -o  outfile  Output file name.

        
        
-EOF-
}


#       -------------------------------------------------------------------
#       Program starts here
#       -------------------------------------------------------------------

##### Initialization And Setup #####

# Set file creation mask so that all files are created with 600 permissions.

#umask 066


# Trap TERM, HUP, and INT signals and properly exit

trap "signal_exit TERM" TERM HUP
trap "signal_exit INT"  INT

# Create temporary file(s)

# put this back if you want to make use of temp files
#make_temp_files


##### Command Line Processing #####

if [ "$1" = "--help" ]; then
        helptext
        graceful_exit
fi

if [ "$1" = "" ]; then
        usage
        graceful_exit
fi

while getopts ":ho:" opt; do
        case $opt in
                o )     oname=$OPTARG ;;
                h )     helptext
                        graceful_exit ;;
                * )     usage
                        clean_up
                        exit 1
        esac
done

##### Main Logic #####

echo "creating sections in $oname.ini"
echo

rm $oname.ini

while IFS= read -r name <&3;
do
        cat $name >> $oname.ini
done 3< sections.txt

graceful_exit

pre_amble.sec
display.sec
rs274ngc.sec
motion.sec
axis.sec
emcio.sec
------------------------------------------------------------------------------
Android apps run on BlackBerry 10
Introducing the new BlackBerry 10.2.1 Runtime for Android apps.
Now with support for Jelly Bean, Bluetooth, Mapview and more.
Get your Android app in front of a whole new audience.  Start now.
http://pubads.g.doubleclick.net/gampad/clk?id=124407151&iu=/4140/ostg.clktrk
_______________________________________________
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users

Reply via email to