aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--TODO.org12
-rw-r--r--man/unixize.151
-rw-r--r--src/c_subst.c5
-rw-r--r--src/c_subst.h4
4 files changed, 56 insertions, 16 deletions
diff --git a/TODO.org b/TODO.org
deleted file mode 100644
index a5a7a66..0000000
--- a/TODO.org
+++ /dev/null
@@ -1,12 +0,0 @@
-#+TITLE: TODO list for unixize
-
-* DONE remove malloc for recursive main [2/2]
- - [X] Remove them / go stack
- - [X] Check "= \0" int c_opts.c:c_recursive_parse
-
-* DONE scanf static-like issue
- CLOSED: [2020-11-06 Fri 5:04]
-
-* TODO subst extended ascii
-
-* TODO subst unicode
diff --git a/man/unixize.1 b/man/unixize.1
index ac1f51c..f58fd4c 100644
--- a/man/unixize.1
+++ b/man/unixize.1
@@ -45,11 +45,28 @@
.\" Manpage for unixize.
.\" Contact rbousset@42lyon.fr to correct errors and typos.
.\"
+.de Text
+.nop \)\\$*
+..
+.de squoted_char
+.Text \(oq\fB\\$1\f[]\(cq\\$2
+..
+.de dquoted_char
+.Text \(lq\fB\\$1\f[]\(rq\\$2
+..
+.de file_example
+.P
+.RS
+\(oq\\$1\(cq \-\> \(oq\\$2\(cq
+.RE
+.P
+..
+.
.TH unixize 1 "14 November 2020" "unixize 1.0"
.
.SH NAME
.B unixize
-\- bulk rename files to UNIX style
+\- bulk rename directory
.
.SH SYNOPSIS
.SY unixize
@@ -61,5 +78,33 @@
.YS
.
.SH DESCRIPTION
-.I unixize
-
+.P
+The
+.B unixize
+utility renames all file in a given
+.I directory
+to a predefined style. Without any
+.I directory
+option specified, the current working directory will be assumed.
+.P
+All upper-case
+characters will be set to lower-case.
+.file_example FILE file
+All unicode characters will be deleted
+except for latin extended ascii characters, which will be replaced by the most
+meaningful ascii character (or double characters).
+.file_example Hliðskjálf.jpg hlidhskjalf.jpg
+Spaces will be substitued by a
+.BR separator ,
+either underscores
+.squoted_char _
+by default or hyphens
+.squoted_char -
+with the
+.B -n
+option. The
+.
+.
+.
+.
+unixize can subst ext... see \(lqOPTIONS\(rq bellow.
diff --git a/src/c_subst.c b/src/c_subst.c
index ace57d3..3c667b7 100644
--- a/src/c_subst.c
+++ b/src/c_subst.c
@@ -266,6 +266,11 @@ c_unicode_subst(char filename[])
*(p + 1) = 'e';
c_unicode_subst(filename);
}
+ if (u_isucharset((unsigned char)*(p + 1), C_CHARSET_AA) == TRUE) {
+ *p = 'a';
+ *(p + 1) = 'a';
+ c_unicode_subst(filename);
+ }
if (u_isucharset((unsigned char)*(p + 1), C_CHARSET_N) == TRUE) {
*p = 'n';
memmove(
diff --git a/src/c_subst.h b/src/c_subst.h
index 00073b2..cc2ca21 100644
--- a/src/c_subst.h
+++ b/src/c_subst.h
@@ -52,7 +52,9 @@
#define C_CHARSET_VALID "_-."
#define C_CHARSET_A \
- "\x80\x81\x82\x83\x84\x85\xa0\xa1\xa2\xa3\xa4\xa5"
+ "\x80\x81\x82\x83\x84\xa0\xa1\xa2\xa3\xa4"
+#define C_CHARSET_AA \
+ "\x85\xa5"
#define C_CHARSET_O \
"\x92\x93\x94\x95\x96\x98\xb2\xb3\xb4\xb5\xb6\xb8"
#define C_CHARSET_AE \