Advertisement
lilezek

Untitled

Mar 31st, 2011
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.05 KB | None | 0 0
  1. /* Man program for handle man protocol */
  2.  
  3. #include <stdio.h>
  4. #include <stdlib.h>
  5. #include "protocol.h"
  6. #include "platform-specific.h"
  7.  
  8.  
  9. int main(int argc, char ** argv)
  10. {
  11.     int result = 0;
  12.     char protocol;
  13.     char url[256];
  14.     // Get next argument:
  15.     argv++;
  16.     argc--;
  17.     // Loop through all the arguments
  18.     for (; argc > 0; argc--,argv++)
  19.     {
  20.         protocol = getProtocolFromUrl(*argv);
  21.         if (protocol == MAN_PROTOCOL)
  22.         {
  23.             memset(url,NULL,sizeof(url));
  24.             // Push pointer to the url without protocol:
  25.             *argv = *argv+6;
  26.             sprintf(url,"\"http://www.google.com/search?hl=es&source=hp&q=manpage+%s&btnI=Voy+a+tener+suerte&meta=&aq=f&oq=\"",*argv);
  27.             result = execute(command,url);
  28.             if (result)
  29.                 return result;
  30.         }
  31.         /*if (protocol == MANOFFLINE_PROTOCOL)
  32.         {
  33.              // Push pointer to the url without protocol:
  34.             *argv = *argv+6;
  35.             sprintf(url,)
  36.         }*/
  37.     }
  38.     return result;
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement