- Timestamp:
- Oct 17, 2009, 6:08:20 PM (15 years ago)
- Branches:
- master, release-1.10, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
- Children:
- 99cc3dc
- Parents:
- b7ee89b
- git-author:
- Karl Ramm <kcr@1ts.org> (10/16/09 11:21:14)
- git-committer:
- Karl Ramm <kcr@1ts.org> (10/17/09 18:08:20)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
zephyr.c
rb7ee89b r6ea3890 19 19 20 20 #define HM_SVC_FALLBACK htons((unsigned short) 2104) 21 22 static char *owl_zephyr_dotfile(const char *name, const char *input) 23 { 24 if (input != NULL) 25 return owl_strdup(input); 26 else 27 return owl_sprintf("%s/%s", owl_global_get_homedir(&g), name); 28 } 21 29 22 30 #ifdef HAVE_LIBZEPHYR … … 254 262 255 263 subs = owl_malloc(sizeof(ZSubscription_t) * subSize); 256 if (filename == NULL) 257 subsfile = owl_sprintf("%s/.zephyr.subs", owl_global_get_homedir(&g)); 258 else 259 subsfile = owl_strdup(filename); 264 subsfile = owl_zephyr_dotfile(".zephyr.subs", filename); 260 265 261 266 if (stat(subsfile, &statbuff) != 0) { … … 373 378 374 379 subs = owl_malloc(numSubs * sizeof(ZSubscription_t)); 375 376 if (filename==NULL) 377 subsfile = owl_sprintf("%s/%s", owl_global_get_homedir(&g), ".anyone"); 378 else 379 subsfile = owl_strdup(filename); 380 subsfile = owl_zephyr_dotfile(".anyone", filename); 380 381 381 382 if (stat(subsfile, &statbuff) == -1) … … 957 958 958 959 line = owl_zephyr_makesubline(class, inst, recip); 959 960 if (filename == NULL) 961 subsfile = owl_sprintf("%s/.zephyr.subs", owl_global_get_homedir(&g)); 962 else 963 subsfile = owl_strdup(filename); 960 subsfile = owl_zephyr_dotfile(".zephyr.subs", filename); 964 961 965 962 /* if the file already exists, check to see if the sub is already there */ … … 1000 997 line[strlen(line)-1]='\0'; 1001 998 1002 if (!filename) { 1003 subsfile=owl_sprintf("%s/.zephyr.subs", owl_global_get_homedir(&g)); 1004 } else { 1005 subsfile=owl_strdup(filename); 1006 } 999 subsfile = owl_zephyr_dotfile(".zephyr.subs", filename); 1007 1000 1008 1001 linesdeleted = owl_util_file_deleteline(subsfile, line, 1); … … 1079 1072 FILE *file; 1080 1073 1081 filename =owl_sprintf("%s/.anyone", owl_global_get_homedir(&g));1082 file =fopen(filename, "a");1074 filename = owl_zephyr_dotfile(".anyone", NULL); 1075 file = fopen(filename, "a"); 1083 1076 owl_free(filename); 1084 1077 if (!file) { … … 1094 1087 char *filename; 1095 1088 1096 filename =owl_sprintf("%s/.anyone", owl_global_get_homedir(&g));1089 filename = owl_zephyr_dotfile(".anyone", NULL); 1097 1090 owl_util_file_deleteline(filename, name, 0); 1098 1091 owl_free(filename); … … 1278 1271 FILE *f; 1279 1272 1280 if (filename == NULL) 1281 ourfile = owl_sprintf("%s/.anyone", owl_global_get_homedir(&g)); 1282 else 1283 ourfile = owl_strdup(filename); 1273 ourfile = owl_zephyr_dotfile(".anyone", filename); 1284 1274 1285 1275 f = fopen(ourfile, "r");
Note: See TracChangeset
for help on using the changeset viewer.