New Extension Proposal: FileConv
| From: | Daniel Brown | Date: | Fri, 02 Jan 2009 20:50:41 +0000 |
| Subject: | New Extension Proposal: FileConv | ||
| Groups: | php.pecl.dev | ||
| Request: | Send a blank email to pecl-dev+get-6031@lists.php.net to get a copy of this message | ||
Happy new year, all!
I've got an extension that I've been using on my side that I
thought may be of benefit to the community as a PECL extension. I've
been referring to it as "FileConv" in my notes, but the name could
probably use a polish.
The package consists of two very simple functions:
* dos2unix()
* unix2dos()
It extends PHP to use these functions natively to do the same as
their *NIX counterparts: the simple act of changing newlines to and
from DOS/UNIX formats. The added benefit is that it does so without
changing the timestamp on the file. The hash of the file would, of
course, be changed, but that's expected.
NOTE: As of now, this has *only* been tested on Linux. I'll
freely admit that I am not very proficient in Windows-specific
programming, especially in C.
From the simple README I threw together:
====
FileConv Extension for PHP
by Daniel P. Brown
danbrown@php.net|| daniel.brown@parasane.net
http://www.parasane.net/
ABOUT
Version 1.0
FileConv contains the following PHP functions:
* dos2unix() - Converts files from UNIX format to DOS format.
* unix2dos() - Converts files from DOS format to UNIX format.
BASIC MANPAGE DESCRIPTION
bool dos2unix( string $filename )
Converts $filename to UNIX format and returns TRUE on success,
FALSE on failure.
TESTING
Once installed, you can test this application simply by running:
/bin/env php fileconv-test.php
====
If this sounds alright, then I'll go through the application
process. If it sucks, then I'll just keep my mouth shut and use (and
distribute) it myself.
--
</Daniel P. Brown>
daniel.brown@parasane.net || danbrown@php.net
http://www.parasane.net/ || http://www.pilotpig.net/
Unadvertised dedicated server deals, too low to print - email me to find out!