| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | Maximus at UNIX |
andrew clarke wrote in a message to Roy J. Tellason:
ac> dos2unix does the temporary file creation itself, so you should be
ac> able to just run:
ac> dos2unix /dir/filespec/*
ac> Unless you don't have dos2unix (*) then you could use:
ac> #!/bin/sh
ac> for file in /dir/filespec.*
ac> do
ac> tr -d "\r\032" ${file}.tmp
ac> mv -f ${file}.tmp ${file}
ac> done
I have not done near enough with bash to know what the heck I'm doing, but
thought that perhaps passing it a parameter would work by changing that one
line to
for file in $1
Does that look like it'd work?
Then I looked at this:
ac> (*) Now you do. :-)
ac> /*
ac> * dos2unix.c
ac> #endif
Understand, it's been at least 8-10 years since I've looked at any but the
most trivial c code or even thought about writing anything, and I'm sure
not up on the usage of the various headers, or how you do things on a unix
or linux platform, but surprisingly enough I could actually follow most of
this! :-)
Dunno what this bit is about though:
ac> static struct stat s_buf;
Or this:
ac> ut_buf.actime = s_buf.st_atime;
ac> ut_buf.modtime = s_buf.st_mtime;
ac> if (utime(temppath, &ut_buf) != 0)
ac> {
ac> perror(temppath);
ac> rval = EXIT_FAILURE;
ac> }
This next part I'll just skip, as I haven't got a problem in that regard
and in fact have a utility on the dos box to fix that sort of thing, if I
need it. But most of the traffic is in the other direction anyway...
ac> * unix2dos.c
I actually figured out how to get that to compile, without errors!
Amazing stuff, those brain cells that hold this without even being used
for ages... :-)
I did get a warning though, that says "the use of mktemp is
dangerous, better use `mkstemp'...?
And somehow I ended up with a file named a.out? I didn't think that was
even still being used! Oh well...
---
* Origin: TANSTAAFL BBS 717-838-8539 (1:270/615)SEEN-BY: 633/267 270 @PATH: 270/615 150/220 379/1 106/1 2000 633/267 |
|
| SOURCE: echomail via fidonet.ozzmosis.com | |
Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.