HDTenEightyP/NetNews huggingface dataset:
From: fazc016@hq.dla.mil (Don Costello)
Newsgroups: comp.lang.c
Subject: Re: About the 'F' in RTFM
Date: 27 Jul 92 19:12:46 GMT
Organization: HQ Defense Logistics Agency/DASC, Cameron Station, VA
X-Newsreader: Tin 1.1 PL4

elias@proxxi.se (Elias M}rtensson (proxxi)) writes:
: stephen@eggneb.astro.ucla.edu (Stephen Schimpf) writes:
: 
: >YES! Finally! It's amazing to me how long it took for someone to write the
: >word. It's just a WORD. Restrict the words we can use and you restrict what
: >we can think. RTM just doesn't express the same feeling that RTFM does.
: 
  "There is nothing wrong with the words, in and amongst themselves.
   It's the context in which the ignorant bastart uses them that make
   the difference..." -- George Carlin.

-- 
+------------------------------------+---------------------------+
| Don Costello, DASC-ZSC             |  It's hard to cram this   |
| DLA Cameron Station, VA            |  signature into just 4    |
| TEL: (703) 274-7215  AV: 284-7215  |  lines!!!                 | 
Newsgroups: comp.lang.c,comp.sys.amiga.programmer
From: elias@proxxi.se (Elias M}rtensson (proxxi))
Subject: Re: Matt Dillon's DICE (Amiga C) and rand() function
Organization: proxxi
Date: Wed, 29 Jul 1992 16:37:04 GMT

CADS_COLE@GALLUA.BITNET (Kevin Cole; Washington DC) writes:

>Date Sent:  29-Jul-1992  08:09:36

>Greetings from the void,

>Here's a very short C program that doesn't do what the documentation claims. 
>According to Matt Dillon's DICE documents, I can limit the range of values
>returned by rand() if I define the variable RAND_MAX to something other than
>the default.  I've tried various values, but I continue to get these huge
>(32-bit) numbers.  Tell me I'm not missing something obvious. 

>Thanx.

>     #include <stdio.h>
>     #include <stdlib.h>
>     #define RAND_MAX ((1023))
>     main()
>     {
>      int i;
>      for (;;)
>      {
>       i = rand();
>       printf("Random number %04X (%d)\n",i,i);
>      }
>      return(0);
>     }
>-- 

I have never used DICE but it looks like RAND_MAX is an extern int.

Try this instead:

#include < stdio.h>
#include <stdlib.h>

extern int RAND_MAX;

main()
{
	int i;

	RAND_MAX = 1023;
	for(;;){
		i = rand();
		printf( "Random number %04X (%d)\n", i, i );
	}
	return( 0 );
}

> ========== U.S. Mail =============================== E-Mail =================
> Kevin Cole      <Flatline>           |  Bitnet: CADS_COLE@GALLUA.BITNET
> Gallaudet Research Institute  (GRI)  |  Internet: KJCOLE@GALLUX.GALLAUDET.EDU
> Washington, D.C.  20002-3625         |  UUCP: ...!psuvax!gallua.bitnet!kjcole
> (202) 651-5575  x4592                |  The WELL:   kjcole

###################
# Elias Martenson #
# elias@proxxi.se #
###################
Newsgroups: comp.lang.c
From: wjb@cscsun2.larc.nasa.gov (William J. Bene)
Subject: Functions Within Functions
Reply-To: wjb@cscsun2.larc.nasa.gov (William J. Bene)
Organization: NASA Langley Research Center, Hampton, VA USA
Date: Wed, 29 Jul 1992 17:47:33 GMT

Is there any way to declare functions within another function like in pascal?

================================
William J. Bene
Computer Sciences Corporation
wjb@cscsun2.larc.nasa.gov
From: chris.lincoln@wugate.wustl.edu!travel (Chris Lincoln) 
Newsgroups: comp.lang.c
Subject: Error in MS C 6.0 ?
Date: 23 Jul 92 06:22:00 GMT
Distribution: world
Organization: Travel Online, St. Louis, MO, USA
Reply-To: chris.lincoln@wugate.wustl.edu!travel (Chris Lincoln) 

VA.From: rdw@vax5.cit.cornell.edu
VA.Newsgroups: comp.lang.c
VA.Subject: Error in MS C 6.0 ?
VA.Message-ID: <1992Jul21.175215.13891@vax5.cit.cornell.edu>
VA.Date: 21 Jul 92 17:52:15 EDT

VA.Dear Microsoft 6.0 C programmers:

VA.If I use the old method, the compiler gives me a Parameter 2 mismatch error.
VA.Does anybody know what's going on?

  I can only confirm that I have ran across that problem.  At the time,
  changing all our code to use the new prototypes was only a 
  (cringe) minor headache, so we did that rather than wait for MS.
---
 . SLMR 2.0 . Infinity is one lawyer waiting for another.
From: wkaufman@us.oracle.com (William Kaufman)
Newsgroups: comp.lang.c
Subject: Re: (Help) dynamic use of sprintf ?
Date: 21 Jul 92 01:56:26 GMT
Organization: Oracle Corporation, Redwood Shores CA
X-Disclaimer: This message was written by an unauthenticated user
              at Oracle Corporation.  The opinions expressed are those
              of the user and not necessarily those of Oracle.

In article <12110@goanna.cs.rmit.oz.au> ok@goanna.cs.rmit.oz.au (Richard A. O'Keefe) writes:
] In article <1992Jul17.195250.16522@oracle.us.oracle.com>, wkaufman@us.oracle.com (William Kaufman) writes:
] > In article <brself.711345285@hal> brself@hal.gnu.ai.mit.edu (Ben Self) writes:
] > ]
] > ]      . using the return value of fprintf () to a file pointer attached
] > ]        to /dev/null with the same arg format that I pass to sprintf ()
] > 
] >     Oooh, icchh!  All the overhead of opening a useless file, writing to
] > the file every time, closing the file; the malloc()'s, free()'s and
] > system calls the stdio functions use.  This solution I'd *absolutely*
] > argue against.
] 
] I would respectfully point out that there is no need to open and close
] a file _EACH_TIME_.  

    OK, this is the second guy to tell me that.

    The "every time", by proper placement of commas, binds with "writing
to the file", not with "opening a useless file".  To be C-ish, this
should be parsed as:

        opening(useless_file);
        while (every_time--)
            writing_to(useless_file);
        closing(useless_file);

    And there's still fopen()'s malloc() and fclose()'s free (every
implementation I've seen does this for the I/O buffer(s)).  And you can
expect that writing to /dev/null, or whatever the local bitbucket is,
will go all the way down, straight to whatever passes for a kernel, and
all the way up: for N variable-length sprintf()'s, that's N+2 system
calls that do damned little.

    I stand by my statement, and hereby proudly reiterate:

        Oooh.  Icchh.

    (Oh, and your code isn't re-entrant.  Nyah. ;-)

] The best thing of all would be to use a stdio implementation that lets
] users define their own stuff, like the 4.4BSD one, so that "null files"
] can be implemented with _no_ mallocs, frees, or system calls, but still
] look just like other stdio files.

    OK, I admit, I haven't seen any BSD internals: maybe it recognizes
the bitbucket as "special" and doesn't have the overhead.  But I really
wouldn't exactly count on that everywhere.

    (Maybe I can take some comfort that no one addressed the other
options I put forward,...)

                                           -- Bill K.

Bill Kaufman,          | "...all conscious species are plastic and
Corporate Lackey       |  all plastic species are conscious."
wkaufman@us.oracle.com |                     -- Yew-Kwang Ng
From: ressler@cs.cornell.edu
Newsgroups: comp.lang.c
Date: 18 Jul 92 08:37 MDT
Subject: Re: (Help) dynamic use of sprintf ?
Nf-ID: #R:brself.711345285@hal:945470687:1992Jul18.043753.28919@cs.cornel:919521842:001:1127
Nf-From: cs.cornell.edu!ressler    Jul 18 08:37:00 1992


In article <1992Jul17.220700.24800@organpipe.uug.arizona.edu> dave@cs.arizona.edu (Dave Schaumann) writes:
>In article <brself.711345285@hal>, brself@hal (Ben Self) writes:
>>Often when formatting strings or converting numerics to alphas, sprintf ()
>>appears as an extremely attractive possibility.  Unfortunately, it does not
>>fit well with dynamic allocation nor is it easily safe guarded from 
>>segmentation faults and bus errors.
>
>[various methods of determining the length of a number's decimal
>[representation deleted
>
>[ Dave's static buffer and copy solution deleted. ]

Another solution that avoids the copy is to malloc big and shrink 
wrap.  In TC, sprintf returns the number of characters in the output
string, so this doesn't even require a strlen():

buf = malloc(MAX_POSSIBLE_SPRINTF_LENGTH);
len = sprintf(buf, "%d", ...);
buf = realloc(buf, len+1);

However, some sprintfs do not return this useful value,
so it's necessary to replace len+1 with strlen(buf)+1.

realloc() is usually very fast when it's shrinking, so this is a 
reasonable way to go.

For a related idea, see GNU's obstack package.
Gene

Newsgroups: comp.lang.c
From: csblm@uxa.ecn.bgu.edu (Brian Murphy)
Subject: programming graphics mouse ?
Organization: Educational Computing Network
Date: Fri, 24 Jul 1992 13:37:35 GMT

I had originally asked this question of comp.graphics (excuse the
redundancy).  I am attempting to program my microsift compatible mouse
in graphics mode (VGA 640x480).  I have initialized the mouse but am
having trouble in generating a descent looking (something besides a
multi-colored block) graphics cursor.  The inadequate documentation I
have mentions a 16 x 16 bit array to be used for the screen and cursor
images and these are ANDed and ORed with the screen to create the cursor
image ?  I need help in preparing this graphics cursor.  If anyone has
information just how to do this or a good source of information.
Please let me know.

Many Thanks in advance.

Brian Murphy
Eastern Illinois University
From: jamiller@hpcupt1.cup.hp.com (Jim Miller)
Newsgroups: comp.lang.c
Subject: Re: Good Books on C - question
Date: 23 Jul 92 19:04:49 GMT
Organization: Hewlett Packard, Cupertino


>I just started reading this group, so excuse me if I'm raising an issue
>already or frequently discussed.  I am interested in a top-5/top-10 list
>of books that aid one who is experienced in programming (but not in C)
>to learn C.  He has some knowledge of C, so is not a complete novice.  He
>expects to use it for rather large and complex applications in the future.
>
>Chris Little, Programmer/DBA

The top ONE (1):

   The C Programming Language
      Second Edition
      by Kernighan and Ritchie


   jim - fact, not opinion - miller
   jamiller@cup.hp.com
   (a.k.a James A. Miller; Jim the JAM; stupid; @!?$$!; ... )
   Anything I say will be used against me ...
   But my company doesn't know or approve or condone anything of mine here.
From: mtompset@undergrad.math.waterloo.edu
Newsgroups: comp.lang.c
Date: 18 Jul 92 10:46 MDT
Subject: Re: About the 'F' in RTFM
Nf-ID: #R:1992Jul17.202448.19848@wyvern.tw:-789306601:BrKo5u.12I@undergrad.math.waterl:-1277736258:001:457
Nf-From: undergrad.math.waterloo.edu!mtompset    Jul 18 10:46:00 1992


In article <1992Jul17.202448.19848@wyvern.twuug.com> alpha@wyvern.twuug.com (Joe Wright) writes:
>Proposed change to 'standard' practice.  'RTFM' is now 'RTM'.
>The 'F' does not relate to any known adjective for Manual.
>'Read The Manual' should suffice.
>
>-- 
>Joe Wright  alpha@wyvern.twuug.com    

I like the 'F' THANK-YOU! You do know what the 'F' stands for don't you?
Secondly, is this really anything realated to C?

                 Mark Tompsett
From: peyote@umiacs.umd.edu (Gary W. Flake)
Newsgroups: comp.lang.c
Subject: Re: Variable arguments & macros...
Keywords: macros, varargs
Date: 22 Jul 92 13:18:06 GMT
Organization: UMIACS, University of Maryland, College Park, MD 20742

markkj@mullian.ee.mu.OZ.AU (Mark Johnston) writes:
>
>    I'm wondering if anyone has any really devious ways of writing macros
>so that variable arguments can be used.  The problem is that I have a function
>that does error handling for a program, and it takes variable arguments:
>
>int writeErrorMsg(int quit, char *file, int line, char *format, ...)
>{
> /* ... */
>}
>    The macros are:
>
>#define error(x) writeErrorMsg(0, __FILE__, __LINE__, x)
>#define fatal(x) writeErrorMsg(1, __FILE__, __LINE__, x)
>
>
>    Last but not least, I'm using the functions in the following way:
>
>	error("The error code is %1d.", errCode);
>


I wouldn't recommend this for everyone but...

MERGE(x,y) will exand both x and y THEN concat them. There are other
ways to doing this, but this is the only one that has always worked
for me.

#define  MERGE(x,y)          MERGE ## _KLUDGE(x,y)
#define  MERGE_KLUDGE(x,y)   x     ## y

now...

#define  ARG(x) , (x)
#define  __ARG(x) (x)
#define error(x) writeErrorMsg(0, __FILE__, __LINE__, MERGE(__,x))
#define fatal(x) writeErrorMsg(1, __FILE__, __LINE__, MERGE(__,x))

The variable argument portion of the macro should have no commas, e.g.

error(ARG("foo = %d -- bar = %d) ARG(fooness) ARG(barness));

expands too:

writeErrorMsg(0, "foo.c", 666,
   MERGE(__, ARG("foo = %d -- bar = %d") ARG(fooness) ARG(barness))

->

writeErrorMsg(0, "foo.c", 666,
   __ARG("foo = %d -- bar = %d) ARG(fooness) ARG(barness))

->

writeErrorMsg(0, "foo.c", 666, ("foo = %d -- bar = %d), (fooness), (barness))


This'll work in gcc.  

Don't you just love the preprocesser!

Cheers,
Gary
-- 
Spoken: Gary W. Flake  Domain: peyote@umiacs.umd.edu  UUCP: uunet!mimsy!peyote
Phone: +1-301-405-6757 USPS: UMIACS, U. of Maryland,  College Park, MD 20742
Newsgroups: comp.lang.c
From: ankleand@mtl.mit.edu (Andrew Karanicolas)
Subject: C-Programming FAQ
Organization: MIT Microsystems Technology Laboratories
Date: Wed, 29 Jul 1992 00:23:05 GMT

Hi,

Where can I find a FAQ list pertaining to this newsgroup?

Thanks.

-- 
Andrew Karanicolas
MIT Microsystems Technology Laboratory
ankleand@mtl.mit.edu
Newsgroups: comp.lang.c,comp.sys.amiga.programmer
From: CADS_COLE@GALLUA.BITNET (Kevin Cole; Washington DC)
Subject: Matt Dillon's DICE (Amiga C) and rand() function
Organization: Gallaudet Research Institute
Date: Wed, 29 Jul 1992 13:12:47 GMT

Date Sent:  29-Jul-1992  08:09:36

Greetings from the void,

Here's a very short C program that doesn't do what the documentation claims. 
According to Matt Dillon's DICE documents, I can limit the range of values
returned by rand() if I define the variable RAND_MAX to something other than
the default.  I've tried various values, but I continue to get these huge
(32-bit) numbers.  Tell me I'm not missing something obvious. 

Thanx.

     #include <stdio.h>
     #include <stdlib.h>
     #define RAND_MAX ((1023))
     main()
     {
      int i;
      for (;;)
      {
       i = rand();
       printf("Random number %04X (%d)\n",i,i);
      }
      return(0);
     }
-- 

 ========== U.S. Mail =============================== E-Mail =================
 Kevin Cole      <Flatline>           |  Bitnet: CADS_COLE@GALLUA.BITNET
 Gallaudet Research Institute  (GRI)  |  Internet: KJCOLE@GALLUX.GALLAUDET.EDU
 Washington, D.C.  20002-3625         |  UUCP: ...!psuvax!gallua.bitnet!kjcole
 (202) 651-5575  x4592                |  The WELL:   kjcole
Newsgroups: comp.lang.c,comp.sys.amiga.programmer
From: hp@vmars.tuwien.ac.at (Peter Holzer)
Subject: Re: Matt Dillon's DICE (Amiga C) and rand() function
Organization: Technical University Vienna, Dept. for Realtime Systems, AUSTRIA
Date: Fri, 31 Jul 1992 11:27:51 GMT

scs@adam.mit.edu (Steve Summit) writes:

>To get integral random numbers with a different range, the
>modulus operator is typically used:

>	rand() % n

>gives random numbers in the range 1..n-1 .  (Note that this
>technique is slightly inaccurate, and works well only if RAND_MAX
>is much greater than, or an exact multiple of, n).

Also, many implementations of rand (e.g. the one in BSD, and (I think)
the example in the standard), have the property that they produce a
cycle of length n if n is a divisor of RAND_MAX + 1. So rand % 2 will
give you 0 and 1 alternately, which does not look very random. On
systems, where RAND_MAX * n <= LONG_MAX, you can use 

	(long) rand() * n / (RAND_MAX + 1)

instead. On many 32bit systems this doesn't work however, and the
portable solution is more complicated (The best I can come up with
contains 3 multiplications, 3 additions and a lot of shifts). 

>One legitimate use of RAND_MAX is generating random floating-
>point numbers; for example,

>	rand() / (double)(RAND_MAX - 1)

>should give randomly distributed numbers over the range 0..1 .

If you want a random value in the range [0, 1] you must divide by
RAND_MAX, if you want a range of [0, 1), divide by (RAND_MAX + 1).

	Peter
-- 
|    _  | Peter J. Holzer                       | Think of it   |
| |_|_) | Technical University Vienna           | as evolution  |
| | |   | Dept. for Real-Time Systems           | in action!    |
| __/   | hp@vmars.tuwien.ac.at                 |     Tony Rand |
From: hartman@ulogic.UUCP (Richard M. Hartman)
Newsgroups: comp.lang.c
Subject: Re: About the 'F' in RTFM
Date: 22 Jul 92 23:37:50 GMT
Organization: negligable

In article <1992Jul21.005916.22447@organpipe.uug.arizona.edu> dave@cs.arizona.edu (Dave Schaumann) writes:
>In article <1992Jul20.162942.14863@mic.ucla.edu>, stephen@eggneb (Stephen Schimpf) writes:
>>YES! Finally! It's amazing to me how long it took for someone to write the
>>word. It's just a WORD.
>
>"Just a word"?  Just a loaded word.  "Sticks and stones may break my bones,

Exactly.  A loaded word that expresses the feelings that may support
techs have after having been asked the same idiotic question 37 times
in the last hour when the answer can be found on page 3 of the "Read
Me First" booklet.

>Presumably, "f-ck" refers to the act of intercourse.  Common usage, however,
>tells us that this is not so.  Those of limited vocabulary will also use it
...

No, it is an expletive used to express frustration and rage.  Anyone that
takes it for it's "literal" meaning is being too darned concerned with
semantics to see why the person on the other end of the conversation may
feel he has to resort to such language (ignoring, for the moment, those
people who use such words only from habit or the hopes that it may
shock someone else).

>I personally avoid using "f-ck" in my conversation; since it has such
>powerful negative connotations, it cannot help but pull my own thoughts
>in the same direction.

In this case, it is the negative connotations that is desired.  Some
questions are just too f-cking annoying after the 1000th time when
the answer is readily available.


			-Richard Hartman
			hartman@uLogic.COM

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Remember, it works better if you plug it in.
		(and if you read the fucking manual)



Newsgroups: comp.lang.c
From: curt@watson.ibm.com (Curt McDowell)
Subject: Re: redirecting stdout
Date: Sat, 25 Jul 1992 23:26:34 GMT
Disclaimer: This posting represents the poster's views, not necessarily those of IBM
Organization: IBM T.J. Watson Research Center
Keywords: stdout, redirect

In article <1992Jul25.184724.27204@news.acns.nwu.edu>, tindall@casbah.acns.nwu.edu (Mike Tindall) writes:
> 	How can  I return stdout to printing to the screen after  redirecting
> it to a file using out_file=freopen("fname","w",stdout)?

The following works for me.  I think it's reasonably robust, but I've only
tested it using the example main() program below.

----------------------------------------------------------------------------

#include <stdio.h>

/*
 * redirect_stdout                        by Curt McDowell, IBM 07-25-92
 *
 *   Redirects stdout to a file in a fairly idiot-proof way.  Returns 0
 *   unless there is an error writing the specified file, in which case
 *   it returns -1, sets errno, and leaves stdout alone.  If filename is
 *   NULL, stdout is restored to the real stdout.
 */

int redirect_stdout(filename)
	char	       *filename;
{
	static	int	ofd	= -1;

	if (filename) {
		if (ofd < 0 && (ofd = dup(1)) < 0)
			return -1;
		if (freopen(filename, "w", stdout) == 0) {
			redirect_stdout(0);
			return -1;
		}
	} else if (ofd >= 0) {
		freopen("/dev/null", "w", stdout);
		dup2(ofd, 1);	/* Sneak in under stdio */
		close(ofd);
		ofd = -1;
		setlinebuf(stdout);
	}

	return 0;
}

main()
{
	printf("This goes to the screen\n");

	redirect_stdout("file1");

	printf("This goes to file1\n");

	redirect_stdout("file2");

	printf("This goes to file2\n");

	redirect_stdout(0);

	printf("This goes back to the screen\n");
}

----------------------------------------------------------------------------
Curt McDowell                             IBM and I disclaim anything that
IBM T. J. Watson Research Center          happens as a result of this post.
Newsgroups: comp.lang.c
From: esova@magnus.acs.ohio-state.edu (Edward R Sova)
Subject: lint clones for DOS
Organization: The Ohio State University
Date: Fri, 31 Jul 1992 19:45:03 GMT

I'd like to hear from people who have tried these products:
Dr. MD from RSS Engineering /w source code $129
  supposedly platform independent, DOS UNIX OS/2 
PCLint from Gimpel Software, $139 for DOS
  this is the one I always hear about 
CLint from MMCAD $125 (combo pkg w/ Cflow, CXref, etc.?
  i couldn't determine from the ad. which are included in pkg.

Are there others? where is the best value?

  ___
  \  \      Mr. Ed on rollerblades?  Nah, that's:
  _\  \      esova@magnus.acs.ohio-state.edu       Prodigy:CBGX09A
 \_____\       but his friends call him Ed,
 o o o o                    yeah that Ed Sova Kid, he answers to anything.
Newsgroups: comp.lang.c
From: leegye@vuse.vanderbilt.edu (Gyesung Lee)
Subject: structure question
Originator: leegye@unleaded
Organization: Vanderbilt University School of Engineering, Nashville, TN, USA
Distribution: usa
Date: Tue, 21 Jul 1992 05:38:58 GMT

The following is a simple program, where a structure is defined with 3 elements
and 'main' calls 'abc' and it calls 'abc1'.

/*----------------------------------*/
#include <stdio.h>

typedef struct a_struct {
       char            *name;
       int             mark;
       struct a_struct *next;
} *A_Type;

A_Type Global_Root;


abc1()
{
   if (Global_Root->next == NULL)
      printf("In abc1: is  NULL\n");
   else
      printf("In abc1: not NULL\n");
}

abc()  /* check next ptr of Global_Root */
{
   if (Global_Root->next == NULL)
      printf("In abc:  is  NULL\n");
   else
      printf("In abc:  not NULL\n");
   abc1();
}


main  ()  /* create a global root and set next ptr to NULL */
{
  Global_Root = (A_Type) malloc (sizeof(A_Type));
  Global_Root->next = NULL;
  abc();
}

/*----------------------------------*/

The right answer should be:

In abc:  is  NULL
In abc1: is  NULL

But, the result turns out as follows:

In abc:  is  NULL
In abc1: not NULL
Segmentation fault (core dumped)

If I modify 'A_Type' structure as follows by switching `mark' and `next',

typedef struct a_struct {
       char            *name;
       struct a_struct *next;
       int             mark;
} *A_Type;

then, it works correctly.

I rearranged the elements of `struct a_struct' and ran it.
In some case it works, in other cases no luck.
Could anyone tell me what is wrong with this program ?

Thank you for your help.

Gyesung Lee.
leegye@vuse.vanderbilt.edu


Newsgroups: comp.lang.c