sync: Auto-sync from Mikes-MacBook-Air.local at 2026-01-22 19:10:48

Synced files:
- DOS batch files updated (ATESYNC, CTONWTXT, DEPLOY, NWTOC, etc.)
- New debug batch files (ATESYNCD, CTONWD, NWTOCD, DIAGBK)
- Removed obsolete debug files (ATESYNC-DEBUG, CTONW-DEBUG, NWTOC-DEBUG)
- New deployment scripts (deploy-to-nas.sh, validate-dos.sh)
- DOS coding agent documentation updated

Machine: Mikes-MacBook-Air.local
Timestamp: 2026-01-22 19:10:48

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-01-22 19:10:59 -07:00
parent 33bd99eb4e
commit 63ab144c8f
23 changed files with 3111 additions and 2869 deletions

View File

@@ -284,6 +284,73 @@ IF NOT EXIST dest\file.txt GOTO ERROR
---
### RULE 19: DOS Line Endings (CR/LF) Required
**Status:** CONFIRMED - LF-only files cause parse errors
DOS 6.22 requires CR/LF (Carriage Return + Line Feed) line endings:
- CR = 0x0D (hex) = \r
- LF = 0x0A (hex) = \n
- DOS needs: CR+LF (0x0D 0x0A)
- Unix uses: LF only (0x0A) - WILL NOT WORK
```bash
# [BAD] Unix line endings (LF only)
# File created on Mac/Linux without conversion
# [GOOD] Convert to DOS line endings before deployment
# On Mac/Linux:
unix2dos FILENAME.BAT
# Or with sed:
sed -i 's/$/\r/' FILENAME.BAT
# Or with Perl:
perl -pi -e 's/\n/\r\n/' FILENAME.BAT
```
**Symptoms of wrong line endings:**
- Commands run together on same line
- "Bad command or file name" on valid commands
- Script appears to do nothing
- Unexpected behavior at label jumps
**CRITICAL:** Always convert files to DOS line endings (CR/LF) before copying to DOS machines.
---
### RULE 20: No Trailing Spaces in SET Statements
**Status:** CONFIRMED - Causes "Too many parameters" errors
Trailing spaces in SET commands become part of the variable value:
```batch
REM [BAD] Trailing space after value
SET MACHINE=TS-3R
REM %MACHINE% = "TS-3R " (with trailing space!)
REM T:\%MACHINE%\LOGS becomes T:\TS-3R \LOGS - FAILS!
REM [GOOD] No trailing space
SET MACHINE=TS-3R
REM %MACHINE% = "TS-3R" (no space)
REM T:\%MACHINE%\LOGS becomes T:\TS-3R\LOGS - CORRECT
```
**Symptoms:**
- "Too many parameters" on MD, COPY, XCOPY commands using the variable
- Paths appear correct in ECHO but fail in actual commands
- Mysterious failures that work when paths are hardcoded
**Prevention:**
```bash
# Check for trailing spaces in SET statements
grep -E "^SET [A-Z]+=.* $" *.BAT
# Strip trailing whitespace from all lines before deployment
sed -i 's/[[:space:]]*$//' *.BAT
```
**CRITICAL:** Always strip trailing whitespace from batch files before deployment.
---
## Validation Checklist
Before deploying ANY DOS batch file, verify:
@@ -303,6 +370,8 @@ Before deploying ANY DOS batch file, verify:
- [ ] Using COPY instead of XCOPY where possible
- [ ] Environment variables quoted in comparisons
- [ ] Clean up SET variables at end
- [ ] **CR/LF line endings (DOS format, not Unix LF)**
- [ ] **No trailing spaces in SET statements or any lines**
---
@@ -432,17 +501,22 @@ FOR %%V IN (set) DO command - Loop (simple use only)
| Error Message | Likely Cause | Fix |
|---------------|--------------|-----|
| Bad command or file name | CALL :label, %DATE%, %TIME%, square brackets | Remove NT+ syntax |
| Bad command or file name | CALL :label, %DATE%, %TIME%, square brackets, wrong line endings | Remove NT+ syntax, convert to CR/LF |
| Too many parameters | 2>NUL, square brackets in ECHO | Remove stderr redirect, remove brackets |
| Invalid switch | XCOPY /I, XCOPY /D | Use COPY or remove flag |
| Invalid number of parameters | XCOPY /D without date | Add date or use COPY |
| Syntax error | Various NT+ constructs | Review all rules |
| Commands run together | Unix LF line endings instead of DOS CR/LF | Convert with unix2dos |
| Script does nothing | Wrong line endings causing parse failure | Convert with unix2dos |
| Too many parameters on paths | Trailing space in SET variable value | Strip trailing whitespace: `sed -i 's/[[:space:]]*$//'` |
---
## Version History
- 2026-01-21: Initial creation with 18 rules
- 2026-01-21: Added Rule 19 - CR/LF line endings requirement
- 2026-01-21: Added Rule 20 - No trailing spaces in SET statements
- Rules confirmed through testing on actual DOS 6.22 machines
---