HDTenEightyP/NetNews huggingface dataset:
From: jarnot@kin.lap.upenn.edu (Kevin J. Jarnot)
Newsgroups: comp.lang.c
Subject: Re: Help : Encryption Algorithms
Date: 21 Aug 92 20:24:28 GMT
Organization: University of Pennsylvania, Language Analysis Center

In article <ebolog.45@elaine.ee.und.ac.za> ebolog@elaine.ee.und.ac.za (EDWIN BOLOGNA : THIRD) writes:
>Does anyone out there happen to have PAS, C, or ASM source code to decode
>and code good encryption algorithms.
>Any information at all on any of these algorithms will be greatly appreciated.
>        Desperate fellow programmer (And very Greatful for any information)
>                E.B. (EBOLOG@ELAINE.EE.UND.AC.ZA)
>PS : Please be kind hearted and Assist !

Gee, Edwin, couldn't these last 6 or 7 posts been combined into one?


I suggest using archie to look for the various pieces of code you're interested
in.  Try telnet'ing to archie.au, or send mail to archie@archie.au with the
subject line "help".

Kevin
 
-- 
Kevin J. Jarnot (jarnot@kin.lap.upenn.edu)      |  
Lead Programmer/Analyst/Keyboardist             | "The monkey-boys are evil -
Univ. of Pennsylvania Language Analysis Center  |  Lord Whorfin is supreme..."
3700 Market St, Suite 202  Phila, PA 19104      | 
Newsgroups: comp.lang.c,gnu.gcc,gnu.gcc.help
From: leland@cs.columbia.edu (Leland Woodbury)
Subject: gcc-cpp chokes: bug or feature?
Originator: leland@shadow.cs.columbia.edu
Organization: Columbia University Department of Computer Science
Date: Fri, 14 Aug 1992 18:29:50 GMT

#if 0
I don't have much experience with gcc, I started using it only
recently.  And I'm in the habit of using the C preprocessor (as shown
here) rather than /* */ to delineate most multi-line comments, because
I think it's more elegant and less likely to result in error.  But
gcc-cpp chokes on any line within such text that contains an odd number
of single quotes, complaining about unterminated character constants.
(Run gcc on the file containing this message for a demo.)

I haven't looked at the source code, but does this make any sense to
anyone?  Is there something in ANSI C that requires such behavior?
Obviously, gcc-cpp is parsing -- in a line-oriented fashion -- the text
between the #if 0 and the #endif, but what's it looking for (besides
#else or #endif)?  Why is it parsing what should be getting ifdef'd
out?

Leland Woodbury
#endif
-- 
INTERNET: leland@cs.columbia.edu
  USENET: ...!columbia!cs.columbia.edu!leland
  BITNET: leland%cs.columbia.edu@cuvmb
  USMAIL: Columbia Univ., 457 CS, 500 W. 120 St., NYC 10027-6699
Newsgroups: comp.lang.c
From: nilo@atdigarfield.cern.ch (Operator)
Subject: problems with atof() 
Organization: CERN European Lab for Particle Physics
Date: Thu, 20 Aug 1992 12:52:52 GMT

Hello!

 I have a problem withe the atof() function, you know string to double 
conversion. 
 I can not figure out where the error is, so any help will be really really appreciated.

   here follows the small program...

    #include <stdio.h>
    #include <ctype.h>
    main()
     {
       double a[2];
       char *b="-.345"
       printf("this is b : %f  %s \n",atof(b),b);

       a[0] = atof(b);

       printf("and this is a[0] : %f \n",a[0]);

       exit();
      }

    whose output is .....

           this is b : -0.345  -.345    

           and this is a[0] : -623456346545..........  large number...

    As you can see the problem appears when I try to assign the return
    value of atof() which is supposed to be a double type number, to a 
    variable. It does not work. 

     I don't know how to use this returned values so as to perform some
     extra operations with it.


             Thank you in advance..

                        Nilo Segura   AT Division
                        CERN - Switzerland
Newsgroups: comp.lang.c
From: ecm@casbah.acns.nwu.edu (Edward Malthouse)
Subject: dynam mem alloc
Organization: Northwestern University, Evanston Illinois.
Date: Fri, 21 Aug 1992 19:14:22 GMT

Suppose I have declared a pointer which I intend to eventully use to point to
a chunk of memory allocated from the system heap using malloc.  How can I
tell whether or not I have already allocated memory for this object?  I have
been using the following:

int *x;
if(n == NULL) /* memory has not been allocated */

This works fine as long as the pointer variable was declared as global or in
main().  If it is declared elsewhere this statement does not work.  For
example:
#include <stdio.h>

int *x;

main()
{
int *y;
printstuff(y);
}

printstuff(y)
int *y;
{
int *z;

printf("x=%d, y=%d, z=%d\n",x,y,z);
}

The output of this program is,
x=0, y=0, z=-559038737

Is there a reason why C does not initialize pointers declared in functions
other than main() to NULL?  Is there portable way around this problem?
Reasons for wanting to do such a thing could be:

-  I want to have a single chunk of code for handling fatal errors including
   the release of all dynamically allocated memory.

-  I want to have other functions which do certain computation.  These 
   functions would be passed a pointer where the results of the computations
   are to be stored and I do not want to have to worry about allocating 
   memory in the calling function the first time it is called.  Instead, 
   I want to have the function which does the computations worry about 
    whether or not memory has already been allocated.

Please respond via e-mail to either
ecm@fisher.stats.nwu.edu    (preferred)
ecm@casbah.acns.nwu.edu

Thank you in advance for you help

Ed Malthouse
From: gonzalod@amex-trs.com (Gonzalo Diethelm)
Newsgroups: comp.lang.c
Subject: AFS calls from C code
Date: 19 Aug 92 00:54:53 GMT



Distribution: world

Hello everyone,

This might be a FAQ, or maybe I should RTFM, but in this case
TFM is about 400 pages and I need this done REALLY SOON. So,
here it goes:

Does anybody know how to have AFS-like functionality in your
C code? Pipes or system() is not acceptable. For example,
how would you implement a function like:

int klog(char *username, char *password)
/*
 * Same thing as the Kerberos klog utility.
 */

but without opening a pipe and actually executing the program
in /usr/afs/bin/klog?

What I'm looking for specifically is a way of checking the
AFS information for a user given his/her login id, uid, etc.
The .h files in my /usr/afs/include directory don't even have
ANSI prototypes, and the manuals are VERY long and terse.
I haven't found any examples either. Can anybody lend a hand?
Please answer by e-mail. Thanks in advance and regards.

P.S. Just in case, I'm using AIX 3.2 and AFS 3.2b

gonzalod@amexphx.amex-trs.com
Gonzalo A. Diethelm                 (602)375-8410  home
16220 N 7th St Ap 1314              (602)492-3536  office
Phoenix, AZ 85022                   (602)492-4248  FAX
Newsgroups: comp.lang.c
From: puckett@lambda.msfc.nasa.gov (Jim Puckett)
Subject: argv[1][1] OK, argv[1][0] Not? Huh?
Organization: NASA/MSFC
Date: Thu, 20 Aug 1992 22:22:54 GMT

Okay. I give up.


In a little application, I ran into this problem...


if (argv[1][0] != '-' ) 
	would cause a core dump, while

if (argv[1][1] != 'P' ) 
	wouldn't.

Using cc on a Sparc 2, with the same arglist.


I wound up using 
if (*argv[1] != '-' ) 

but I still don't understand the discrepency.

Can anyone help me?

thanks,
jim p.
-- 
Jim Puckett    NTI    puckett@freedom.msfc.nasa.gov     
Huntsville,AL (205)461-4922  
This life is a test. It is only a test. If it had been a real life, you 
would have been given instructions....
From: jimh@ultra.com (Jim Hurley)
Newsgroups: comp.lang.c
Subject: Help with function typedef.
Date: 14 Aug 92 22:34:59 GMT
Organization: Ultra Network Technologies

I don't understand what's happening here, can anyone help?

File x.c (between the dahed lines):
--------------------------------------------
typedef unsigned char CLI_RETURN_CODE;

typedef CLI_RETURN_CODE (*CLI) (int, char **);

typedef struct {
    char * command_name;
    char * command_description;
    CLI command_entry;
} CLI_Command_Table;

/* prototype */
CLI cli_help;

 
CLI_Command_Table cli_command_table[] = {
   "help",   "List available commands",  cli_help
};


CLI_RETURN_CODE cli_help (int argc, char **argv) {

  /* nothing yet */
  
}
--------------------------------------------
Compilation results:

gcc -c x.c
x.c:17: initializer for static variable is not constant
x.c: In function cli_help:
x.c:20: `cli_help' redeclared as different kind of symbol
x.c:12: previous declaration of `cli_help'
-- 
Jim Hurley --> jimh@ultra.com  ...!ames!ultra!jimh  (408) 922-0100
Ultra Network Technologies / 101 Daggett Drive / San Jose CA 95134
Newsgroups: comp.lang.c
From: dharris@trirex.com (Doug Harris)
Subject: Variable field width portable? (was question about \t)
Reply-To: dharris@trirex.com
Organization: Trirex Systems Inc.
Date: Mon, 17 Aug 1992 16:01:34 GMT

Jutta Degener writes
>To print a string indented by n spaces:
>
>	printf("%*s%s\n", n, "", string);
>

Is this portable?  I'd never seen this before and it's not in the ANSI
C book that I have (_The Waite Group's Essential Guide to ANSI C_), but
it compiles and runs as advertised under NeXT's GNU C compiler...

curious,
doug

--
				|          Doug Harris          |
				|      Trirex Systems Inc.      |
				| dharris@trirex.com (NeXTMail) |
				|        dough@panix.com        |
Newsgroups: comp.lang.c,gnu.gcc,gnu.gcc.help
From: amorgan@Xenon.Stanford.EDU (Crunchy Frog)
Subject: Re: gcc-cpp chokes: bug or feature?
Organization: Computer Science Department, Stanford University.
Date: Fri, 14 Aug 1992 18:57:30 GMT

In article <BszKpr.GBu@cs.columbia.edu> 
  leland@cs.columbia.edu (Leland Woodbury) writes:
>#if 0
>I don't have much experience with gcc, I started using it only
>recently.  And I'm in the habit of using the C preprocessor (as shown
>here) rather than /* */ to delineate most multi-line comments, because
>I think it's more elegant and less likely to result in error.  

Elegant is a matter of taste, but less likely to result in error?????

>But
>gcc-cpp chokes on any line within such text that contains an odd number
>of single quotes, complaining about unterminated character constants.
>
>Leland Woodbury
>#endif

This behavior is documented.  See the gcc.info files.

C Frog
Newsgroups: comp.lang.c
From: gordon@osiris.cso.uiuc.edu (John Gordon)
Subject: Re: Memory problems....
Organization: University of Illinois at Urbana
Date: Tue, 18 Aug 1992 01:52:06 GMT

jedwards@gmuvax2.gmu.edu (James Edwards) writes:

>I am really having a rough time trying to understand this.  I am writing
>C code on a Sparc 2 with 32mb of RAM, and about 100mb of swap space.  It
>seems to me that there must be some limiting factor as to why I can't
>create an array around 10mb in size.  I've tried this both globally and
>using the routines in the FAQ to create the array dynamically; both to
>no avail.  What is the problem here?  I haven't found anything in any of
>the sun manuals that talks about max global array sizes, or any compiler
>limitations, but something is definately screwing things up.  If anyone
>has any advice, hints, whatever; it would be greatly appreciated.

	Perhaps the system has a per-user or per-process memory limit.

---
John Gordon                        My incredibly witty saying has been 
gordon@osiris.cso.uiuc.edu         Politically Corrected into oblivion.
From: scs@adam.mit.edu (Steve Summit)
Newsgroups: comp.lang.c
Subject: Re: Allocate memory to typed in string, How?
Date: 15 Aug 92 20:13:59 GMT
Organization: none, at the moment

In article <1992Aug13.184911.376@wyvern.twuug.com>, alpha@wyvern.twuug.com (Joe Wright) writes:
> Attempts to allocate memory, char at a time, to an arbitrary 'string'
> is silly even if it is possible.  If a string is assumed to be a line
> of a text file or arbitrary keyboard input, we can easily declare that
> it must not be longer than (let's say) 256 bytes.

I agree that it's easy to "declare that it must not be longer,"
but the ease of stating something is not necessarily correlated
with its wisdom.

Attempting to deal with arbitrarily-long input lines, using
dynamic memory allocation or other techniques, is most certainly
not silly.  If you must write a routine which imposes a fixed
limit on input line length, let it be for one of these two
reasons:

     1.	"I am too lazy and/or stupid to do any better."

     2.	"I have complete control over the input."

Operating-system-imposed limits on interactive input line length
are red herrings, for several reasons: they generally do *not*
apply to disk files; they are not the same from system to system,
and they may change between releases of the same system.  (If the
next release of the operating system advertised new, longer
keyboard input buffers, I'd hate to have to tell my customers
that my application couldn't make use of them, because I had
wired in an assumption that the previous, smaller limit held.)

Arbitrary, fixed, (small) limits on input line length ought to be
a thing of the past.  It's not all that difficult to write an
input routine which accepts arbitrarily-long lines; indeed, we've
seen several posted recently in the context of this and other
related threads.  The fact that old Unix utilities tended to
(silently, and more-or-usually-less gracefully) impose
512-character limits should *not* be used as justification to
continue the practice; those limits are one of the more glaring
blights on the ubiquitous "Unix philosophy."

					Steve Summit
					scs@adam.mit.edu

P.S.  Please, don't anyone get too steamed if it seems like I'm
      branding you as "too lazy and/or stupid to do any better."
      I frequently write little throwaway utilities with
      arbitrary limits, because I'm lazy, too.  You can perform a
      cost/benefit analysis which may show that it's not
      worthwhile to accept arbitrarily-large inputs: in a way,
      that's just institutionalized laziness, but if the analysis
      is accurate and well-founded it may well be perfectly
      reasonable and nothing to be ashamed of.  But make very
      very sure that you document the limit(s) well, and deal
      with overflows gracefully (and that you include the costs
      of dealing gracefully, and of putting up with the limits,
      in your analysis).
Newsgroups: comp.lang.c
From: lfm@pgroup.com (Larry Meadows)
Subject: Re: POWER OF LARGE NUMBERS
Date: Tue, 18 Aug 1992 20:21:44 GMT
Organization: The Portland Group, Portland, OR

In article <thompson.714156001@daphne.socsci.umn.edu> thompson@atlas.socsci.umn.edu writes:

>P.S.  Mathematica 2.1 on a Sparc 2 does 6 ^ (6 ^ 6) in 5.02 CPU seconds.

                                         ^^^^^^^^^^^

AAARGGHHH!!! The Beast is among us!
-- 
Larry Meadows		The Portland Group
lfm@pgroup.com
From: dave@cs.arizona.edu (Dave Schaumann)
Newsgroups: comp.lang.c
Subject: Re: problems with atof()
Date: 20 Aug 92 16:06:21 GMT
Reply-To: dave@cs.arizona.edu (Dave Schaumann)
Organization: University of Arizona

In article <1992Aug20.125252.3451@dxcern.cern.ch>, nilo@atdigarfield (Operator) writes:
>    #include <stdio.h>
>    #include <ctype.h>
>    main()
>     {
>       double a[2];
>       char *b="-.345"
>       printf("this is b : %f  %s \n",atof(b),b);
>
>       a[0] = atof(b);
>
>       printf("and this is a[0] : %f \n",a[0]);
>
>       exit();
>      }
>
>    whose output is .....
>
>           this is b : -0.345  -.345    
>
>           and this is a[0] : -623456346545..........  large number...

The short answer is that you need to #include <math.h> in your program
if you want to use atof() (this should be in the manual).

The long answer is this:

You have no declared return type in scope for atof(), so it defaults to
int, even though the code returns a double.  Now, in the call to printf(),
the "%f" field effectively says "look for a floating point value here",
so everything happens fine, despite the fact that the compiler thinks
atof() is returning an int.

The trouble comes when you try to use the value of atof() in an assignment
statement.  The compiler says "oh!  this code is assigning an int to a 
double -- I'd better insert some conversion code".  Thus, a value which
is a perfectly good double gets treated as an int, and run through the
"int to double" conversion code, which of course, yeilds garbage.

To solve this problem, <math.h> includes (amoung other things) a line
that probably looks something like this:

	double atof( const char * ) ;

So what's the moral of the story?
	-defaults and automatic conversion can be dangerous
	-always read the manual about new functions

-- 
You unlock this door with the key of imagination.  Beyond it is another
dimension: a dimension of sound, a dimension of sight, a dimension of mind.
You're moving into a land of both shadow and substance, of things and ideas.
You've just crossed over into... the Twilight Zone.
Newsgroups: comp.lang.c
Subject: Help : Music File Formats.
From: ebolog@elaine.ee.und.ac.za (EDWIN BOLOGNA : THIRD)
Date: 20 Aug 92 12:53:09 +0200
Organization: Electronic Eng., Univ. Natal, Durban, South Africa


Does anyone out there happen to have PAS, C, or ASM source code to decode
.MOD, .SAM, .SND, or .ROL music formats.

Any information at all on any of these formats will be greatly appreciated.

        Desperate fellow programmer (And very Greatful for any information)

                E.B. (EBOLOG@ELAINE.EE.UND.AC.ZA)

PS : Please be kind hearted and Assist !
Xref: sparky comp.lang.c:12588 comp.programming:2407
From: billb@crpmks.uucp (Bill Bochnik (Info Systems))
Newsgroups: comp.lang.c,comp.programming
Subject: Re: A LITTLE BRAINTEASER...
Date: 20 Aug 92 16:07:44 GMT
Reply-To: billb@crpmks.UUCP (Bill Bochnik (Info Systems))
Organization: Ciba-Geigy Corporation

In article <UuUwr*iT1@germal.bs.open.de> gm@germal.bs.open.de (Gerald Malitz) writes:
>In article <josef.713800013@uranium>, Josef Moellers writes:
>
>> In <Bswt31.7zC@research.canon.oz.au> andy@research.canon.oz.au (Andy Newman) writes:
>>
>> >aet@mullian.ee.mu.OZ.AU (bert thompson) writes:
>[...]
>> >>	char ch = getchar();
>> >        ^^^^^^^
>> >	NOT AGAIN!
>[...]
>> >So how may machines does this work on? Want to run it on something
>> >without memory protection and let the little sucker recurse and
>> >recurse...
>>
>> It'll run perfectly on systems that have signed characters!
>
>	No, it won't.
>
>> EOF usually is -1, so '\377' will expand to -1.
>
>	'\377' may appear at any place within a file.  So (ch == EOF)
>may be TRUE long before you reach EndOfFile.
>
>	regards, Gerald.


Isn't that an ESC 377 ?   Or is that ESC followed by the 3 characters 377?  If 
it is the former (what I thought was true) , my pc can't hold such a file.  
-- 
Bill Bochnik			| It's hard to be a James Bond in an Abbott
Systems Analyst 		|	and Costello world.
Ciba-Geigy Corporation		| Signed and sealed, they deliver oblivion.
philabs!crpmks!billb		| It's worse than that, he's dead Jim.
From: pedersen@seas.smu.edu (Ted Pedersen)
Newsgroups: comp.lang.c
Subject: Re: Knight's tour
Date: 12 Aug 92 19:47:21 GMT
Organization: SMU School Of Engineering and Applied Science

Believe it or not this really is something of personal interest...besides it's
August 12, no school here... It's a sad way to spend a vacation but this is whatI do. 

...meanwhile Japanese computers are washing ashore by the boatload...but Prime
is caught up on the USENET. Hurrah! Or is Prime Japanese yet? I doubt they'd
still have USENET stuff...probably make you do exercises all together instead...

So I'm still hoping to get my little knights touring around...
Newsgroups: comp.lang.c
From: bibhas@pico.engr.mun.ca (Bibhas Bhattacharya)
Subject: Re: Routine to disable Ctrl-Alt-Del on PC
Organization: Memorial University of Newfoundland
Date: Sat, 15 Aug 1992 15:17:32 GMT

root@fincomp.raidernet.com (Neal McClain) writes:
>Simple:

>   1.  Install a 386 based UNIX on said PC.
>   2.  Boot UNIX

>:-)  Sorry - couldn't resist!

Up in some of the *NIX groups, I think, I came across some postings asking
why Ctrl-Alt-Del doesn't work for them. I think what works for one doesn't
work for another! ;-)
Bibhas.

    =========================================================================
    Wait for the day when Zork, the super human		    ||
    will rule the world.				    ||
    Peace will get a chance and cannibalism will be rampant.||
    =========================================================================
	 ____						           ___ 
	|     \       _                                          /     \
	|      |     (_)                                        |        
	|_____/     _____    ___     ___    ___      ______      \ ___ 
	|     \       |     |___)     |      |        /  |             \
	|      |      |     |   \     |------|      /----|              | 
	|_____/     __|__   |____)   _|_    _|_  _/_    _|_      \ ___ /
    =========================================================================
Xref: sparky comp.lang.c:12664 comp.std.c:2491
From: pausch@saaf.se (Paul Schlyter)
Newsgroups: comp.lang.c,comp.std.c
Subject: Re: strcpy implementation question
Date: 23 Aug 92 00:39:30 GMT
Distribution: comp
Organization: SAAF, Svensk Amat|rAstronomisk F|rening

In article <1992Aug22.132132.13813@iecc.cambridge.ma.us> johnl@iecc.cambridge.ma.us (John R. Levine) writes:
>
>In my copy of the C standard, section 4.1.1 says "a string is a contiguous
>sequence of characters terminated by and including the first null
>character."  Section 4.11.2.3 says "The strcpy function copies the string
>pointed to by s2 (including the terminating null character) into the array
>pointed to by s1."
>
>But it doesn't say "(including the terminating null character and any other
>garbage convenient for the compiler implementer)".  You have to stop at the
>null byte.

Even on a machine with word addressing, where each string is very likely to
occupy an integral number of machine words?




-- 
---
Paul Schlyter, Swedish Amateur Astronomer's Society (SAAF)
Nybrogatan 75 A, 6 tr,  S-114 40 Stockholm,  Sweden
InterNet:  pausch@saaf.se
From: randy@pippin.ee.usu.edu (Randy Ray West)
Newsgroups: comp.lang.c
Subject: Need getwd() function -- HELP!
Date: 19 Aug 92 22:03:06 GMT
Article-I.D.: pippin.RANDY.92Aug19150306
Distribution: comp.lang.c
Organization: Utah State University Dept EE Logan, Utah


The system that I am working on (Sun Unix Workstation) doesn't have a
C library function that will return the current working directory.  I
believe the function I'm after is getwd().

char *getwd(pathname)
char pathname[MAXPATHLEN]

It is supposed to be in #include<sys/param.h> but isn't on my system.

Any help would be appreciated.  Please email me.
--
-----------------------------------------------------------------------------
Randy R West         (randy@pippin.ee.usu.edu)
Space Dynamics Laboratory\Utah State University
Logan, Utah

DISCLAIMER:
My opinions and/or statements do not necessarily represent my employer's.
_____________________________________________________________________________
Newsgroups: comp.lang.c
From: darcy@druid.uucp (D'Arcy J.M. Cain)
Subject: Re: Using ANSI.SYS codes from C?  (Turbo)
Date: Sat, 22 Aug 1992 22:53:33 GMT
Organization: D'Arcy Cain Consulting

tiok_ks@tac.fi writes:
>In article <1992Aug18.111356@shovel.Prime.COM>
>tim@shovel.Prime.COM (Tim Cantin) writes:
>> 						it's the same as the resistor
>> 						code table if you know that! :)~
>> 	If anyone knows those color codes, feel free to post them! *grin*
>I don't think it's the same... Resistors have 10 different colours,
>order of which I'm not sure of, but according to the Programmer's PC
>Sourcebook there are only 8 ANSI colours:
>
>text	bkgr.	colour
>----	-----	------
>30	40	black
>31	41	red
>32	42	green
>33	43	yellow
>34	44	blue
>35	45	magenta
>36	46	cyan
>37	47	white

And this isn't even the same order as resistor codes which can be remembered
by "Bad Boys Rape Our Young Girls But Violet Gives Willingly."  This maps to
Black, Brown, Red, Orange, Yellow, Green, Blue, Violet, Grey and White.

And to the guy who accused me of being politically correct a while back
in email what do you think now?  :-)

-- 
D'Arcy J.M. Cain (darcy@druid.com)  |
D'Arcy Cain Consulting              |   There's no government
Toronto, Ontario, Canada            |   like no government!
+1 416 424 2871          DoD#0082   |
Newsgroups: comp.lang.c