On Mon, May 02, 2011 at 08:47:02PM +0200, Sami Kerola wrote: > Variables from global scope are moved to main, and passed as > function arguments where ever they are needed. > > Signed-off-by: Sami Kerola <kerolasa@xxxxxx> > --- > text-utils/column.c | 111 ++++++++++++++++++++++++++++---------------------- > 1 files changed, 62 insertions(+), 49 deletions(-) > > diff --git a/text-utils/column.c b/text-utils/column.c > index 05ab689..a81af8b 100644 > --- a/text-utils/column.c > +++ b/text-utils/column.c > @@ -71,37 +71,17 @@ static char *mtsafe_strtok(char *, const char *, char **); > #define DEFNUM 1000 > #define MAXLINELEN (LINE_MAX + 1) > > -static void c_columnate(void); > -static void input(FILE *); > -static void maketbl(void); > -static void print(void); > -static void r_columnate(void); > +static int input(FILE *fp, int *maxlength, wchar_t ***list, int *entries); > +static void c_columnate(int maxlength, long termwidth, wchar_t **list, int entries); > +static void r_columnate(int maxlength, long termwidth, wchar_t **list, int entries); > +static void maketbl(wchar_t **list, int entries, wchar_t *separator); > +static void print(wchar_t **list, int entries); > > typedef struct _tbl { > wchar_t **list; > int cols, *len; > } TBL; > > -long termwidth; > - > -int entries; /* number of records */ > -int eval; /* exit value */ > -int maxlength; /* longest record */ > -wchar_t **list; /* array of pointers to records */ > -wchar_t default_separator[] = { '\t', ' ', 0 }; > -wchar_t *separator = default_separator; /* field separator for table option */ This is invasive change. It would be nice to have some regression tests for the column(1) command to verify that functionality is not affected... [...] > + eval += EXIT_FAILURE; > + > + if (eval == 0) > + return(EXIT_SUCCESS); > + else > + return(EXIT_FAILURE); return is not a function, use return EXIT_FAILURE; Karel -- Karel Zak <kzak@xxxxxxxxxx> http://karelzak.blogspot.com -- To unsubscribe from this list: send the line "unsubscribe util-linux" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html