[hackers] [sbase] Fixing whitespaces. || Christoph Lohmann
commit f648c7fa7124d2ee8c4745ce25350404b3c9ba89
Author: Christoph Lohmann <20h_AT_r-36.net>
Date: Sat May 4 07:49:51 2013 +0200
Fixing whitespaces.
diff --git a/paste.c b/paste.c
index 0d0bcdb..ab24691 100644
--- a/paste.c
+++ b/paste.c
_AT_@ -28,9 +28,9 @@ main(int argc, char **argv) {
size_t len;
Fdescr *dsc;
int i, c;
-
+
setlocale(LC_CTYPE, "");
-
+
while((c = getopt(argc, argv, "sd:")) != -1)
switch(c) {
case 's':
_AT_@ -44,58 +44,58 @@ main(int argc, char **argv) {
eusage();
break;
}
-
+
argc -= optind;
argv += optind;
if(argc == 0)
eusage();
-
+
/* populate delimeters */
if(!adelim)
adelim = " ";
-
+
len = mbstowcs(NULL, adelim, 0);
if(len == (size_t)-1)
eprintf("invalid delimiter
");
-
+
delim = malloc((len + 1) * sizeof(*delim));
if(!delim)
eprintf("out of memory
");
-
+
mbstowcs(delim, adelim, len);
len = unescape(delim);
if(len == 0)
eprintf("no delimiters specified
");
-
+
/* populate file list */
dsc = malloc(argc * sizeof(*dsc));
if(!dsc)
eprintf("out of memory
");
-
+
for(i = 0; i < argc; i++) {
const char *name = argv[i];
-
+
if(strcmp(name, "-") == 0)
dsc[i].fp = stdin;
else
dsc[i].fp = fopen(name, "r");
-
+
if(!dsc[i].fp)
eprintf("can't open '%s':", name);
-
+
dsc[i].name = name;
}
-
+
if(seq)
sequential(dsc, argc, delim, len);
else
parallel(dsc, argc, delim, len);
-
+
for(i = 0; i < argc; i++) {
if(dsc[i].fp != stdin)
(void)fclose(dsc[i].fp);
}
-
+
free(delim);
free(dsc);
return 0;
_AT_@ -111,7 +111,7 @@ unescape(wchar_t *delim) {
wchar_t c;
size_t i;
size_t len;
-
+
for(i = 0, len = 0; (c = delim[i++]) != '
Received on Sat May 04 2013 - 07:52:18 CEST
This archive was generated by hypermail 2.3.0
: Sat May 04 2013 - 08:00:27 CEST