Stable Sort
Stable Sort

Perform a stable sort.

Notes
This option effectively forces a merge sort algorithm to be used.

Define stable flag
Variable definition
Notes
This declaration relies on the C Virtual Machine to initialize the variable stable to zero.
Segment Source
 185: /* Flag for stable sort.  This turns off the last ditch bytewise
 186:    comparison of lines, and instead leaves lines in the same order
 187:    they were read if all keys compare equal.  */
 188: static int stable;
 189: 

Insert user message text
Text insertion
Segment Source
 233:   -s               stabilize sort by disabling last resort comparison\n\

Test field content only
Code modification

Avoid the last ditch byte-wise record comparision. With stable (and keys) enabled, comparision results should depend solely on the results of the key comparision.
Segment Source
1180:       if (unique || stable)
1181:         return 0;

Parse StableOpt option (-s)
Code insertion
Segment Source
1972:                   case 's':
1973:                     stable = 1;
1974:                     break;