File: path.template

package info (click to toggle)
dotfile 1%3A2.4-1
  • links: PTS
  • area: main
  • in suites: potato
  • size: 5,472 kB
  • ctags: 523
  • sloc: tcl: 14,072; sh: 918; makefile: 177; lisp: 18; ansic: 7
file content (133 lines) | stat: -rw-r--r-- 3,968 bytes parent folder | download | duplicates (3)
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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
### Copyright (C) 1996 Per Zacho
### 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 this program; if not, write to the Free Software
### Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

proc path {} {
    # System<->Bash interface / Paths

    Desc "This configuration page will help you to setup command-, CD- and manualpaths."

    ShortDesc "Paths"

    ### Command path ###

    Header head1 -text "Command path"\
	    -background gray\
	    -help "Setup of command path--where to search for commands/programs (executables)."

    Dir-Browser comPathEntry -text "Path"
    ExtEntry comPath -text ""\
	    -entries frame_comPathEntry\
	    -help "This is the path, where a command/program can be found. Remember to"\
	    "write the complete name of each element in the path, including the prefix slash (/)."\
	    -export 0

    Command readComPath -setvalue {$widget configure -text "Load path from system"}\
	    -invoke {
	if {[info exists env(PATH)]} {
	    foreach elm [split $env(PATH) ":"] {
		AddTuple comPath
		set comPathEntry $elm
		set com_comPathEntry $elm
	    }
        }
    }
	    
    ### CD path ###

    Header head2 -text "\"Change Directory\" path"\
	    -background gray\
	    -help "Setup of where \"cd\" is to search for subdirs."

    Dir-Browser cdPathEntry -text "Path"
    ExtEntry cdPath -text ""\
	-entries frame_cdPathEntry\
	-help "This is the path, where a specific subdir can be found. Remember to"\
	"write the complete name of each element in the path, including the prefix slash (/)."\
	-export 0

    ### Manual path ###

    Header head3 -text "Manual path"\
	    -background gray\
	    -help "Setup of where \"man\" is to search for manual pages."

    Dir-Browser manPathEntry -text "Path"
    ExtEntry manPath -text ""\
	-entries frame_manPathEntry\
	-help "This is the path, where manual pages can be found. Remember to"\
	"write the complete name of each element in the path, including the prefix slash (/)."\
	-export 0

    Command readManPath -setvalue {$widget configure -text "Load path from system"}\
	    -invoke {
	if {[info exists env(MANPATH)]} {
	    foreach elm [split $env(MANPATH) ":"] {
		AddTuple manPath
		set manPathEntry $elm
		set com_manPathEntry $elm
	    }
        }
    }

    ### Security precautions ###

    Header head4 -text "Security precautions"\
	    -background gray

    Label label1 -text "When setting up your command/program path,\nplease bear in mind, that putting your personal 'bin'\n(or any other of your directories, for that sake)\ndirectory in front of the path, will cause a security\nbreach. Therefore, append new directories at\nthe end of the path."

    Save {
	### Command path ###
	set temp ""
	forevery comPath {
	    if {$comPathEntry != ""} {
		append temp "$comPathEntry:\\\n"
	    }
	}
	set temp [string trim $temp ":\\\n"]
	if {$temp != ""} {
	    print "PATH=\\\n$temp"
	    print "export PATH"
	}

	### CD path ###
	set temp ""
	forevery cdPath {
	    if {$cdPathEntry != ""} {
		append temp "$cdPathEntry:\\\n"
	    }
	}
	set temp [string trim $temp ":\\\n"]
	if {$temp != ""} {
	    print "CDPATH=\\\n$temp"
	    print "export CDPATH"
	}

	### Manual path ###
	set temp ""
	forevery manPath {
	    if {$manPathEntry != ""} {
		append temp "$manPathEntry:\\\n"
	    }
	}
	set temp [string trim $temp ":\\\n"]
	if {$temp != ""} {
	    print "MANPATH=\\\n$temp"
	    print "export MANPATH"
	}
    }
}