test-msg.c
上传用户:seven77cht
上传日期:2007-01-04
资源大小:486k
文件大小:2k
源码类别:

浏览器

开发平台:

Unix_Linux

  1. /***************************************
  2.   $Header$
  3.   Messages parser test program
  4.   ******************/ /******************
  5.   Written by Andrew M. Bishop
  6.   This file Copyright 1998,2000 Andrew M. Bishop
  7.   It may be distributed under the GNU Public License, version 2, or
  8.   any higher version.  See section COPYING of the GNU Public license
  9.   for conditions under which this file may be redistributed.
  10.   ***************************************/
  11. #include <stdio.h>
  12. #include "wwwoffle.h"
  13. #include "misc.h"
  14. int main(int argc,char **argv)
  15. {
  16.  char *var[5],*val[5];
  17.  int i;
  18.  if(argc==1)
  19.    {fprintf(stderr,"usage: test-msg <Page> [<variable>=<value>] ...n");return(1);}
  20.  for(i=2;i<argc;i++)
  21.    {
  22.     char *p=argv[i];
  23.     var[i-2]=argv[i];
  24.     while(*p && *p!='=')
  25.        p++;
  26.     if(*p)
  27.       {
  28.        *p=0;
  29.        val[i-2]=++p;
  30.       }
  31.     else
  32.        val[i-2]=NULL;
  33.    }
  34.  switch(argc)
  35.    {
  36.    case 2:
  37.     HTMLMessageBody(1,argv[1],
  38.                     NULL);
  39.     break;
  40.    case 3:
  41.     HTMLMessageBody(1,argv[1],
  42.                     var[0],val[0],
  43.                     NULL);
  44.     break;
  45.    case 4:
  46.     HTMLMessageBody(1,argv[1],
  47.                     var[0],val[0],
  48.                     var[1],val[1],
  49.                     NULL);
  50.     break;
  51.    case 5:
  52.     HTMLMessageBody(1,argv[1],
  53.                     var[0],val[0],
  54.                     var[1],val[1],
  55.                     var[2],val[2],
  56.                     NULL);
  57.     break;
  58.    case 6:
  59.     HTMLMessageBody(1,argv[1],
  60.                     var[0],val[0],
  61.                     var[1],val[1],
  62.                     var[2],val[2],
  63.                     var[3],val[3],
  64.                     NULL);
  65.     break;
  66.    case 7:
  67.     HTMLMessageBody(1,argv[1],
  68.                     var[0],val[0],
  69.                     var[1],val[1],
  70.                     var[2],val[2],
  71.                     var[3],val[3],
  72.                     var[4],val[4],
  73.                     NULL);
  74.     break;
  75.    default:
  76.     fprintf(stderr,"Too many argumentsn");    
  77.     return(1);
  78.    }
  79.  return(0);
  80. }