🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: cn.bbs.comp.program
Article #1754

CGI����C���Է���(ת��)

#1754
From: 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]
Technical Details
Message-ID: <3NceUT$Sz5@bbs.nease.net>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII
X-Google-Thread: fc86e,8cfb4a5157037a84,start
X-Google-Attributes: gidfc86e,public
From: wooce.bbs@bbs.nease.net (wooce)
Subject: CGI����C���Է���(ת��)
Date: 1998/03/25
Message-ID: <3NceUT$Sz5@bbs.nease.net>
X-Deja-AN: 337410403
X-Filename: Program/M.890801597.A
Organization: Net Ease
Newsgroups: cn.bbs.comp.program,