Changeset b7ee89b for functions.c
- Timestamp:
- Oct 17, 2009, 6:08:15 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:
- 6ea3890
- Parents:
- 435001d
- git-author:
- Karl Ramm <kcr@1ts.org> (09/24/09 11:05:55)
- git-committer:
- Karl Ramm <kcr@1ts.org> (10/17/09 18:08:15)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
functions.c
r08e414a rb7ee89b 1363 1363 owl_fmtext fm; 1364 1364 FILE *file; 1365 char buff[1024];1365 char *s = NULL; 1366 1366 1367 1367 file=fopen(filename, "r"); … … 1372 1372 1373 1373 owl_fmtext_init_null(&fm); 1374 while (fgets(buff, 1024, file)) { 1375 owl_fmtext_append_normal(&fm, buff); 1376 /* owl_fmtext_append_normal(&fm, "\n"); */ 1377 } 1374 while (owl_getline(&s, file)) 1375 owl_fmtext_append_normal(&fm, s); 1376 owl_free(s); 1378 1377 1379 1378 owl_function_popless_fmtext(&fm); … … 2022 2021 const char *redirect = " 2>&1 < /dev/null"; 2023 2022 char *newbuff; 2024 char *out, buff2[1024]; 2025 int size; 2023 char *out; 2026 2024 FILE *p; 2027 2025 … … 2041 2039 owl_popexec_new(newbuff); 2042 2040 } else { 2043 p=popen(newbuff, "r"); 2044 out=owl_malloc(1024); 2045 size=1024; 2046 strcpy(out, ""); 2047 while (fgets(buff2, 1024, p)!=NULL) { 2048 size+=1024; 2049 out=owl_realloc(out, size); 2050 strcat(out, buff2); 2051 } 2041 p = popen(newbuff, "r"); 2042 out = owl_slurp(p); 2052 2043 pclose(p); 2053 2044 … … 3338 3329 char *path; 3339 3330 FILE *file; 3340 char buff[LINE];3331 char *s = NULL; 3341 3332 int fail_silent = 0; 3342 3333 … … 3347 3338 path = owl_util_makepath(filename); 3348 3339 } 3349 file =fopen(path, "r");3340 file = fopen(path, "r"); 3350 3341 owl_free(path); 3351 3342 if (!file) { … … 3355 3346 return; 3356 3347 } 3357 while (fgets(buff, LINE, file)!=NULL) { 3358 if (buff[0] == '\0' || buff[0] == '#') continue; 3359 if (buff[strlen(buff) - 1] == '\n') 3360 buff[strlen(buff) - 1] = '\0'; 3361 owl_function_command(buff); 3362 } 3348 while (owl_getline_chomp(&s, file)) { 3349 if (s[0] == '\0' || s[0] == '#') 3350 continue; 3351 owl_function_command(s); 3352 } 3353 3354 owl_free(s); 3363 3355 fclose(file); 3364 3356 }
Note: See TracChangeset
for help on using the changeset viewer.