gif.c
上传用户:shbosideng
上传日期:2013-05-04
资源大小:1555k
文件大小:1k
源码类别:

SNMP编程

开发平台:

C/C++

  1. /*
  2. Iulian Radu [v2.0@07.1999]
  3. */
  4. void fgif(char* buf,char* ext){
  5. char link[129],host[129],*hosti,url[257];
  6. if(!fh) return;
  7. sscanf(buf,"%s %s",link,host);
  8. if(strcmp(host,"#")){ //host!=# -> search for a host definition
  9.     hosti=findhost(host);
  10.     if(!hosti) return;
  11.     if(strcmp(link,"#")){
  12.         if(base[0]) sprintf(url,"http://%s/%s",base,hosti);
  13.         else strcpy(url,hosti);
  14.         fprintf(fh,"<A HREF="%s">",link);
  15.         fprintf(fh,"<IMG SRC="%s%s">",url,ext);}
  16.     else{
  17.         if(base[0]) sprintf(url,"http://%s/%s",base,hosti);
  18.         else strcpy(url,hosti);
  19.         fprintf(fh,"<A HREF="%s.html">",url);
  20.         fprintf(fh,"<IMG SRC="%s%s">",url,ext);}
  21.     }
  22. else{
  23.     if(strcmp(link,"#")){
  24.         if(base[0]) sprintf(url,"http://%s/%s",base,link);
  25.         else strcpy(url,link);
  26.         fprintf(fh,"<A HREF="%s.html">",url);
  27.         fprintf(fh,"<IMG SRC="%s%s">",url,ext);}
  28.     else{
  29. fprintf(stderr,"aERROR: 0 GIF%c # #n",toupper(ext[1]));
  30. return;}
  31.     }
  32. fprintf(fh,"</IMG></A>n");
  33. }
  34. void fgifd(char* buf){
  35. fgif(buf,"-day.gif");
  36. }
  37. void fgifw(char* buf){
  38. fgif(buf,"-week.gif");
  39. }
  40. void fgifm(char* buf){
  41. fgif(buf,"-month.gif");
  42. }
  43. void fgify(char* buf){
  44. fgif(buf,"-year.gif");
  45. }