Changeset 8639

Show
Ignore:
Timestamp:
11/29/10 17:26:00 (2 years ago)
Author:
sampson
Message:

Testing command-line apps

Location:
branches/windows-client
Files:
2 added
2 modified

Legend:

Unmodified
Added
Removed
  • branches/windows-client/projects/OrangeFS/OrangeFS.sln

    r8635 r8639  
    115115EndProject 
    116116Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "proto", "proto\proto.vcxproj", "{2F406AB6-D010-4196-A523-FAE6F2B1585F}" 
     117EndProject 
     118Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pvfs2-ls", "pvfs2-ls\pvfs2-ls.vcxproj", "{09F8C9E4-1E99-4EBB-88E6-2A2CA290D718}" 
    117119EndProject 
    118120Global 
     
    272274                {2F406AB6-D010-4196-A523-FAE6F2B1585F}.Release|x64.ActiveCfg = Release|x64 
    273275                {2F406AB6-D010-4196-A523-FAE6F2B1585F}.Release|x64.Build.0 = Release|x64 
     276                {09F8C9E4-1E99-4EBB-88E6-2A2CA290D718}.Debug|Win32.ActiveCfg = Debug|Win32 
     277                {09F8C9E4-1E99-4EBB-88E6-2A2CA290D718}.Debug|Win32.Build.0 = Debug|Win32 
     278                {09F8C9E4-1E99-4EBB-88E6-2A2CA290D718}.Debug|x64.ActiveCfg = Debug|Win32 
     279                {09F8C9E4-1E99-4EBB-88E6-2A2CA290D718}.Release|Win32.ActiveCfg = Release|Win32 
     280                {09F8C9E4-1E99-4EBB-88E6-2A2CA290D718}.Release|Win32.Build.0 = Release|Win32 
     281                {09F8C9E4-1E99-4EBB-88E6-2A2CA290D718}.Release|x64.ActiveCfg = Release|Win32 
    274282        EndGlobalSection 
    275283        GlobalSection(SolutionProperties) = preSolution 
  • branches/windows-client/src/apps/admin/pvfs2-ls.c

    r8638 r8639  
    2020#endif 
    2121#include <assert.h> 
     22#ifndef WIN32 
    2223#include <getopt.h> 
     24#endif 
    2325 
    2426#include "pvfs2.h" 
     
    224226    char *formatted_size = NULL; 
    225227    char *formatted_owner = NULL, *formatted_group = NULL, *formatted_time = NULL; 
     228#ifdef WIN32 
     229 
     230#else 
    226231    struct group *grp = NULL; 
    227232    struct passwd *pwd = NULL; 
     233#endif 
    228234    char *empty_str = ""; 
    229235    char *owner = empty_str, *group = empty_str; 
     
    321327        if (!opts->list_no_owner) 
    322328        { 
     329#ifdef WIN32 
     330            owner = scratch_owner; 
     331#else 
    323332            pwd = getpwuid((uid_t)attr->owner); 
    324333            owner = (pwd ? pwd->pw_name : scratch_owner); 
     334#endif 
    325335        } 
    326336 
    327337        if (!opts->list_no_group) 
    328338        { 
     339#ifdef WIN32 
     340            group = scratch_group; 
     341#else 
    329342            grp = getgrgid((gid_t)attr->group); 
    330343            group = (grp ? grp->gr_name : scratch_group); 
     344#endif 
     345 
    331346        } 
    332347    } 
     
    610625        for(i = 0; i < rdplus_response.pvfs_dirent_outcount; i++) 
    611626        { 
     627            PVFS_sys_attr *attr; 
     628 
    612629            cur_file = rdplus_response.dirent_array[i].d_name; 
    613630            cur_handle = rdplus_response.dirent_array[i].handle; 
     
    618635                    opts, entry_buffer); 
    619636 
    620             PVFS_sys_attr *attr = &rdplus_response.attr_array[i]; 
     637            attr = &rdplus_response.attr_array[i]; 
    621638            if(attr->objtype == PVFS_TYPE_DIRECTORY && opts->list_recursive) 
    622639            { 
     
    713730 * returns pointer to options structure on success, NULL on failure 
    714731 */ 
     732#ifdef WIN32 
    715733static struct options* parse_args(int argc, char* argv[]) 
    716734{ 
     
    718736    const char *cur_option = NULL; 
    719737    struct options* tmp_opts = NULL; 
     738 
     739    static char str_opts[14][16] = { 
     740        "help", 
     741        "human-readable", 
     742        "si", 
     743        "version", 
     744        "recursive", 
     745        "verbose", 
     746        "numeric-uid-gid", 
     747        "directory", 
     748        "no-group", 
     749        "almost-all", 
     750        "all", 
     751        "inode", 
     752        "size", 
     753        "all-times" 
     754    }; 
     755 
     756    tmp_opts = (struct options*)malloc(sizeof(struct options)); 
     757    if (!tmp_opts) 
     758    { 
     759        return(NULL); 
     760    } 
     761    memset(tmp_opts, 0, sizeof(struct options)); 
     762    /* RVndGoAaiglt */ 
     763    option_index = 1; 
     764    while ((option_index < argc) && (argv[option_index][0] == '-')) 
     765    { 
     766        cur_option = argv[option_index]; 
     767 
     768        if ((strcmp(cur_option, "-?") == 0) ||  
     769            (strcmp(cur_option, "--help") == 0)) 
     770        { 
     771            usage(argc, argv); 
     772            exit(0); 
     773        } 
     774        else if ((strcmp(cur_option, "--human-readable") == 0) || 
     775                 (strcmp(cur_option, "-h") == 0)) 
     776        { 
     777            tmp_opts->list_human_readable = 1; 
     778        } 
     779        else if (strcmp(cur_option, "--si") == 0) 
     780        { 
     781            tmp_opts->list_use_si_units = 1; 
     782            break; 
     783        } 
     784        else if (strcmp(cur_option, "--version") == 0) 
     785        { 
     786            printf("%s\n", PVFS2_VERSION); 
     787            exit(0); 
     788        } 
     789        else if ((strcmp(cur_option, "--recursive") == 0) || 
     790                 (strcmp(cur_option, "-R") == 0)) 
     791        { 
     792            tmp_opts->list_recursive = 1; 
     793        } 
     794        else if ((strcmp(cur_option, "--verbose") == 0) || 
     795                 (strcmp(cur_option, "-V") == 0)) 
     796        { 
     797            tmp_opts->list_verbose = 1; 
     798        } 
     799        else if ((strcmp(cur_option, "--numeric-uid-gid") == 0) || 
     800                 (strcmp(cur_option, "-n") == 0)) 
     801        { 
     802            tmp_opts->list_long = 1; 
     803            tmp_opts->list_numeric_uid_gid = 1; 
     804        } 
     805        else if ((strcmp(cur_option, "--directory") == 0) || 
     806                 (strcmp(cur_option, "-d") == 0)) 
     807        { 
     808            tmp_opts->list_directory = 1; 
     809        } 
     810        else if ((strcmp(cur_option, "--no-group") == 0) || 
     811                 (strcmp(cur_option, "-G") == 0)) 
     812        { 
     813            tmp_opts->list_long = 1; 
     814            tmp_opts->list_no_group = 1; 
     815        } 
     816        else if ((strcmp(cur_option, "--almost-all") == 0) || 
     817                 (strcmp(cur_option, "-A") == 0)) 
     818        { 
     819            tmp_opts->list_almost_all = 1; 
     820        } 
     821        else if ((strcmp(cur_option, "--all") == 0) || 
     822                 (strcmp(cur_option, "-a") == 0)) 
     823        { 
     824            tmp_opts->list_all = 1; 
     825        } 
     826        else if ((strcmp(cur_option, "--inode") == 0) || 
     827                 (strcmp(cur_option, "-i") == 0)) 
     828        { 
     829            tmp_opts->list_inode = 1; 
     830        } 
     831        else if ((strcmp(cur_option, "--all-times") == 0)) 
     832        { 
     833            tmp_opts->list_all_times = 1; 
     834        } 
     835        else if (strcmp(cur_option, "-l") == 0) 
     836        { 
     837            tmp_opts->list_long = 1; 
     838        } 
     839        else 
     840        { 
     841            usage(argc, argv); 
     842            exit(EXIT_FAILURE); 
     843        } 
     844         
     845        option_index++; 
     846    } 
     847 
     848    for(i = option_index; i < argc; i++) 
     849    { 
     850        if (tmp_opts->num_starts < MAX_NUM_PATHS) 
     851        { 
     852            tmp_opts->start[i-option_index] = argv[i]; 
     853            tmp_opts->num_starts++; 
     854        } 
     855        else 
     856        { 
     857            fprintf(stderr,"Ignoring path %s\n",argv[i]); 
     858        } 
     859    } 
     860 
     861    return tmp_opts; 
     862 
     863} 
     864#else 
     865static struct options* parse_args(int argc, char* argv[]) 
     866{ 
     867    int i = 0, ret = 0, option_index = 0; 
     868    const char *cur_option = NULL; 
     869    struct options* tmp_opts = NULL; 
     870 
    720871    static struct option long_opts[] = 
    721872    { 
     
    8841035    return tmp_opts; 
    8851036} 
     1037#endif 
    8861038 
    8871039static void usage(int argc, char** argv)