version_path.awk (1010B)
1 function get_package_path(name) { 2 if(!("pthbs_path_"name in ENVIRON)) { 3 print "version_path.awk: Fatal: path for package '"name"' not specified" >"/dev/stderr" 4 exit 2 5 } 6 return ENVIRON["pthbs_path_"name] 7 } 8 9 function exec_path(name) { 10 if(!length(execfile)) { 11 print "version_path.awk: Fatal: 'execfile' variable not specified" >"/dev/stderr" 12 exit 2 13 } 14 print name >>execfile 15 return get_package_path("system-config") "/deps/command/" name 16 } 17 18 function q(s) { # quote string for execline 19 gsub(/\\/, "\\\\", s) 20 gsub(/\n/, "\\n", s) 21 gsub(/\"/, "\\\"", s) 22 return "\"" s "\"" 23 } 24 25 function qexec(s) { 26 return q(exec_path(s)) 27 } 28 29 function config_path(name) { 30 return get_package_path("system-config") "/config/" name 31 } 32 33 function qconfig(s) { 34 return q(config_path(s)) 35 } 36 37 function env_enter(name) { 38 return get_package_path(name)"/command/pthbs-enter" 39 } 40 41 function qenv(s) { 42 return q(env_enter(s)) 43 } 44 45 function env_el(s) { 46 return env_enter(s)"-execlineb" 47 } 48 49 function env_sh(s) { 50 return env_enter(s)"-sh" 51 }