summaryrefslogtreecommitdiff
path: root/data/ncurses/_metadata/preinst.c
blob: a2e8d5641ad63e272fc2f0b8d5e33b7837349734 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#include <string.h>
#include <unistd.h>

int main(int argc, char *argv[]) {
    if (argc < 2 || (
        strcmp(argv[1], "install") != 0 && (
            strcmp(argv[1], "upgrade") != 0 ||
            strncmp(argv[2], "5.6-", 4) != 0
    ))) return 0;

    unlink("/usr/lib/_ncurses");
    if (symlink("/usr/lib", "/usr/lib/_ncurses") != 0)
        return 1;

    return 0;
}