- Timestamp:
- Sep 28, 2009, 3:19:50 PM (15 years ago)
- Branches:
- master, release-1.10, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
- Children:
- 39cff48
- Parents:
- bb79a52
- git-author:
- Karl Ramm <kcr@1ts.org> (09/26/09 12:25:28)
- git-committer:
- Karl Ramm <kcr@1ts.org> (09/28/09 15:19:50)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
zwrite.c
r24ccc01 rde3f641 154 154 void owl_zwrite_populate_zsig(owl_zwrite *z) 155 155 { 156 const char *zsigproc, *zsigowlvar, *zsigzvar;157 char *ptr;158 struct passwd *pw;159 160 156 /* get a zsig, if not given */ 161 if (z->zsig==NULL) { 162 zsigproc = owl_global_get_zsigproc(&g); 163 zsigowlvar = owl_global_get_zsig(&g); 164 zsigzvar = owl_zephyr_get_variable("zwrite-signature"); 165 166 if (zsigowlvar && *zsigowlvar) { 167 z->zsig=owl_validate_utf8(zsigowlvar); 168 } else if (zsigproc && *zsigproc) { 169 FILE *file; 170 char buff[LINE], *openline; 171 172 /* simple hack for now to nuke stderr */ 173 #if OWL_STDERR_REDIR 174 openline = owl_strdup(zsigproc); 175 #else 176 openline = owl_sprintf("%s 2> /dev/null", zsigproc); 177 #endif 178 file=popen(openline, "r"); 179 owl_free(openline); 180 if (!file) { 181 if (zsigzvar && *zsigzvar) { 182 z->zsig=owl_validate_utf8(zsigzvar); 183 } 184 } else { 185 z->zsig=owl_malloc(LINE*5); 186 strcpy(z->zsig, ""); 187 while (fgets(buff, LINE, file)) { /* wrong sizing */ 188 strcat(z->zsig, buff); 189 } 190 pclose(file); 191 if (z->zsig[0] != '\0' && z->zsig[strlen(z->zsig) - 1] == '\n') { 192 z->zsig[strlen(z->zsig)-1]='\0'; 193 } 194 } 195 } else if (zsigzvar) { 196 z->zsig=owl_validate_utf8(zsigzvar); 197 } else if (((pw=getpwuid(getuid()))!=NULL) && (pw->pw_gecos)) { 198 z->zsig=owl_validate_utf8(pw->pw_gecos); 199 ptr=strchr(z->zsig, ','); 200 if (ptr) { 201 ptr[0]='\0'; 202 } 203 } 204 } 157 if (z->zsig != NULL) 158 return; 159 160 z->zsig = owl_perlconfig_execute(owl_global_get_zsigfunc(&g)); 205 161 } 206 162
Note: See TracChangeset
for help on using the changeset viewer.