This file is indexed.

/usr/lib/exmh/folderNew.tcl is in exmh 1:2.8.0-6.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
# folderNew.tcl
#
# New folder dialog
#
# Copyright (c) 1993 Xerox Corporation.
# Use and copying of this software and preparation of derivative works based
# upon this software are permitted. Any distribution of this software or
# derivative works must comply with all applicable United States export
# control laws. This software is made available AS IS, and Xerox Corporation
# makes no warranty about the software, its performance or its conformity to
# any specification.

proc FolderDialogInner {path label cancelProc okProc message} {
    global mhProfile exwin exmh

   set t $path
   if [Exwin_Toplevel $path $label FolderDialog nomenu] {
	wm transient $t

	Widget_Message $t msg -aspect 400 -text $message
	set f [Widget_Frame $t name Rim]
	$f configure -bd 10
	set f [Widget_Frame $f rim LabeledEntry]
	Widget_Label $f label {left} -text "Folder Name:"
	set e [Widget_Entry $f name {right fill}]
	Widget_BindEntryCmd $e <Return> "$okProc $path $e"

	set f [Widget_Frame $t but Rim]
	$f configure -bd 10
       Widget_AddBut $f cancel "Cancel" [list $cancelProc $path] {left filly}
       Widget_AddBut $f ok "OK" [list $okProc $path $e] {right filly}
    } else {
	$t.msg config -text $message
	set e $path.name.rim.name
    }
    focus $e
}

proc Folder_New {} {
    global mhProfile exmh

    FolderDialogInner .newf "Create Folder" Exwin_Dismiss FolderNewCommit \
"Creating a new folder results in a new directory under $mhProfile(path).
Nested folders are allowed.
You need NOT put a + before the folder name.
@ is shorthand for the current folder, so
@foo => $exmh(folder)/foo"
}

proc FolderNewCommit { top entry } {
    global mhProfile exmh
    set name [string trim [$entry get]]
    if {[string length $name] == 0} {
	Exmh_Status "Please enter a folder name"
	return
    }
    if [regexp { } $name] {
	Exmh_Status "NO SPACES in folder names" error
	return
    }
    if [regexp {^[0-9]+$} $name] {
	Exmh_Status "No pure NUMBERS for folder names" error
	return	
    }
    if [regexp {^@(.*)} $name all newname] {
	set name $exmh(folder)
	if {[string length $newname] > 0} {
	    set name $name/$newname
	}
    }
    set components [split $name /]
    set path $mhProfile(path)
    foreach comp $components {
	append path /$comp
	if [file isdirectory $path] {
	    continue
	}
	if [file exists $path] {
	    Exmh_Status "Non-directory $path already exists" warning
	    Exwin_Dismiss $top
	    return
	}
	if [catch {file mkdir $path} msg] {
	    Exmh_Status "mkdir $path: $msg"
	    Exwin_Dismiss $top
	    return
	}
	if {[catch {
	    close [open [file join $path .mh_sequences] w]
	    if [info exists mhProfile(folder-protect)] {
		file attributes $path/.mh_sequences -permissions 0$mhProfile(folder-protect)
	    }
	} msg]} {
	    Exmh_Debug ".mh_sequences: $msg"
	}
	if [info exists mhProfile(folder-protect)] {
	    file attributes $path -permissions 0$mhProfile(folder-protect)
	}
    }
    Exmh_Status "Created folder $name"
    Flist_AddFolder $name
    Fcache_Folder $name
    Exwin_Dismiss $top
    return
}

proc Folder_Delete {} {
    global mhProfile exmh

    FolderDialogInner .delf "Delete Folder" Exwin_Dismiss FolderDelCommit \
"Only folders with no messages can be deleted.
You need NOT put a + before the folder name.
@ is shorthand for the current folder, so
@foo => $exmh(folder)/foo"
}

proc FolderDelCommit { top entry } {
    global mhProfile exmh
    set name [string trim [$entry get]]
    if {[string length $name] == 0} {
	Exmh_Status "Please enter a folder name"
	return
    }
    if [regexp {^@(.*)} $name all newname] {
	set name $exmh(folder)
	if {[string length $newname] > 0} {
	    set name $name/$newname
	}
    }
    set path $mhProfile(path)
    if [catch {Mh_Path $name new} nextid] {
	Exmh_Status "Cleaning up folder $name"
	Flist_DelFolder $name
	Fcache_FolderDiscard $name
	Glimpse_Delete $name
	Exwin_Dismiss $top
	return
    }
    if {[file tail $nextid] == 1} {
	File_Delete $path/$name/.xmhcache
	foreach nfsjunk [glob -nocomplain $path/$name/.nfs*] {
	    File_Delete $nfsjunk
	}
	if [catch {exec rmf +$name -nointeractive} err] {
	    Exmh_Status $err
	} else {
	    Exmh_Status "Deleted folder $name"
	    Flist_DelFolder $name
	    Fcache_FolderDiscard $name
	    Glimpse_Delete $name
	}
    } else {
	Exmh_Status "Still messages in +$name"
    }
    Exwin_Dismiss $top
    return
}