1
1
/* dctrl-tools - Debian control file inspection tools
2
Copyright © 2005, 2006, 2007, 2008, 2009, 2010, 2011 Antti-Juhani Kaijanaho
2
Copyright © 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Antti-Juhani Kaijanaho
4
4
This program is free software; you can redistribute it and/or modify
5
5
it under the terms of the GNU General Public License as published by
35
36
const char * argp_program_bug_address = MAINTAINER;
37
38
static struct argp_option options[] = {
38
{ "delimiter", 'd', N_("DELIM"), 0, N_("Specify a delimiter.") },
39
{ "no-heading", 'H', 0, 0, N_("Do not print a table heading") },
40
{ "column", 'c', N_("SPEC"), 0, N_("Append the specified column.") },
41
{ "copying", 'C', 0, 0, N_("Print out the copyright license.") },
42
{ "errorlevel", 'l', N_("LEVEL"), 0, N_("Set debugging level to LEVEL.") },
43
{ "mmap", OPT_MMAP, 0, 0, N_("Attempt mmapping input files") },
39
{ "delimiter", 'd', N_("DELIM"), 0, N_("Specify a delimiter."), 0 },
40
{ "no-heading", 'H', 0, 0, N_("Do not print a table heading"), 0 },
41
{ "column", 'c', N_("SPEC"), 0, N_("Append the specified column."), 0 },
42
{ "copying", 'C', 0, 0, N_("Print out the copyright license."), 0 },
43
{ "errorlevel", 'l', N_("LEVEL"), 0, N_("Set debugging level to LEVEL."), 0 },
44
{ "mmap", OPT_MMAP, 0, 0, N_("Attempt mmapping input files"), 0 },
47
48
#define MAX_FNAMES 4096
128
int n = mblen(orig + i, orig_len - i);
130
int n = mbrlen(orig + i, orig_len - i, &mbs);
129
131
if (n <= 0) break;
130
for (size_t j = 0; j < n; j++) INSERT(orig[i+j]);
132
for (int j = 0; j < n; j++) INSERT(orig[i+j]);
174
int n = mblen(data[j].wrapped + k,
175
data[j].wrapped_len - k);
177
int n = mbrlen(data[j].wrapped + k,
178
data[j].wrapped_len - k,
176
180
for (int l = 0; l < n; l++) {
177
181
putchar(data[j].wrapped[k+l]);
337
341
static char progdoc [] =
338
342
N_("tbl-dctrl -- tabularize Debian control files");
340
static struct argp argp = { options, parse_opt, 0, progdoc };
344
static struct argp argp = { options, parse_opt, 0, progdoc, 0, 0, 0 };
342
346
static size_t mbs_len(char const *mbs, size_t n, char const *fname)
344
348
if (n == (size_t)(-1)) n = strlen(mbs);
352
memset(&mbstate, 0, sizeof mbstate);
348
353
for (size_t k = 0; k < n;/**/) {
349
354
if (mbs[k] == '\n') {
350
355
if (len > mlen) mlen = len;
356
int delta = mblen(mbs + k, n - k);
361
int delta = mbrlen(mbs + k, n - k, &mbstate);
357
362
if (delta <= 0) {
358
363
message(L_IMPORTANT, fname,
359
364
_("bad multibyte character"));