delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2002/10/08/08:15:15

From: dmcg6174 AT yahoo DOT com (daniel gerard mcgrath)
Newsgroups: comp.os.msdos.djgpp,comp.emacs
Subject: Re: "shell" command in DJGPP Emacs?
Message-ID: <3da2c999.5774704@news-server.optonline.net>
References: <3da26e84 DOT 3476875 AT news-server DOT optonline DOT net> <anu64k$mgp$1 AT nets3 DOT rz DOT RWTH-Aachen DOT DE> <3da2bdfe DOT 2802949 AT news-server DOT optonline DOT net> <x5ofa52m6q DOT fsf AT tupik DOT goethe DOT zz>
X-Newsreader: Forte Free Agent 1.21/32.243
Lines: 59
Date: Tue, 08 Oct 2002 12:22:44 GMT
NNTP-Posting-Host: 24.190.226.156
X-Trace: news4.srv.hcvlny.cv.net 1034079002 24.190.226.156 (Tue, 08 Oct 2002 08:10:02 EDT)
NNTP-Posting-Date: Tue, 08 Oct 2002 08:10:02 EDT
Organization: Optimum Online
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

On 08 Oct 2002 13:40:29 +0200, David Kastrup
<David DOT Kastrup AT t-online DOT de> wrote:

>dmcg6174 AT yahoo DOT com (daniel gerard mcgrath) writes:
>
>> On 8 Oct 2002 08:48:20 GMT, Hans-Bernhard Broeker
>> <broeker AT physik DOT rwth-aachen DOT de> wrote:
>> 
>> >In comp.os.msdos.djgpp daniel gerard mcgrath <dmcg6174 AT yahoo DOT com> wrote:
>> >> Hi.  I use the DJGPP version of Emacs under DOS (Windows 98).  I am
>> >> trying to figure out, how do you get a sort of "M-x shell" command,
>> >> where you type in successive DOS commands?
>> >
>> >M-x shell and similar commands, i.e. anything where you type live
>> >command input to some other program into an emacs window, cannot work
>> >on DOS.  DOS *is* a single-tasking operating system, after all. 
>> 
>> Hmmm, I guess maybe I should then get my C source code translated into
>> Emacs-Lisp?  Here it is:
>> 
>> int main(int argc, char **argv)
>> {
>>   int i;
>> 
>>   for (i = 1; i < argc; ++i)
>>     {
>>       int c, lines;
>>       FILE *file;
>> 
>>       lines = 0;
>>       file = fopen(argv[i], "r");
>>       while ((c = getc(file)) != EOF)
>> 	{
>> 	  if (c == '\n') { ++lines; }
>> 	}
>>       printf("%d\n", lines);
>>       fclose(file);
>>     }
>>   return 0;
>> }
>> 
>> /*** end of clif.c ******************************/
>> 
>> Maybe I can get somewhere from there?
>
>C-h f count-lines
>
OK!  Well, actually, I need a function that works something like this:

(count-lines-in-file FILENAME)

where FILENAME is some sort of path name, like
"/windows/dansstuf.txt", and the result being that the number of lines
(i.e. newline characters) in DANSSTUF.TXT (or whatever) is returned
from the "count-lines-in-file" function.

--------------------------------------------------
daniel g. mcgrath (currently going through a depression)
http://members.tripod.com/denyore_w0o/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019