From: Digest To: "OS/2GenAu Digest" Date: Mon, 21 Apr 2003 00:04:03 EST-10EDT,10,-1,0,7200,3,-1,0,7200,3600 Subject: [os2genau_digest] No. 597 Reply-To: X-List-Unsubscribe: www.os2site.com/list/ ************************************************** Sunday 20 April 2003 Number 597 ************************************************** Subjects for today 1 Any watcom guru's ? : Ian Manners" 2 Re: USB card readers with OS/2 : Ed Durrant 3 Re: Any watcom guru's ? : Simon Coulter" 4 Re: Any watcom guru's ? : Chris Graham [WarpSpeed]" 5 Re: Any watcom guru's ? : Ian Manners" 6 RBL - blackholes.mail-abuse dot org : Chris Graham [WarpSpeed]" 7 Re: Novell migrates to Linux : tsq at internode.on dot net **= Email 1 ==========================** Date: Sun, 20 Apr 2003 03:13:16 +1000 (EST) From: "Ian Manners" Subject: Any watcom guru's ? The following code snippet returns a blank for the converted bytes, any idea of what I'm doing wrong ? All variables are declared, and ultoa works fine when tested otherwise, I suspect the problem is staring me in the face, and I should go get some sleep... /**********************************/ /* Convert bytes to comma strings */ /**********************************/ char *convert_bytes(unsigned long size) { char *cp; char buffer[80]; char buff_temp[80]; int x; int y; int done; int length; int comma_counter; ultoa(size, buffer, 10); strrev(buffer); length=strlen(buffer); x=0; y=0; done=0; comma_counter=1; while(!done) { if(y3) && (y Subject: Re: USB card readers with OS/2 I seem to remember there was an article in OS/2 eZine on USB devices a few months ago. You might want to check this out. Cheers/2 Ed. Steve.Clark at nre.vic.gov.au wrote: > G'day all > > I'd like to get a card reader to read/write Secure DIgital cards. My local > Harvey Norman has USB readers called "6 in 1" sold under the Verbatim name > for $60-90 depending on which version of USB they support (1.? or 2.?). > Does anyone have experience with these under OS/2 (ECS)? If not, what > about alternative brands? My Ricoh digital camera won't send photos to my > OS/2 notebook via the USB port so a card reader would be a solution. > > Cheers > > Steve Clark > Hamilton, Victoria > > ---------------------------------------------------------------------------------- **= Email 3 ==========================** Date: Sun, 20 Apr 03 09:06:52 +1000 From: "Simon Coulter" Subject: Re: Any watcom guru's ? Hello Ian, You wrote: >The following code snippet returns a blank for the >converted bytes, any idea of what I'm doing wrong ? >All variables are declared, and ultoa works fine when >tested otherwise, I suspect the problem is staring me >in the face, and I should go get some sleep... The function does indeed format the input number with the appropriate commas so I presume you mean "it returns an empty string" rather than returns a blank but it could return anything at all--including the formatted string. Why? Because: char buff_temp[80]; is declared as local storage and then cp=buff_temp; sets cp to the address of the local storage and then return cp; returns that address to the caller. At this point the convert_bytes function has ended and all its automatic storage is reclaimed thus the pointer in the caller holding the address of buff_temp is no longer addressing valid storage. Thus it may point to initialised storage, the old storage, or anything at all. You can perform a quick fix by declaring buff_temp as static but be aware that has its own set of problems. Regards, Simon Coulter. -------------------------------------------------------------------- FlyByNight Software AS/400 Technical Specialists http://www.flybynight dot com dot au/ Phone: +61 3 9419 0175 Mobile: +61 0411 091 400 /"\ Fax: +61 3 9419 0175 mailto: shc at flybynight dot com dot au \ / X ASCII Ribbon campaign against HTML E-Mail / \ -------------------------------------------------------------------- ---------------------------------------------------------------------------------- **= Email 4 ==========================** Date: Sun, 20 Apr 2003 11:00:43 +1000 (EST) From: "Chris Graham [WarpSpeed]" Subject: Re: Any watcom guru's ? Here is a slightly more succinct version. It is what I use inside my utils: /* ------------------------------------------------------------------------ */ /* pretty_num() Format a ULONG into a string with commas. */ /* ------------------------------------------------------------------------ */ PSZ DLLENTRY pretty_num( ULONG ulValue, PSZ pszResult ) { char fDisplay = 0 ; int sDigit; ULONG ulQuotient, ulDivisor = 1000000000L ; static char szLocalBuff[40] ; PSZ pszLocalBuff ; pszLocalBuff = szLocalBuff ; for ( sDigit = 0; sDigit < 10; sDigit++ ) { ulQuotient = ulValue / ulDivisor ; if ( fDisplay || ulQuotient > 0 || sDigit == 9 ) { fDisplay = 1 ; *pszLocalBuff++ = (char) ('0' + ulQuotient) ; if ( ( sDigit % 3 == 0 ) && sDigit != 9 ) { *pszLocalBuff++ = lsSystemLanguage.chComma ; } } ulValue -= ulQuotient * ulDivisor ; ulDivisor /= 10 ; } *pszLocalBuff = '\0' ; if ( NULL != pszResult ) { strcpy( pszResult, szLocalBuff ) ; return( pszResult ) ; } else { return( szLocalBuff ) ; } } /* ------------------------------------------------------------------------ */ /* pretty_dbl() Format a DOUBLE into a string with commas. */ /* ------------------------------------------------------------------------ */ PSZ DLLENTRY pretty_dbl( double dValue, PSZ pszResult ) { char fDisplay = 0 ; int sDigit; double dDivisor = 1000000000000.0 ; ULONG ulQuotient ; static char szLocalBuff[40] ; PSZ pszLocalBuff ; pszLocalBuff = szLocalBuff ; for ( sDigit = 0; sDigit < 13; sDigit++ ) { ulQuotient = (ULONG) ( dValue / dDivisor ) ; if ( fDisplay || ulQuotient > 0 || sDigit == 12 ) { fDisplay = 1 ; *pszLocalBuff++ = (char) ('0' + ulQuotient) ; if ( ( sDigit % 3 == 0 ) && sDigit != 12 ) { *pszLocalBuff++ = lsSystemLanguage.chComma ; } } dValue -= ulQuotient * dDivisor ; dDivisor /= 10.0 ; } *pszLocalBuff = '\0' ; if ( NULL != pszResult ) { strcpy( pszResult, szLocalBuff ) ; return( pszResult ) ; } else { return( szLocalBuff ) ; } } The problem is your original code is that you are returning a pointer to a locally defined variable, which will be eventually overwritten as the stack is used else where. In essence, you've got: char * func(int param) { char szBuffer[80]; return( szBuffer ); } what you return, a) needs to be static (be vary careful in a multi threaded env) or b) pass in a buffer to fill. -Chris WarpSpeed Computers - The Graham Utilities for OS/2. Voice: +61-3-9307-0611 PO Box 212 FidoNet: 3:632/344 FAX: +61-3-9307-0633 Brunswick Internet: chrisg at warpspeed dot com dot au BBS: +61-3-9307-0644 VIC 3056 CompuServe: 100250,1645 300-28,800 N,8,1 ANSI Australia Web Page: http://www.warpspeed dot com dot au ---------------------------------------------------------------------------------- **= Email 5 ==========================** Date: Sun, 20 Apr 2003 12:55:12 +1000 (EST) From: "Ian Manners" Subject: Re: Any watcom guru's ? Hi Simon & Chris Thanks for the input, its amazing how when someone points it out and you read it the next day its all very obvious :-| I'll modify your code and slot that in thanks Chris, see how far I get, and if I've made more mistakes. I should probably be doing this in GCC but I started this in Watcom, so I'll try to finish it in watcom and move over to GCC later to keep up with the times, but then again, I've an OS/2 user :-) Cheers Ian B Manners http://www.os2site dot com/ Never spit in a man's face unless his moustache is on fire. --Henry Root ---------------------------------------------------------------------------------- **= Email 6 ==========================** Date: Sun, 20 Apr 2003 14:55:08 +1000 (EST) From: "Chris Graham [WarpSpeed]" Subject: RBL - blackholes.mail-abuse dot org Can some please tell me the real IP address of blackholes.mail-abuse dot org and it's authorative DNS, as I can not find it. TIA, -Chris WarpSpeed Computers - The Graham Utilities for OS/2. Voice: +61-3-9307-0611 PO Box 212 FidoNet: 3:632/344 FAX: +61-3-9307-0633 Brunswick Internet: chrisg at warpspeed dot com dot au BBS: +61-3-9307-0644 VIC 3056 CompuServe: 100250,1645 300-28,800 N,8,1 ANSI Australia Web Page: http://www.warpspeed dot com dot au ---------------------------------------------------------------------------------- **= Email 7 ==========================** Date: Sun, 20 Apr 2003 21:45:07 -0500 From: tsq at internode.on dot net Subject: Re: Novell migrates to Linux On 04/16/03 at 07:52 PM, Ed Durrant said: Hi Ed, ->Recent press releases from Novell have stated that their direction of ->development is to the Linux platform. Since Apple (through their ->implementation of Unix via OS/X) and IBM are also both suggesting the ->direction is to Linux rather than Windows, should we be looking to ->recompile or port open source applications from the Linux/unix platform ->to OS/2 rather than from the Windows platform ? There are some efforts underway in this area eg: www.unixos2 dot org www.os2ports dot org mailing list: os2-unix-request at warpix dot org netlabs have an OS/2 PM version of Gimp available utillising the everblue project. Xfree86/2: 3.3.6 & 4.2.99.2 languages: recent versions of perl, python, ruby, .... Recent addition: Zope There's some movement at the station ... regards Glenn. -- ----------------------------------------------------------- Glenn Thompson tsq at internode.on dot net OS/2 Users Group of South Australia www. ----------------------------------------------------------- ----------------------------------------------------------------------------------