summaryrefslogtreecommitdiff
path: root/data/ncurses/_metadata/preinst.c
blob: 2c33ad71d8e2f852b0a7d700ca35dbc0a4ab8c3a (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;
}