summaryrefslogtreecommitdiffstats
path: root/text-utils/col.c
Commit message (Collapse)AuthorAgeFilesLines
* misc: consolidate version printing and close_stdout()Karel Zak2019-04-161-3/+3
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* col: improve error message, update regression testKarel Zak2019-02-051-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* col: make flush_line() a little bit robustKarel Zak2019-02-051-6/+7
| | | | | | | | | | | | | | The code is horrible. The core of the problem are signed integers and no check for the limits. This patch fixes c->c_column = cur_col; where c_column is "short" and "cur_col" is int. Let's use "int" for all the variables. It's really not perfect as for bigger lines it can segfault again... The patch also removes some unnecessary static variables. Addresses: https://github.com/karelzak/util-linux/issues/749 Signed-off-by: Karel Zak <kzak@redhat.com>
* misc: consolidate macro style USAGE_HELP_OPTIONSRuediger Meier2017-06-291-1/+1
| | | | | | | | | changed in include/c.h and applied via sed: sed -i 's/fprintf.*\(USAGE_MAN_TAIL.*\)/printf(\1/' $(git ls-files -- "*.c") sed -i 's/print_usage_help_options\(.*\);/printf(USAGE_HELP_OPTIONS\1);/' $(git ls-files -- "*.c") Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* misc: consolidate all --help option descriptionsRuediger Meier2017-06-271-2/+4
| | | | | | | | Now we are always using the same text also for commands which had still hardcoded descriptions or where we can't use the standard print_usage_help_options macro. Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* misc: never use usage(stderr)Ruediger Meier2017-06-261-5/+8
| | | | | | | Here we fix all cases where we have usage(FILE*) functions. Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* col: avoid extra newline if no inputSami Kerola2017-05-101-0/+2
| | | | | | | | | BSD fix missed for 22 years, and all util-linux releases so far. Backported-from: https://github.com/dspinellis/unix-history-repo/commit/2a15260a2a3230e02f57c096fb4c5e1f797bf4f3 Addresses: https://github.com/karelzak/util-linux/issues/422 Reported-by: Pavel Raiskup <praiskup@redhat.com> Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* misc: add static keyword to where needed [smatch scan]Sami Kerola2017-02-201-8/+8
| | | | | | | text-utils/rev.c:68:9: warning: symbol 'buf' was not declared. Should it be static? Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* misc: do not use plain 0 as NULL [smatch scan]Sami Kerola2017-02-201-9/+9
| | | | | | | | | | text-utils/tailf.c:69:21: warning: Using plain integer as NULL pointer Since many 'struct option' has used zero as NULL make them more readable in same go by reindenting, and using named argument requirements. Reference: https://lwn.net/Articles/93577/ Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* col: backspacing widecharsGrady Martin2017-01-041-3/+9
| | | | | | | | Until now, backspace characters have not accounted for characters of widths other than one. This single line amends that. Requsted-by: Grady Martin <admin@nosuck.org> Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* Use --help suggestion on invalid optionKarel Zak2016-12-191-1/+1
| | | | | | | | The current default is to print all usage() output. This is overkill in many case. Addresses: https://github.com/karelzak/util-linux/issues/338 Signed-off-by: Karel Zak <kzak@redhat.com>
* misc: never cast void* from malloc(3) and friendsRuediger Meier2016-03-071-2/+2
| | | | | | | | | | Such cast could hide serious compiler warnings in case we are missing includes (e.g. <stdlib.h> or "xalloc.h"). See http://stackoverflow.com/questions/605845/do-i-cast-the-result-of-malloc Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* textual: add a docstring to most of the utilitiesBenno Schulenberg2015-01-061-0/+3
| | | | | | | | | This adds a concise description of a tool to its usage text. A first form of this patch was proposed by Steven Honeyman (see http://www.spinics.net/lists/util-linux-ng/msg09994.html). Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* textual: use manual tail usage() macroSami Kerola2014-10-011-0/+1
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* textual: use version printing macro everywhereSami Kerola2014-10-011-2/+1Star
| | | | | | | Only mount, umount, and blkid remains not using the macro because they are print also library references. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* docs: update deprecation bannersSami Kerola2014-10-011-0/+9
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* libmount, col: remove redundant null checks [smatch scan]Sami Kerola2013-04-091-2/+1Star
| | | | | | | | libmount/src/context_umount.c:174 mnt_context_find_umount_fs() info: redundant null check on loopdev calling free() libmount/src/context_umount.c:179 mnt_context_find_umount_fs() info: redundant null check on loopdev calling free() text-utils/col.c:406 flush_lines() info: redundant null check on l->l_line calling free() Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* various: fix variable and function declarations [smatch scan]Sami Kerola2013-04-091-2/+2
| | | | | | | | | | | | | | | | | disk-utils/fsck.minix.c:511:9: warning: mixing declarations and code fdisks/sfdisk.c:982:5: warning: mixing declarations and code fdisks/sfdisk.c:1254:5: warning: mixing declarations and code fdisks/sfdisk.c:1564:5: warning: mixing declarations and code lib/mbsalign.c:279:7: warning: mixing declarations and code libblkid/src/devname.c:378:17: warning: mixing declarations and code libfdisk/src/alignment.c:219:9: warning: mixing declarations and code term-utils/wall.c:111:9: warning: mixing declarations and code text-utils/col.c:418:19: warning: non-ANSI function declaration of function 'flush_blanks' text-utils/col.c:553:12: warning: non-ANSI function declaration of function 'alloc_line' text-utils/rev.c:105:9: warning: mixing declarations and code text-utils/tailf.c:245:9: warning: mixing declarations and code Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* textual: spell and encode the name of Arkadiusz Miśkiewicz correctlyBenno Schulenberg2013-02-061-1/+1
| | | | Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* textual: remove inconsistent periods from two error messagesBenno Schulenberg2013-01-251-1/+1
| | | | Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* col: fix compiler warning [-Wstrict-prototypes]Karel Zak2012-09-041-1/+1
| | | | | | text-utils/col.c:142:43: warning: function declaration isn’t a prototype [-Wstrict-prototypes] Signed-off-by: Karel Zak <kzak@redhat.com>
* text-utils: cleanup strtoxx_or_err()Karel Zak2012-05-151-7/+4Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* text-utils: verify writing to streams was successfulSami Kerola2012-04-041-2/+2
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* col: check with strtol_or_err option argumentSami Kerola2011-06-081-7/+12
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* col: coding style changesSami Kerola2011-06-011-13/+11Star
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* col: use long optionsSami Kerola2011-06-011-7/+44
| | | | | | This commit introduces help & version options. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* don't declare usage() without parametrKarel Zak2011-01-211-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* col: use err.h and EXIT_* macrosKarel Zak2010-11-011-27/+23Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* col: use xalloc for memory allocationDavidlohr Bueso2010-11-011-27/+11Star
| | | | | | Differentiate between malloc and realloc (not done so far) and get rid of local warn() Signed-off-by: Davidlohr Bueso <dave@gnu.org>
* col: getwchar() errors shouldn't be hiddenKarel Zak2007-01-301-3/+12
| | | | | | | | The col truncates output when multibyte errors is detected, but the problem is not reported to stderr and return code is still same like for successful exit. This stupid behaviour is fixed by this patch. Signed-off-by: Karel Zak <kzak@redhat.com>
* Imported from util-linux-2.11o tarball.Karel Zak2006-12-071-2/+0Star
|
* Imported from util-linux-2.11b tarball.Karel Zak2006-12-071-1/+1
|
* Imported from util-linux-2.10s tarball.Karel Zak2006-12-071-4/+20
|
* Imported from util-linux-2.10m tarball.Karel Zak2006-12-071-6/+11
|
* Imported from util-linux-2.10f tarball.Karel Zak2006-12-071-8/+13
|
* Imported from util-linux-2.9v tarball.Karel Zak2006-12-071-8/+13
|
* Imported from util-linux-2.8 tarball.Karel Zak2006-12-071-10/+0Star
|
* Imported from util-linux-2.7.1 tarball.Karel Zak2006-12-071-20/+22
|
* Imported from util-linux-2.2 tarball.Karel Zak2006-12-071-0/+529