Sponsored Content
Full Discussion: Switch
Top Forums Programming Switch Post 84483 by vino on Monday 26th of September 2005 01:25:50 AM
Old 09-26-2005
Quote:
Originally Posted by abey
using switch can we match for more than one values..

eg:

switcha(a)
{
case 1, 2, 3: printf("ddd");
break;
case 4, 5, 6: printf("mmm");
break;
}

In this case wat i found was only for the last value, i.e 3 and 6 the switch works.

I'd greateful if someone can help me in solving this out(using switch or any other alternative).


abey
Code:
{
case 1:
case 2:
case 3: printf("ddd"); break ;
case 4:
case 5:
case 6: printf("mmm"); break ;
}

This should work.

vino
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

can you switch

hi, i am try to run following script in c-shell, using switch command. #!/bin/csh choice=0 while do echo "system monitor" echo " 1) system paging 2) system file inf. 3) system disk inf. 9) exit " echo "select an option: \c" read choice case $choice in 1)... (3 Replies)
Discussion started by: neer45
3 Replies

2. Shell Programming and Scripting

script with more then one switch

Hi, have managed to code a script that has a simple menu so for instance if I run: this will call a help function that displays the programs help, I have coded this in using a case statement so if: case is h) call the help function The problem is I don't know how to code in the... (3 Replies)
Discussion started by: Del33t
3 Replies

3. UNIX for Advanced & Expert Users

switch login

Hi, How can I switch from one login to another login in UNIX. su command is disabled in my environment. Is there any alternate way to login. (1 Reply)
Discussion started by: sharif
1 Replies

4. Shell Programming and Scripting

Switch + stirng

Hi, This script receive in input 2 parameters, the use $2 in this way: switch ($2) case r: p=r-- echo $2 ok breaksw case rw: p=rw- echo $2 ok breaksw case rwx: p=rwx echo $2 ok breaksw default... (5 Replies)
Discussion started by: DNAx86
5 Replies

5. UNIX for Advanced & Expert Users

Accessing switch

Hello Community! Anyone knows how can I access the switch for monitoring the traffic on my LAN? The switch is a Linksys sr2024 Thanks in advance (1 Reply)
Discussion started by: ncatdesigner
1 Replies

6. Shell Programming and Scripting

need help for cp with -p switch

Guys, I need to copy files from source to destination with datetime preserved I did it with cp -p <source>/file <destinaltion>/file But when I do stat command on copied file , it seems the copied file has "change time" modified. Please guide me in understanding (2 Replies)
Discussion started by: mohan_xunil
2 Replies

7. Shell Programming and Scripting

how to access console of a switch having rj45 on switch side to db 9 female on pc side console cable

hi, how to access console of a switch having rj45 on switch side to db 9 female on pc side console cable which needs to be connected to one console server having rj11 on its side and db 9 female on other end.i.e. on switch side,console cable has rj45 and db 9 pin female connector on other side of... (1 Reply)
Discussion started by: pankajd
1 Replies

8. UNIX for Dummies Questions & Answers

Tar with -T switch

Howdy, I'm trying to tar a bunch of files into their own individual tar archives. In other words i have files a.txt thru z.txt and i want to create a.tar thru z.tar in the same folder. I've been using -T to read in the list of files to be archived but i can't get it to work. I think my problem is... (5 Replies)
Discussion started by: fistikuffs
5 Replies

9. Solaris

Switch to su

Hi, I've put the correct root password but why do I get this below? huamin@SOL11I:~$ su Password: su: Sorry huamin@SOL11I:~$ Many Thanks & Best Regards, HuaMin (16 Replies)
Discussion started by: HuaMin
16 Replies
scsi_probe(9F)						   Kernel Functions for Drivers 					    scsi_probe(9F)

NAME
scsi_probe - utility for probing a scsi device SYNOPSIS
#include <sys/scsi/scsi.h> int scsi_probe(struct scsi_device *devp, int (*waitfunc); INTERFACE LEVEL
Solaris DDI specific (Solaris DDI). PARAMETERS
devp Pointer to a scsi_device(9S) structure waitfunc NULL_FUNC or SLEEP_FUNC DESCRIPTION
scsi_probe() determines whether a target/lun is present and sets up the scsi_device structure with inquiry data. scsi_probe() uses the SCSI Inquiry command to test if the device exists. It can retry the Inquiry command as appropriate. If scsi_probe() is successful, it will allocate space for the scsi_inquiry structure and assign the address to the sd_inq member of the scsi_device(9S) structure. scsi_probe() will then fill in this scsi_inquiry(9S) structure and return SCSIPROBE_EXISTS. If scsi_probe() is unsuccessful, it returns SCSIPROBE_NOMEM in spite of callback set to SLEEP_FUNC. scsi_unprobe(9F) is used to undo the effect of scsi_probe(). If the target is a non-CCS device, SCSIPROBE_NONCCS will be returned. waitfunc indicates what the allocator routines should do when resources are not available; the valid values are: NULL_FUNC Do not wait for resources. Return SCSIPROBE_NOMEM or SCSIPROBE_FAILURE SLEEP_FUNC Wait indefinitely for resources. RETURN VALUES
scsi_probe() returns: SCSIPROBE_BUSY Device exists but is currently busy. SCSIPROBE_EXISTS Device exists and inquiry data is valid. SCSIPROBE_FAILURE Polled command failure. SCSIPROBE_NOMEM No space available for structures. SCSIPROBE_NOMEM_CB No space available for structures but callback request has been queued. SCSIPROBE_NONCCS Device exists but inquiry data is not valid. SCSIPROBE_NORESP Device does not respond to an INQUIRY. CONTEXT
scsi_probe() is normally called from the target driver's probe(9E) or attach(9E) routine. In any case, this routine should not be called from interrupt context, because it can sleep waiting for memory to be allocated. EXAMPLES
Example 1 Using scsi_probe() switch (scsi_probe(devp, NULL_FUNC)) { default: case SCSIPROBE_NORESP: case SCSIPROBE_NONCCS: case SCSIPROBE_NOMEM: case SCSIPROBE_FAILURE: case SCSIPROBE_BUSY: break; case SCSIPROBE_EXISTS: switch (devp->sd_inq->inq_dtype) { case DTYPE_DIRECT: rval = DDI_PROBE_SUCCESS; break; case DTYPE_RODIRECT: rval = DDI_PROBE_SUCCESS; break; case DTYPE_NOTPRESENT: default: break; } } scsi_unprobe(devp); SEE ALSO
attach(9E), probe(9E), scsi_slave(9F), scsi_unprobe(9F), scsi_unslave(9F), scsi_device(9S), scsi_inquiry(9S) ANSI Small Computer System Interface-2 (SCSI-2) Writing Device Drivers NOTES
A waitfunc function other than NULL_FUNC or SLEEP_FUNC is not supported and may have unexpected results. SunOS 5.11 26 Feb 2002 scsi_probe(9F)
All times are GMT -4. The time now is 07:47 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy