version_path.awk (1130B)
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 envdep_path(name) { 10 if(!length(linkdep_list)) { 11 print "version_path.awk: Fatal: 'linkdep_list' variable not specified" >"/dev/stderr" 12 exit 2 13 } 14 print name >>linkdep_list 15 return get_package_path("system-config") "/deps/" name 16 } 17 18 function exec_path(name) { 19 return envdep_path("command/"name) 20 } 21 22 function q(s) { # quote string for execline 23 gsub(/\\/, "\\\\", s) 24 gsub(/\n/, "\\n", s) 25 gsub(/\"/, "\\\"", s) 26 return "\"" s "\"" 27 } 28 29 function qexec(s) { 30 return q(exec_path(s)) 31 } 32 33 function qdep(s) { 34 return q(envdep_path(s)) 35 } 36 37 function config_path(name) { 38 return get_package_path("system-config") "/config/" name 39 } 40 41 function qconfig(s) { 42 return q(config_path(s)) 43 } 44 45 function env_enter(name) { 46 return get_package_path(name)"/command/pthbs-enter" 47 } 48 49 function qenv(s) { 50 return q(env_enter(s)) 51 } 52 53 function env_el(s) { 54 return env_enter(s)"-execlineb" 55 } 56 57 function env_sh(s) { 58 return env_enter(s)"-sh" 59 }