[ale] Excuse me for my web stupidity. Working on displaying output to a browser.

Adrin haswes at mindspring.com
Tue Jan 22 16:42:23 EST 2002


Couldn't php do this?

Hey if you get it to work. Think you could
share part of it? When I first got my Linux
machine up and running. I just set up some
script files to get the uptime, the last time
a user logged in, and the current aDSL ip address.
The hardest part was trying to figure out how to get
ftp to run in a script. After all that my brother
tells me about www.dns2go.com and its free service
for personal use. I think the business accounts were
a bit much.

But I had fun with it and now it is over due for a update.
I could add more to it I think.

Adrin
p.s. By the way it is http://haswes.home.mindspring.com



-----Original Message-----
From: Calvin Harrigan [mailto:charrig at earthlink.net]
To: ale at ale.org
Sent: Tuesday, January 22, 2002 4:20 PM
To: cfowler at outpostsentinel.com
Cc: ale at ale.org
Subject: Re: [ale] Excuse me for my web stupidity. Working on displaying
output to a browser.


Not sure if it should work at all. From what I remember it shouldn't work if
looking at it from a brower.  Most browsers ignore newline and carriage
returns, considered white space.  You might try replacing the:

putchar(10);
putchar(13);

with:

printf("<br>");

that should put you on a new line.

Calvin...
-----Original Message-----
From: Chris Fowler <cfowler at outpostsentinel.com>
To: ale at ale.org
Date: Tue, 22 Jan 2002 10:06:39 -0500
To: ale at ale.org
Subject: [ale] Excuse me for my web stupidity.  Working on displaying output
to  a browser.


> I want to excute a C program that is in cgi-bin directory of my thttpd
server and have some output issues.  I originally thought it would be with
CR vs NL but now I'm not sure.   I created this because I thought it would
sove the
> problem.
>
> F
>
> Exapmle program
>
>
>
> int
> main(int argc, char *argv[])
> {
>         FILE *fp;
>         int c;
>
>
>         fp = popen("/sbin/stat", "r");
>
>
>         printf("<HTML><HEAD><TITLE>System
Statistics</TITLE></HEAD><BODY>\n");
>
>         while(!feof(fp))
>         {
>                 c = getc(fp);
>
>                 if(c == 10)
>                 {
>                         putchar(10);
>                         putchar(13);
>                 }
>                 else
>                         putchar(c);
>         }
>
>         pclose(fp);
>
>         printf("</BODY></HTML>\n");
>
>         return 0;
>
> }
>
>
> First time I access http://IPADDRESS/cgi-bin/test  Below is the output
>
> *************************************************************** Linux
version 2.4.13 (root at moses.outpostsentinel.com) (gcc version 2.96 20000731
(Red Hat Linux 7.1 2.96-98)) #12 Wed Jan 16 14:35:42 EST 2002 BIOS-provided
physical
> RAM map: BIOS-e820: 0000000000000000 - 0000000000098000 (usable)
BIOS-e820: 000000000009fc00 - 00000000000a0000 (usable) BIOS-e820:
00000000000f0000 - 0000000000100000 (reserved) BIOS-e820:
> 0000000000100000 - 0000000007d80000 (usable) BIOS-e820: 00000000ffff0000 -
0000000100000000 (reserved) On node 0 totalpages: 32128 zone(0): 4096 pages.
zone(1): 28032 pages. zone(2): 0 pages. No local APIC
> present or hardware disabled Kernel command line: auto BOOT_IMAGE=outpost
ro root=107 ramdisk=16384 console=ttyS0,9600 Initializing CPU#0 Detected
300.684 MHz processor. Console: colour VGA+ 80x25 Calibrating delay
> loop... 594.73 BogoMIPS Memory: 124000k/128512k available (809k kernel
code, 4096k reserved, 211k data, 204k init, 0k highmem) Checking if this
processor honours the WP bit even in supervisor mode... Ok. Dentry-cache
> hash table entries: 16384 (order: 5, 131072 bytes) Inode-cache hash table
entries: 8192 (order: 4, 65536 bytes) Mount-cache hash table entries: 2048
(order: 2, 16384 bytes) Buffer-cache hash table entries: 4096 (order: 2,
16384
> bytes) Page-cache hash table entries: 32768 (order: 5, 131072 bytes) CPU:
Before vendor init, caps: 00808131 01818131 00000000, vendor = 255 CPU:
After vendor init, caps: 00808131 01818131 00000000 00000000 CPU:
> After generic, caps: 00808131 01818131
>
>
> Notice no CR's or NL
>
> Now if I hit refresh here is the example output:
>
> ***************************************************************
>
> Linux version 2.4.13 (root at moses.outpostsentinel.com) (gcc version 2.96
20000731 (Red Hat Linux 7.1 2.96-98)) #12 Wed Jan 16 14:35:42 EST 2002
>
> BIOS-provided physical RAM map:
>
>  BIOS-e820: 0000000000000000 - 0000000000098000 (usable)
>
>  BIOS-e820: 000000000009fc00 - 00000000000a0000 (usable)
>
>  BIOS-e820: 00000000000f0000 - 0000000000100000 (reserved)
>
>  BIOS-e820: 0000000000100000 - 0000000007d80000 (usable)
>
>  BIOS-e820: 00000000ffff0000 - 0000000100000000 (reserved)
>
> On node 0 totalpages: 32128
>
> zone(0): 4096 pages.
>
>
>
> Now I have both CR's and NL.  Basically I have  stat program that displays
/proc info on command line.  I want this to also be displayed on a web page
to the users that needs to see this info without logging in.
>
> Any help would be appreciated.
>
>
> ---
> This message has been sent through the ALE general discussion list.
> See http://www.ale.org/mailing-lists.shtml for more info. Problems should
be
> sent to listmaster at ale dot org.
>
>

--



---
This message has been sent through the ALE general discussion list.
See http://www.ale.org/mailing-lists.shtml for more info. Problems should be
sent to listmaster at ale dot org.


---
This message has been sent through the ALE general discussion list.
See http://www.ale.org/mailing-lists.shtml for more info. Problems should be 
sent to listmaster at ale dot org.






More information about the Ale mailing list