Xref: utzoo comp.unix.programmer:1143 comp.unix.internals:2131 Path: utzoo!mnetor!tmsoft!torsqnt!news-server.csri.toronto.edu!bonnie.concordia.ca!thunder.mcrcim.mcgill.edu!snorkelwacker.mit.edu!usc!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!linac!att!pacbell.com!ucsd!dog.ee.lbl.gov!nosc!humu!pegasus!pilikia!art From: art@pilikia.pegasus.com (Art Neilson) Newsgroups: comp.unix.programmer,comp.unix.internals Subject: Re: ls & file pipes (FIFO), curses... Message-ID: <1991Feb20.184948.11808@pilikia.pegasus.com> Date: 20 Feb 91 18:49:48 GMT References: Organization: Pilikia, Honolulu Lines: 20 In article avalon@coombs.anu.edu.au (avalon) writes: >G'day, can anyone tell me how 'ls' knows whether a >file is a regular file or a pipe ? > >When i do a stat(2) call on the file, it is returned >as a regular file. What tricks does ls perform ? Here's an example of testing if a file is a pipe or not: if (stat(pathname, &st) == -1) { perror("stat"); exit(1); } if ((st.st_mode & S_IFMT) == S_IFIFO) printf("%s is a fifo\n", pathname); -- Arthur W. Neilson III | INET: art@pilikia.pegasus.com Bank of Hawaii Tech Support | UUCP: uunet!ucsd!nosc!pegasus!pilikia!art Brought to you by Super Global Mega Corp .com