"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/modules/mail.c" between
userinfo-2.4.tar.gz and userinfo-2.5.tar.gz

About: userinfo is a console utility to display a variety of information about a local user.

mail.c  (userinfo-2.4):mail.c  (userinfo-2.5)
/* /*
Copyright (C) 2001-2013 Ben Kibbey <bjk@luxsci.net> Copyright (C) 2001-2015 Ben Kibbey <bjk@luxsci.net>
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or the Free Software Foundation; either version 2 of the License, or
(at your option) any later version. (at your option) any later version.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
skipping to change at line 159 skipping to change at line 159
if (stat(ALIAS_FILE, &st) == -1) if (stat(ALIAS_FILE, &st) == -1)
return "!"; return "!";
if ((fd = open(ALIAS_FILE, O_RDONLY)) == -1) if ((fd = open(ALIAS_FILE, O_RDONLY)) == -1)
return "!"; return "!";
if ((aliasbuf = mmap(NULL, st.st_size, PROT_READ, MAP_PRIVATE, fd, if ((aliasbuf = mmap(NULL, st.st_size, PROT_READ, MAP_PRIVATE, fd,
0)) == MAP_FAILED) { 0)) == MAP_FAILED) {
warn("%s", "mmap()"); warn("%s", "mmap()");
close (fd);
return "!"; return "!";
} }
close(fd); close(fd);
} }
for (i = n = 0; aliasbuf[i]; i++) { for (i = n = 0; aliasbuf[i]; i++) {
char *last, *name, *tmp; char *last, *name, *tmp;
while (aliasbuf[i] != '\n') while (aliasbuf[i] != '\n')
skipping to change at line 256 skipping to change at line 257
fclose(fp); fclose(fp);
if (!n) if (!n)
return "-"; return "-";
s = buf2; s = buf2;
return s; return s;
} }
/* /var/mail/username folder size in bytes. */ /* /var/mail/username folder size in bytes. */
static char *foldersize(struct stat st) static char *foldersize(struct stat *st)
{ {
static char str[33], *p; static char str[33], *p;
snprintf(str, sizeof(str), "%lu", (unsigned long) st.st_size); snprintf(str, sizeof(str), "%lu", (unsigned long) st->st_size);
p = str; p = str;
return p; return p;
} }
/* This is output if the -h command line option is passed to the main program. /* This is output if the -h command line option is passed to the main program.
*/ */
void ui_module_help() void ui_module_help()
{ {
printf(" Mail information [-M (-%s)]:\n", MAIL_OPTION_ORDER); printf(" Mail information [-M (-%s)]:\n", MAIL_OPTION_ORDER);
printf("\t-f forwarding addresses\t"); printf("\t-f forwarding addresses\t");
skipping to change at line 296 skipping to change at line 297
strings = *s; strings = *s;
folder[0] = '\0'; folder[0] = '\0';
snprintf(folder, sizeof(folder), "%s/%s", _PATH_MAILDIR, pw->pw_name); snprintf(folder, sizeof(folder), "%s/%s", _PATH_MAILDIR, pw->pw_name);
if (stat(folder, &st) != -1) if (stat(folder, &st) != -1)
gotstat = 1; gotstat = 1;
for (; *p; p++) { for (; *p; p++) {
switch (*p) { switch (*p) {
case 's': case 's':
add_string(&strings, (gotstat) ? foldersize(st) : "!"); add_string(&strings, (gotstat) ? foldersize(&st) : "!");
break; break;
case 'r': case 'r':
add_string(&strings, (gotstat) ? stamp(st.st_atime, tf) : "!"); add_string(&strings, (gotstat) ? stamp(st.st_atime, tf) : "!");
break; break;
case 'm': case 'm':
add_string(&strings, (gotstat) ? stamp(st.st_mtime, tf) : "!"); add_string(&strings, (gotstat) ? stamp(st.st_mtime, tf) : "!");
break; break;
case 'f': case 'f':
add_string(&strings, forwards(pw->pw_dir, multi_char)); add_string(&strings, forwards(pw->pw_dir, multi_char));
break; break;
 End of changes. 5 change blocks. 
4 lines changed or deleted 5 lines changed or added

Home  |  About  |  All  |  Newest  |  Fossies Dox  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTPS