Skip to content

AFNI/NIfTI Server

Sections
Personal tools
You are here: Home » AFNI » Documentation

Doxygen Source Code Documentation


Main Page   Alphabetical List   Data Structures   File List   Data Fields   Globals   Search  

afni_vcheck.c

Go to the documentation of this file.
00001 /*****************************************************************************
00002    Major portions of this software are copyrighted by the Medical College
00003    of Wisconsin, 1994-2000, and are released under the Gnu General Public
00004    License, Version 2.  See the file README.Copyright for details.
00005 ******************************************************************************/
00006    
00007 #include "afni.h"
00008 
00009 #define VERSION_URL "http://afni.nimh.nih.gov/afni/AFNI.version"
00010 
00011 #define VERSION_FILE "/Volumes/afni/var/www/html/pub/dist/AFNI.version"
00012 
00013 /*------------------------------------------------------------------------
00014    Program to check (or write) the AFNI version information.
00015    -- RWCox, 10 January 2000
00016 --------------------------------------------------------------------------*/
00017 
00018 int main( int argc , char *argv[] )
00019 {
00020    int nbuf ;
00021    char *vbuf=NULL ,
00022          vv[128]="none" ;
00023 
00024    /*-- for my use only: write out the new version file --*/
00025 
00026    if( argc == 2 && strcmp(argv[1],"-write") == 0 ){
00027      FILE *fp = fopen(VERSION_FILE,"w") ;
00028      if( fp == NULL ){
00029        fprintf(stderr,"** Failed to open %s!\n",VERSION_FILE); EXIT(1);
00030      }
00031      fprintf( fp , "%s\n%s\n" , VERSION , "no date given" ) ;
00032      fclose(fp) ;
00033      fprintf(stderr,"Wrote out %s\n",VERSION_FILE) ;
00034      exit(0) ;
00035    }
00036 
00037    machdep() ;
00038 
00039    /*-- otherwise, any options means the user needs help --*/
00040 
00041    if( argc > 1 ){
00042      printf("Usage: afni_version\n"
00043             " Prints out the AFNI version with which it was compiled,\n"
00044             " and checks across the Web for the latest version available.\n"
00045             "N.B.: Doing the check across the Web will mean that your\n"
00046             "      computer's access to our server will be logged here.\n"
00047             "      If you don't want this, don't use this program!\n" ) ;
00048      exit(0) ;
00049    }
00050 
00051    /*-- internal information --*/
00052 
00053    printf("This program was compiled with the following settings:\n"
00054           "  Version ID   = %s\n" , VERSION ) ;
00055 
00056    fprintf(stderr,"++ now fetching %s",VERSION_URL) ;
00057 
00058    /*-- get information from the master computer --*/
00059 
00060    nbuf = read_URL( VERSION_URL , &vbuf ) ;  /* see thd_http.c */
00061    fprintf(stderr,"\n") ;
00062 
00063    if( nbuf <= 0 || vbuf == NULL || vbuf[0] == '\0' ){
00064      fprintf(stderr,"** Error in fetch!\n"); EXIT(1);
00065    }
00066 
00067    sscanf( vbuf , "%127s" , vv ) ;
00068 
00069    printf("Latest version listed at AFNI web site:\n"
00070           "  Version ID   = %s\n" , vv ) ;
00071 
00072    exit(0) ;
00073 }
 

Powered by Plone

This site conforms to the following standards: