🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: cn.bbs.comp.program
1 messages
1 total messages Started by wooce Wed, 25 Mar 1998 00:00
CGI����C���Է���(ת��)
#1754
Author: wooce
Date: Wed, 25 Mar 1998 00:00
103 lines
2148 bytes


parseurl.c


------------------------------------------------------------------------




/* 
 * file: parseurl.c
 * (c) 1995-1996 William E. Weinman
 */

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>

#define false (0)
#define true  (1)

struct urlparts {
  char * name;
  char separator[4];
  char value[128];
  } parts[] = {
  { "scheme", ":" },
  { "userid", "@" },
  { "password", ":" },
  { "host", "//" },
  { "port", ":" },
  { "path", "/" },
  { "param", ";" },
  { "qu0;
  }
else if (!s[i])
  *s = 0; /* we copied the whole string */

return out;
}

/* 
  char firstpunc(char *s)

  return the first non-alphanumeric 
  in s.
*/

char firstpunc(char * s)
{
while(*s++)
  if(!isalnum(*s)) return *s;

return false;
}

/*
  int strleft(char * s, int n)

  shift s left n characters

  returns number of characters 
  shifted, zero for none or 
  -1 for error

  if n is less than the length
  of s, no shift is done and 
  error is returned

  if n is equal to the length
  of s, s is truncated to zero 
  length and n is returned.
*/

int strleft(char * s, int n)
{
int l;

l = strlen(s);
if(l < n)
  return -1;
else if (l == n)
  *s = 0;

memmove(s, s + n, l - n + 1);
return n;
}





------------------------------------------------------------------------
Document: /chap04/parseurl.c.html � Modified: Tuesday, 9 April 1996, 11:51:47
It is now Tuesday, 10 March 1998, 02:52:51 in Dallas, Texas

� 1995-1997 William E. Weinman � email:�wew@bearnet.com � web:�http://www.weinman.com/wew/

--
�� ��Դ:���������� BBS bbs.nease.net��[FROM: 202.96.174.34]
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads