Re: A somewhat new BBtool -- bbweb

2002-06-07 Thread Mike

You could look at urlencode() from php, should be fairly small and easy enough to rip.

---

static unsigned char hexchars[] = 0123456789ABCDEF;

/* {{{ php_url_encode
 */
PHPAPI char *php_url_encode(char *s, int len, int *new_length)
{
register int x, y;
unsigned char *str;

str = (unsigned char *) emalloc(3 * len + 1);
for (x = 0, y = 0; len--; x++, y++) {
str[y] = (unsigned char) s[x];
if (str[y] == ' ') {
str[y] = '+';
#ifndef CHARSET_EBCDIC
} else if ((str[y]  '0'  str[y] != '-'  str[y] != '.') ||
   (str[y]  'A'  str[y]  '9') ||
   (str[y]  'Z'  str[y]  'a'  str[y] != '_') ||
   (str[y]  'z')) {
str[y++] = '%';
str[y++] = hexchars[(unsigned char) s[x]  4];
str[y] = hexchars[(unsigned char) s[x]  15];
}
#else /*CHARSET_EBCDIC*/
} else if (!isalnum(str[y])  strchr(_-., str[y]) == NULL) {
/* Allow only alphanumeric chars and '_', '-', '.'; escape the rest 
*/
str[y++] = '%';
str[y++] = hexchars[os_toascii[(unsigned char) s[x]]  4];
str[y] = hexchars[os_toascii[(unsigned char) s[x]]  0x0F];
}
#endif /*CHARSET_EBCDIC*/
}
str[y] = '\0';
if (new_length) {
*new_length = y;
}
return ((char *) str);
}
/* }}} */

On Friday, June 07, 2002 at 12:31PM, Scott Furt wrote:
Derek Cunningham wrote:
On Thu, Jun06,02 12:53, Mr.X wrote:

This is cool.  Works fine for me, by the way.


Hmm... now we need bbgoogle. :)

DC


remove the space when strncat()'ing browser
to real_command, build it.  (the patch shows the lines)

modify bbweb.browser to be something like
/usr/bin/mozilla http://www.google.com/search\?hl=en\q=

i have no idea how URL-escape stuff in C, so some queries
might fail (ones with spaces or other funky chars), but
that's the general idea of making bbweb into bbgoogle :-)

maybe i'll use this opportunity to teach myself Perl/Tk
or PHP-Gtk -- becuase then i could do so much more
with it.

--- bbweb.orig Fri Jun  7 12:19:33 2002
+++ bbweb.cFri Jun  7 12:27:34 2002
 -92,7 +92,7 
   read_browser();
   
   strncat(real_command, browser, 100);
-  strncat(real_command,  , 2);
+  //strncat(real_command,  , 2);
 
 
   for (i = 1; i  argc; i++)



Re: A somewhat new BBtool -- bbweb

2002-06-06 Thread Mr . X

On 06 Jun 2002 12:00:55 -0400
Matthew Weier O'Phinney [EMAIL PROTECTED] wrote:
 On Thu, 2002-06-06 at 11:19, Scott Furt wrote:
  Good morning everyone:
  
  I couldnt get any sleep last night so i decided to hack up
  bbrun and modify it to bbweb.
  
  Now, instead of typing in a binary to run, you can type
  in a URL, and it'll load the browser of your choice with
  the URL.
  
  Put the path to your fav. browser in ~/.bbtools/bbweb.browser
  it stores a history of past URLs in ~/.bbtools/bbweb.history
  
  Whoopee :)
  
  To get it:
  http://furt.com/code/linux/bbweb/
  http://furt.com/code/linux/bbweb-1.0.tgz
 I just downloaded it and compiled it on my Debian Woody installation
 -- when I tried to run it, it gave me a segmentation fault...
 
 (I've had a functionality like this for some time, actually, by piping
 the input from an xask dialog to my browser... just another way to go,
 if you don't hack C or C++... :-)  )

This is cool.  Works fine for me, by the way.



Re: A somewhat new BBtool -- bbweb

2002-06-06 Thread Derek Cunningham

On Thu, Jun06,02 12:53, Mr.X wrote:
 On 06 Jun 2002 12:00:55 -0400
 Matthew Weier O'Phinney [EMAIL PROTECTED] wrote:
  On Thu, 2002-06-06 at 11:19, Scott Furt wrote:
   Good morning everyone:
   
   I couldnt get any sleep last night so i decided to hack up
   bbrun and modify it to bbweb.
   
   Now, instead of typing in a binary to run, you can type
   in a URL, and it'll load the browser of your choice with
   the URL.
   
   Put the path to your fav. browser in ~/.bbtools/bbweb.browser
   it stores a history of past URLs in ~/.bbtools/bbweb.history
   
   Whoopee :)
   
   To get it:
   http://furt.com/code/linux/bbweb/
   http://furt.com/code/linux/bbweb-1.0.tgz
  I just downloaded it and compiled it on my Debian Woody installation
  -- when I tried to run it, it gave me a segmentation fault...
  
  (I've had a functionality like this for some time, actually, by piping
  the input from an xask dialog to my browser... just another way to go,
  if you don't hack C or C++... :-)  )
 
 This is cool.  Works fine for me, by the way.

Hmm... now we need bbgoogle. :)

DC

-- 
Derek Cunningham
[EMAIL PROTECTED]

Human beings act intelligently only after they have
exhausted the alternatives -- Abba Eban

Registered Linux User Number 195825