public inbox for linux-ia64@vger.kernel.org
 help / color / mirror / Atom feed
* [Linux-ia64] sscanf() broken on ia64
@ 2001-10-18 21:50 David J. Morse
  2001-10-18 23:03 ` Keith Owens
  0 siblings, 1 reply; 2+ messages in thread
From: David J. Morse @ 2001-10-18 21:50 UTC (permalink / raw)
  To: linux-ia64

Hi,

I'm having a problem with sscanf() on IA-64; it seems to be able to parse
a string into arguments correctly when whitespace is the delimiter, but
not "."!

Below is a small module to illustrate what I mean (you must be running
2.4.10 or greater, since that's when sscanf was added).  On IA-64 I get

sscanf returned 1, d1\x192, d2=0, d30, d4=0, port=0
sscanf returned 5, d1\x192, d2=1, d3=1, d4\x132, port€

when I should get the latter both times (as I do on x86).

Can someone help?

Thanks,

David
-----------------------------------------------------------------
/* sscanf.c 
 * 
 * Tests sscanf() functionality as a loadable kernel module.
 *
 *  gcc -Wall -Wstrict-prototypes -O6 -I/lib/modules/`uname -r`/build/include
-c -o sscanf.o sscanf.c
 */

/* Declare what kind of code we want from the header files */
#define __KERNEL__         /* We're part of the kernel */
#define MODULE             /* Not a permanent part, though. */

/* Standard headers for LKMs */
#include <linux/modversions.h> 
#include <linux/module.h>  

/* Initialize the LKM */
int init_module()
{
        unsigned int d1, d2, d3, d4, port;
	int retval = 0;

	/* This does not work on IA-64 */
	retval = sscanf("192.1.1.132:80", "%d.%d.%d.%d:%d",
                                        &d1, &d2, &d3, &d4, &port);
	printk(KERN_INFO "sscanf returned %d, d1=%d, d2=%d, d3=%d, d4=%d,
port=%d\n", retval, d1, d2, d3, d4, port);

	/* This does work on IA-64 */

	retval = sscanf("192 1 1 132 80", "%d %d %d %d %d",
                                        &d1, &d2, &d3, &d4, &port);
	printk(KERN_INFO "sscanf returned %d, d1=%d, d2=%d, d3=%d, d4=%d,
port=%d\n", retval, d1, d2, d3, d4, port);

  return 0;
}


/* Cleanup - undo whatever init_module did */
void cleanup_module()
{
  printk(KERN_INFO "Removing sscanf module\n");
}


__________________________________________________
FREE voicemail, email, and fax...all in one place.
Sign Up Now! http://www.onebox.com



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [Linux-ia64] sscanf() broken on ia64
  2001-10-18 21:50 [Linux-ia64] sscanf() broken on ia64 David J. Morse
@ 2001-10-18 23:03 ` Keith Owens
  0 siblings, 0 replies; 2+ messages in thread
From: Keith Owens @ 2001-10-18 23:03 UTC (permalink / raw)
  To: linux-ia64

On Thu, 18 Oct 2001 16:50:28 -0500, 
"David J. Morse" <david.morse@onebox.com> wrote:
>I'm having a problem with sscanf() on IA-64; it seems to be able to parse
>a string into arguments correctly when whitespace is the delimiter, but
>not "."!

lib/vsprintf.c::vscanf had a bug in handling non-format characters.  It
was corrected in 2.4.13-pre3.  Try copying lib/vsprintf.c from a
current Linus kernel into your IA64 kernel.

>/* Declare what kind of code we want from the header files */
>#define __KERNEL__         /* We're part of the kernel */
>#define MODULE             /* Not a permanent part, though. */
>
>/* Standard headers for LKMs */
>#include <linux/modversions.h> 
>#include <linux/module.h>  

Unrelated to the scanf problem.  Please do not #define those symbols
nor include modversions.h in modules, even sample ones, the symbols and
include should be handled via the command line.  That code will break
in kernel 2.5 with my new kernel build system.



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2001-10-18 23:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-10-18 21:50 [Linux-ia64] sscanf() broken on ia64 David J. Morse
2001-10-18 23:03 ` Keith Owens

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox