1tcsh Windows NT version 2----------------------- 3 4You can get current binaries for this version of tcsh from 5ftp.blarg.net:users/amol/tcsh. 6 7-------------------------------------------------------------------------- 8NT sources for tcsh can be now found in the same place as 9the unix tcsh sources, via anonymous ftp from ftp.astron.com. 10The location is /pub/tcsh. 11 12Files to get: 13 14tcsh-6.xx.tar.gz - Basic Unix source 15tcsh-6.xxwin32src.tar.gz - Extracts into "win32" subdirectory of basic source. 16 17Pre-compiled binaries and html docs for Alpha and x86 can also be 18found in the same location. 19-------------------------------------------------------------------------- 20 21Send comments/bug-fixes/questions to amol@blarg.net 22 23(Any requests to make tcsh more like DOS shells will be ignored. If you 24like DOS shells, use them. tcsh provides unix shell behaviour on windows, 25not the other way around.) 26 27Please do not ask me general shell questions either. If you've never 28used a unix shell, read the man pages and docs. Read the comp.unix.shell 29FAQ. 30 31Bug reports that do not contain your operating system type will 32also be ignored. 33 34Bug reports that can be solved by reading the docs or README.NT will be 35ignored as well. 36 37Microsoft Corporation has nothing to do with this code. It is not supported in 38any fashion by Microsoft. 39 40----------------------------------------------------------------------------- 41This is NOT a Cygwin gcc version. It will not compile with Cygwin gcc or 42work seamlessly with Cygwin apps. Do NOT ask me to hack support for Cygwin 43'mount points' unless you are willing to provide the translation code. 44 45To prevent Cygwin applications from expanding wildcards, set the environment 46variable CYGWIN to "noglob". i.e., in your .tcshrc, put a line like this: 47 48setenv CYGWIN noglob 49 50(Cygwin applications assume that if they are not started from a shell 51using the Cygwin runtime, the parent shell does not have the ability to glob. 52This is visible as tcsh apparently expanding wildcards for quoted arguments.) 53 54----------------------------------------------------------------------------- 55 56All paths MUST be '/'-delimited. Do not expect the shell to work with 57DOS-style paths. 58 59 60Compiling: 61--------- 62You will need sed to generate some headers. 63 64You must extract the win32src.tar.gz into a subdirectory of the basic 65unix source. 66 67tcsh currently only compiles with Microsoft Visual C++ (2.0 and greater) on 68x86 or Alpha platforms. Simply copy config/win32 to config.h and 69win32/makefile.win32 to the base directory. 70 71run nmake -f makefile.win32 72 73If you plan to contribute changes, PLEASE read the file CODING 74 75(Note: This distribution does not have a VC project. To compile the shell, 76you will need to open a cmd.exe/command.com window, run vcvars32.bat from 77your VC bin subdirectory and then run nmake as above). 78 79 80 81Known Bugs: 82---------- 83* Horizontal scrolling is completely busted. 84* The 'time' builtin does not work. 85 86* There is a hard limit of 64Kb on the size of the command line. This is 87 an os-specific limit and cannot be changed. 88 89* Launching applications via explorer associations is slow if the argument 90 list is large. 91 92----------------------------------------------------------------------------- 93* This section only documents features specific to Windows NT/95 or 94* behaviour that is different from the Unix version. For complete tcsh 95* documentation, please read the man pages or html docs. 96----------------------------------------------------------------------------- 97 98Version numbers below refer to the tail end of the $version variable, 99containing the NT-specific version. For example, 100 101tcsh 6.09.00 (Astron) 1999-08-16 (i586-Microsoft-Windows2000) options 8b,nls,dl,hb,color,nt-rev-5.40 102 103In this case, the NT-specific version is 5.40 104 105 106Environment Variables: 107--------------------- 108Environment variables are case-insensitive on NT. tcsh as of 5.33 has 109also been changed to reflect this behaviour. Thus, 110 111setenv FOO bar 112 113and, 114 115setenv foo bar 116 117are equivalent. 118 119Note that the *value* is, of course, not case-insensitive. 120 121 122Features 123-------- 124 125* No backgrounding/job control. Use 'start' instead 126 127 You can also use 128 <foo> & 129 or, 130 nohup <foo> & 131 132 where <foo> is some arbitrary command. 133 134DO NOT start console apps with & unless u want them to read/write to your 135console. (A "console app" is any 32-bit application that is not GUI based.) 136 137(nohup foo & will say "foo Done" pretty quickly, but ignore that. There is no 138way for the shell to know when the nohupped process dies. Your job may still 139be running in the background.) 140 141* Filenames in the directories under WINNT (or WINDOWS or whatever you call 142 your windows directory) are hashed only if they are .EXE. 143 Names which are uppercase (For example, CALC.EXE) will also be hashed as 144 lowercase,without extension. Thus, "where calc" as well as 145 "where CALC.EXE" will work. 146 147(Explanation: tcsh uses a hashtable to track the location of executables. By 148default on Unix, all the files in every path element are hashed. Since the 149SystemRoot on NT has hundreds of junk files, tcsh will only hash .EXE files. 150This hashing is, of course, case-sensitive. Thus CALC.EXE hashes to a 151different value than calc.exe would. To enable the shell to work in a Windows 152environment, tcsh will hash CALC.EXE as CALC.EXE as well as "calc"). 153 154 155Special Variables 156----------------- 157* The tcsh "complete" variable can be set to igncase and will cause the shell 158 to ignore case in completion. This is slightly different from 159 the behaviour of complete=enhance, which should still work as before. 160 161* oldtitle: 162 163 Stores the previous value of the console title, when you use 164 the title builtin below. Use it like so: 165 166 title "$oldtitle" 167 168 to restore the previous title. 169 170* NTlamepathfix: 171 172 When set, '/'-s in the PATH environment variable will be 173 changed to '\'. This helps applications started within tcsh that may 174 not handle Unix-style PATHs. 175 176* NTslowexec: 177 178 When set, this variable disables attempts to save a fork() by 179 directly executing simple commands. "Simple" command means one which is 180 interactive and not piped, niced, nohupped etc. redirecting output of 181 a command also disables this optimization. 182 183 Since this shortcut feature is new, the variable provides a way to retain 184 backward compatibility. It may be taken out at some time in the future, if 185 the shell is found to be stable enough. 186 187 If you see problems like the shell seeming to expand wildcards when it 188 shouldn't, or other substitutions which should be quoted, set this 189 variable and see if that fixes the problem. 190 191* NTnoquoteprotect: 192 193 Ordinarily , if you pass a double quote to a command string, tcsh 194 will protect the quotes by adding backslashes. For example, 195 196 find . -name '"*.c"' 197 would get executed as 198 199 find . -name \"*.c\" 200 201 Some applications (MKS find, for example) do not like the '\'. To 202 prevent tcsh from quoting such arguments, set this variable. 203 204 Of course, it may cause other applications to break, so use at 205 your own risk. 206 207* NTcaseifypwd: 208 209 If set, corrects case of current directory when cd'ing into it. Apparently, 210 some "filesystems" can't handle the default behaviour. Only works on 211 Windows NT. 212 213* TCSHSUBSTHB (Environment, NOT shell variable): 214 215 Specifies mappings for hashbang emulation. Should be ';'-separated pairs 216 of blank-separated mappings. 217 218 For example, 219 220 setenv TCSHSUBSTHB "/usr/local/bin/perl c:/bin/perl.exe;" 221 222 will substitute #!c:/bin/perl.exe for scripts which have 223 #!/usr/local/bin/perl at the top. 224 225 The final ';' MUST be included. I don't check for errors too 226 carefully, so it's up to you to supply the exact sequence. 227 There is a hardcoded limit of 20 such pairs. 228 229 230* TCSHONLYSTARTEXES (Environment variable): 231 232 Can be set on the fly and controls whether associations will be tried 233 for non-executables. 234 235 ("Associations" here means Explorer file-type associations, that cause, 236 for example, Microsoft Word to be launched when you type "foo.doc" at 237 a command prompt. That can have unexpected side-effects like batch files 238 and perl scripts launching in another window when run from tcsh. ) 239 240 Any changes to this variable will NOT affect the the "start" builtin. 241 This builtin ALWAYS launches associations, since the whole point of 242 using "start" is to not block the current shell. 243 244 You can also supply a semi-colon-separated list of extensions for 245 which to NOT try associations. For example, if the variable is set to 246 247 "cmd;bat", 248 249 .cmd/.bat files will be executed in the same window because the default 250 association is not used, instead an internal hack feeds them to the 251 DOS command processor. 252 253 If the file extension does not match the list, the shell will try to 254 launch an association. 255 256 o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o- 257 258 To achieve the old behaviour of this setting, you must set the 259 variable to a 1-character value.i.e., 260 261 setenv TCSHONLYSTARTEXES 262 263 should be replaced by 264 265 setenv TCSHONLYSTARTEXES 1 266 267 This setting, as before, will prevent tcsh from trying associations 268 for ANY non-executable. 269 270 (a zero-length setting will not work. A length greater than 1 will 271 be assumed to be a list of extensions as above.) 272 273 o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o- 274 275 276 277* TCSH_NOASYNCGUI (Enviroment variable): 278 279 Makes tcsh wait for win32 GUI apps to terminate, instead of returning 280 immediately. This affects child processes, so it can be set/unset in 281 the parent shell at any point. 282 283 284NT-specific Builtins 285-------------------- 286* start: like cmd.exe's start 287* title: change the shell title 288* cls: Clear the entire console buffer instead of just the visible window. 289* ps: list processes running currently. With -w, list window titles as well. 290 291* shutdown: (works on Windows NT only) 292 293 shutdown -[r|l|f] now 294 295(Even though no time argument is supported, "now" must be specified, EXCEPT 296with -l .This is to prevent you from accidentally shutting the machine down.) 297 -r reboots, -l logs you off and -f forces apps to terminate. 298 299The default action is to shut the machine down. 300 301 302* sourcerc: tcsh can be compiled with a stringtable resource that can be 303 sourced using this command. This feature is designed as a way to avoid 304 having to copy the .tcshrc to every computer you run tcsh on. The default 305 resource is a simple version of my .tcshrc. More complicated settings can 306 then be copied when needed. 307 308* printrc: print the compiled-in resource that will be sourced by sourcerc. 309 310 311Notes: 312----- 313* You should probably get the Cygwin utilities from http://cygwin.com 314 315 Things like 'ls' and 'cat' are useful, since we don't have a 'type' or 'dir' 316 anymore. 'ls' is pretty much a requirement unless you never do 'ls -l'. 317 318 319* tcsh was compiled with Visual C++ >= 4.2. I don't guarantee it will compile 320 with any other compilers, but it should. It will *not* compile with the 321 Cygwin gcc port, so don't even tell me about it. 322 323* It should be pointed out that there is also a Cygwin version of tcsh that 324 will compile with gcc and provide all the other features emulated by the 325 Cygwin runtime (like job control, signals, etc.). So, if you are looking for 326 a way to pretend that you are on Unix, you should use that version. 327 The same holds true for UWIN as well. 328 329 330Startup Files: 331-------------- 332 333For Windows 95: 334 <windows_directory>/.tcshrc 335 For Example, C:\WINDOWS\.tcshrc 336 337For Windows NT: 338 version 3.51: <getenv(HOMEDRIVE)/getenv(HOMEPATH)/.tcshrc> 339 Usually something like C:\USERS\DEFAULT\.tcshrc 340 341 version 4.00: <getenv(USERPROFILE)/.tcshrc) 342 Usually something like C:\WINNT\USERS\amold\profile\.tcshrc 343 344These can all be overridden by setting HOME in the user's environment 345 346 347 348* TCSHLANG: NLS support 349 350You can get messages in a specific language by doing: 351 352 setenv TCSHLANG <dll>, where <dll> is the name of the NLS dll. 353 354tcsh comes with: 355 356 tcshde.dll -> German 357 tcshfr.dll -> French 358 tcshsp.dll -> Spanish 359 tcsh-it.dll -> Italian 360 361 tcshc.dll => Default "C" locale 362 363You can change the dll at runtime by setting/unsetting this variable. 364 365You can specify the DLL name, or the complete path, if it is not in your 366standard search path. 367 368(Using tcshc.dll is useless and adds unnecessary overhead. If you are 369using English versions, do not install the dlls) 370 371 372Virtual key code bindings: 373------------------------- 374To use keys like function keys, arrows, insert, etc., the following 375form of bindkey must be used: 376 377bindkey -b N-xxx <command> 378 379where xxx is either: 380 a) A number from 1 through 24, representing the fucntion keys. 381 For example, bindkey -b N-1 run-help 382 383 b) The strings "pgup","pgdown","end","home", "left","up","right","down", 384 "ins","del" 385 For example, bindkey -b N-del delete-char 386 387Here are the bindings I use in my .tcshrc: 388 389# NT specific bindkey extensions 390 bindkey -b N-up up-history 391 bindkey -b N-down down-history 392 bindkey -b N-right forward-char 393 bindkey -b N-left backward-char 394 bindkey -b N-del delete-char 395 bindkey -b N-ins overwrite-mode 396 bindkey -b N-1 which-command 397 bindkey -b N-2 expand-history 398 bindkey -b N-3 complete-word-raw 399 bindkey -b N-home beginning-of-line 400 bindkey -b N-end end-of-line 401 402 bindkey -b N-pgup e_page_up 403 bindkey -b N-pgdown e_page_down 404 405(Note that on Win9x, you must set your console window to NOT be Auto 406sized, and you must use the "settc" builtin to increase and then reduce 407back the number of lines, in order to get a scrollbar. pgup and 408pgdown will not work without a scroll bar) 409 410 411To bind ctrl or alt combinations, use the following as examples. 412 413 bindkey -b N-C-left backward-word 414 bindkey -b N-M-right forward-word 415 416For Shift combinations: 417 bindkey -b N-S-1 backward-word 418 419Clipboard support 420----------------- 421Since version 3.58, you can cut and paste to and from the clipboard 422directly from the shell. To do this, use bindings like the following: 423 424 bindkey -b M-x e_copy_to_clipboard 425 bindkey -b M-y e_paste_from_clipboard 426 427Then, to paste text from the clipboard into the current input line, you 428can type: 429 M-y 430And to copy the current shell's kill buffer to the clipboard, 431 M-x 432 433(The kill buffer contains the last deletion from an editing command. Sort 434of like an 'undo' buffer). 435 436You can also use the clipboard to redirect I/O, with /dev/clipboard as 437the destination/source file. 438 439 440NOTE: From version 6.00 onwards, the e_paste operation does NOT copy the 441clipboard contents to the shell kill buffer. 442 443 444 445e_dosify_next 446------------- 447A key bound to this editor function can be used to convert unix-style 448paths to DOS-style paths. 449For example, 450 bindkey -b M-/ e_dosify_next 451Then, if I had line like so: 452 xcopy /e /u c:/nt40/system32 453I would move the cursor to the C: and hit alt-/. magically, the command 454line changes to 455 xcopy /e /u c:\\nt40\\system32 456 457This function converts every '/' to '\\' until the first space. If the 458space is escaped by a '\', the function looks for the next space. 459 460e_dosify_prev 461------------- 462Works like above, but on the previous word. Matt Landau pointed out that 463this was much more convenient. 464 465e_page_up 466--------- 467Editor function to move console window up one page. Can be bound to 468PageUp key. 469 470e_page_down 471---------- 472Ditto for page down. 473 474 475Literal Prompt Characters 476------------------------- 477tcsh uses a special syntax for embedding literal character sequences in the 478prompt. For example, ANSI escapes. 479Thus, if you did 480set prompt='%{<ESC>[44mfoo%}\>', 481this will print the prompt in the appropriate colors. 482 483The color-ls patch in 6.07.09 implements parsing for ANSI escapes. To keep 484the prompt specification consistent with the availablity of this feature, 485the literal string will now accept ANSI escapes like color-ls would. 486 487The shell can be compiled for the old behaviour, but I don't recommend it. 488 489I'm aware this is a major incompatibility, but I think the change is 490worthwhile. 491 492As an example, here is my new prompt, with the old one as a reference. 493 494#old specification 495# set prompt='%{f9%}%c03%{gg%}\>' 496# set prompt3 = '%{fc%}Correct to %R ?(y|n|e)%{gg%} ' 497 498# new spec. 499 set prompt='%{^[[1;34m%}%c03%{^[[0m%}\>' 500 set prompt3='%{^[[1;31m%}Correct to %R ?(y|n|e)%{^[[0m%} ' 501# 502# 503 504ls-F is noticeably slow if color is set. This is especially true on slower 505machines (P100, for example). You may not want to set it for those kinds 506of systems. More so if you already have an external color-ls. 507 508watch: 509----- 510Since rev 3.12, support (ha ha) for the watch variable has been added. This 511will work only on a Microsoft Windows Network, i.e, where computers 512participate in an NT domain. Here is how tcsh will work if your network 513configuration is to its taste: 514 515 set watch=(2 AMOLD SKYNYRD any LYNYRD) 516 517sets a watch for AMOLD on machine SKYNYRD, and any user on machine LYNYRD. The 518watch interval is 2 minutes. 519 520Note that these are NETBIOS names, and hence the results may be flaky. There 521is no good way to distinguish computer names from user names in a netbios name 522table (even a good guess is very expensive), so be prepared for unexpected 523results. 524 525There may be problems depending on what protocol is on lana number 0. 526(This will usually be shown (and/or set) on NT in the properties for the 527NETBIOS interface in the control panel/networks applet. Win95 is screwed up, 528and if you have more than one protocol, watch may not work. Don't bug me 529about it) 530 531Also note that names must all be uppercase. 532 533The default time interval of 10 minutes is probably good, since you don't want 534to generate too much network traffic. 535 536Nice: 537----- 538// 539// nice(niceness) 540// 541// where niceness is an integer in the range -6 to +7 542// 543// A usual foreground process starts at level 9 in the chart below 544// 545// the range -6 to +7 takes it from Base priority 15 down to 2. 546// 547// Note that level 1 or > 15 are not allowed. 548// 549// Priority Level 11 (niceness -2) or greater affects system performance, 550// so use with care. 551// 552// niceness defaults to +4, which is lowest for background normal class. 553// As in unix, +ve niceness indicates lower priorities. 554 555/*************************************************************************** 556Niceness Base Priority class/thread priority 557 558 1 Idle, normal, or high class, THREAD_PRIORITY_IDLE 559 560+7 2 Idle class, THREAD_PRIORITY_LOWEST 561+6 3 Idle class, THREAD_PRIORITY_BELOW_NORMAL 562+5 4 Idle class, THREAD_PRIORITY_NORMAL 563+4 5 Background normal class, THREAD_PRIORITY_LOWEST 564 Idle class, THREAD_PRIORITY_ABOVE_NORMAL 565+3 6 Background normal class, THREAD_PRIORITY_BELOW_NORMAL 566 Idle class, THREAD_PRIORITY_HIGHEST 567+2 7 Foreground normal class, THREAD_PRIORITY_LOWEST 568 Background normal class, THREAD_PRIORITY_NORMAL 569+1 8 Foreground normal class, THREAD_PRIORITY_BELOW_NORMAL 570 Background normal class, THREAD_PRIORITY_ABOVE_NORMAL 571 0 9 Foreground normal class, THREAD_PRIORITY_NORMAL 572 Background normal class, THREAD_PRIORITY_HIGHEST 573-1 10 Foreground normal class, THREAD_PRIORITY_ABOVE_NORMAL 574-2 11 High class, THREAD_PRIORITY_LOWEST 575 Foreground normal class, THREAD_PRIORITY_HIGHEST 576-3 12 High class, THREAD_PRIORITY_BELOW_NORMAL 577-4 13 High class, THREAD_PRIORITY_NORMAL 578-5 14 High class, THREAD_PRIORITY_ABOVE_NORMAL 579-6 15 Idle, normal, or high class, THREAD_PRIORITY_TIME_CRITICAL 580 High class, THREAD_PRIORITY_HIGHEST 581 582 583 16 Real-time class, THREAD_PRIORITY_IDLE 584 22 Real-time class, THREAD_PRIORITY_LOWEST 585 23 Real-time class, THREAD_PRIORITY_BELOW_NORMAL 586 24 Real-time class, THREAD_PRIORITY_NORMAL 587 25 Real-time class, THREAD_PRIORITY_ABOVE_NORMAL 588 26 Real-time class, THREAD_PRIORITY_HIGHEST 589 31 Real-time class, THREAD_PRIORITY_TIME_CRITICAL 590****************************************************************************/ 591 592kill: 593---- 594 595You can try to kill a process 4 ways: 596 597kill -1 <pid> (which will send a sigint) 598kill -2 <pid> (which will send a sigbreak) 599 6001 and 2 are only good for processes started in the same console. The 601signals cannot be sent to other process groups (other consoles/GUI apps). 602 603kill -3 <pid> (which will send a quit message to each window of the child> 604 605kill -7 <pid> , which will call TerminateProcess() 606