The program needs to know a magical system-dependent constant called
FIBMAP that is defined in the C include file
<linux/fs.h>.
It assumes that the current directory contains a file,
fibmap.ph, which will define
$FIBMAP
with the appropriate value. But if
fibmap.ph
does not exist, then the program creates it with
the correct value.
Please don't ask what this program was for.
unless (eval {require "fibmap.ph"}) {
open C, "> fibmap.c" or die "Couldn't write configurator: $!; aborti
+ng";
print C while <DATA>;
close C;
system("cc -o fibmap fibmap.c") == 0 or die "Couldn't run C compiler
+.\n";
system("./fibmap > fibmap.ph") == 0 or die "Couldn't run configurato
+r.\n";
unless (eval {require "fibmap.ph"}) {
die "Couldn't load configurator: $@.\n";
}
unlink "fibmap", "fibmap.c";
}
print "Configurator ran OK; FIBMAP is $FIBMAP\n";
# ...
# much code omitted here
# ...
__DATA__
#include <stdio.h>
#include <linux/fs.h>
int main(void)
{
printf("$FIBMAP = %d;\n1;\n", FIBMAP);
return 0;
}
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.