]> git.pld-linux.org Git - packages/poldek.git/blob - poldek-home_etc.patch
- (perhaps) better comment
[packages/poldek.git] / poldek-home_etc.patch
1 diff -Nru poldek-0.18.1/conf.c poldek-0.18.1.new/conf.c
2 --- poldek-0.18.1/conf.c        Fri Oct 18 16:19:42 2002
3 +++ poldek-0.18.1.new/conf.c    Mon Mar 10 07:39:16 2003
4 @@ -374,14 +374,23 @@
5  tn_hash *ldconf_deafult(void)
6  {
7      char *homedir;
8 +               char *config_dir;
9      char *etcpath = "/etc/poldek.conf";
10      
11 -    if ((homedir = getenv("HOME")) != NULL) {
12 +    if ((config_dir = getenv("CONFIG_DIR")) != NULL) {
13 +        char path[PATH_MAX];
14 +        
15 +        snprintf(path, sizeof(path), "%s/poldekrc", config_dir);
16 +        if (access(path, R_OK) == 0)
17 +            return ldconf(path);
18 +    } else {
19 +      if ((homedir = getenv("HOME")) != NULL) {
20          char path[PATH_MAX];
21          
22          snprintf(path, sizeof(path), "%s/.poldekrc", homedir);
23          if (access(path, R_OK) == 0)
24              return ldconf(path);
25 +      }
26      }
27      
28      if (access(etcpath, R_OK) == 0)
29 diff -Nru poldek-0.18.1/pkgscore.c poldek-0.18.1.new/pkgscore.c
30 --- poldek-0.18.1/pkgscore.c    Fri Nov 22 17:08:53 2002
31 +++ poldek-0.18.1.new/pkgscore.c        Mon Mar 10 07:44:02 2003
32 @@ -40,26 +40,46 @@
33  
34      if (fpath == NULL) {
35          char *homedir;
36 +                               char *config_dir;
37  
38 -        if ((homedir = getenv("HOME")) == NULL)
39 +                               if ((config_dir = getenv("CONFIG_DIR")) != NULL) {
40 +               switch (type) {
41 +               case PKG_HELD:
42 +                       snprintf(path, sizeof(path), "%s/poldek-hold", config_dir);
43 +                       if (access(path, R_OK) != 0) /* backward compat */
44 +                    snprintf(path, sizeof(path), "%s/poldek_hold", config_dir);
45 +                       
46 +                       break;
47 +
48 +               case PKG_IGNORED:
49 +                       snprintf(path, sizeof(path), "%s/poldek-ignore", config_dir);
50 +                       break;
51 +
52 +               default:
53 +                       n_assert(0);
54 +                       break;
55 +               }
56 +                               } else {
57 +                                       if ((homedir = getenv("HOME")) == NULL)
58              return NULL;
59  
60 -        switch (type) {
61 -            case PKG_HELD:
62 -                snprintf(path, sizeof(path), "%s/.poldek-hold", homedir);
63 -                if (access(path, R_OK) != 0) /* backward compat */
64 +               switch (type) {
65 +               case PKG_HELD:
66 +                       snprintf(path, sizeof(path), "%s/.poldek-hold", homedir);
67 +                       if (access(path, R_OK) != 0) /* backward compat */
68                      snprintf(path, sizeof(path), "%s/.poldek_hold", homedir);
69 -               
70 -                break;
71 +                       
72 +                       break;
73 +
74 +               case PKG_IGNORED:
75 +                       snprintf(path, sizeof(path), "%s/.poldek-ignore", homedir);
76 +                       break;
77  
78 -            case PKG_IGNORED:
79 -                snprintf(path, sizeof(path), "%s/.poldek-ignore", homedir);
80 -                break;
81 -
82 -            default:
83 -                n_assert(0);
84 -                break;
85 -        }
86 +               default:
87 +                       n_assert(0);
88 +                       break;
89 +               }
90 +                               }
91          
92          if (access(path, R_OK) != 0)
93              return patterns;
94 diff -Nru poldek-0.18.1/shell/shell.c poldek-0.18.1.new/shell/shell.c
95 --- poldek-0.18.1/shell/shell.c Tue Oct 29 16:55:58 2002
96 +++ poldek-0.18.1.new/shell/shell.c     Mon Mar 10 07:50:21 2003
97 @@ -1226,7 +1226,7 @@
98  
99  int shell_main(struct pkgset *ps, struct inst_s *inst, int skip_installed)
100  {
101 -    char *line, *s, *home;
102 +    char *line, *s, *home, *config_dir;
103      
104      
105      if (!isatty(fileno(stdout))) {
106 @@ -1240,12 +1240,19 @@
107      initialize_readline();
108      histfile = NULL;
109  
110 -    if ((home = getenv("HOME"))) {
111 +    if ((config_dir = getenv("CONFIG_DIR"))) {
112 +        int len = strlen(config_dir) + strlen("/poldek_history") + 2;
113 +        histfile = alloca(len);
114 +        snprintf(histfile, len, "%s/poldek_history", config_dir);
115 +        read_history(histfile);
116 +    } else {
117 +       if ((home = getenv("HOME"))) {
118          int len = strlen(home) + strlen("/.poldek_history") + 2;
119          histfile = alloca(len);
120          snprintf(histfile, len, "%s/.poldek_history", home);
121          read_history(histfile);
122 -    }
123 +       }
124 +               }
125  
126      sigint_init();
127      sigint_reached_cb = sigint_reached_fn;
This page took 0.176619 seconds and 3 git commands to generate.