This is the mail archive of the cygwin@sourceware.cygnus.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: gzip converts stuff to 8.3 filenames


I decided to write a little executable to convert those 8.3 programs
back again.  
I thought w32fn (for win32filename) would be an okay name.

It takes the 8.3 name on the command line and spits out the longname on
stdout.  For what it's worth I'm sending it out.

Two questions however:

1.)  I compiled it under MS VC++ (cheapo $35.00 edition).  If I wanted
to compile with cygwin or mingw32 would it be a big deal (uses / needs
windows.h)

2.) How best to incorporate this into the "sento" explorer folder?  As I
mentioned, it uses stdout.  Can I do pass these args with with cmd.exe? 
Or do I need to use:

explorer -> cmd.exe -> bash -> gzip.exe

Isn't that overkill?

Code attached (exe available if you want):


Earnie Boyd wrote:
> 
> ---Allan Peda <allan@interport.net> wrote:
> >
> > I'm fudging around with gzip and those nifty registry sendto commands,
> > and I zip a file off to gzip, sure enough emacs-lisp-manual.ps
> > becomes EMACS-~1.PS.gz
> 
> Are you on Win95?  Are you sure that your picking up the cygwin32
> gzip.exe and not some other you may have had?  Are you executing from
> DOS or from BASH?  You shouldn't get this executing the cygwin32
> gzip.exe from the cygwin32 bash.exe.
> 
> >
> > Now: I guess the most sure bet/quick fix is a batch file "wrapper"
> > to save the name as a variable and move it.  Anyone have one.  I'll
> wait
> > a day and if no reply, I'll post it here.
> 
> Make that a two week wait.
> 
> >
> > .. Well it's (sorta) Cygwin32 related.
> >
> > Thanks
> > a
> 
> -        \\||//
> ---o0O0--Earnie--0O0o----
> -earnie_boyd@hotmail.com-
> ------ooo0O--O0ooo-------
> 
> Check out these great gnu-win32 related sites:
> ftp://ftp.cygnus.com/pub/gnu-win32/latest/                  (ftp site)
> http://www.cygnus.com/pubs/gnupro/                    (Comercial Page)
> http://www.cygnus.com/misc/gnu-win32/                   (Project Page)
> http://www.cygnus.com/ml/gnu-win32                     (Mail Archives)
> http://www.itribe.net/virtunix/winhelp-man-pages/     (HTML Man Pages)
> http://www.lexa.ru/sos                               (Sergey Okhapkin)
> ftp://www.lexa.ru/pub/domestic/sos/                (Sergey's ftp site)
> http://www.fu.is.saga-u.ac.jp/~colin/gcc.html           (Colin Peters)
> http://www.xraylith.wisc.edu/~khan/software/gnu-win32/    (Mumit Khan)
> http://gnu-win32.paranoia.ru                   (Chuck Bogorad's ports)
> http://www.bestweb.net/~aka/gnu-win32/  (GNU-Win32 Bash Configuration)
> http://rcw.home.ml.org/                  (Rob Warner - software ports)
> http://www.wenet.net/~garbanzo/gnuwin32/     (more - software portals)
> http://www.wenet.net/~garbanzo/gnuwin32/rpm   (Redhat Package Manager)
> http://www.parallax.co.uk/~andyp/index_text.html  (Andy Piper - ports)
> http://www.tiac.net/users/cgf     (Christopher Faylor - package ports)
> ftp://ftp.franken.de/pub/win32/develop/gnuwin32/       (German mirror)
> http://www.dol.ru/users/valtul      (Valery Tulnikov - software ports)
> 
> SEARCH ENGINES WITH gnu-win32 mail archive RELATED INDICIES:
> http://www.progressive-comp.com/Lists/?l=gnu-win32&r=1&w=2#gnu-win32
> http://www.findmail.com
> http://www.search.com
> add gnu-win32 or gnuwin32 to the search criteria.
> 
> Help for Win32 Beginners: http://www.relisoft.com
> 
> _________________________________________________________
> DO YOU YAHOO!?
> Get your free @yahoo.com address at http://mail.yahoo.com
> 
> -
> For help on using this list (especially unsubscribing), send a message to
> "gnu-win32-request@cygnus.com" with one line of text: "help".
#include <iostream.h>
#include <string.h>
#include <windows.h>

/*
 w32fn.exe
 April 19, 1998
 Allan Peda
 Version 0.1
 Release under GPL (see www.gnu.org for terms)
  */
int main( int argc, char *argv[] )
{
	// Windows specific data types
	WIN32_FIND_DATA fd;
	TCHAR filename[ MAX_PATH ];
	// What to display in case of erroneous input
	char *tips = "\nUsage: w32fn -[l|d] filename \n\
please provide only no more than two arguents to this command.\n\n\
\t-l specifies the output provide a Win32 long filename (default).\n\
\t-d specifies the output yield a 8.3 (DOS) compliant filename.\n";
	// some local variables
	char *choice = "-l";
	TCHAR Input_Filename[ MAX_PATH ];

	/*  exit if input is no good
	if ( ( argc > 3) || ( argc == 1 ) ) {
		clog << tips << flush;
		return ( 1 );
	}
	*/

	switch ( argc ) {
		case 1 :
			// No command line arguments
			clog << tips << flush;
			return ( 1 );
		case 2 :
			// Only 1 command line argument, use default switch.
			strcpy( choice, "-l" );
			strcpy( Input_Filename, argv[1]);
			break; 
		case 3 :
			// Two arguments, use first one for command switch
			strcpy( choice, argv[1] );
			strcpy( Input_Filename, argv[2]);
			break;
		default :
			// No arguments given at all, exit pgm
			clog << tips << flush;
			return ( 1 );
	}

	
	// Look for file name
	FindFirstFile( Input_Filename, &fd );
	if ( strcmp (choice,"-l") == 0)
		strcpy( filename, fd.cFileName );	

	if ( strcmp (choice,"-d") == 0){
		if (strlen(fd.cAlternateFileName) != 0)			
			// 8.3 filename exists, so use it
			strcpy( filename, fd.cAlternateFileName );			
		else
		// keep short name (since it is the same as the long one)
			strcpy( filename, fd.cFileName ); // use long file name
	}

	cout << filename << flush;
	return( 0 );
}

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]