"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/ui.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.

ui.c  (userinfo-2.4):ui.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 182 skipping to change at line 182
static int open_module(char *filename, struct module_s **ptr) static int open_module(char *filename, struct module_s **ptr)
{ {
void *m; void *m;
module_init *init; module_init *init;
char *p, s[PATH_MAX]; char *p, s[PATH_MAX];
int chainable = 0; int chainable = 0;
struct module_s *mod, **mods, *last; struct module_s *mod, **mods, *last;
int dup = 0; int dup = 0;
strncpy(s, filename, sizeof(s)); strncpy(s, filename, sizeof(s));
s[sizeof(s)-1] = 0;
if ((p = strrchr(s, '/')) != NULL) if ((p = strrchr(s, '/')) != NULL)
p++; p++;
else { else {
strncpy(s, filename, sizeof(s)); strncpy(s, filename, sizeof(s));
s[sizeof(s)-1] = 0;
p = s; p = s;
} }
for (mods = modules; mods && *mods; mods++) { for (mods = modules; mods && *mods; mods++) {
if (strcmp(p, (*mods)->name) == 0) { if (strcmp(p, (*mods)->name) == 0) {
dup = 1; dup = 1;
break; break;
} }
} }
skipping to change at line 211 skipping to change at line 213
return 1; return 1;
} }
last = modules ? modules[module_total-1] : NULL; last = modules ? modules[module_total-1] : NULL;
modules = Realloc(modules, (module_total+2) * sizeof(struct module_s *)); modules = Realloc(modules, (module_total+2) * sizeof(struct module_s *));
mod = calloc(1, sizeof(struct module_s)); mod = calloc(1, sizeof(struct module_s));
modules[module_total++] = mod; modules[module_total++] = mod;
modules[module_total] = NULL; modules[module_total] = NULL;
mod->m = m; mod->m = m;
strncpy(mod->name, p, sizeof(mod->name)); strncpy(mod->name, p, sizeof(mod->name));
mod->name[sizeof(mod->name)-1] = 0;
if ((init = dlsym(mod->m, "ui_module_init")) == NULL) if ((init = dlsym(mod->m, "ui_module_init")) == NULL)
warnx("%s", dlerror()); warnx("%s", dlerror());
else else
(*init) (&chainable); (*init) (&chainable);
if (chainable) if (chainable)
SET_FLAG(mod->flags, MODULE_CHAINABLE); SET_FLAG(mod->flags, MODULE_CHAINABLE);
if (last && TEST_FLAG(last->flags, MODULE_CHAINED) && if (last && TEST_FLAG(last->flags, MODULE_CHAINED) &&
skipping to change at line 545 skipping to change at line 548
if ((pw = getpwuid(getuid())) == NULL) { if ((pw = getpwuid(getuid())) == NULL) {
if (errno) if (errno)
warn("getpwuid()"); warn("getpwuid()");
else else
warnx("getpwuid(): no such uid"); warnx("getpwuid(): no such uid");
return NULL; return NULL;
} }
strncpy(dir, pw->pw_dir, sizeof(dir)); strncpy(dir, pw->pw_dir, sizeof(dir));
dir[sizeof(dir)-1] = 0;
return dir; return dir;
} }
/* Read in a configuration file adding modules to the module array and /* Read in a configuration file adding modules to the module array and
* checking any module options. */ * checking any module options. */
static int parse_rc_file(const char *filename) static int parse_rc_file(const char *filename)
{ {
char line[LINE_MAX], *p; char line[LINE_MAX], *p;
FILE *fp; FILE *fp;
int old_optind = optind; int old_optind = optind;
skipping to change at line 626 skipping to change at line 630
lastchar = *s++ = *p++; lastchar = *s++ = *p++;
} }
*s = '\0'; *s = '\0';
p = name; p = name;
if (*p == '~') { if (*p == '~') {
s = get_home_directory(); s = get_home_directory();
strncpy(tmp, s, sizeof(tmp)); strncpy(tmp, s, sizeof(tmp));
tmp[sizeof(tmp)-1] = 0;
p++; p++;
safe_strncat(tmp, p, sizeof(tmp)); safe_strncat(tmp, p, sizeof(tmp));
strncpy(name, tmp, sizeof(name)); strncpy(name, tmp, sizeof(name));
name[sizeof(name)-1] = 0;
} }
if (open_module(name, &mod)) if (open_module(name, &mod))
continue; continue;
if ((my_argv = parseargv(options, __progname, &my_argc)) == NULL) if ((my_argv = parseargv(options, __progname, &my_argc)) == NULL)
continue; continue;
optind = 0; optind = 0;
n = init_module_options(my_argc, my_argv, mod); n = init_module_options(my_argc, my_argv, mod);
 End of changes. 7 change blocks. 
1 lines changed or deleted 7 lines changed or added

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