diff options
author | Dave Reisner <d@falconindy.com> | 2010-11-30 19:56:08 -0500 |
---|---|---|
committer | Dave Reisner <d@falconindy.com> | 2010-11-30 19:56:08 -0500 |
commit | e1cb35fc7630f113648e362ef77d659cc0863891 (patch) | |
tree | 46fdeced39bb884a3a20c1dc6ce774062b39d04a | |
parent | 8fd6a00b8c7f51e32b0e20c4880482438d768f2c (diff) | |
download | expac-e1cb35fc7630f113648e362ef77d659cc0863891.tar.xz |
fix up commenting
-rw-r--r-- | expac.c | 11 |
1 files changed, 6 insertions, 5 deletions
@@ -3,9 +3,9 @@ #include <ctype.h> #include <getopt.h> #include <limits.h> +#include <stdbool.h> #include <stdio.h> #include <stdlib.h> -#include <stdbool.h> #include <string.h> #define FORMAT_TOKENS "BCDEFGLNOPRSabdfiklmnprsuv%" @@ -266,7 +266,7 @@ static void print_list(alpm_list_t *list, extractfn fn, bool shortdeps) { while (1) { char *item; - item = fn ? (char*)fn(alpm_list_getdata(i)) : (char*)alpm_list_getdata(i); + item = (char*)(fn ? fn(alpm_list_getdata(i)) : alpm_list_getdata(i)); if (shortdeps) { *(item + strcspn(item, "<>=")) = '\0'; @@ -294,6 +294,7 @@ static void print_time(time_t timestamp) { return; } + /* no overflow here, strftime prints a max of 64 including null */ strftime(&buffer[0], 64, timefmt, localtime(×tamp)); printf("%s", buffer); } @@ -394,7 +395,7 @@ static int print_pkg(pmpkg_t *pkg, const char *format) { break; } } else if (*f == '\\') { - char buf[3]; + char buf[3]; /* its not safe to do this in a single sprintf */ buf[0] = *f; buf[1] = *++f; buf[2] = '\0'; @@ -477,7 +478,7 @@ int main(int argc, char *argv[]) { ret = alpm_init(); if (ret != 0) { - return(1); + return(ret); } ret = parse_options(argc, argv); @@ -485,7 +486,7 @@ int main(int argc, char *argv[]) { goto finish; } - /* default vals */ + /* ensure sane defaults */ if (!dblist) { dblist = alpm_list_add(dblist, db_local); } |