File: uninstall

package info (click to toggle)
c++-annotations 11.5.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 11,244 kB
  • sloc: cpp: 21,698; makefile: 1,505; ansic: 165; sh: 121; perl: 90
file content (46 lines) | stat: -rw-r--r-- 800 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
void uninstall()
{
    string key;
    int idx;
    int nDirs;
    list entry;
    list dirs;
    string dir;

    if (g_logPath == "")            // do not store uninstall info
    {
        printf(LOGENV " environment variable not available\n");
        exit(0);
    }

    readlog();

    for (idx = listlen(g_log); idx--; )    
    {
        entry = strtok(g_log[idx], " ");

        if (entry[1] == "dir")
        {
            dir = entry[2];
            dirs += (list)dir;
            chdir(dir);
        }
        else if (entry[1] == "file")
            remove(entry);
        else if (entry[1] == "link")
            run("rm " + entry[2]);
    }

    for (idx = 0, nDirs = listlen(dirs); idx != nDirs; ++idx)
        removeDir(dirs[idx]);

    run("rm " + g_logPath);

    exit(0);
}