-
Notifications
You must be signed in to change notification settings - Fork 3
/
_Config.bat
111 lines (102 loc) · 3.52 KB
/
_Config.bat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
@ECHO OFF
SETLOCAL ENABLEDELAYEDEXPANSION&::(Don't pollute the global environment with the following)
::**********************************************************************
SET $NAME=%~n0
SET $DESCRIPTION=Global configuration file
SET $AUTHOR=Erik Bachmann, ClicketyClick.dk [[email protected]]
SET $SOURCE=%~f0
::@(#)NAME
::@(-) The name of the command or function, followed by a one-line description of what it does.
::@(#) %$NAME% -- %$DESCRIPTION%
::@(#)
::@(#)SYNOPSIS
::@(-) In the case of a command, a formal description of how to run it and what command line options it takes.
::@(-) For program functions, a list of the parameters the function takes and which header file contains its definition.
::@(-)
::@(#) CALL %$NAME%
::@(#)
::@(#)OPTIONS
::@(-) Flags, parameters, arguments (NOT the Monty Python way)
::@(#) -h Help page
::@(#)
::@ (#)
::@(#)DESCRIPTION
::@(-) A textual description of the functioning of the command or function.
::@(#) Setting up global vars needed by most scripts like logging, trace etc.
::@(#)
::@ (#)EXAMPLES
::@(-) Some examples of common usage.
::@ (#)
::@ (#)
::@ (#)
::@ (#)EXIT STATUS
::@(-) Exit status / errorlevel is 0 if OK, otherwise 1+.
::@ (#)
::@(#)ENVIRONMENT
::@(-) Variables affected
::@(#) _LogFile Location of log file
::@(#) _TraceFile Location of trace file
::@(#) _LOG_ Log command
::@(#) _TRACE_ Trace command
::@(#) _FINAL_ Footer
::@(#)
::@ (#)FILES,
::@(-) Files used, required, affected
::@ (#)
::@ (#)
::@ (#)BUGS / KNOWN PROBLEMS
::@(-) If any known
::@ (#)
::@ (#)
::@(#)REQUIRES
::@(-) Dependecies
::@(#) _Debug.cmd Setting up debug environment for batch scripts
::@(#) _GetOpt.cmd Parse command line options and create environment vars
::@(#) _utc.cmd
::@(#)
::@ (#)SEE ALSO
::@(-) A list of related commands or functions.
::@ (#)
::@ (#)
::@ (#)REFERENCE
::@(-) References to inspiration, clips and other documentation
::@ (#) Author:
::@ (#) URL: http://en.wikipedia.org/wiki/Man_page
::@ (#)
::@(#)
::@(#)SOURCE
::@(-) Where to find this source
::@(#) %$Source%
::@(#)
::@ (#)AUTHOR
::@(-) Who did what
::@ (#) %$AUTHOR%
::*** HISTORY **********************************************************
::SET $VERSION=xx.xxx&SET $REVISION=YYYY-MM-DDThh:mm&SET $COMMENT=Description/init
::SET $VERSION=2015-02-19&SET $REVISION=00:00:00&SET $COMMENT=Initial/ErikBachmann
SET $VERSION=2015-10-08&SET $REVISION=16:00:00&SET $COMMENT=GetOpt: Calling usage and exit on error / ErikBachmann
::**********************************************************************
::@(#)(C)%$Version:~0,4% %$Author%
::**********************************************************************
ENDLOCAL
CALL "%~dp0\_DEBUG"
CALL "%~dp0\_Getopt" %*&IF ERRORLEVEL 1 EXIT /B 1
CALL "%~dp0_utc" > nul
SET _LOGFILE=%TMP%\%$NAME%.%DTS%.log
SET _TraceFile=%TMP%\%$NAME%.trc.%DTS%.txt
SET _LOG_=^>^>"%_logFile%" 2^>^&1 ECHO:
SET _TRACE_=^>^>"%_TraceFile%" 2^>^&1 ECHO:
::SET _Servers=Helge Frode, Calm, Arena, Adlib
::SET _Servers=HELGE FRODE, CALM, ARENA
::SET _SourceDir=%~dp0\bib-it\scripts.archive\
:: Header
FOR %%A IN ( ^&2 "%_LogFile%" "%_TraceFile%" ) DO (
ECHO:%$NAME% - %$DESCRIPTION%
ECHO:%Date% %Time% start
ECHO:
)>%%A
:: Footer
SET _FINAL_=FOR %%a IN ( CON: "%_LogFile%" "%_TraceFile%" ) DO ^
( ECHO:^&ECHO:%$NAME% %Date% %Time% Done )^>^>%%a
::*** End of File ******************************************************