Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.sys.apple2.programmer > #1182
| From | "Bill Buckels" <bbuckels@mts.net> |
|---|---|
| Newsgroups | comp.sys.apple2.programmer |
| Subject | Re: Mousetext Screens |
| Date | 2014-03-06 13:51 -0600 |
| Organization | Aioe.org NNTP Server |
| Message-ID | <lfajk5$auc$1@speranza.aioe.org> (permalink) |
| References | <f478c823-d161-45be-852f-4a1475ace7a5@googlegroups.com> <4ba897c1-21b6-40c9-817f-9457140f7e30@googlegroups.com> <89334c06-ac36-4e96-a0ab-5b9a078bdfb2@googlegroups.com> |
<gids.rs@sasktel.net> wrote:
>Google is spazzing out.
Hi Rob,
The choice to view a newsgroup in html rather than on a news-server in plain
text is your enemy here.
Shoe-horning usenet into google groups creates many problems, the least
objectionable being the correct translation of html escape codes
(semi-colons missing, etc.). It could be your browser doing that too... in
fact your browser should do that.
When posting code why not try using the html tag for preformatted text and
see what happens...
use <PRE> before you post code
and
use </PRE> after you post code.
I'll give that a try right now and you can see what google groups does with
my post, coming the other way from usenet but please understand that I do
not intend to use google groups for anything unless I need to, and don't
care what google groups shows its users... except people that I know of
course.
I also really object to top quoting an entire message thread before
answering one line of a post. It may look fine in google but it's a load of
cak in my newsreader...
It's also a waste of my personal disk space. Arguably lots of my posts are a
waste of other people's personal disk space, but this aberrant top quoting
practice of posting long no-content google messages more than justifies my
long messages on usenet. Again and arguably if someone doesn't want to read
something they don't need to... so my position on all of this is just my
opinion and nothing more...
You may notice that the test below is a filter which changes plain text to
html. It has escape codes buried in it. Use view source on your browser to
see what this really is. If you want the program and if it works in google
groups it may not give usenet users what they need to see but it may be fine
for barney google's html clownshow.
I also should mention that if you are distributing a series of programs for
posterity or anything, it would be best to have some webspace available and
provide disk images and working programs. Anyone reading this probably
already knows how to use the tools required to access disk images but may
not want to bother with extra work to cut and paste your stuff. Lord knows
nobdy likely cuts and pastes my stuff... They might also want to see your
program in action first before going to extra work.
Like Antoine:) And lazy old me:)
This is your decision of course and I get it! Don't worry. We understand
what you said... but is the goal to entertain yourself or distribute
information or do both in a manner that someone might actually use? In this
case, more is better and downloads are a good thing. In the 1980's and later
when I trained junior programmers, I would make them do extra work and watch
them suffer until they learned their stuff. This was how I weeded-out the
ones that I fired from the ones I kept. If you made it through the first
couple of weeks with me, then I took the time to train in detail. I also
required almost perfect marksin your degree to get an interview, and a
verbal technical test with a weighted sum to get a probationary period with
the team. Incentive bonuses and participation with sem very smart existing
team members demande it! I am not sure what constitute's worthiness in the
industry anymore. I really am not sure:) But my Apple II stuff doesn't
require any such flogging...
If you want your own webpages or download area for disk images on
www.appleoldies.ca like
http://www.appledies.ca/RobsStuff/
I will give you the keys to the website and you can go nuts and fill-it up
with all your cool stuff. I have a fair amount of free space there and it is
dirt-cheap so unless I die it will likely be there for quite a while.
Ok so here's the test...
<PRE>
/* ----------------------------------------------------------------------
Program : src2htm (gcc -o src2htm.exe src2htm.c)
Description : Filter Programs and Commandline Utility
Inspired by Emmanuel ROCHE's WS4HTM.BAS
(The html wrapper is directly taken from
Mr.Roche's code but this program is not
as elegant and makes no attempt to
"pretty-up" the HTML when processing WS files.
Does not handle unicode characters.
That part of Roche's HTML I did not use.
7 bit Ascii only (strips hi-bits).)
Converts "Unix" and Windows Text Files
to plain-text html.
Input: "Unix" or Windows Sequential Text File.
Do not use Apple text files as input files.
Output: Html to Console or to File
Includes a tabstop feature which takes an optional command line argument
of the number of spaces per tabstop in the range of 1-8.
Can be used as a filter or as a standalone program. When used as a
standalone program, input and output file options can be specified as
additional command line arguments.
Written by : Bill Buckels but based on
Emmanuel ROCHE's WS4HTM.BAS (Mallard BASIC)
Date Revised : Nov 21, 2013
Revision : 1.0 First Release
Compiles under MinGW
Licence : You may use this program for whatever you wish as long
as you agree that Bill Buckels has no warranty or
liability obligations whatsoever from said use.
---------------------------------------------------------------------- */
#include <stdio.h>
#include <stdlib.h>
/*
Synopsis:
========
This is a standard tab filter that has seen multiple iterations over the
last several decades. This latest iteration has been extended to provide
html output for tab-free source listings and textfiles.
Standard Usage: Input is from stdin or a text file.
============== Output is to stdout in html format.
Default Tabstop = 8.
Optional: Tabstop range of 1-8.
1. Filter - pipe tabfree output to stdout or redirect to file.
Usage: untab
untab 4
2. File Input - Open a file and output to stdout or redirect to file.
Usage: untab infile.txt
untab infile.txt 4
Special Usage: Text File Output:
=============
Default Tabstop = 4.
Optional: Tabstop range of 1-8.
3. Convert text files with tabs to html files without tabs.
Usage: untab infile.txt outfile.htm
untab infile.txt outfile.htm 8
-
- When an output file is specified, the default tabwidth is 4.
Optional: Tabstop range of 1-8.
-------------------------------------------------------------------- */
char infile[512];
char outfile[512];
FILE *fp = NULL;
FILE *fp2 = NULL;
int main(int argc, char *argv[])
{
int c,
i,
spaces,
tabstop = 8, tabset = 0; /* default to 8 space max per tab */
/* if a valid numeric argument use the tabstop
value that was entered on the command line */
infile[0] = outfile[0] = 0;
if (argc > 1) {
for (i = 1; i < argc; i++) {
if (argv[i][0] >= '0' && argv[i][0] <= '9') {
tabset = 1;
tabstop = atoi(argv[i]);
if (tabstop < 1 || tabstop > 8) tabstop = 8;
}
else {
if (infile[0] == 0)
strcpy(infile, argv[i]);
else if (outfile[0] == 0)
strcpy(outfile, argv[i]);
}
}
}
if (infile[0] != 0) {
fp = fopen(infile, "r");
if (NULL == fp) {
fprintf(stderr, "open failure on %s\n",infile);
return (1);
}
}
if (outfile[0] != 0) {
fp2 = fopen(outfile, "wb");
if (NULL == fp2) {
fclose(fp);
fprintf(stderr, "open failure on %s for write.\n",outfile);
return (2);
}
/* default to a tabstop of 4 */
if (tabset == 0) tabstop = 4;
}
if (NULL != fp2) {
fprintf(fp2,"<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01//EN\">%c%c",
0x0d,0x0a);
fprintf(fp2,"<html>%c%c<head>%c%c",0x0d,0x0a,0x0d,0x0a);
fprintf(fp2,"<meta http-equiv=\"Content-Type\" content=\"text/html;
charset=UTF-8\">%c%c",
0x0d,0x0a);
fprintf(fp2,"<meta name=\"Generator\" content=\"src2htm by Bill
Buckels\">%c%c",
0x0d,0x0a);
fprintf(fp2,"<title>Converted from file
\"%s\"</title>\n",infile,0x0d,0x0a);
fprintf(fp2,"</head>%c%c<basefont size=3>%c%c<body>%c%c<pre>%c%c",
0x0d,0x0a,0x0d,0x0a,0x0d,0x0a,0x0d,0x0a);
}
else {
puts("<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01//EN\">");
puts("<html>\n<head>");
puts("<meta http-equiv=\"Content-Type\" content=\"text/html;
charset=UTF-8\">");
puts("<meta name=\"Generator\" content=\"src2htm by Bill Buckels\">");
printf("<title>Converted from file \"%s\"</title>\n",infile);
puts("</head>\n<basefont size=3>\n<body>\n<pre>");
}
spaces = tabstop; /* initialize spaces to a full tab */
for(;;)
{
if (NULL == fp)
c = getchar();
else
c = fgetc(fp);
if (c==EOF)break;
if (c==0x1a) break; /* CP/M EOF */
c &= 0x7f; /* strip hi-bits - 7 bit text only */
/* note this should handle WS files as well as text files */
if(c==0x0a) /* eol found, so reset spaces to a full tabstop */
{
spaces = tabstop;
}
else
{
if(c==0x09) /* tab found, so print remaining spaces */
{
for(i=0;i<spaces;i++) {
if (NULL == fp2) putchar(0x20);
else fputc(0x20,fp2);
}
spaces = tabstop;
continue;
}
spaces--; /* other character found, one less space required
until next tabstop */
if(spaces == 0)spaces = tabstop; /* spaces are all used so
reset to a full tabstop */
}
/* replace special UTF-8 characters with HTML 2.0
escape sequences and convert both unix and
windows text lines by ignoring
carriage returns from input and writing
carriage returns before linefeeds */
if (NULL == fp2) {
switch(c) {
case 0x22: printf("""); break;
case 0x26: printf("&"); break;
case 0x3c: printf("<"); break;
case 0x3e: printf(">"); break;
default: putchar(c);
}
}
else {
switch(c) {
case 0x22: fprintf(fp2,"""); break;
case 0x26: fprintf(fp2,"&"); break;
case 0x3c: fprintf(fp2,"<"); break;
case 0x3e: fprintf(fp2,">"); break;
case 0x0d: break;
case 0x0a: fputc(0x0d, fp2);
default: fputc(c, fp2);
}
}
}
/* print html trailer */
if (NULL != fp2)
fprintf(fp2,"</pre>%c%c</body>%c%c</html>%c%c",
0x0d,0x0a,0x0d,0x0a,0x0d,0x0a);
else
puts("</pre>\n</body>\n</html>");
if (NULL != fp) {
fclose(fp);
if (NULL != fp2) fclose(fp2);
}
return (0);
}
</PRE>
Back to comp.sys.apple2.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Mousetext Screens gids.rs@sasktel.net - 2014-02-28 12:28 -0800
Re: Mousetext Screens gids.rs@sasktel.net - 2014-02-28 12:35 -0800
Re: Mousetext Screens gids.rs@sasktel.net - 2014-02-28 17:44 -0800
Re: Mousetext Screens Marco Verpelli <mverpelli@libero.it> - 2014-03-01 00:33 -0800
Re: Mousetext Screens gids.rs@sasktel.net - 2014-03-03 21:02 -0800
Re: Mousetext Screens gids.rs@sasktel.net - 2014-03-03 21:08 -0800
Re: Mousetext Screens gids.rs@sasktel.net - 2014-03-06 10:24 -0800
Re: Mousetext Screens "Bill Buckels" <bbuckels@mts.net> - 2014-03-06 13:51 -0600
Re: Mousetext Screens aiiadict@gmail.com - 2014-02-28 13:05 -0800
Re: Mousetext Screens Antoine Vignau <antoine.vignau@laposte.net> - 2014-03-01 06:23 -0800
Re: Mousetext Screens gids.rs@sasktel.net - 2014-03-01 08:40 -0800
Re: Mousetext Screens "Bill Buckels" <bbuckels@mts.net> - 2014-03-01 17:00 -0600
Re: Mousetext Screens gids.rs@sasktel.net - 2014-03-01 22:07 -0800
Re: Mousetext Screens gids.rs@sasktel.net - 2014-03-06 10:18 -0800
Re: Mousetext Screens "Bill Garber" <willy46pa@comcast.net> - 2014-03-06 21:38 -0500
Re: Mousetext Screens Jeff Blakeney <CUTjeffrey_blakeney@yahoo.ca> - 2014-03-07 07:51 -0500
csiph-web