]> git.pld-linux.org Git - packages/links2.git/blob - links2-home_etc.patch
- updated to 2.1pre21, updated pl patch
[packages/links2.git] / links2-home_etc.patch
1 diff -Nru links-2.1pre9/default.c links-2.1pre9.new/default.c
2 --- links-2.1pre9/default.c     Tue Mar 11 14:20:30 2003
3 +++ links-2.1pre9.new/default.c Tue Mar 11 14:26:34 2003
4 @@ -232,29 +232,12 @@
5         unsigned char *config_dir = stracpy(getenv("CONFIG_DIR"));
6  
7         if (n) *n = 1;
8 -       if (!home) {
9 -               int i;
10 -               home = stracpy(path_to_exe);
11 -               if (!home) {
12 -                       if (config_dir) mem_free(config_dir);
13 -                       return NULL;
14 -               }
15 -               for (i = strlen(home) - 1; i >= 0; i--) if (dir_sep(home[i])) {
16 -                       home[i + 1] = 0;
17 -                       goto br;
18 -               }
19 -               home[0] = 0;
20 -               br:;
21 -       }
22 -       while (home[0] && dir_sep(home[strlen(home) - 1])) home[strlen(home) - 1] = 0;
23 -       if (home[0]) add_to_strn(&home, "/");
24 -       home_links = stracpy(home);
25         if (config_dir)         
26         {
27 -               add_to_strn(&home_links, config_dir);
28 +               home_links = stracpy(config_dir);
29                 while (home_links[0] && dir_sep(home_links[strlen(home_links) - 1])) home_links[strlen(home_links) - 1] = 0;
30                 if (stat(home_links, &st) != -1 && S_ISDIR(st.st_mode)) {
31 -                       add_to_strn(&home_links, "/links");
32 +                       add_to_strn(&home_links, "/links2");
33                 } else {
34                         fprintf(stderr, "CONFIG_DIR set to %s. But directory %s doesn't exist.\n\007", config_dir, home_links);
35                         sleep(3);
36 @@ -263,7 +246,25 @@
37                         add_to_strn(&home_links, ".links2");            
38                 }
39                 mem_free(config_dir);
40 -       } else add_to_strn(&home_links, ".links2");
41 +       } else {
42 +               if (!home) {
43 +                       int i;
44 +                       home = stracpy(path_to_exe);
45 +                       if (!home) {
46 +                               return NULL;
47 +                       }
48 +                       for (i = strlen(home) - 1; i >= 0; i--) if (dir_sep(home[i])) {
49 +                               home[i + 1] = 0;
50 +                               goto br;
51 +                       }
52 +                       home[0] = 0;
53 +                       br:;
54 +               }
55 +               while (home[0] && dir_sep(home[strlen(home) - 1])) home[strlen(home) - 1] = 0;
56 +               if (home[0]) add_to_strn(&home, "/");
57 +               home_links = stracpy(home);
58 +               add_to_strn(&home_links, ".links2");
59 +       }
60         if (stat(home_links, &st)) {
61                 if (!mkdir(home_links, 0777)) goto home_creat;
62                 if (config_dir) goto failed;
This page took 0.026112 seconds and 3 git commands to generate.