So, I have here, a mostly complete shortcut proc, so users can do like ~cs add word definition. To use it, they simply envoke ?word and get "definition". Problem is, I have no way to make sure the word they give doesn't already exist in the file. Every combination of while {[gets..., foreach, regex and string trim have failed.
There are two parts I need this kind of functionality: in the add { switch and then again in the list { switch section. They differ slightly, but I need a way to match only against the first element in $line.
Problem #2. For some reason, the while {[gets $fs line] >= 0} { line in add { switch does not loop through each line. I tried to make it notice me each line, but it would not. The one is list { is nearly identical, and it will at least notice me properly. But i also need that section to check index one of each line to see if it exists. if so, display 1 end.
http://paste.tclhelp.net/?id=7dr
Help is appreciated. :)