File: modinfo.awk

package info (click to toggle)
runawk 1.6.1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 712 kB
  • sloc: awk: 1,127; ansic: 736; sh: 420; makefile: 103
file content (39 lines) | stat: -rw-r--r-- 764 bytes parent folder | download | duplicates (4)
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
# Written by Aleksey Cheusov <vle@gmx.net>, public domain
#
# This awk module is a part of RunAWK distribution,
#        http://sourceforge.net/projects/runawk
#    
############################################################

# =head2 modinfo.awk
#
# This module provides the following variables
#
# =over 2
#
# =item I<MODC>
#
# A number of modules (-f <filename>) passed to an awk interpreter
#
# =item I<MODV>
#
# Array with [0..MODC) indexes of those modules
#
# =item I<MODMAIN>
#
# Path to the main module, i.e. program filename
#
# =back
#
# See example/demo_modinfo for the sample of usage
#

BEGIN {
	MODC = ENVIRON ["RUNAWK_MODC"] + 0 # force to number

	for (i=0; i < MODC; ++i){
		MODV [i] = ENVIRON ["RUNAWK_MODV_" i]
	}

	MODMAIN = MODV [MODC-1]
}