Commit bf9f8290 authored by User Claes's avatar User Claes

FreeBSD build

parent 8c6916b8
......@@ -18,13 +18,8 @@
*/
#include <stdio.h>
#if defined OS_VMS
# include "co_getopt.h"
#elif defined OS_LYNX
extern int getopt();
#if defined OS_LYNX
# include <sys/wait.h>
#elif defined OS_LINUX
extern int getopt();
#elif defined OS_MACOS || defined OS_FREEBSD
# include <sys/wait.h>
# include <fcntl.h>
......@@ -561,25 +556,9 @@ checkErrors (
static ini_sContext *
createContext (int argc, char **argv)
{
int c;
extern char *optarg;
extern int optind;
#if 1
extern int optind;
#endif
int i, j;
ini_sContext *cp;
pwr_tStatus sts;
#if defined(OS_LYNX) || defined(OS_LINUX) || defined(OS_MACOS) || defined OS_FREEBSD
char *options = "a:b:c:d:efg:hin:p:q:rsu:vwA:H:V";
#else
char *options = "a:b:d:efhin:p:q:rvwA:H:V";
#endif
#if 0
extern int opterr;
opterr = 0;
#endif
optind = 0;
if ( argc > 1 && strcmp( argv[1], "--version") == 0) {
system( "cat $pwr_exe/rt_version.dat");
......@@ -590,67 +569,138 @@ createContext (int argc, char **argv)
exit(1);
}
while ((c = getopt(argc, argv, options)) != -1) {
switch (c) {
case 'a':
cp->flags.b.applfile = 1;
strcpy(cp->applfile.name, optarg);
break;
case 'b':
cp->flags.b.bootfile = 1;
strcpy(cp->bootfile.name, optarg);
break;
case 'c':
strcpy(cp->console, optarg);
break;
case 'd':
strcpy(cp->dir, optarg);
break;
case 'e':
cp->flags.b.ignoreError = 1;
break;
case 'f':
cp->flags.b.ignoreFatal = 1;
break;
case 'h':
cp->flags.b.hostname = 1;
strcpy(cp->hostname, optarg);
break;
case 'i':
cp->flags.b.interactive = 1;
break;
case 'n':
cp->flags.b.nodename = 1;
strcpy(cp->nodename, optarg);
break;
case 'p':
cp->flags.b.plcfile = 1;
strcpy(cp->plcfile.name, optarg);
break;
case 'q':
cp->flags.b.busid = 1;
cp->busid = atoi(optarg);
break;
case 'r':
cp->flags.b.restart = 1;
cp->flags.b.interactive = 1;
break;
case 's':
cp->flags.b.stop = 1;
break;
case 'v':
cp->flags.b.verbose = 1;
break;
case 'w':
cp->flags.b.ignoreWarning = 1;
break;
case 'A':
cp->flags.b.aliasfile = 1;
strcpy(cp->aliasfile.name, optarg);
break;
case '?':
usage(argv[0]);
break;
for ( i = 1; i < argc; i++) {
if ( argv[i][0] == '-') {
int i_incr = 0;
for ( j = 1;
argv[i][j] != 0 && argv[i][j] != ' ' && argv[i][j] != ' ';
j++) {
switch ( argv[i][j]) {
case 'a':
if ( i + 1 >= argc ||
!(argv[i][j+1] == ' ' || argv[i][j+1] != ' ')) {
usage( argv[0]);
exit(0);
}
cp->flags.b.applfile = 1;
strcpy(cp->applfile.name, argv[i+1]);
i++;
i_incr = 1;
break;
case 'b':
if ( i + 1 >= argc ||
!(argv[i][j+1] == ' ' || argv[i][j+1] != ' ')) {
usage( argv[0]);
exit(0);
}
cp->flags.b.bootfile = 1;
strcpy(cp->bootfile.name, argv[i+1]);
break;
case 'c':
if ( i + 1 >= argc ||
!(argv[i][j+1] == ' ' || argv[i][j+1] != ' ')) {
usage( argv[0]);
exit(0);
}
strcpy(cp->console, argv[i+1]);
i++;
i_incr = 1;
break;
case 'd':
if ( i + 1 >= argc ||
!(argv[i][j+1] == ' ' || argv[i][j+1] != ' ')) {
usage( argv[0]);
exit(0);
}
strcpy(cp->dir, argv[i+1]);
i++;
i_incr = 1;
break;
case 'e':
cp->flags.b.ignoreError = 1;
break;
case 'f':
cp->flags.b.ignoreFatal = 1;
break;
case 'h':
if ( i + 1 >= argc ||
!(argv[i][j+1] == ' ' || argv[i][j+1] != ' ')) {
usage( argv[0]);
exit(0);
}
cp->flags.b.hostname = 1;
strcpy(cp->hostname, argv[i+1]);
i++;
i_incr = 1;
break;
case 'i':
cp->flags.b.interactive = 1;
break;
case 'n':
if ( i + 1 >= argc ||
!(argv[i][j+1] == ' ' || argv[i][j+1] != ' ')) {
usage( argv[0]);
exit(0);
}
cp->flags.b.nodename = 1;
strcpy(cp->nodename, argv[i+1]);
i++;
i_incr = 1;
break;
case 'p':
if ( i + 1 >= argc ||
!(argv[i][j+1] == ' ' || argv[i][j+1] != ' ')) {
usage( argv[0]);
exit(0);
}
cp->flags.b.plcfile = 1;
strcpy(cp->plcfile.name, argv[i+1]);
i++;
i_incr = 1;
break;
case 'q':
if ( i + 1 >= argc ||
!(argv[i][j+1] == ' ' || argv[i][j+1] != ' ')) {
usage( argv[0]);
exit(0);
}
cp->flags.b.busid = 1;
cp->busid = atoi(argv[i+1]);
break;
case 'r':
cp->flags.b.restart = 1;
cp->flags.b.interactive = 1;
break;
case 's':
cp->flags.b.stop = 1;
break;
case 'v':
cp->flags.b.verbose = 1;
break;
case 'w':
cp->flags.b.ignoreWarning = 1;
break;
case 'A':
if ( i + 1 >= argc ||
!(argv[i][j+1] == ' ' || argv[i][j+1] != ' ')) {
usage( argv[0]);
exit(0);
}
cp->flags.b.aliasfile = 1;
strcpy(cp->aliasfile.name, argv[i+1]);
i++;
i_incr = 1;
break;
case '?':
usage(argv[0]);
break;
default:
usage(argv[0]);
exit(0);
}
if ( i_incr)
break;
}
}
}
......
#!/bin/bash
#
# Proview $Id: ge_javac.sh,v 1.5 2006-06-14 10:42:48 claes Exp $
# Copyright (C) 2005 SSAB Oxelsund AB.
#
# 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 the program, if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
#
#
function=$1
src_file=$2
systemname=$3
if [ $function == "java_web" ]; then
jarfile="$pwrp_web/pwrp_"$systemname"_web.jar"
if javac -d $pwrp_web -classpath $pwr_lib/pwr_rt.jar:$pwr_lib/pwr_jop.jar:$pwr_lib/pwr_jopc.jar:$jarfile $pwrp_pop/$src_file
then
echo "-- $src_file compiled"
if [ ! -e $jarfile ]; then
cd $pwrp_web
jar -cf $jarfile ${src_file%.java}.class
rm ${src_file%.java}.class
else
cd $pwrp_web
jar -uf $jarfile ${src_file%.java}.class
rm ${src_file%.java}.class
fi
files=`ls $pwrp_web/${src_file%.java}\\$*.class 2>&-`
if [ ! -z "$files" ]; then
# echo "Insert in archive $jarfile"
jar -uf $jarfile ${src_file%.java}\$*.class
rm ${src_file%.java}\$*.class
fi
files=`ls $pwrp_pop/*.gif 2>&-`
if [ ! -z "$files" ]; then
cd $pwrp_pop
jar -uf $jarfile *.gif
fi
files=`ls $pwrp_pop/*.jpg 2>&-`
if [ ! -z "$files" ]; then
cd $pwrp_pop
jar -uf $jarfile *.jpg
fi
fi
fi
if [ $function == "java" ]; then
jarfile="$pwrp_lib/pwrp_"$systemname".jar"
jarfileweb="$pwrp_web/pwrp_"$systemname"_web.jar"
if javac -d $pwrp_web -classpath $pwr_lib/pwr_rt.jar:$pwr_lib/pwr_jop.jar:$pwr_lib/pwr_jopc.jar:$jarfile $pwrp_pop/$src_file
then
echo "-- $src_file compiled"
if [ ! -e $jarfile ]; then
cd $pwrp_web
jar -cf $jarfile ${src_file%.java}.class
else
cd $pwrp_web
jar -uf $jarfile ${src_file%.java}.class
fi
if [ ! -e $jarfileweb ]; then
cd $pwrp_web
jar -cf $jarfileweb ${src_file%.java}.class
else
cd $pwrp_web
jar -uf $jarfileweb ${src_file%.java}.class
fi
rm ${src_file%.java}.class
files=`ls $pwrp_web/${src_file%.java}\\$*.class 2>&-`
if [ ! -z "$files" ]; then
# echo "Insert in archive $jarfile"
jar -uf $jarfile ${src_file%.java}\$*.class
jar -uf $jarfileweb ${src_file%.java}\$*.class
rm ${src_file%.java}\$*.class
fi
files=`ls $pwrp_pop/*.gif 2>&-`
if [ ! -z "$files" ]; then
cd $pwrp_pop
jar -uf $jarfile *.gif
jar -uf $jarfileweb *.gif
fi
files=`ls $pwrp_pop/*.jpg 2>&-`
if [ ! -z "$files" ]; then
cd $pwrp_pop
jar -uf $jarfile *.jpg
jar -uf $jarfileweb *.jpg
fi
fi
fi
if [ $function == "html" ]; then
cp $pwrp_pop/$src_file $pwrp_web/
fi
#!/bin/bash
#
# Proview $Id: jop_start.sh,v 1.2 2005-09-01 14:57:49 claes Exp $
# Copyright (C) 2005 SSAB Oxelösund AB.
#
# 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 the program, if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
echo "Here in jop start"
#export LD_LIBRARY_PATH=$pwr_exe
#echo $LD_LIBRARY_PATH
#export CLASSPATH=$pwr_lib/pwr_rt.jar:$pwr_lib/pwr_jop.jar
java jpwr.jop.JopSpider $1
#!/bin/bash
#
# Proview $Id: pwr_cleanup.sh,v 1.2 2005-09-01 14:57:49 claes Exp $
# Copyright (C) 2005 SSAB Oxelösund AB.
#
# 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 the program, if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
#
# pwr_cleanup.sh
#
# NOTE! This file removes all IPC objects for the user.
# If you have other program which creates IPC objects,
# then do not use this script
#
# remove semaphores
eval `ipcs -s|grep ^0x|grep "[ \t]$USER[ \t]"|awk '{printf "ipcrm sem %s;", $2}'`
# remove message queues
eval `ipcs -q|grep ^0x|grep "[ \t]$USER[ \t]"|awk '{printf "ipcrm msg %s;", $2}'`
# remove shared memory
eval `ipcs -m|grep ^0x|grep "[ \t]$USER[ \t]"|awk '{printf "ipcrm shm %s;", $2}'`
rm /tmp/pwr*$PWR_BUS_ID
#!/bin/bash
#
# Proview $Id: pwr_pkg.sh,v 1.7 2006-08-22 07:44:25 claes Exp $
# Copyright (C) 2005 SSAB Oxelsund AB.
#
# 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 the program, if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
pkg_install_func ()
{
pkg_remove_func "force"
if [ $1 == ${1##*/} ]; then
# Add path
pkg="/home/pwrp/$1"
else
pkg=$1
fi
if [ ! -e "$pkg" ]; then
echo "No package $pkg"
exit 1
fi
echo "-- Installing package $1"
cd /tmp
if ! tar -xzf $pkg pkg_unpack.sh; then
echo "Package $1 incomplete"
exit 1
fi
chmod a+x pkg_unpack.sh
./pkg_unpack.sh
}
pkg_list_func ()
{
if [ -z $1 ]; then
# List installed package
if [ ! -e $pwrp_load/pwr_pkg.dat ]; then
echo "-- No package installed"
exit 1
fi
datfile=$pwrp_load/pwr_pkg.dat
else
# Extract datfile from package
if [ $1 == ${1##*/} ]; then
# Add path
pkg="/home/pwrp/$1"
else
pkg=$1
fi
if [ ! -e $pkg ]; then
echo "-- No such package"
exit 1
fi
echo "-- Opening file $pkg"
cd /tmp
if ! tar -xzf $pkg pwr_pkg.dat; then
echo "Package $1 incomplete"
exit 1
fi
datfile=/tmp/pwr_pkg.dat
fi
{
let printout=0
while read line; do
if [ "$line" = "%Description:" ]; then
printout=1
else
if [ "$line" = "%Files:" ]; then
break
fi
if [ $printout -eq 1 ]; then
echo $line
fi
fi
done
} < $datfile
}
pkg_listfiles_func ()
{
if [ -z $1 ]; then
# List installed package
if [ ! -e $pwrp_load/pwr_pkg.dat ]; then
echo "-- No package installed"
exit 1
fi
datfile=$pwrp_load/pwr_pkg.dat
else
# Extract datfile from package
if [ $1 == ${1##*/} ]; then
# Add path
pkg="/home/pwrp/$1"
else
pkg=$1
fi
if [ ! -e $pkg ]; then
echo "-- No such package"
exit 1
fi
echo "-- Opening file $pkg"
cd /tmp
if ! tar -xzf $pkg pwr_pkg.dat; then
echo "Package $1 incomplete"
exit 1
fi
datfile=/tmp/pwr_pkg.dat
fi
{
let printout=0
while read line date time; do
if [ "$line" = "%Files:" ]; then
printout=1
else
if [ "$line" = "%End:" ]; then
break
fi
if [ $printout -eq 1 ]; then
echo $date $time $line
fi
fi
done
} < $datfile
}
pkg_brief_func ()
{
if [ -z $1 ]; then
# List installed package
if [ ! -e $pwrp_load/pwr_pkg.dat ]; then
echo "-- No package installed"
exit 1
fi
datfile=$pwrp_load/pwr_pkg.dat
{
let printout=0
while read line; do
if [ "$line" = "%Brief:" ]; then
printout=1
else
if [ "$line" = "%Description:" ]; then
break
fi
if [ $printout -eq 1 ]; then
echo $line
fi
fi
done
} < $datfile
else
# Extract datfile from package
for file
do
if [ $file == ${file##*/} ]; then
# Add path
pkg="/home/pwrp/$file"
else
pkg=$file
fi
if [ ! -e $pkg ]; then
echo "-- No such package"
exit 1
fi
dir=`eval pwd`
cd /tmp
if ! tar -xzf $pkg pwr_pkg.dat; then
echo "Package $pkg incomplete"
else
datfile=/tmp/pwr_pkg.dat
{
let printout=0
while read line; do
if [ "$line" = "%Brief:" ]; then
printout=1
else
if [ "$line" = "%Description:" ]; then
break
fi
if [ $printout -eq 1 ]; then
fname=`eval basename $pkg`
echo $fname ${line#Proview package}
fi
fi
done
} < $datfile
rm $datfile
fi
cd $dir
done
fi
}
pkg_dir_func()
{
if [ -z $1 ]; then
allpkg=`ls /home/pwrp/pwrp_pkg_*.tgz`
else
if [ $1 == ${1##*/} ]; then
# Add path
pattern="/home/pwrp/*$1*"
elif [ ${1:0:1} == "/" ]; then
pattern=$1*
else
pattern=*$1*
fi
allpkg=`ls $pattern`
fi
for pkg in $allpkg ; do
if [ -z ${pkg##*pwrp_pkg_*.tgz} ]; then
pkg_brief_func $pkg
fi
done
}
pkg_dirbrief_func()
{
if [ -z "$1" ]; then
allpkg=`ls /home/pwrp/pwrp_pkg_*.tgz`
else
if [ "$1" == "${1##*/}" ]; then
# Add path
pattern="/home/pwrp/*$1*"
elif [ ${1:0:1} == "/" ]; then
pattern=$1*
else
pattern=*$1*
fi
allpkg=`ls $pattern`
fi
for pkg in $allpkg ; do
if [ -z ${pkg##*pwrp_pkg_*.tgz} ]; then
fname=`eval basename $pkg`
ftime=`eval stat $pkg --print=%z | cut -b -19`
# echo $fname $ftime
echo $fname
fi
done
}
pkg_remove_func ()
{
if [ ! -e $pwrp_load/pwr_pkg.dat ]; then
echo "-- No package installed"
return
fi
# Get the name of the current package
{
let found=0
while read line; do
if [ "$line" = "%Package:" ]; then
found=1
else
if [ $found -eq 1 ]; then
pkg=$line
break
fi
fi
done
} < $pwrp_load/pwr_pkg.dat
if [ ! "$1" = "force" ]; then
echo ""
echo -n "Do you wan't to remove package $pkg (y/n) [n] "
read remove_pkg
if [ ! "$remove_pkg" = "y" ]; then
return
fi
fi
echo "-- Removing package $pkg"
{
let removefile=0
while read line date time; do
if [ "$line" = "%Files:" ]; then
removefile=1
else
if [ "$line" = "%End:" ]; then
break
fi
if [ $removefile -eq 1 ]; then
file=`eval echo $line`
#echo "rm $file"
rm $file
fi
fi
done
} < $pwrp_load/pwr_pkg.dat
rm $pwrp_load/pwr_pkg.dat
}
force="no"
while [ -n "$(echo $1 | grep '-')" ]; do
OPTARG=$2
case $1 in
-i ) pkg_install_func $OPTARG ;;
-la ) pkg_list_func $OPTARG ;;
-lf ) pkg_listfiles_func $OPTARG;;
-lp ) shift
pkg_brief_func $@ ;;
-r ) pkg_remove_func ;;
-rf ) force="force"
pkg_remove_func $force ;;
-ld ) pkg_dir_func $OPTARG ;;
-l ) pkg_dirbrief_func "$OPTARG";;
* ) cat <<EOF
usage: pwr_pkg [-i pkg] [-l [pkg]] [-b [pkg]] [-r]
pwr_pkg -i 'pkg' Install package 'pkg'
pwr_pkg -r Remove currently installed package
pwr_pkg -lp ['pkg'] List installed package, or package 'pkg'
pwr_pkg -la ['pkg'] List installed package, or package 'pkg', all info
pwr_pkg -lf ['pkg'] List files in installed package, or package 'pkg'
pwr_pkg -l List all packages
EOF
exit 1
esac
shift
done
#!/bin/bash
#
# Proview $Id: pwr_stop.sh,v 1.3 2008-11-24 15:22:42 claes Exp $
# Copyright (C) 2005 SSAB Oxelsund AB.
#
# 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 the program, if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
kill -9 `ps ax | grep "rt_neth_acp" | awk '{ print $1}'`
kill -9 `ps ax | grep "rt_neth" | awk '{ print $1}'`
kill -9 `ps ax | grep "rt_qmon" | awk '{ print $1}'`
kill -9 `ps ax | grep "rt_emon" | awk '{ print $1}'`
kill -9 `ps ax | grep "rt_tmon" | awk '{ print $1}'`
kill -9 `ps ax | grep "rt_\|/pwr/exe/rs" | awk '{ print $1}'`
kill -9 `ps ax | grep "\[rt_" | awk '{ print $1}'`
kill -9 `ps ax | grep "plc_" | awk '{ print $1}'`
kill -9 `ps ax | grep "jpwr.rt" | awk '{ print $1}'`
kill -9 `ps ax | grep "rs_nmps" | awk '{ print $1}'`
kill -9 `ps ax | grep "rs_remote" | awk '{ print $1}'`
kill -9 `ps ax | grep "sev_server" | awk '{ print $1}'`
kill -9 `ps ax | grep "opc_server" | awk '{ print $1}'`
if [ -u $pwr_exe/rt_ini ]; then
user=`ls -al $pwr_exe/rt_ini | awk '{ print $3}'`
else
user=$USER
fi
echo "User $user"
eval `ipcs -s|grep ^s|grep "[ \t]$user[ \t]"|awk '{printf "ipcrm -s %s;", $2
}'`
# remove message queues
eval `ipcs -q|grep ^q|grep "[ \t]$user[ \t]"|awk '{printf "ipcrm -q %s;", $2
}'`
# remove shared memory
eval `ipcs -m|grep ^m|grep "[ \t]$user[ \t]"|awk '{printf "ipcrm -m %s;", $2
}'`
if [ -e $pwrp_exe/pwrp_stop.sh ]; then
source $pwrp_exe/pwrp_stop.sh
fi
rm /tmp/pwr*$PWR_BUS_ID
#rm -f /tmp/pwr*
#id=`ipcs -s | grep $user | awk '{print $2}'`
#id1=`echo $id | awk '{print $1}'`
#id2=`echo $id | awk '{print $2}'`
#id3=`echo $id | awk '{print $3}'`
#ipcrm sem $id1
#ipcrm sem $id2
#ipcrm sem $id3
#id=`ipcs -q | grep $user | awk '{print $2}'`
#id1=`echo $id | awk '{print $1}'`
#id2=`echo $id | awk '{print $2}'`
#id3=`echo $id | awk '{print $3}'`
#ipcrm msg $id1
#ipcrm msg $id2
#ipcrm msg $id3
This diff is collapsed.
This diff is collapsed.
!** Invisible: Script used by reload.sh to save classvolume versions
!
! Proview $Id: reload_vol_versions.pwr_com,v 1.2 2005-09-01 14:57:49 claes Exp $
! Copyright (C) 2005 SSAB Oxelsund AB.
!
! 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 the program, if not, write to the Free Software
! Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
!
!
main()
string v;
string class;
string attr;
int version;
int sts;
int file;
string fname;
string cmd;
int file_open;
printf("\n");
printf("-- ssab_exe:ssab_reload_vol_versions\n");
printf("-- Script to store current classvolume versions\n\n");
fname = "$pwrp_db/reload_vol_versions_" + p1 + ".pwr_com";
fname = translate_filename( fname);
file_open = 0;
v = GetVolumeList();
while( v != "")
class = GetVolumeClass( v);
if ( class == "$ClassVolume" && v != "pwrs" && v != "pwrb" && v != "mps" && v != "NMps" && v != "TLog" && v != "SSAB" && v != "SA")
if ( !file_open)
file = fopen( fname, "w");
if ( !file)
printf("Unable to open file %s\n", fname);
exit(0);
endif
fprintf( file, "printf(\"\\n\");\n");
fprintf( file, "printf(\"-- %s\\n\");\n", fname);
fprintf( file, "printf(\"-- Script to restore current classvolume versions\\n\\n\");\n");
file_open = 1;
endif
attr = v + ":.RtVersion";
version = GetAttribute( attr, sts);
printf( "-- Store version %d of volume '%s'\n", version, v);
fprintf(file, "printf( \"-- Restore version number %d in volume '%s'\\n\");\n", version, v);
fprintf(file, "set volume/volume=%s\n", v);
fprintf(file, "set attr/name=%s:/attr=RtVersion/value=%d/noconf\n", v, version);
fprintf(file, "save\n");
endif
v = GetNextVolume(v);
endwhile
if ( file_open)
fclose(file);
endif
endmain
!** Invisible: Load a backup dumpfile into development data base.
!
! Proview $Id: restore_bck.pwr_com,v 1.3 2008-11-28 17:15:37 claes Exp $
! Copyright (C) 2005 SSAB Oxelsund AB.
!
! 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 the program, if not, write to the Free Software
! Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
!
function int usage()
printf( "Script to load backup dumpfile into development database.\n\n");
printf( "pwrc -v 'volumename' @pwr_exe:restore_bck 'nodename' 'dumpfile'\n\n");
printf( "Create a dumpfile on an process station with rt_bck -p\n\n");
endfunction
main()
int dump_file;
int alias_file;
string str;
string dbname;
string volname;
int i;
int j;
int first;
int len;
string start;
string objname;
string attrname;
string db_attrname;
string value;
string answer;
int loaddb;
int export_alias;
string alias_filename;
printf("\n");
if (p1 == "" || p2 == "")
usage();
exit(0);
endif
dump_file = fopen(p2, "r");
if (!dump_file)
printf( "Unable to open dumpfile %s\n", p2);
exit();
endif
loaddb = 0;
ask("Do you want to load values from the dumpfile into the database? (Y/N) ", answer);
if (answer == "y" || answer == "Y")
loaddb = 1;
endif
export_alias = 0;
ask("Do you wan to create an alias-file with values from the dumpfile? (Y/N) ", answer);
if (answer == "y" || answer == "Y")
ask("Alias-file name: ", answer);
alias_file = fopen(answer, "w");
if (!alias_file)
printf( "Unable to open output alias file %s\n", answer);
exit();
endif
export_alias = 1;
alias_filename = answer;
endif
while (fgets(str, dump_file))
start = extract(1, 2, str);
i = strstr(start, "/");
if (!i)
i = strstr(str, ".");
j = strstr(str, " ");
first = 1;
len = i-1;
objname = extract(first, len, str);
first = i+1;
len = j-i-1;
attrname = extract(first, len, str);
first = j+1;
len = strlen(str) - j;
value = extract(first, len, str);
db_attrname = attrname;
if (attrname == "ActualValue")
db_attrname = "InitialValue";
endif
if (loaddb)
set attr/attr='db_attrname'/value="'value'"/name='objname'/noconf/log
endif
if (export_alias)
fprintf(alias_file, "%s_setvalp %s.%s = \"%s\"\n", p1, objname, attrname, value);
endif
endif
endwhile
if (dump_file)
fclose(dump_file);
endif
if (alias_file)
printf("Alias-file created, %s\n", alias_filename);
fclose(alias_file);
endif
if (loaddb)
ask("Do you wan to save the database changes? (Y/N) ", answer);
if (answer == "y" || answer == "Y")
printf("Saving changes...\n");
save
else
printf("Not saving any changes\n");
endif
endif
endmain
#!/bin/bash
#
# Proview $Id: rt_print.sh,v 1.2 2005-09-01 14:57:49 claes Exp $
# Copyright (C) 2005 SSAB Oxelösund AB.
#
# 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 the program, if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
#
FileName="$1"
Color="$2"
Printer="$pwr_rt_print"
ColorPrinter="$pwr_rt_colorprint"
if [ "$Color" == "1" ]; then
if [ -z "$pwr_rt_colorprint" ]; then
Printer=$pwr_rt_print
else
Printer=$pwr_rt_colorprint
fi
else
if [ -z "$pwr_rt_print" ]; then
Printer=$pwr_rt_colorprint
else
Printer=$pwr_rt_print
fi
fi
if [ -z "$Printer" ]; then
echo "Printer is not defined in env 'pwr_rt_print'"
else
echo "Printing $1"
$Printer $1
fi
#!/bin/bash
#
# Proview $Id: rt_webmon.sh,v 1.5 2007-10-30 07:48:50 claes Exp $
# Copyright (C) 2005 SSAB Oxelsund AB.
#
# 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 the program, if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
#
export LD_LIBRARY_PATH=$pwr_exe
export CLASSPATH=$pwr_lib/pwr_rt.jar:$pwr_lib/pwr_jop.jar
#$jdk_home/java jpwr.rt.GdhServer
$jdk_home/java -Djava.library.path=$jdk/lib/i386/client:$jdk/lib/i386:$jdk/../lib/i386:$pwr_exe jpwr.rt.GdhServer
\ No newline at end of file
#!/bin/bash
#
# Proview $Id: rt_webmonelog.sh,v 1.3 2007-10-30 07:48:50 claes Exp $
# Copyright (C) 2005 SSAB Oxelsund AB.
#
# 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 the program, if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
#
export LD_LIBRARY_PATH=$pwr_exe
export CLASSPATH=$pwr_lib/pwr_rt.jar:$pwr_lib/pwr_jop.jar
#$jdk_home/java jpwr.rt.HistServer
$jdk_home/java -Djava.library.path=$jdk/lib/i386/client:$jdk/lib/i386:$jdk/../lib/i386:$pwr_exe jpwr.rt.HistServer
#!/bin/bash
#
# Proview $Id: rt_webmonmh.sh,v 1.4 2007-10-30 07:48:50 claes Exp $
# Copyright (C) 2005 SSAB Oxelsund AB.
#
# 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 the program, if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
#
export LD_LIBRARY_PATH=$pwr_exe
export CLASSPATH=$pwr_lib/pwr_rt.jar:$pwr_lib/pwr_jop.jar
$jdk_home/java -Djava.library.path=$jdk/lib/i386/client:$jdk/lib/i386:$jdk/../lib/i386:$pwr_exe jpwr.rt.MhServer
!** Invisible: Include file for io configuration script
!
! Proview $Id: ssab_config_card.pwr_com,v 1.3 2005-09-01 14:57:49 claes Exp $
! Copyright (C) 2005 SSAB Oxelsund AB.
!
! 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 the program, if not, write to the Free Software
! Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
!
!
! Create a signal.
! If the card of the signal does not exist, the card with channels, and signals
! positioned in the reservhierarchy, will be created, and signals and channels
! will be connected.
! If the card already exist the signal will be move from the reservhierarchy
! to the given destination
!
function int ssab_create_signal( string rname, string resname, string chname, string signame, string chan_descr, string chan_ident, string sig_descr)
string cname;
string cardclass;
string type;
int channels;
int i;
int j;
string newname;
string oldname;
string rnam;
string chnam;
string cnam;
string hnam;
string snam;
string chnr_str;
string tnam;
int sts;
! Check if card exist
cname = extract( 1, 4, chname);
chname = toupper( chname);
type = extract( 1, 2, chname);
chnr_str = extract( 5, 2, chname);
cnam=rname + "-" + cname;
if ( type == "DI")
cardclass = "Ssab_DI32D";
channels = 32;
endif
if ( type == "DO")
cardclass = "Ssab_DO32DKS";
channels = 32;
endif
if ( type == "AI")
cardclass = "Ssab_AI32uP";
channels = 32;
endif
if ( type == "AO")
cardclass = "Ssab_AO8uP";
channels = 8;
endif
if ( type == "CO")
cardclass = "Ssab_Co4uP";
channels = 4;
endif
if (!ObjectExist(cnam))
! Create the rack and reservhierarchy if not created
ssab_create_object( rname, "Rack_SSAB");
ssab_create_object( resname, "$PlantHier");
! The card didn't exist, create it
! Create the card
create object/dest="'rname'"/class='cardclass'/name="'cname'"
! Create signalobjects in reserv hierarchy
for ( i = 1; i < channels + 1; i++)
sprintf( rnam, "Reserv_%s%02.2d", cname, i);
sprintf( hnam, "%s-%s", resname, rnam);
if (!ObjectExist(hnam))
create object/dest='resname'/class='type'/name="'rnam'"
sprintf( chnam, "Ch%02.2d", i);
! Connect to channel
set attr/noco/name='hnam'/attr=SigChanCon/value='rname'-'cname'.'chnam'
endif
endfor
endif
! Set description in signal
sprintf( rnam, "Reserv_%s%s", cname, chnr_str);
set attr/noco/name='resname'-'rnam'/attr=Description/value="'sig_descr'"
! Move signal to the final destination
i = strrchr( signame, "-");
if ( i)
i++;
j = i - 2;
hnam = extract( 1, j, signame);
snam = extract( i, 80, signame);
endif
ssab_create_object( hnam, "$PlantHier");
move obj/source='resname'-'rnam'/dest='hnam'/rename="'snam'"
endfunction
!
! Create an object and it's ancestors if they doesn't exist
!
function int ssab_create_object( string name, string class)
int i;
int j;
string parent;
string object;
int sts;
i = strrchr( name, "-");
if ( i)
i++;
j = i - 2;
parent = extract( 1, j, name);
object = extract( i, 80, name);
else
object = name;
parent = "";
endif
if ( !ObjectExist( name))
if ( parent != "")
ssab_create_object( parent, class);
endif
create object/dest="'parent'"/class='class'/name="'object'"
endif
endfunction
This diff is collapsed.
This diff is collapsed.
#!/bin/bash
#
# Proview $Id: upgrade_cnvdmp.sh,v 1.4 2006-01-30 09:02:51 claes Exp $
# Copyright (C) 2005 SSAB Oxelsund AB.
#
# 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 the program, if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
sed '
/\"$/{
N
h
s/\"\n.*Attr Parameter = \"/\./
}
s/Attr object_did = /Attr oid = /
s/Attr window_did = /Attr woid = /
s/Attr subwind_objdid/Attr subwind_oid/
s/Attr parent_node_did = /Attr poid = /
s/Attr dest_node_did = /Attr dest_oid = /
s/Attr source_node_did = /Attr source_oid = /
s/Attr reset_objdid = /Attr reset_oid = /
s/pwrb:Class-Ai_AI32uP/SsabOx:Class-Ai_AI32uP/
s/pwrb:Class-Ai_HVAI32/SsabOx:Class-Ai_HVAI32/
s/pwrb:Class-Ao_AO8uP/SsabOx:Class-Ao_AO8uP/
s/pwrb:Class-Ao_HVAO4/SsabOx:Class-Ao_HVAO4/
s/pwrb:Class-Co_CO4uP/SsabOx:Class-Co_CO4uP/
s/pwrb:Class-Co_PI24BO/SsabOx:Class-Co_PI24BO/
s/pwrb:Class-Di_DIX2/SsabOx:Class-Di_DIX2/
s/pwrb:Class-Do_HVDO32/SsabOx:Class-Do_HVDO32/
s/NMps:Class-RemTransSend/Remote:Class-RemTransSend/
s/NMps:Class-RemTransRcv/Remote:Class-RemTransRcv/
/PlcProgram$/{
N
N
h
s/Attr objdid = /Attr oid =/
s/Attr classid = /Attr cid =/
}
/PlcWindow$/{
N
N
h
s/Attr objdid = /Attr oid =/
s/Attr classid = /Attr cid =/
}
/PlcNode$/{
N
N
h
s/Attr classid = /Attr cid =/
}
/PlcConnection$/{
N
N
N
h
s/Attr objdid = /Attr oid =/
s/Attr classid = /Attr cid =/
}
' $1 > $2
BEGIN {
innum = 0;
inbody = 0;
par = "";
}
{
if ( $3 == "CStoNumSp") {
innum = 1;
inbody = 0;
}
if ( innum) {
if ( $1 == "Body" && $2 == "DevBody") {
inbody = 1;
}
if ( inbody) {
if ( $1 == "EndBody") {
printf( "Attr Object = \"%s\"\n", par);
printf( "%s\n", $0);
innum = 0;
}
else if ( $1 == "EndObject") {
innum = 0;
printf( "%s\n", $0);
}
else if ( $1 == "Attr" && $2 == "Object") {
par = substr( $4, 2, length($4)-2);
}
else if ( $1 == "Attr" && $2 == "Parameter") {
par = par "." substr($4,2,length($4)-2);
printf( "Attr Object = \"%s\"\n", par);
innum = 0;
}
else {
printf( "%s\n", $0);
}
}
else {
printf( "%s\n", $0);
}
}
else {
printf( "%s\n", $0);
}
}
This diff is collapsed.
#!/bin/bash
#
# Proview $Id: wb_rtt_appl.sh,v 1.4 2005-09-01 14:57:49 claes Exp $
# Copyright (C) 2005 SSAB Oxelsund AB.
#
# 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 the program, if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
#
# Link rtt application
#
#
name=$1
action=$2
is_rttsys=$3
opsys=$4
menuname=dtt_appl_${name}_m
applname=ra_rtt_${name}
exename=ra_rtt_${name}
arname=ra_rtt_${name}.a
arname_pict=ra_rtt_${name}_pict.a
if [ $is_rttsys = "0" ]
then
# echo "Not rttsys"
if [ $action = "1" ]
then
# echo "Link"
if [ ! -e $pwrp_lib/${arname} ]
then
# echo "Creating archive $arname"
ar rc $pwrp_lib/${arname}
fi
if [ ! -e $pwrp_lib/${arname_pict} ]
then
# echo "Creating archive $arname_pict"
ar rc $pwrp_lib/${arname_pict}
fi
#link option file exists and is not empty
if [ -s $pwrp_exe/ra_rtt.opt ]; then
ld_opt_tmp="`cat $pwrp_exe/ra_rtt.opt`"
ld_opt="`eval echo $ld_opt_tmp`"
else
ld_opt=""
fi
cc=gcc
cinc="-I$pwr_inc -I$pwrp_rttbld -I-"
cflags="-DOS_FREEBSDOS=1 -DOS=freebsd -DHW_X86_64=1 -DHW=x86_64 -O3 -DGNU_SOURCE -DPWR_NDEBUG -D_REENTRANT"
${cc} -c -o $pwrp_obj/${menuname}.o \
$pwrp_rttbld/${menuname}.c \
${cinc} ${cflags}
ld=g++
linkflags="-g -L/lib/thread -L$pwrp_lib -L$pwr_lib"
${ld} ${linkflags} -o $pwrp_exe/${exename} $pwrp_obj/${menuname}.o \
$pwr_obj/dtt_rttsys.o $pwr_obj/rt_io_user.o \
$pwrp_lib/${arname_pict} $pwrp_lib/${arname} \
$ld_opt \
-lpwr_dtt\
-lpwr_rt -lpwr_co -lpwr_flow -lpwr_msg_dummy -lrpcsvc -lpthread -lm -lrt -lcrypt
fi
if [ $action = "2" ]
then
# echo "Compile"
cc=gcc
cinc="-I$pwr_inc -I$pwrp_rttbld -I$pwrp_inc -I$pwrp_cmn/common/inc -I-"
cflags="-DOS_FREEBSD=1 -DOS=freebsd -DHW_X86_64=1 -DHW=x86_64 -O3 -DGNU_SOURCE -DPWR_NDEBUG -D_REENTRANT"
${cc} -c -o $pwrp_obj/${applname}.o \
$pwrp_rtt/${applname}.c \
${cinc} ${cflags}
ar rc $pwrp_lib/${arname} $pwrp_obj/${applname}.o
fi
fi
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment