GIDForums  

Go Back   GIDForums > Computer Programming Forums > C Programming Language
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 14-Jun-2004, 10:55
setupray setupray is offline
New Member
 
Join Date: Jun 2004
Posts: 4
setupray is on a distinguished road

fnmatch version with and without FNM_EXTMATCH


Hello,

please help!!!

I am a newbie to programming..in C

recently I have downloaded an open source code that was orginally ran in debian linux,

But, my uni only support Sun soloaris unix.

Everything seems to be ok...until

the open source code used fnmatch that used FNM_EXTMATCh flag.

The library of sun soloaris only has fnmatch ver 1.3, which does not have the FNM_EXTMATCH flag stuff.


Please help...what is the best way to solve this problem, please.

yours sincerely,

littel ray
  #2  
Old 14-Jun-2004, 11:27
aaroncohn's Avatar
aaroncohn aaroncohn is offline
Regular Member
 
Join Date: Feb 2004
Location: Bay Area, CA.
Posts: 564
aaroncohn is a jewel in the roughaaroncohn is a jewel in the roughaaroncohn is a jewel in the rough
WELCOME! I'm so glad you've found our forums. However, I really don't understand what your problem is. It appears that English is not your first language, so I'll go easy on you, but this problem really needs more explanation before a detailed answer can be given. So far the only conflict I see is between the debian fnmatch version and your operating system. Install the latest version of fnmatch for your operating system, or port their code to Solaris so that it'll run on your system. Why did you download the debian version, anyway?
__________________
-Aaron
  #3  
Old 14-Jun-2004, 22:08
setupray setupray is offline
New Member
 
Join Date: Jun 2004
Posts: 4
setupray is on a distinguished road

Fnm_extmatch


Sorry, I had left UK for almost three years now, so my English is a little small.

The aurthor of the program orginally build it on Debian Linux.

Now I am trying to use thie program on a solaris machine in my University.

The program used a library called fnmatch.h, which requires this FNM_EXTMATCH flag.

The version of fnmatch.h located in the soloaris machine is ver 1.3, which does not have the FNM_EXTMATCH.

I am not sure, which version is eariler.

I don't know where I guess you suggestion on downloading the fnmatch library is a good solution, but I am not too sure where I can download just that? Can you help me please.

yours sincerely,

little ray


Quote:
Originally Posted by aaroncohn
WELCOME! I'm so glad you've found our forums. However, I really don't understand what your problem is. It appears that English is not your first language, so I'll go easy on you, but this problem really needs more explanation before a detailed answer can be given. So far the only conflict I see is between the debian fnmatch version and your operating system. Install the latest version of fnmatch for your operating system, or port their code to Solaris so that it'll run on your system. Why did you download the debian version, anyway?
  #4  
Old 14-Jun-2004, 22:56
aaroncohn's Avatar
aaroncohn aaroncohn is offline
Regular Member
 
Join Date: Feb 2004
Location: Bay Area, CA.
Posts: 564
aaroncohn is a jewel in the roughaaroncohn is a jewel in the roughaaroncohn is a jewel in the rough
I've only done a small amount of searching, but it appears that 1.3 is the latest version.
__________________
-Aaron
  #5  
Old 15-Jun-2004, 08:11
dsmith's Avatar
dsmith dsmith is offline
Senior Member
 
Join Date: Jan 2004
Location: Utah, USA
Posts: 1,351
dsmith is a glorious beacon of lightdsmith is a glorious beacon of lightdsmith is a glorious beacon of lightdsmith is a glorious beacon of lightdsmith is a glorious beacon of light
Hi Little Ray.

What is the context in which FNM_EXTMATCH is used in this program? I think that you may want to look at what it is trying to do and see if you can get around it. Here is the definition of FNM_EXTMATCH from a linux system:

CPP / C++ / C Code:
#if !defined _POSIX_C_SOURCE || _POSIX_C_SOURCE < 2 || defined _GNU_SOURCE
# define FNM_FILE_NAME	 FNM_PATHNAME	/* Preferred GNU name.  */
# define FNM_LEADING_DIR (1 << 3)	/* Ignore `/...' after a match.  */
# define FNM_CASEFOLD	 (1 << 4)	/* Compare without regard to case.  */
# define FNM_EXTMATCH	 (1 << 5)	/* Use ksh-like extended matching. */
#endif

So it is using a Korn Shell extended matching. Having never used ksh, I am not sure of what this is exactly, but it may not be available in the Sun system. Anyway, if we could see the context of the call, perhaps we could see why it is important to use FNM_EXTMATCH.
  #6  
Old 18-Jun-2004, 05:00
setupray setupray is offline
New Member
 
Join Date: Jun 2004
Posts: 4
setupray is on a distinguished road

Why FNM_EXTMATCH


The original code was not writtne by me.
I can barely understand why.
I think its because it content some ksh structure in the string to be compare.
I think the simiplest way is to find a complete version of fnmatch.h for sun that support FNM_EXTMATCH. Does any one know where I can download that please?

little ray


the code below is part of the extraction from near the FNM_EXTMATCH of the source code.
CPP / C++ / C Code:
      if (strcmp(temptd->state,"@(any)")==0 ||
          strcmp(temptd->state,"@(*)")==0)
      {
        fprintf(cfile,"1 ");
      }
      else
      {
        the_first = 1;
        temps = my_states;
        while (temps)
        {
          if (fnmatch(temptd->state,temps->base_state_name,FNM_EXTMATCH)==0)
          {
            if (!the_first) fprintf(cfile, " ||");
            else the_first = 0;
            fprintf(cfile, " fsm == %s ",temps->state_name);
          }



Quote:
Originally Posted by dsmith
Hi Little Ray.

What is the context in which FNM_EXTMATCH is used in this program? I think that you may want to look at what it is trying to do and see if you can get around it. Here is the definition of FNM_EXTMATCH from a linux system:

CPP / C++ / C Code:
#if !defined _POSIX_C_SOURCE || _POSIX_C_SOURCE < 2 || defined _GNU_SOURCE
# define FNM_FILE_NAME	 FNM_PATHNAME	/* Preferred GNU name.  */
# define FNM_LEADING_DIR (1 << 3)	/* Ignore `/...' after a match.  */
# define FNM_CASEFOLD	 (1 << 4)	/* Compare without regard to case.  */
# define FNM_EXTMATCH	 (1 << 5)	/* Use ksh-like extended matching. */
#endif

So it is using a Korn Shell extended matching. Having never used ksh, I am not sure of what this is exactly, but it may not be available in the Sun system. Anyway, if we could see the context of the call, perhaps we could see why it is important to use FNM_EXTMATCH.
Last edited by dsmith : 18-Jun-2004 at 07:24.
  #7  
Old 18-Jun-2004, 08:05
dsmith's Avatar
dsmith dsmith is offline
Senior Member
 
Join Date: Jan 2004
Location: Utah, USA
Posts: 1,351
dsmith is a glorious beacon of lightdsmith is a glorious beacon of lightdsmith is a glorious beacon of lightdsmith is a glorious beacon of lightdsmith is a glorious beacon of light
This seems to be a GNU C library specific flag. You can get the entire library here. You could then try to compile only the fnmatch object files and see if you could make your own fnmatch version. This does not seem to be available as a single library.

That is why this works on gnu/linux, because it uses the gnu C library. While fnmatch is a standard routine, the gnu C library has "extended" it to include this flag. While this is a nice feature, it is going to break across other *nixes, unless you can use the Gnu C Library.

Sorry. If you knew more about why the FNM_EXTMATCH was needed, you may be able to write around it.
  #8  
Old 20-Jun-2004, 09:21
setupray setupray is offline
New Member
 
Join Date: Jun 2004
Posts: 4
setupray is on a distinguished road

Don't know where to begin...


Thanks for the link to the library, I 'll give it a try, see if I can drag the fnmatch library out.

I wanted to write around it as well, but I didn't wrote the code. Also, its very complicated. First of all the code is generated by from a yacc file to start with...then, it builds a compiler that compile .mac script file, then, from than script file it can either generates ns-2 script or c++ script. I can barely understand the concept, never mind trying to go around it

I'll try it out, if it doesn't work. I'll ask agian.

little ray

Quote:
Originally Posted by dsmith
This seems to be a GNU C library specific flag. You can get the entire library ftp.gnu.org. You could then try to compile only the fnmatch object files and see if you could make your own fnmatch version. This does not seem to be available as a single library.

That is why this works on gnu/linux, because it uses the gnu C library. While fnmatch is a standard routine, the gnu C library has "extended" it to include this flag. While this is a nice feature, it is going to break across other *nixes, unless you can use the Gnu C Library.

Sorry. If you knew more about why the FNM_EXTMATCH was needed, you may be able to write around it.
:-(
 
 

Recent GIDBlogMeeting the local Iraqis by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 14:34.


vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.