|
Prev: damenbekleidung bestellen xxl damenbekleidung bestellen gr 46 gebrauchte damenkleidung kaufen restposten damenbekleidung bestellen
Next: Amusing factoid..
From: rudra on 16 Jul 2008 03:03 dear friends, firstly plz pardon me if you think this is *NOT* the right place of posting this topic in my code, i am testing the machine system using popen command. but for testing , i have to write a casceding if-else-if list as if (strncmp(sysptr, "i686",4)==0) { t=1; } else { if (strncmp(sysptr, "i386",4)==0) { t=1; } else { t=0; } } is it possible to test it as it is done in configure file? eg: case "$host_arch" in i[3-9]86|x86|x86pc|k5|k6|k6-2|k6-3|pentium*|athlon*|i586-i686) return 0 ;; *) return 1 ;; instead of those casceding if-else?
From: Joachim Schmitz on 16 Jul 2008 05:57 rudra wrote: > dear friends, > firstly plz pardon me if you think this is *NOT* the right place of > posting this topic > in my code, i am testing the machine system using popen command. > but for testing , i have to write a casceding if-else-if list as > > if (strncmp(sysptr, "i686",4)==0) > { > t=1; > } > > else { > if (strncmp(sysptr, "i386",4)==0) { > t=1; > } > else { > t=0; > } > } Nothing C++ like here, surely looks like plain C (but also legal C++) > is it possible to test it as it is done in configure file? eg: > > case "$host_arch" in > i[3-9]86|x86|x86pc|k5|k6|k6-2|k6-3|pentium*|athlon*|i586-i686) > return 0 ;; > *) return 1 ;; > instead of those casceding if-else? Yes, sort of: if ((strncmp(sysptr, "i686",4)==0) || (strncmp(sysptr, "i386",4)==0)) { return 1; } else { return 0; } Bye, Jojo
From: rudra on 16 Jul 2008 10:12
On Jul 16, 2:57 pm, "Joachim Schmitz" <nospam.j...(a)schmitz-digital.de> wrote: > Nothing C++ like here, surely looks like plain C (but also legal C++) You are right...its just a C routine.....but i have used one CPP statement so that i was forced to name it as cpp. > Yes, sort of: > if ((strncmp(sysptr, "i686",4)==0) || > (strncmp(sysptr, "i386",4)==0)) { > return 1; > > } else { > return 0; > } > > Bye, Jojo Thanks.....its working fine |