[news.software.b] Porting C News to MS-DOS?

mju@cardiology.ummc.umich.edu (Marc Unangst) (07/27/89)

I am currently reading news on my MS-DOS machine, using a package called
UFGATE.  UFGATE works okay, but has a lot of undesirable "features" in
it, like not supporting the References: header, not supporting cross-
posting, etc.  It's also slow, and the uucico supplied with it is even
slower (~90cps @ 2400 baud...C'mon!).  (Note that, since I do not get
news.software.b on my MS-DOS machine, this is being posted from a
friend's machine.  Please respect the Reply-To: address, if you send
mail.)

At any rate, I am curious how difficult it would be to port C News to
MS-DOS.  I plan on using Turbo C 2.0, which is "mostly" UNIX compatable,
except for some things (such as signal(), which doesn't support all of
the UNIX signals), and, quite obviously, things that have no relevance
to a single-tasking system, such as fork().

I realize that the absense of fork() may make porting C News difficult,
but since a fork() is very commonly almost immediately followed by an
exec(), and since Turbo C has a set of spawn() routines to spawn a
process, it shouldn't be that hard (although it'll probably be tedious).

Any comments from the author(s), or others that are familiar with the
source?

--
Marc Unangst
UUCP smart    : mju@mudos.ann-arbor.mi.us
UUCP dumb     : ...!uunet!sharkey!mudos!mju
UUCP dumb alt.: ...!{ames,rutgers}!mailrus!clip!mudos!mju
Internet      : mju@mudos.ann-arbor.mi.us

rmtodd@servalan.uucp (Richard Todd) (07/29/89)

In article <1143@mailrus.cc.umich.edu> mju@mudos.ann-arbor.mi.us (Marc Unangst) writes:
>At any rate, I am curious how difficult it would be to port C News to
>MS-DOS.  I plan on using Turbo C 2.0, which is "mostly" UNIX compatable,
>except for some things (such as signal(), which doesn't support all of
>the UNIX signals), and, quite obviously, things that have no relevance
>to a single-tasking system, such as fork().
  I can speak with some authority on this subject.  Back when C News Alpha
was posted to the net a year or so back, I started work on trying to port
it to my PC/XT.  After several weeks of messing about with it, I gave up in
disgust, having not been able to even get relaynews working.  It's a good deal
more difficult than it might look on the surface.

>I realize that the absense of fork() may make porting C News difficult,
>but since a fork() is very commonly almost immediately followed by an
>exec(), and since Turbo C has a set of spawn() routines to spawn a
>process, it shouldn't be that hard (although it'll probably be tedious).
  That's just one of the many things you have to diddle with.  When you look
into it, there are a lot of calles in Unix that you somehow have to deal
with on MS-DOS.  Some are relatively simple (e.g. getuid() -- just have it
return some suitably plausible integer), some are not.  Probably the 
nastiest one to deal with is link().  The MS-DOS filesystem just doesn't
support giving multiple links (names) to the same file, and this feature
is *repeatedly* used in C News (and B News, for that matter) to handle 
crossposted articles.  The gross and ugly hack I used was to accumulate in
an array the names of all the links the file was to have, then as the
incoming article was processed accumulate it in a temp file, then at the
end of article processing make copies of the article under all the destination
filenames.  
   Another problem I noticed, but never figured out a solution to, is this:
On Unix time values are stored in a very simple format (seconds since 
midnight Jan 1,1970), and doing arithmetic on time values (figuring out,
e.g. just what time value corresponds to "3 days ago") is trivial.  Under
MSDOS time values are more complex (an ugly mass of bitfields for day,week,
month, hour, etc.) and doing arithmetic on these values is non-trivial.
Expire, among other programs, depends heavily on being able to do this
sort of arithmetic on time values.  Never did figure out a solution for
this one...
   More fun:  Much of the guts of C News (programs like inews, the control
message handlers, etc.) is done as shell scripts.  While on a Unix system
this is really cool, as shell scripts are easy to modify, on a DOS system
you've got to somehow translate the shell scripts into C programs.  
And some of those shell scripts are rather complex....
   Once you get all the stuff set up so that it will at least compile and
link, they you get the joy of trying to debug it.  Or, to be more exact,
you end up debugging the compiler's code.  As I recall, I gave up in
disgust after finding over 10 separate places in relaynews alone where
the compiler (Aztec C v4.1) had produced incorrect code.  I've got better
things to do with my time than debug somebody's compiler for them.  The
state of the art in PC compiler reliability may be better now than it was then,
but I wouldn't bet on it.  
  Some time back, I saw a posting on the net from somebody who claimed to
have ported B News 2.11 to MS-DOS.  He said it took him a year to do it. 
I can believe it.
  In summary: Trying to get netnews to run on a PC is like trying to teach
a pig to sing; it wastes your time and annoys the pig.  If you want to have
your own netnews site, save your pennies and get yourself a real Unix box.
Rumor has it you can pick up a 3b1 or 3b2 pretty cheap these days, and 
it'll be a whole lot easier to work with.  
--
Richard Todd	rmtodd@uokmax.ecn.uoknor.edu  rmtodd@chinet.chi.il.us
				rmtodd@servalan.uucp
Motorola Skates On Intel's Head!

peter@ficc.uu.net (Peter da Silva) (07/30/89)

In article <1989Jul28.232622.1036@servalan.uucp>, rmtodd@servalan.uucp (Richard Todd) writes:
> Probably the 
> nastiest one to deal with is link().

You could look at the VMS code in B news. Instead of creating a link it creates
a file containing the name of the file to link to... a symbolic link.

>    Another problem I noticed, but never figured out a solution to, is this:
> On Unix time values are stored in a very simple format [ms-dos ones aren't]

The solution I have come up with for this one is to convert dates to UNIX format
in the library.

> message handlers, etc.) is done as shell scripts.  While on a Unix system
> this is really cool, as shell scripts are easy to modify, on a DOS system
> you've got to somehow translate the shell scripts into C programs.  

There is a PD version of the UNIX shell available, under the name ASH. You
could try converting that. Backgrounding tasks would be impossible, as would
concurrent pipelines, but you should be able to get a lot of the functionality.

> a pig to sing; it wastes your time and annoys the pig.  If you want to have
> your own netnews site, save your pennies and get yourself a real Unix box.

Or get an Amiga. Porting UNIX code to the Amiga would be easier than porting
it to a PC, because it has much more of an operating system (complete with
real pipes). Or you can port News to MINIX.
-- 
Peter da Silva, Xenix Support, Ferranti International Controls Corporation.
Business: peter@ficc.uu.net, +1 713 274 5180. | "...helping make the world
Personal: peter@sugar.hackercorp.com.   `-_-' |  a quote-free zone..."
Quote: Have you hugged your wolf today?  'U`  |    -- hjm@cernvax.cern.ch

mshiels@tmsoft.uucp (Michael A. Shiels) (07/30/89)

Porting C news to the PC is not impossible.  I had an earlier version of
Cnews running on my pc for ages until I found that doing my own message
conversions was easier than running Cnews and then reading those messages
for gatewaying to another system.  But IT'S NOT IMPOSSIBLE.  I was using
Microsoft C 5.1 and a whole pile of porting libraries I have created over
the last 5 years.

brian@ucsd.EDU (Brian Kantor) (07/30/89)

Why would you WANT to port C news to your PC?  Wouldn't it be smarter
and about as cost-effective to port your PC over to the trashcan and buy
a real computer that runs a real operating system like Unix?

Or don't you count your time as valuable?  Even PC programmers who only
know BASIC are worth $25 an hour around here.
	- Gadfly

peter@ficc.uu.net (Peter da Silva) (07/31/89)

In article <1871@ucsd.EDU>, brian@ucsd.EDU (Brian Kantor) writes:
> Or don't you count your time as valuable?

This is a completely bogus argument. *IF* you don't have the money to,
as you put it, "port your PC to the trashcan" and buy a UNIX box, *THEN*
it doesn't matter what arbitrary value you put on your time.

Besides, don't you know RMS said it's evil to earn big bucks from software?
-- 
Peter da Silva, Xenix Support, Ferranti International Controls Corporation.
Business: peter@ficc.uu.net, +1 713 274 5180. | "The sentence I am now
Personal: peter@sugar.hackercorp.com.   `-_-' |  writing is the sentence
Quote: Have you hugged your wolf today?  'U`  |  you are now reading"

gors@well.UUCP (Gordon Stewart) (07/31/89)

In article <1871@ucsd.EDU> brian@ucsd.edu (Brian Kantor) writes:
>Why would you WANT to port C news to your PC?  Wouldn't it be smarter
>and about as cost-effective to port your PC over to the trashcan and buy
>a real computer that runs a real operating system like Unix?
>

The above comments are seen too often on the net, and are never helpful.
The suggestion to throw away one's equipment to buy the latest and
greatest comes easily to some -- but the rest of us, for whatever reason
(desire for experience, lack of moola, fear of flying) want to use
our equipment at LEAST until we've depreciated it!

Maybe your parents are still supporting you, I dunno.  It is almost
invariably the case that when someone in computerdom says: "you should
junk that thing, because <blah> is coming out!" they're a student, with
resources that are paid for by someone else.  Outside the academy, we
have to PAY for our fun!  And it isn't always a question of labor vs.
money -- I could, I suppose afford a plumber -- but I'd rather fix the
drain under the sink myself. And I don't want to wait for the plumber
to arrive.

m sierchio
-- 
				{apple, pacbell, hplabs, ucbvax}!well!gors
							gors@well.sf.ca.us
(Doolan) | (Meyer) | (Sierchio) | (Stewart)

rmtodd@servalan.uucp (Richard Todd) (08/02/89)

In article <1989Jul30.022407.2361@tmsoft.uucp> mshiels@tmsoft.UUCP (Michael A. Shiels) writes:
>Porting C news to the PC is not impossible.  I had an earlier version of
>Cnews running on my pc for ages until I found that doing my own message
>conversions was easier than running Cnews and then reading those messages
>for gatewaying to another system.  But IT'S NOT IMPOSSIBLE.  I was using
>Microsoft C 5.1 and a whole pile of porting libraries I have created over
>the last 5 years.
  I never said that it was impossible.  I just said it would be a royal pain,
and tried to give hints on what "features" of MSDOS are likely to cause trouble.
The fact that you needed a whole pile of porting libraries that you created
over a 5 year span says more eloquently than anything I can write how poorly
suited the PC is to running netnews, or any other serious program of the
modern age.  
  How long did it take you to port C News to your PC?  Three months? Four?
It took me 3-4 *hours* to get C News running on my Unix box, and most of that
was waiting for various makes to complete.  The advantage of having a real
computer instead of a PC cannot be overstated, not only in the time involved
but in the hassle.  As Peter da Silva points out, even an Amiga would be
an improvement; at least the Amiga has a multitasking OS.  
--
Richard Todd	rmtodd@uokmax.ecn.uoknor.edu  rmtodd@chinet.chi.il.us
	rmtodd@servalan.uucp
MMDF is a 4 letter word. 

eddjp@althea.UUCP (Dewey Paciaffi) (08/04/89)

 (Richard Todd) writes:
>It took me 3-4 *hours* to get C News running on my Unix box, and most of that
>was waiting for various makes to complete.  The advantage of having a real
>computer instead of a PC cannot be overstated, not only in the time involved
>but in the hassle.  As Peter da Silva points out, even an Amiga would be
>an improvement; at least the Amiga has a multitasking OS.  

Let us not confuse PC's with DOS. At this very moment, I'm on my "PC", along
with 5 other users, who are running Oracle and other "real" software under
Xenix, while I play with the news.

This old 20MHz 386 runs RINGS around the "Real Computers" I worked on
5 years ago ( 32-bit Minis ).

I for one would love to see a netnews system for DOS. I just can't afford
enough hardware for my home set-up :-(.

And another thing, there is a Multi-tasking operating system for the PC,
and we like to call it UN*X.

Dewey Paciaffi

henry@utzoo.uucp (Henry Spencer) (08/04/89)

In article <5360@ficc.uu.net> peter@ficc.uu.net (Peter da Silva) writes:
>> Probably the 
>> nastiest one to deal with is link().
>
>You could look at the VMS code in B news. Instead of creating a link it creates
>a file containing the name of the file to link to... a symbolic link.

C News actually has some limited support for this, but we assume that
symlink() exists and works.  That is, we don't supply the underlying
machinery but if it's there we're prepared to use it.  Note that that stuff
hasn't been well tested.  See notebook/vms for some details.
-- 
1961-1969: 8 years of Apollo.  |     Henry Spencer at U of Toronto Zoology
1969-1989: 20 years of nothing.| uunet!attcan!utzoo!henry henry@zoo.toronto.edu

henry@utzoo.uucp (Henry Spencer) (08/04/89)

In article <1143@mailrus.cc.umich.edu> mju@mudos.ann-arbor.mi.us (Marc Unangst) writes:
>At any rate, I am curious how difficult it would be to port C News to
>MS-DOS.  I plan on using Turbo C 2.0, which is "mostly" UNIX compatable...

The C code may present some problems, but depending on how good Turbo C's
Unix compatibility is, that might go okay.  The real problem will be all
the shell files and all the references to sed, awk, etc. in them.
-- 
1961-1969: 8 years of Apollo.  |     Henry Spencer at U of Toronto Zoology
1969-1989: 20 years of nothing.| uunet!attcan!utzoo!henry henry@zoo.toronto.edu

jbuck@epimass.EPI.COM (Joe Buck) (08/04/89)

In article <1143@mailrus.cc.umich.edu> mju@mudos.ann-arbor.mi.us (Marc Unangst) writes:
>>At any rate, I am curious how difficult it would be to port C News to
>>MS-DOS.  I plan on using Turbo C 2.0, which is "mostly" UNIX compatable...

In article <1989Aug3.235543.13996@utzoo.uucp> henry@utzoo.uucp (Henry Spencer) writes:
>The C code may present some problems, but depending on how good Turbo C's
>Unix compatibility is, that might go okay.  The real problem will be all
>the shell files and all the references to sed, awk, etc. in them.

This still might be doable with MKS Tools, which provides the Korn
shell, sed, awk, and a hundred other basic tools for MS-DOS.  These
are the real thing, licensed from AT&T.  On those occasions where I
must use a PC with DOS, I'm glad I have MKS Tools available.
-- 
-- Joe Buck	jbuck@epimass.epi.com, uunet!epimass.epi.com!jbuck

tower@bu-cs.BU.EDU (Leonard H. Tower Jr.) (08/31/89)

In article <5369@ficc.uu.net> peter@ficc.uu.net (Peter da Silva) writes:
|Besides, don't you know RMS said it's evil to earn big bucks from software?

Peter:

Though I detect the ;-) face, it's not quite what rms saids.  He's
against anyone earning big bucks from the use of force.  This includes
software hoarding and other abuses of the intellectual property laws.

thanx -len