Pages: 1 2 3 4 >>

30.01.12

Permalien 16:17:00, par mazet Email , 45 mots   French (FR) latin1
Catégories: Systeme

MSYS

Sur www.mingw.org, il faut recuperer mingw-get-inst-lastest.exe pour install ''MinGW'' ET ''MSYS''

Apres avoir lancer le ''MinGW Shell'', il faut installer un meilleur terminal (par exemple rxvt).

mingw-get install msys-rxvt

Enfin, il ne reste plus qu'a modifier ''MinGW Shell'' pour que la cible
soit :

C:\MinGW\msys\1.0\msys.bat -rxvt

03.01.12

Permalink 03:59:00 pm, by mazet Email , 55 words   English (US) latin1
Categories: Programmation, Awk

Convertion from hexa to decinal

Simple function to convert hexadecimal figures to decimal. It need to define a constant table hex

BEGIN {
    for (i = 0; i < 10; i++) hex[i] = i

    hex["a"] = hex["A"] = 10
    hex["b"] = hex["B"] = 11

    hex["c"] = hex["C"] = 12
    hex["D"] = hex["d"] = 13

    hex["e"] = hex["E"] = 14
    hex["f"] = hex["F"] = 15

    hex["x"] = hex["X"] = 0
}


function hex2dec(h,  i, x) {

    x = 0
    for (i = 1; i <= length(h); i++)

        x = x * 16 + hex[substr(h, i, 1)]
    return x

}
Permalink 03:51:00 pm, by mazet Email , 50 words   English (US) latin1
Categories: Programmation, Awk

Asort for Mawk

Mawk does not provide asort function to sort array.

function alength(A,  n, val) {
    n = 0

    for (val in A) n++
    return n

}


function asort(A,  hold, i, j, n) {
    n = alength(A)

    for (i = 2; i <= n ; i++) {
        hold = A[j = i]

        while (A[j-1] > hold) {
            j--

            A[j+1] = A[j]
        }

        A[j] = hold
    }

    delete A[0 ]


    return n

}

13.12.11

Permalink 05:35:00 pm, by mazet Email , 32 words   English (US) latin1
Categories: Programmation, C

Link statically only some specific libraries to a binary

You could also use ld options -Bstatic and -Bdynamic

gcc mixer.o \
    -Wl,-Bstatic -lapplejuice \
    -Wl,-Bdynamic -lorangejuice \
    -o multifruitjuice

All libraries after it (including system ones linked by gcc automatically) will be linked dynamically.

18.03.10

Permalink 05:53:15 pm, by mazet Email , 62 words   English (US) latin1
Categories: Systeme, Debian

Build a kernel 2.6

This is only very short remainder notes to rebuild a kernel packqge for Debian.
apt-get install kernel-package ncurses-dev initramfs-tools bzip2 wget
cd /usr/src
wget http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.33.tar.bz2
tar xjf linux-2.6.33.tar.bz2
cd linux-2.6.33/
make menuconfig
make-kpkg clean
make -j 4
#make-kpkg --append-to-version=-custom --revision=1.0 kernel_image kernel_headers
make-kpkg --initrd --append-to-version=-custom --revision=1.0 kernel_image kernel_headers
cd ..
dpkg -i linux-image-2.6.33-custom_1.0_i386.deb
dpkg -i linux-headers-2.6.33-custom_1.0_i386.deb
#update-initramfs -k 2.6.33-custom -c
Thank to Falko Timme

1 2 3 4 >>