For the current implementation, consider only the rotors I - V, and the stock B & C reflectors. For sake of convenience, our message format will contain everything including the settings, as explained below.
machine_settings ( reflector, left rotor, middle rotor, right rotor )
message ( this may be more that one line )
For example :
B I II III
ZZZZZ ZZZZZ ...
The initial position is where the rotors start, the encrypted message indicator is the input then, and the resulting values would be the message indicator. That indicator becomes the initial position for the message. Historically the message body was written as 4 or 5 letter groups.
Kindly refer to the attached document ("Enigma Machine.doc") for detailed explanation of encryption logic using examples.
Attached 152594.c compiles correctly with "gcc -Wall -ansi", and has ...
Attached program compiles with 'gcc -Wall -ansi' without any errors and warnings (tested with gcc 3.3.1 on cygwin), and has been tested for inputs given in the document, with and without '-vvv' argument to the compiled program.