⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 proto.c

📁 稀疏矩阵、链表、图、队列、二叉树、多叉树、排序、遗传算法等的实现
💻 C
📖 第 1 页 / 共 2 页
字号:
/*  proto.c - CGI Sample Application
*
*
*  Copyright (C) 1999   Chad Dixon
*                       Macmillan Computer Publishing
*
*  This program is free software; you can redistribute it
*  and/or modify it under the terms of the GNU General
*  Public License as published by the Free Software
*  Foundation; either version 2 of the License, or
*  (at your option) any later version.
*
*  This program is distributed in the hope that it will
*  be useful, but WITHOUT ANY WARRANTY; without even the
*  implied warranty of MERCHANTABILITY or FITNESS FOR A
*  PARTICULAR PURPOSE.  See the GNU General Public License
*  for more details.
*
*  You should have received a copy of the GNU General
*  Public License along with this program; if not, write
*  to the Free Software Foundation, Inc., 675 Mass Ave,
*  Cambridge, MA 02139, USA.
*
*  Chad Dixon may be contacted by email at:
*     http://www.loopy.org
*
*/



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

#include "cgi.h"

typedef struct PROTOTYPE
{
  char *Name;
  char *Prototype;
} PROTOTYPE;

int CompProtos(const void *p1, const void *p2)
{
  const PROTOTYPE *Pro1 = p1, *Pro2 = p2;
  return strcmp(Pro1->Name, Pro2->Name);
}

char *GetPrototype(char *funcname)
{
  static PROTOTYPE Prototype[] =
  {
      { "fopen",      "<h2>&lt;stdio.h&gt</h2><p><h3>"
                      "   FILE *fopen(const char *"
                      "filename, const char *mode);"
                      "</h3>"},

      { "freopen",    "<h2>&lt;stdio.h&gt</h2><p><h3>"
                      "   FILE *freopen(const char *"
                      "filename, const char *mode, "
                      "FILE *stream);</h3>" },
      
      { "fflush",     "<h2>&lt;stdio.h&gt</h2><p><h3>"
                      "   int fflush(FILE *stream);"
                      "</h3>" },
      
      { "fclose",     "<h2>&lt;stdio.h&gt</h2><p><h3>"
                      "   int fclose(FILE *stream);"
                      "</h3>" },
      
      { "remove",     "<h2>&lt;stdio.h&gt</h2><p><h3>"
                      "   int remove(const char *"
                      "filename);</h3>" },
      
      { "rename",     "<h2>&lt;stdio.h&gt</h2><p><h3>"
                      "   int rename(const char *"
                      "oldname, const char *newname);"
                      "</h3>" },
      
      { "tmpfile",    "<h2>&lt;stdio.h&gt</h2><p><h3>"
                      "   FILE *tmpfile(void);</h3>"},
      
      { "tmpnam",     "<h2>&lt;stdio.h&gt</h2><p><h3>"
                      "   char *tmpnam(char s[L_tmpnam]);"
                      "</h3>" },
      
      { "setvbuf",    "<h2>&lt;stdio.h&gt</h2><p><h3>"
                      "   int setvbuf(FILE *stream,"
                      " char *buf, int mode, size_t size"
                      ");</h3>" },
      
      { "setbuf",     "<h2>&lt;stdio.h&gt</h2><p><h3>"
                      "   void setbuf(FILE *stream"
                      ", char *buf);</h3>" },
      
      { "fprintf",    "<h2>&lt;stdio.h&gt</h2><p><h3>"
                      "   int fprintf(FILE *stream,"
                      " const char *format, ...);</h3>"},
      
      { "printf",     "<h2>&lt;stdio.h&gt</h2><p><h3>"
                      "   int printf(const char *format,"
                      " ...);</h3>" },
      
      { "sprintf",    "<h2>&lt;stdio.h&gt</h2><p><h3>"
                      "   int    sprintf(char *s,"
                      " const char *format, ...);</h3>" },
      
      { "vprintf",    "<h2>&lt;stdio.h&gt</h2><p><h3>"
                      "   int vprintf(const char *format,"
                      " va_list arg);</h3>" },
      
      { "vfprintf",   "<h2>&lt;stdio.h&gt</h2><p><h3>"
                      "   int vfprintf(FILE *stream,"
                      " const char *format, va_list "
                      "arg);</h3>" },
      
      { "vsprintf",   "<h2>&lt;stdio.h&gt</h2><p><h3>"
                      "   int vsprintf(char *s, const"
                      " char *format, va_list arg);"
                      "</h3>" },
      
      { "fscanf",     "<h2>&lt;stdio.h&gt</h2><p><h3>"
                      "   int fscanf(FILE *stream,"
                      " const char *format, ...);</h3>" },
      
      { "scanf",      "<h2>&lt;stdio.h&gt</h2><p><h3>"
                      "   int scanf(const char *format,"
                      " ...);</h3>" },
      
      { "sscanf",     "<h2>&lt;stdio.h&gt</h2><p><h3>"
                      "   int sscanf(const char *s,"
                      " const char *format, ...);</h3>" },
      
      { "fgetc",      "<h2>&lt;stdio.h&gt</h2><p><h3>"
                      "   int fgetc(FILE *stream);</h3>"},
      
      { "fgets",      "<h2>&lt;stdio.h&gt</h2><p><h3>"
                      "   char *fgets(char *s, int n,"
                      " FILE *stream);</h3>" },
      
      { "fputc",      "<h2>&lt;stdio.h&gt</h2><p><h3>"
                      "   int fputc(int c, FILE *stream);"
                      "</h3>" },
      
      { "fputs",      "<h2>&lt;stdio.h&gt</h2><p><h3>"
                      "   int fputs(const char *s,"
                      " FILE *stream);</h3>" },
      
      { "getc",       "<h2>&lt;stdio.h&gt</h2><p><h3>"
                      "   int getc(FILE *stream);</h3>" },
      
      { "getchar",    "<h2>&lt;stdio.h&gt</h2><p><h3>"
                      "   int getchar(void);</h3>" },
      
      { "gets",       "<h2>&lt;stdio.h&gt</h2><p><h3>"
                      "   char *gets(char *s);"
                      " /* care: many experts believe"
                      "this function <b>cannot</b> be"
                      " used safely */</h3>" },
      
      { "putc",       "<h2>&lt;stdio.h&gt</h2><p><h3>"
                      "   int putc(int c, FILE *stream);"
                      "</h3>" },
      
      { "putchar",    "<h2>&lt;stdio.h&gt</h2><p><h3>"
                      "   int putchar(int c);</h3>" },
      
      { "puts",       "<h2>&lt;stdio.h&gt</h2><p><h3>"
                      "   int puts(const char *s);</h3>"},
      
      { "ungetc",     "<h2>&lt;stdio.h&gt</h2><p><h3>"
                      "   int ungetc(int c, FILE *"
                      "stream);</h3>" },
      
      { "fread",      "<h2>&lt;stdio.h&gt</h2><p><h3>"
                      "   size_t fread(void *ptr,"
                      " size_t size, size_t nobj,"
                      " FILE *stream);</h3>" },
      
      { "fwrite",     "<h2>&lt;stdio.h&gt</h2><p><h3>"
                      "   size_t fwrite(const void *"
                      "ptr, size_t size, size_t nobj,"
                      " FILE *stream);</h3>" },
      
      { "fseek",      "<h2>&lt;stdio.h&gt</h2><p><h3>"
                      "   int fseek(FILE *stream, long"
                      " offset, int origin);</h3>" },
      
      { "ftell",      "<h2>&lt;stdio.h&gt</h2><p><h3>"
                      "   long ftell(FILE *stream);</h3>"},
      
      { "rewind",     "<h2>&lt;stdio.h&gt</h2><p><h3>"
                      "   void rewind(FILE *stream);"
                      "</h3>"},
      
      { "fgetpos",    "<h2>&lt;stdio.h&gt</h2><p><h3>"
                      "   int fgetpos(FILE *stream,"
                      " fpos_t *ptr);</h3>" },
      
      { "fsetpos",    "<h2>&lt;stdio.h&gt</h2><p><h3>"
                      "   int fsetpos(FILE *stream,"
                      " const fpos_t *ptr);</h3>" },
      
      { "clearerr",   "<h2>&lt;stdio.h&gt</h2><p><h3>"
                      "   void clearerr(FILE *stream);"
                      "</h3>" },
      
      { "feof",       "<h2>&lt;stdio.h&gt</h2><p><h3>"
                      "   int feof(FILE *stream);</h3>"},
      
      { "ferror",     "<h2>&lt;stdio.h&gt</h2><p><h3>"
                      "   int ferror(FILE *stream);"
                      "</h3>"},
      
      { "perror",     "<h2>&lt;stdio.h&gt</h2><p><h3>"
                      "   void   perror  (const char *s);"
                      "</h3>" },
      
      { "isalnum",    "<h2>&lt;ctype.h&gt</h2><p><h3>"
                      "   int isalnum(int c);</h3>" },
      
      { "isalpha",    "<h2>&lt;ctype.h&gt</h2><p><h3>"
                      "   int isalpha(int c);</h3>" },
                      
      { "iscntrl",    "<h2>&lt;ctype.h&gt</h2><p><h3>"
                      "   int iscntrl(int c);</h3>" },
                      
      { "isdigit",    "<h2>&lt;ctype.h&gt</h2><p><h3>"
                      "   int isdigit(int c);</h3>" },
                      
      { "isgraph",    "<h2>&lt;ctype.h&gt</h2><p><h3>"
                      "   int isgraph(int c);</h3>" },
                      
      { "islower",    "<h2>&lt;ctype.h&gt</h2><p><h3>"
                      "   int islower(int c);</h3>" },
                      
      { "isprint",    "<h2>&lt;ctype.h&gt</h2><p><h3>"
                      "   int isprint(int c);</h3>" },
                      
      { "ispunct",    "<h2>&lt;ctype.h&gt</h2><p><h3>"
                      "   int ispunct(int c);</h3>" },
                      
      { "isspace",    "<h2>&lt;ctype.h&gt</h2><p><h3>"
                      "   int isspace(int c);</h3>" },
                      
      { "isupper",    "<h2>&lt;ctype.h&gt</h2><p><h3>"
                      "   int isupper(int c);</h3>" },
                      
      { "isxdigit",   "<h2>&lt;ctype.h&gt</h2><p><h3>"
                      "   int isxdigit(int c);</h3>" },
                      
      { "tolower",    "<h2>&lt;ctype.h&gt</h2><p><h3>"
                      "   int tolower(int c);</h3>" },
                      
      { "toupper",    "<h2>&lt;ctype.h&gt</h2><p><h3>"
                      "   int toupper(int c);</h3>" },
                      
      { "strcpy",     "<h2>&lt;string.h&gt</h2><p><h3>"
                      "  char *strcpy(char *s, const"
                      " char *t);</h3>" },
                      
      { "strncpy",    "<h2>&lt;string.h&gt</h2><p><h3>"
                      "  char * strncpy(char *s, const"
                      " char *t, size_t n);</h3>" },
                      
      { "strcat",     "<h2>&lt;string.h&gt</h2><p><h3>"
                      "  char *strcat(char *s, const"
                      " char *t);</h3>" },
                      
      { "strncat",    "<h2>&lt;string.h&gt</h2><p><h3>"
                      "  char *strncat(char *s, const"
                      " char *t, size_t n);</h3>" },
                      
      { "strcmp",     "<h2>&lt;string.h&gt</h2><p><h3>"
                      "  int strcmp(const char *s, const"
                      " char *t);</h3>" },
                      
      { "strncmp",    "<h2>&lt;string.h&gt</h2><p><h3>"
                      "  int strncmp(const char *s,"
                      " const char *t, size_t n);</h3>" },
                      
      { "strchr",     "<h2>&lt;string.h&gt</h2><p><h3>"
                      "  char *strchr(const char *s,"
                      " int c);</h3>" },
                      
      { "strrchr",    "<h2>&lt;string.h&gt</h2><p><h3>"
                      "  char *strrchr(const char *s, "
                      "int c);</h3>" },
                      
      { "strspn",     "<h2>&lt;string.h&gt</h2><p><h3>"
                      "  size_t strspn(const char *s,"
                      " const char *t);</h3>" },
                      
      { "strcspn",    "<h2>&lt;string.h&gt</h2><p><h3>"
                      "  size_t strcspn(const char *s,"
                      " const char *t);</h3>" },
                      
      { "strpbrk",    "<h2>&lt;string.h&gt</h2><p><h3>"
                      "  char *strpbrk(const char *s,"
                      " const char *t);</h3>" },
                      
      { "strstr",     "<h2>&lt;string.h&gt</h2><p><h3>"
                      "  char *strstr(const char *s,"
                      " const char *t);</h3>" },
                      
      { "strlen",     "<h2>&lt;string.h&gt</h2><p><h3>"
                      "  int strlen(const char *s);"
                      "</h3>" },
                      
      { "strerror",   "<h2>&lt;string.h&gt</h2><p><h3>"
                      "  char *strerror(size_t n);"
                      "</h3>" },
                      
      { "strtok",     "<h2>&lt;string.h&gt</h2><p><h3>"
                      "  char *strtok(char *s, const"
                      " char *t);</h3>" },
                      
      { "memcpy",     "<h2>&lt;string.h&gt</h2><p><h3>"
                      "  void *memcpy(void *s, const"
                      " void *t, size_t n);</h3>" },
                      
      { "memmove",    "<h2>&lt;string.h&gt</h2><p><h3>"
                      "  void *memmove(void *s, const"
                      " void *t, size_t n);</h3>" },
                      
      { "memcmp",     "<h2>&lt;string.h&gt</h2><p><h3>"
                      "  int memcmp(const void *s,"
                      " const void *t, size_t n);"
                      "</h3>" },
                      
      { "memchr",     "<h2>&lt;string.h&gt</h2><p><h3>"
                      "  void *memchr(const void *s,"
                      " int c, size_t n);</h3>" },
                      
      { "memset",     "<h2>&lt;string.h&gt</h2><p><h3>"
                      "  void *memset(void *s, int c,"
                      " size_t n);</h3>" },
                      
      { "sin",        "<h2>&lt;math.h&gt</h2><p>  <h3>"
                      "  double sin(double x);</h3>" },
                      
      { "cos",        "<h2>&lt;math.h&gt</h2><p>  <h3>"
                      "  double cos(double x);</h3>" },
                      
      { "tan",        "<h2>&lt;math.h&gt</h2><p>  <h3>"
                      "  double tan(double x);</h3>" },
                      
      { "asin",       "<h2>&lt;math.h&gt</h2><p>  <h3>"
                      "  double asin(double x);</h3>" },
                      
      { "acos",       "<h2>&lt;math.h&gt</h2><p>  <h3>"
                      "  double acos(double x);</h3>" },
                      
      { "atan",       "<h2>&lt;math.h&gt</h2><p>  <h3>"
                      "  double atan(double x);</h3>" },
                      
      { "atan2",      "<h2>&lt;math.h&gt</h2><p>  <h3>"
                      "  double atan2(double y, double"
                      " x);</h3>" },
                      
      { "sinh",       "<h2>&lt;math.h&gt</h2><p>  <h3>"
                      "  double sinh(double x);</h3>" },
                      
      { "cosh",       "<h2>&lt;math.h&gt</h2><p>  <h3>"
                      "  double cosh(double x);</h3>" },
                      
      { "tanh",       "<h2>&lt;math.h&gt</h2><p>  <h3>"
                      "  double tanh(double x);</h3>" },
                      
      { "exp",        "<h2>&lt;math.h&gt</h2><p>  <h3>"
                      "  double exp(double x);</h3>" },
                      
      { "log",        "<h2>&lt;math.h&gt</h2><p>  <h3>"
                      "  double log(double x);</h3>" },
                      
      { "log10",      "<h2>&lt;math.h&gt</h2><p>  <h3>"
                      "  double log10(double x);</h3>" },
                      
      { "pow",        "<h2>&lt;math.h&gt</h2><p>  <h3>"
                      "  double pow(double x, double y);"
                      "</h3>" },
                      
      { "sqrt",       "<h2>&lt;math.h&gt</h2><p>  <h3>"
                      "  double sqrt(double x);</h3>" },

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -