[GH-ISSUE #1185] Drop obsolete FMT_MAIN_VERSION #ifdef's #740

Closed
opened 2026-10-14 03:21:58 +07:00 by bsakaguchi · 1 comment
Owner

Originally created by @magnumripper on GitHub (Apr 6, 2015).
Original GitHub issue: https://github.com/openwall/john/issues/1185

https://github.com/magnumripper/JohnTheRipper/pull/1184#issuecomment-90115562

Actually since we have released Jumbo-1, I think we can remove them across the board. But you are right it's better done in a separate commit.

Then let's create a new issue, and plan to cleanup all the other dependencies FMT_MAIN_VERSION:

    593 #if FMT_MAIN_VERSION > 11
     30 #if FMT_MAIN_VERSION > 9
      4 #if FMT_MAIN_VERSION > 10
      1 #if FMT_MAIN_VERSION > 11 && IKE_REPORT_TUNABLE_COSTS

This could be an easy part of the GSoC code cleanup task.

Originally created by @magnumripper on GitHub (Apr 6, 2015). Original GitHub issue: https://github.com/openwall/john/issues/1185 https://github.com/magnumripper/JohnTheRipper/pull/1184#issuecomment-90115562 > > Actually since we have released Jumbo-1, I think we can remove them across the board. But you are right it's better done in a separate commit. > > Then let's create a new issue, and plan to cleanup all the other dependencies FMT_MAIN_VERSION: > > ``` > 593 #if FMT_MAIN_VERSION > 11 > 30 #if FMT_MAIN_VERSION > 9 > 4 #if FMT_MAIN_VERSION > 10 > 1 #if FMT_MAIN_VERSION > 11 && IKE_REPORT_TUNABLE_COSTS > ``` > > This could be an easy part of the GSoC code cleanup task.
bsakaguchi 2026-10-14 03:21:58 +07:00
Author
Owner

@jfoug commented on GitHub (Jul 25, 2015):

#!/usr/bin/perl
use strict;
use warnings;
use Path::Class;
use autodie;

my $dir = dir("./");
my $ifile = $dir->file($ARGV[0])->openr();
my $ofile = $dir->file($ARGV[0].".tmp")->openw();
my $cnt=0;
my $in_def=0;
while( my $line = $ifile->getline() ) {
    if (index($line, "#if FMT_MAIN_VERSION >") == 0) {
        $in_def = 1; # no print.
        $cnt++;
    } elsif ($in_def > 0 && index($line, "#endif") == 0 && --$in_def == 0) {
        # do nothing, no print and if() statement adjusted $in_def
    } else {
        $ofile->print($line);
    }
}
$ifile->close();
$ofile->close();
if ($cnt > 0) {
    rename($ARGV[0].".tmp", $ARGV[0]);
    print ("Fixed $ARGV[0], remove $cnt #ifdefs\n");
} else {
    unlink($ARGV[0].".tmp");
}

After editing a few files, I gave up, and wrote a simple perl script to do it. It handled all but a couple of files perfectely. I did not take #else into account, lol. Had to hand edit dynamic (2 files), ike_fmt and listconf.c I think that was the only files the script did not handle perfectly.

<!-- gh-comment-id:124790065 --> @jfoug commented on GitHub (Jul 25, 2015): ``` Perl #!/usr/bin/perl use strict; use warnings; use Path::Class; use autodie; my $dir = dir("./"); my $ifile = $dir->file($ARGV[0])->openr(); my $ofile = $dir->file($ARGV[0].".tmp")->openw(); my $cnt=0; my $in_def=0; while( my $line = $ifile->getline() ) { if (index($line, "#if FMT_MAIN_VERSION >") == 0) { $in_def = 1; # no print. $cnt++; } elsif ($in_def > 0 && index($line, "#endif") == 0 && --$in_def == 0) { # do nothing, no print and if() statement adjusted $in_def } else { $ofile->print($line); } } $ifile->close(); $ofile->close(); if ($cnt > 0) { rename($ARGV[0].".tmp", $ARGV[0]); print ("Fixed $ARGV[0], remove $cnt #ifdefs\n"); } else { unlink($ARGV[0].".tmp"); } ``` After editing a few files, I gave up, and wrote a simple perl script to do it. It handled all but a couple of files perfectely. I did not take #else into account, lol. Had to hand edit dynamic (2 files), ike_fmt and listconf.c I think that was the only files the script did not handle perfectly.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
openwall/john#740
No description provided.