Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!columbia!rutgers!clyde!cbatt!cwruecmp!hal!ncoast!robertd From: robertd@ncoast.UUCP (Rob DeMarco) Newsgroups: comp.unix.questions Subject: Re: A couple questions Message-ID: <2382@ncoast.UUCP> Date: Sat, 18-Apr-87 09:27:49 EST Article-I.D.: ncoast.2382 Posted: Sat Apr 18 09:27:49 1987 Date-Received: Tue, 21-Apr-87 03:55:17 EST References: <3164@jade.BERKELEY.EDU> Reply-To: robertd@ncoast.UUCP (Rob DeMarco) Organization: Cleveland Public Access UN*X, Cleveland, Oh Lines: 45 In article <3164@jade.BERKELEY.EDU> marcp@beryl.berkeley.edu (Marc M. Pack) writes: >Hello! I've a couple of questions in UNIX 4.2. > >1. How do programs like "more" distinguish between text files and > executable files? Hopefully, there's something surer than > just taking a sample of a file and testing it. (This question > came up when a bunch of people started accidentally sending > executables to a line printer, and I was trying to figure > out a way to filter out the execs from the texts). I would believe that a pretty sure method would be to test the file permisions, if an "x" accours in the file permisions, then it is executable, other wise its text. >2. Is it possible to, while in a C program, call another program and > put it into the background? Actually, I know it's possible, > 'cause I can do it with a line like: > > system("cat textfile &"); > > This won't work, however, if I try to "more" the file instead. > What determines what can be put in the background and what can't? My guess is that more accepts input, since you have to press to go on. Since it is in background, it doesn't wait for it to complete before going on, therefor , getting input is imposible, because it doesn't check for input. >Thanks for your time, Your welcome! :-) > Marc M. Pack -- [=====================================] [ Rob DeMarco ] [ UUCP:decvax!cwruecmp!ncoast!robertd ] [ ] [ "bus error - passengers dumped" ] [===============7@rid/* (/* (/, /Wagiste