On operating systems where the source comes in /usr/src you can variously find the source code for their vi:
You've come here because you've said something along the lines of:
I use the original
virather thanvim.
There's only one family of operating systems where vi will actually run the original vi program by Bill Joy, Mark (now Mary Ann) Horton, et al.:
Illumos and its derivatives Tribblix, OpenIndiana, OmniOS, and SmartOS.
They inherited it from Solaris, which retained the original Joy+Horton program.
Everyone else uses one of the ground-up clones; because the Joy+Horton code was encumbered with a restrictive copyright licence until the 21st century.
On FreeBSD, OpenBSD, NetBSD, MidnightBSD, and DragonFlyBSD vi is Keith Bostic's early 1990s nvi, or a derivative of the same.
On Linux-based operating systems, vi is Bostic nvi, Moolenaar's VIM, or NeoVIM.
On none of those will you get original Joy+Horton vi in base, or indeed packaged/in ports. (Indeed, you might not even get the original Bostic nvi. Both FreeBSD and NetBSD package up one of its forks, that has such augmentations as UTF-8 support.)
Yes, Heirloom vi exists, which is Gunner Ritter's 2002 fork of 1985 Joy+Horton vi.
But it's not even available in Arch Linux nowadays.
(It was removed because it didn't compile.
It hadn't changed; Arch had used a new GNU C compiler that defaulted to a newer version of the C language.
It actually could have been fixed by simply using the -std=gnu90 option to GCC.)