HDTenEightyP/NetNews huggingface dataset:
From: zhu@cs.utexas.edu (Kai Zhu)
Newsgroups: comp.unix.questions,comp.lang.c
Subject: Free memory, memory usage
Followup-To: poster
Date: 27 Aug 1992 22:23:10 -0500
Organization: CS Dept, University of Texas at Austin
NNTP-Posting-Host: panda.cs.utexas.edu
Keywords: free(), ps -u

I run the following program to see the effect of free() function
and system call "ps -u" for measuring memory usage by the process:

========================
#include <stdio.h>
#include <malloc.h>

main()
{
   printf("***** before function.\n");
   system("ps -ux | grep 'a.out'");
   sub();
   printf("***** after function.\n");
   system("ps -ux | grep 'a.out'");

}

sub()
{
   int num[500000], i;
   char *ptr[2];

   for (i = 0; i < 2; i++) {
      printf("i = %d\n", i);
      if ((ptr[i] = (char *) malloc(1000000)) == NULL) {
	 printf("Cannot get memory\n");
	 exit(1);
      }
      system("ps -ux | grep 'a.out'");
   }
   for (i = 0; i < 2; i++) {
      printf("i = %d\n", i);
      free(ptr[i]);
      system("ps -ux | grep 'a.out'");
   }
}
======================

The outputs are (irrelevant outputs are deleted):

=====================
USER       PID %CPU %MEM   SZ  RSS TT STAT START  TIME COMMAND /* I add this line */
***** before function.
zhu      21565  7.7  1.3   24  188 p8 S    22:02   0:00 a.out
i = 0
zhu      21565  3.9  1.4 2956  204 p8 S    22:02   0:00 a.out
i = 1
zhu      21565  2.7  1.4 3936  204 p8 S    22:02   0:00 a.out
i = 0
zhu      21565  2.1  1.4 3936  208 p8 S    22:02   0:00 a.out /* memory usage increases*/
i = 1
zhu      21565  1.7  1.4 3936  204 p8 S    22:02   0:00 a.out
***** after function.
zhu      21565  0.0  1.4 3936  208 p8 S    22:02   0:00 a.out /* memory increases */
======================

My questions are:
(1) Is "ps -u" the command to check the memory usage by a process 
    during its execution ?
(2) If the anwser to (1) is yes, why the memory used by the process increases
    after ptr[0] was freed ?  The man page of ps says the field RSS is 
    real memory usage, and the field SZ is the combined size of the data
    and stack segments. What is the difference between RSS and SZ ?
(3) After calling function sub(), the memory usage is larger than that
    before calling sub() and SZ stays the same.  Why the memory used 
    by the array num[] in sub() was not released after calling sub() ?
(4) I tried out any testing program.  After freeing a string, the content
    of the string can still be printed out.  This means free(ptr) does not set
    ptr (or any pointer) to NULL. Does this imply the memory is not freed ? 

Any explanations will be greatly appreciated.
Apology if the posting is too long.

-Kai Zhu
zhu@cs.utexas.edu
From: chem001@hoss.unl.edu (Jonathan Skean)
Newsgroups: comp.unix.questions
Subject: Re: Man page ---> postscript .... help!
Date: 29 Aug 92 20:18:32 GMT
Distribution: all
Organization: University of Nebraska - Lincoln

In <1992Aug29.115148@betsy.mc.ti.com> cobb@betsy.mc.ti.com (Chip Cobb) writes:

>This is probably a very basic question.  I want to print a man 
>page on a postscript printer.

I can't help with the postscript part, but this is what I do to
convert a man entry for a given command to a text file:

man command |col -b >temp;uniq temp m_command;rm temp;vi m_command

Actually, I have a line in my .cshrc file that aliases this for me,
but you get the idea.   I'm sure there are slicker ways to do this
and I'd be grateful to anyone who would follow up with a better
method.
--
Jonathan Skean                     usenet: JSKEAN@UNL.EDU
502 Hamilton Hall                  bitnet: JSKEAN%UNL.EDU@UNLVAX1
University of Nebraska              voice: (402)472-2684
Lincoln, NE 68588-0304   USA          fax: (402)472-9402
Newsgroups: comp.unix.questions
From: Tom Christiansen <tchrist@convex.COM>
Subject: Re: specifying range in awk
Originator: tchrist@pixel.convex.com
Date: Fri, 28 Aug 1992 04:06:43 GMT
Reply-To: tchrist@convex.COM (Tom Christiansen)
Organization: Convex Computer Corporation, Colorado Springs, CO
X-Disclaimer: This message was written by a user at CONVEX Computer
              Corp. The opinions expressed are those of the user and
              not necessarily those of CONVEX.

From the keyboard of b130778@hp9000.csc.cuhk.hk (MA NGAI LING):
:
:	        I have a file looking like the following:
:
:aaaa
:bbbb
:cccc
:dddd
:eeee
:aaaa
:bbbb
:bbbbb
:cccc
:
:        I would like to use awk or sed or something else to get all   
:ocurrence of a and anything between "c" and "e".  I tried 'a|c,e' and
:other combination in awk without much joy.  Is there any way to do it?
:Thanks in advance.

Anything wrong with:

    sed -ne '/a/,/[ce]/p'

--tom
-- 
    Tom Christiansen      tchrist@convex.com      convex!tchrist
"I sincerely hope that the future does not mean we must continually restrict
 ourselves to the tools that were available 10 years ago."
	Mark Bush in comp.unix.wizards <4235@inca.comlab.ox.ac.uk>
From: zeev@key.amdahl.com (Ze'ev Wurman)
Newsgroups: comp.unix.questions
Subject: Re: emulating a vt100 terminal under Openwindows 2.0
Date: 4 Sep 92 18:03:37 GMT


Newsgroups: comp.unix.questions
From: dxs@evolving.com (Dan Stanger)
Subject: changing name of core file
Date: Thu, 3 Sep 1992 21:06:50 GMT
Organization: Evolving Systems, Inc.

does anyone know how to change the name of the core file that will be
created if a program fails.  we have several programs running in the
same directory so if more than one of them fails the core file from
one overwrites the other.  we would like to change the name to
program.core or somthing like that.

thanks

dxs@evolving.com
From: zzang@whale.uucp (Zhuo Zang)
Newsgroups: comp.unix.questions
Subject: Zmodem upload problem
Date: 25 Aug 92 17:43:27 GMT
Distribution: usa
Organization: University of Florida

Hello,
I installed the Zmodem on our DECstation running
Ultrix 4.2 . I use ProComm 2.4.2 on my PC .
The Zmodem contains Ymodem, so I use the Ymodem in
ProComm to transfer the files DECstation <-> PC .
I can download from the DECstation to PC, but I
can't upload from PC to DECstation .

I used:
>sb <file>
for download
>rb
for upload

The message I got is :bad packet .

I tried to debug the source program, the problem
looks like the crc checking problem  and also
the block number sent by the ProComm does not
match the one in Zmodem.

Does anyone have such experiences ?

The line setting I use in ProComm is 1200-N-8-1 .
My PC is an XT.

Possible problem:??
1. the ProComm sends 8-bit crc (actually I don't know
   what kind of crc the ProComm is using), while Zmodem uses 16-bit crc
   this will cause crc mismatching.
   But I use the Ymodem when I connect to BBS, without any 
   problem .
2. the PC is 16-bit, while the Unix is 32-bit
   But why the downloading is alright?


Thanks in advance !

--zhuo
Newsgroups: comp.unix.questions
From: zzang@whale.uucp (Zhuo Zang)
Subject: mail help: how to reject mail?
Organization: University of Florida
Distribution: usa
Date: Thu, 27 Aug 92 15:28:47 GMT

Hello,
this may look like a strange question.
someone distributes mails to our Dept
on a weekly base . but not neccessarily
everyone in this Dept need that info,
is it possible to reject this kind of
mail on personal preference?

Thanks in advance !

-zhuo
From: drs@muppet.bt.co.uk (Dave Smith)
Newsgroups: comp.unix.questions
Subject: Re: vi (cut and paste)
Date: 25 Aug 92 11:52:10 GMT
Reply-To: drs@muppet.bt.co.uk
Organization: BTL

In article 6759@uxa.ecn.bgu.edu, mflll@uxa.ecn.bgu.edu (Dr. Laurence Leff) writes:
>...
>For example, you may have a procedure defined in file1 and you would
>like to make use of it in a program contained in file2.
>...
>This will consist of starting file1 up with vi, copying the block
>of text to a temporary file.  Then you will read the temporary file
>into the appropriate location in file2.
>

Hmm,,, why use the temp file? T'is easier using a named buffer as
a holding place, and :e'ing to the second file
 

 / Dave Smith          \/                                                \
|| drs@muppet.bt.co.uk || Quoth the Raven 'Nevermore'...                 ||
|| tel: +44 473 647694 || as if his soul in that one word he did outpour ||
 \                     /\                                                /
Newsgroups: comp.unix.questions
From: ellis@nova.gmi.edu (Stew Ellis)
Subject: Re: How to prevent a large core-dump
Organization: GMI Engineering&Management Institute, Flint, MI
Date: Sat, 29 Aug 1992 15:23:01 GMT

gjn@cs.uq.oz.au (Geoff (cbird) Newton) writes:

>In <118390009@hpcupt3.cup.hp.com> aakash@hpcupt3.cup.hp.com (Aakash Sahai) writes:

>>In article <1992Aug25.173056.13401@utwente.nl> soos@math.utwente.nl (Adwin Soos) writes:
>>| A few weeks or even months ago I have read some discussion about the problem
>>| of preventing a core-dump.

>>Two simple solutions are -

>>(i)	Run the core-dumping program from a directory where the user does
>>	not have permission to create file.

>>(ii)	Set the Effective-User-ID of the program different from its
>>	Real-User-ID.

>Most systems have a ulimit command which allows you to set resource limits.

>bash has a builtin ulimit command, 'ulimit -c <num>' specifies the max size
>of a corefile. <num> == 0 means no coredumps.

>csh has a similar feature with its builtin 'limit' (limit coredumpsize <num>).

>gjn
>gjn@cs.uq.oz.au
>(-|


On SunOS, the core filesize if usually reported as being much larger than
the number of blocks it actually occupies.  The reason is that it does not
dump the dynamic libs with the image, but reports the amount of mem they
take up when the process is running.  Frequently they take up only 20K even
though they report 8M with ls -l.

Frequently it is not the size that is a problem, but rather the information
they may contain to the curious person with access to strings.  If you use
the limit command in the csh family, that does not impact a program that is
running suid root, and you can get a core that contains passwords or
something else sensitive written in a core that is mode 644.  What I have
done is 'ln /dev/null core' in some of the directories where cores have had
a nasty habit of showing up.  Does anybody know of any problem with this?

--
--                                                        ___________________
  R.Stewart(Stew) Ellis, Assoc.Prof., (Off)313-762-9765  /   _____  ______ 
  Humanities & Social Science,  GMI Eng.& Mgmt. Inst.   /        / /  /  / /
  Flint, MI 48504      ellis@nova.gmi.edu              /________/ /  /  / /
From: zhu@cs.utexas.edu (Kai Zhu)
Newsgroups: comp.unix.questions
Subject: FAQ
Date: 27 Aug 1992 20:44:08 -0500
Organization: CS Dept, University of Texas at Austin
NNTP-Posting-Host: panda.cs.utexas.edu

I would to like to have a copy of FAQ of this news group.
Could anyone send me a copy or tell me the FTP site ?
Thanks in advance.

-Kai Zhu
zhu@cs.utexas.edu

Newsgroups: comp.unix.questions
From: ahoekstr@cs.utwente.nl (Andre Hoekstra)
Subject: Re: How can I allow access to a subdirectory without risking other files?
Organization: University of Twente, Dept. of Computer Science
Date: Fri, 4 Sep 1992 12:58:22 GMT

In article <Btq39I.1on@chinet.chi.il.us> les@chinet.chi.il.us (Leslie Mikesell) writes:
>In article <92Aug26.165308.27634@acs.ucalgary.ca> barker@enel.ucalgary.ca writes:
>>I know how to give group/other access to a subdirectory without risking my
>>other files, however, I want people to be able to read/write to ANY file in
>>the subdirectory. That includes files put there by other people.  The only way
>>I know of to do this is to make sure that everyone has their umask set to 000
>>when they are working in that subdirectory.
>
>It sounds fairly dangerous to do this without any arbitration to keep
>several people from writing to the same file at once.  Why don't you
>just insist that each person copy a file before making changes?  Or
>write a suid root program that does nothing but change the modes on
>the files in that directory and make the users run that before writing
>to any files.  Better yet, make the program also perform some kind of
>file locking while each person is writing.

SCCS(1) ?
>
>Les Mikesell
>  les@chinet.chi.il.us

Andre Hoekstra
Newsgroups: comp.unix.questions
From: benjy@athena.mit.edu (Benjamin B Thomas)
Subject: Re: need script to rename uppercase filenames
Organization: Massachvsetts Institvte of Technology
Date: Thu, 3 Sep 1992 08:31:07 GMT

In article <699@svcs1.UUCP> slix@svcs1.UUCP (Bill Miller) writes:
> 
>I have some source code in DOS (many separate files) that I tarred under
>DOS and untarred under 386BSD.  The big problem is that all the files
>came through in UPPERCASE and I need a script to mv (rename) them all
>to lowercase quickly.

Try:

#!/bin/csh 
foreach i ($argv)
setenv file $i
cat $file | tr -d '\015' > `echo foo | nawk '{print tolower(ENVIRON["file"])}'`
rm $file
end


     Now just type the script name and the filenames (or partial filenames 
with wildcards) and you should be set. 

					-Benjy
Xref: sparky comp.unix.questions:10467 comp.unix.wizards:3724
From: dymm@cards.com (David Dymm)
Newsgroups: comp.unix.questions,comp.unix.wizards
Subject: IP address from remote telnet
Date: 27 Aug 92 19:18:21 GMT


I would like to figure out how to determine an individual's IP address
when they are telneting into my system from a remote machine.
The scenario is that a user is on machine A (anywhere in the world),
and telnets into my system, and then runs a program on my system that
I provide to them.  The program that is running on my system must be
able to determine the IP address of machine A.

Any help on this (including code...) would be most appreciated.

Thanks.

	david dymm

	dymm@cards.com
	304 367-0770
Xref: sparky comp.unix.questions:10505 comp.unix.wizards:3736 comp.unix.misc:3421
From: barmar@think.com (Barry Margolin)
Newsgroups: comp.unix.questions,comp.unix.wizards,comp.unix.misc
Subject: Re: How Can I Discover Alternate IP Addresses For Gateway?
Date: 29 Aug 1992 09:47:21 GMT
Organization: Thinking Machines Corporation, Cambridge MA, USA
NNTP-Posting-Host: gandalf.think.com

In article <64880@cup.portal.com> Startup@cup.portal.com (Startup Consulting Company) writes:
>If you know the IP address of a gateway (the one that is published to
>the outside world), is there a way to discover the other IP addresses
>that are used for that gateway on the other networks that it services?

Do a DNS query to translate the address into a domain name.  Then look up
the name.  All the addresses should be listed in its A records.
-- 
Barry Margolin
System Manager, Thinking Machines Corp.

barmar@think.com          {uunet,harvard}!think!barmar
Xref: sparky comp.unix.questions:10365 comp.sys.sgi:12859
From: lim@cs.umass.edu
Newsgroups: comp.unix.questions,comp.sys.sgi
Subject: csh/subshell anomalies
Date: 25 Aug 92 18:29:21 GMT
Reply-To: lim@cs.umass.edu ()
Followup-To: comp.unix.questions
Organization: University of Massachusetts, Amherst


Here's something about csh that's been puzzling me for a while:


If I enter:  % alias test '(echo \!:*)'
and:         % test a b c > z
"a b c" is saved in file z as expected.


If I enter:  % alias test '(echo \!:1; echo \!:2; echo \!:3)'
and:         % test a b c > z
It returns:  a
             b
             c
but nothing is saved in file z.


If I enter:  % alias test '(echo \!:*; echo \!:1)'
and:         % test a b > z
It returns:  a
and saves only "a b" in file z, leaving out the extra "a".


In all cases,
  % (test a b c) > z
saves all output in file z.


Is this a known problem, or am I missing something? This happens in csh or
tcsh-6.02, on either Ultrix-4.2 or Irix-4.0.4. I'd appreciate any help on this.
Thanks.

--------------------------------------------------------------------------------
             Jonathan Lim          Computer Vision Research Group
           lim@cs.umass.edu    University of Massachusetts at Amherst
--------------------------------------------------------------------------------
From: cosmo@cherry.ucsb.edu (Burtin;Boris;;;;COMS;Undergraduate;940630;911002;1000)
Newsgroups: comp.unix.questions
Subject: How to determine user login time in minutes?
Keywords: time, login, accounting
Date: 26 Aug 92 18:46:35 GMT

I'd like to keep track of how long I've used the system.  This should be done
in my .logout file.  I've played around with "last," but it won't give me the
time for the _current_ session (it says "still logged in").  

Is there a utility that I'm missing?  Or does someone know of a script 
(preferably in Perl) that will figure out the login time?

Thanks,


--
     - Boris
(cosmo@cs.ucsb.edu)
From: cosmo@cherry.ucsb.edu (Burtin;Boris;;;;COMS;Undergraduate;940630;911002;1000)
Newsgroups: comp.unix.questions
Subject: Novice question--connecting to Internet
Date: 26 Aug 92 19:00:43 GMT

Sorry if this is the wrong group.  I really didn't know where else to ask.  I'd
like to find out where to get information about connecting our network to the
internet.  Can anyone help me out?

Thanks,


--
     - Boris
(cosmo@cs.ucsb.edu)
From: naren@tekig5.pen.tek.com (Naren Bala)
Newsgroups: comp.unix.questions
Subject: A question on ls
Date: 29 Aug 92 21:56:44 GMT
Distribution: na
Organization: Tektronix, Inc., Beaverton,  OR.

Hi,
I had a question.

If I type
% ls *.Z 
All files with .Z extension are displayed.

What command would I type to display all files that do not have a .Z 
extension ?
Thanks

** Naren **
email: naren@tekig5.pen.tek.com
Newsgroups: comp.unix.questions
From: rairan@ecf.toronto.edu (RAI Ranjan)
Subject: Links in UNIX
Keywords: ln, cp, mv, and rm.
Organization: University of Toronto, Engineering Computing Facility
Date: Mon, 31 Aug 1992 00:45:13 GMT

Could someone please enlighten me on the following topics:

1.  What is the difference between a hard link and a soft link in UNIX?  A text  book definition of each followed by some examples would be great.

2.  What are the similarities and diffs. in the commands mv, cp, and ln?  I
  understand they are in fact just links to the same system file.

BTW, I have just started to learn about UNIX, and I'm currently reading throughKernighan and Pike's book 'The UNIX Prog. Env.'  After I finish with it, what
would be your recommendations on the next book to read?

Thanks.
-- 
---
Ranjan Rai                             <rairan@ecf.toronto.edu> 
Engineering Science 9T3                <rairan@eecg.toronto.edu>
University of Toronto
From: navarra@casbah.acns.nwu.edu (John Navarra)
Newsgroups: comp.unix.questions
Subject: Re: elm save file
Date: 3 Sep 92 07:26:15 GMT
Organization: Northwestern University, Evanston Illinois.

In article <32317@adm.brl.mil> jbowyer%ovc.vutbr.cs%CSBRMU11.BITNET@aearn.edvz.uni-linz.ac.at (Jeff Bowyer) writes:
>Gordon:
>
>When I set the following variables in elmrc
>
>     savemail = $HOME/axe    # for example
>     savename = ON
>
>then enter the 's' command, elm displays the login name of the
>current mail message, not the savemail directory, as I had hoped.
>
	I don't think the elmrc file likes the $HOME variable. I use
'~' in my elmrc. Try that. Otherwise, use the full path name.

-tms


-- 
You can get further with a kind word | You can get further with a kind word
and a gun than a kind word alone.    | and a phaser than a kind word and a gun.
          --al capone                |           -- John Navarra
=======From the Lab of the MaD ScIenTIst....navarra@casbah.acns.nwu.edu========
Newsgroups: comp.unix.questions
From: blackman@acsu.buffalo.edu (Cancholech)
Newsgroups: comp.unix.questions
Subject: Thansk
Date: 26 Aug 92 23:33:04 GMT
Organization: Miskatonic University Graduate Program
  Affiliations: A.R.C.H.I.E. Laboratory
 Project: Raising R'yleh
 Where: Lost in Cyberspace
 Quote: Reality is the Product of Our Mutual Imaginations
 Philosophy: Life is just one Conception after Another.



I want to thank everyone who sent information about SPSS for unix.
I found that we have sas, now all i have to do is play with it.
This makes my life easier, now i can stay completely away from the
VAX.

chris

-- 
"I have all my wisdom teeth, two up top and two beneath,
Aye, to recognise my mouth says things that aren't so wise.."
rutgers!ub!blackman blackman@acsu.buffalo.edu
Newsgroups: comp.unix.questions
From: dave@admiral.uucp (Dave Litchman)
Subject: Postnews: Help!
Organization: The Admiral's Unix System & The Grid BBS
Distribution: na
Date: Thu, 20 Aug 1992 05:11:57 GMT

I sure hope this is the right group to ask stupid questions about UNIX on,
because here comes a stupid question about UNIX, and more specifically, 
postnews.

Now, before you wonder 'Has this guy checked "man postnews"?' yes, I have 
checked 'man postnews'. It didn't help my situation at all. Basically, the
problem is this. The man pages for postnews say that once I've entered the
group(s) to post to, and the Subject: line, it will drop me into my editor
of choice, which I have every reason to believe is vi (trn invokes it, whenever
I follow-up to a message through it). But postnews puts me into some editor-
from-hell which I have never seen before, and I have no idea how to use it
(ok, so I'm no UNIX genius...). 

If anyone has the answer to my quandry, could you please mail me the answer?
Thanks in advance!


-- 
"Dammit Jim, I'm a free man, not a number!"
----------------------------------------------------------------------
"Quick, man! Cling tenaciously to my buttocks!" -- Powdered Toast Man
From: guy@Auspex.COM (Guy Harris)
Newsgroups: comp.unix.questions
Subject: Re: Unix naming conventions from the dark times
Date: 30 Aug 92 23:19:33 GMT
Organization: Auspex Systems, Santa Clara

>> But what about names like 'var'?
>> My first (wild) guess would be an association with 'variable', right?
>> 
>> Surely, some elderly fellow-unix-user must remember the origins for
>> those names from the early days...
>                       ^^^^^
>The early days of Sys V R4 ? :)

Early days of SunOS 4.0, actually; "/var" and "/sbin" were cooked up by,
as I remember, Rusty Sandberg as part of the 4.0 filesystem reorg, done
in an attempt to separate stuff that can be shared by multiple diskless
clients from stuff that each client needs a private version of.  SVR4,
BSD, and other OSes picked it up from Sun, with some changes (e.g., the
replacement of "/usr/etc" by "/usr/sbin"; given that both Berkeley and
AT&T/USL seem to have gone with "/usr/sbin", I guess I'll just have to
grit my teeth and make "/usr/etc" a symlink to "/usr/sbin"...).
Xref: sparky comp.unix.questions:10535 comp.unix.bsd:4858