# bformat command

The bformat command formats a BASIC
source program and updates the source file with the formatted item.

## Syntax

```
bformat file.name{{item.list}|{*}} {(options}
```

## Parameter(s)

| file.name | Any BASIC source file. | |
| --- | --- | --- |
| {item.list}\|{*} | Lists of program names, or an asterisk for all items, or null if there is a select list active. | |
| options | r | Renumbers statement labels and all references to the labels (goto, gosub, return to). |
| n 1- n 2 | Used with the r option, n 1 specifies the new beginning statement label number, n 2 specifies the increment between statement labels. Both n 1 and n 2 default to 10. | |
The action of bformat is identical to blist, except that the output is not printed, but is filed
into the source file overwriting the original source program.

The bformat command is table driven, like the blist command. The table is stored in the messages file. The item-ID of the control table is bf, followed by a four-character
hexadecimal number. The table number is contained in line 5 of the
command definition. The default table number is 0, thus the default
table item-ID is bf0000. The structure of the table is identical with
the blist control table. The only default options are r for renumber, c for comment indent inhibit, and
the numeric options for specifying the starting statement label number
and increment. It is possible to specify the numeric options in the
control table, and leave the r option as a run-time
option. In this case, the numeric options need not be specified at
run-time.

The r option is useful for renumbering
a source program to make it easier to follow. If the r option is used, then a line containing only an exclamation point
and a statement label may be used to change the current new statement
label number to the label specified on that line. This is true as
long as the current statement label number is greater than what would
be the next number (previous label number plus increment). This is
useful when specific labels make the program easier to follow, such
as at the beginning of subroutines, and so on.

Note: Certain forms
of the goto, gosub, and return to statements are not renumbered. This occurs when
there is no space between the keyword and the destination label. For
example, goto20 is not renumbered, but goto 20 is renumbered. Also, a mixture of numeric and alphanumeric
statement labels, following an on goto or on gosub command, fails to renumber any numeric labels
past the first alphanumeric label.

## See also

- [BASIC (glossary)](https://d3codex.com/definitions/basic-glossary/)
- [blist command](https://d3codex.com/tcl/blist-command/)
- [messages file](https://d3codex.com/systemfiles/messages-file/)
- [renumber command](https://d3codex.com/tcl/renumber-command/)
- [set-floppy command](https://d3codex.com/tcl/set-floppy-command/)
- [t-att command](https://d3codex.com/tcl/t-att-command/)

---
Source: https://d3codex.com/tcl/bformat-command/ - part of the D3Codex reference.
