httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From p..@hyperreal.org
Subject cvs commit: apachen/src/os/win32 util_win32.c
Date Thu, 27 Nov 1997 14:32:41 GMT
pcs         97/11/27 06:32:40

  Modified:    src/os/win32 util_win32.c
  Log:
  Indent the recent changes to the Apache code style. No code changes.
  
  Revision  Changes    Path
  1.5       +132 -139  apachen/src/os/win32/util_win32.c
  
  Index: util_win32.c
  ===================================================================
  RCS file: /export/home/cvs/apachen/src/os/win32/util_win32.c,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- util_win32.c	1997/11/23 18:10:04	1.4
  +++ util_win32.c	1997/11/27 14:32:40	1.5
  @@ -5,7 +5,7 @@
   
   #include "httpd.h"
   
  -static void sub_canonical_filename(char *szCanon,const char *szFile)
  +static void sub_canonical_filename(char *szCanon, const char *szFile)
   {
       char buf[_MAX_PATH];
       int n;
  @@ -13,92 +13,85 @@
       WIN32_FIND_DATA d;
       HANDLE h;
   
  -    n=GetFullPathName(szFile,sizeof buf,buf,&szFilePart);
  +    n = GetFullPathName(szFile, sizeof buf, buf, &szFilePart);
       assert(n);
       assert(n < sizeof buf);
   
  -    if(!strchr(buf,'*') && !strchr(buf,'?'))
  -    {
  -	h=FindFirstFile(buf,&d);
  +    if (!strchr(buf, '*') && !strchr(buf, '?')) {
  +        h = FindFirstFile(buf, &d);
           if(h != INVALID_HANDLE_VALUE)
  -	    FindClose(h);
  +            FindClose(h);
  +    }
  +    else {
  +        h=INVALID_HANDLE_VALUE;
       }
  -    else
  -	h=INVALID_HANDLE_VALUE;
   
  -    if(szFilePart < buf+3)
  -    {
  -	strcpy(szCanon,buf);
  -	szCanon[2]='/';
  -	return;
  +    if (szFilePart < buf+3) {
  +        strcpy(szCanon, buf);
  +        szCanon[2] = '/';
  +        return;
       }
  -    if(szFilePart != buf+3)
  -    {
  -	char b2[_MAX_PATH];
  -	assert(szFilePart > buf+3);
  +    if (szFilePart != buf+3) {
  +        char b2[_MAX_PATH];
  +        assert(szFilePart > buf+3);
   
  -	szFilePart[-1]='\0';
  -	sub_canonical_filename(b2,buf);
  +        szFilePart[-1]='\0';
  +        sub_canonical_filename(b2, buf);
   
  -	strcpy(szCanon,b2);
  -	strcat(szCanon,"/");
  +        strcpy(szCanon, b2);
  +        strcat(szCanon, "/");
       }
  -    else
  -    {
  -	strcpy(szCanon,buf);
  -	szCanon[2]='/';
  -	szCanon[3]='\0';
  +    else {
  +        strcpy(szCanon, buf);
  +        szCanon[2] = '/';
  +        szCanon[3] = '\0';
       }
  -    if(h == INVALID_HANDLE_VALUE)
  -	strcat(szCanon,szFilePart);
  -    else
  -    {
  -	strlwr(d.cFileName);
  -	strcat(szCanon,d.cFileName);
  +    if (h == INVALID_HANDLE_VALUE)
  +        strcat(szCanon, szFilePart);
  +    else {
  +        strlwr(d.cFileName);
  +        strcat(szCanon, d.cFileName);
       }
   }
   
  -API_EXPORT(char *) os_canonical_filename(pool *pPool,const char *szFile)
  +API_EXPORT(char *) os_canonical_filename(pool *pPool, const char *szFile)
   {
       char buf[_MAX_PATH];
   
  -    sub_canonical_filename(buf,szFile);
  -    return pstrdup(pPool,buf);
  +    sub_canonical_filename(buf, szFile);
  +    return pstrdup(pPool, buf);
   }
   
  -/*
  -Win95 doesn't like trailing /s. NT and Unix don't mind. This works around
  -the problem
  -*/
  +/* Win95 doesn't like trailing /s. NT and Unix don't mind. This works 
  + * around the problem
  + */
   
   #undef stat
  -API_EXPORT(int) os_stat(const char *szPath,struct stat *pStat)
  +API_EXPORT(int) os_stat(const char *szPath, struct stat *pStat)
   {
       int n;
   
  -    n=strlen(szPath);
  -    if(szPath[n-1] == '\\' || szPath[n-1] == '/')
  -	{
  +    n = strlen(szPath);
  +    if(szPath[n-1] == '\\' || szPath[n-1] == '/') {
           char buf[_MAX_PATH];
  -
  +        
           ap_assert(n < _MAX_PATH);
  -	strcpy(buf,szPath);
  -	buf[n-1]='\0';
  -
  -        return stat(buf,pStat);
  -	}
  -    return stat(szPath,pStat);
  +        strcpy(buf, szPath);
  +        buf[n-1] = '\0';
  +        
  +        return stat(buf, pStat);
  +    }
  +    return stat(szPath, pStat);
   }
   
  -/*
  -Fix two really crap problems with Win32 spawn[lv]e*:
  -
  -  1. Win32 doesn't deal with spaces in argv.
  -  2. Win95 doesn't like / in cmdname.
  -*/
  +/* Fix two really crap problems with Win32 spawn[lv]e*:
  + *
  + *  1. Win32 doesn't deal with spaces in argv.
  + *  2. Win95 doesn't like / in cmdname.
  + */
   
   #undef _spawnv
  -API_EXPORT(int) os_spawnv(int mode,const char *cmdname,const char *const *argv)
  +API_EXPORT(int) os_spawnv(int mode, const char *cmdname, const char *const *argv)
   {
       int n;
       char **aszArgs;
  @@ -106,38 +99,38 @@
       char *szCmd;
       char *s;
       
  -    szCmd=_alloca(strlen(cmdname)+1);
  -    strcpy(szCmd,cmdname);
  -    for(s=szCmd ; *s ; ++s)
  -	if(*s == '/')
  -	    *s='\\';
  -    
  -    for(n=0 ; argv[n] ; ++n)
  -	;
  -
  -    aszArgs=_alloca((n+1)*sizeof(const char *));
  -
  -    for(n=0 ; szArg=argv[n] ; ++n)
  -	if(strchr(szArg,' '))
  -	    {
  -	    int l=strlen(szArg);
  -
  -	    aszArgs[n]=_alloca(l+2+1);
  -	    aszArgs[n][0]='"';
  -	    strcpy(&aszArgs[n][1],szArg);
  -	    aszArgs[n][l+1]='"';
  -	    aszArgs[n][l+2]='\0';
  -	    }
  -	else
  -	    aszArgs[n]=(char *)szArg;
  +    szCmd = _alloca(strlen(cmdname)+1);
  +    strcpy(szCmd, cmdname);
  +    for (s = szCmd; *s; ++s)
  +        if (*s == '/')
  +            *s = '\\';
  +    
  +    for (n=0; argv[n]; ++n)
  +        ;
   
  -    aszArgs[n]=NULL;
  +    aszArgs = _alloca((n+1)*sizeof(const char *));
   
  -    return _spawnv(mode,szCmd,aszArgs);
  -    }
  +    for (n = 0; szArg = argv[n]; ++n)
  +        if (strchr(szArg, ' ')) {
  +            int l = strlen(szArg);
  +
  +            aszArgs[n] = _alloca(l+2+1);
  +            aszArgs[n][0] = '"';
  +            strcpy(&aszArgs[n][1], szArg);
  +            aszArgs[n][l+1] = '"';
  +            aszArgs[n][l+2] = '\0';
  +        }
  +        else {
  +            aszArgs[n] = (char *)szArg;
  +        }
  +
  +    aszArgs[n] = NULL;
  +
  +    return _spawnv(mode, szCmd, aszArgs);
  +}
   
   #undef _spawnve
  -API_EXPORT(int) os_spawnve(int mode,const char *cmdname,const char *const *argv,const char
*const *envp)
  +API_EXPORT(int) os_spawnve(int mode, const char *cmdname, const char *const *argv, const
char *const *envp)
   {
       int n;
       char **aszArgs;
  @@ -145,37 +138,37 @@
       char *szCmd;
       char *s;
       
  -    szCmd=_alloca(strlen(cmdname)+1);
  -    strcpy(szCmd,cmdname);
  -    for(s=szCmd ; *s ; ++s)
  -	if(*s == '/')
  -	    *s='\\';
  +    szCmd = _alloca(strlen(cmdname)+1);
  +    strcpy(szCmd, cmdname);
  +    for (s = szCmd; *s; ++s)
  +        if (*s == '/')
  +            *s = '\\';
       
  -    for(n=0 ; argv[n] ; ++n)
  -	;
  -
  -    aszArgs=_alloca((n+1)*sizeof(const char *));
  +    for (n = 0; argv[n] ; ++n)
  +        ;
   
  -    for(n=0 ; szArg=argv[n] ; ++n)
  -	if(strchr(szArg,' '))
  -	    {
  -	    int l=strlen(szArg);
  +    aszArgs = _alloca((n+1)*sizeof(const char *));
   
  -	    aszArgs[n]=_alloca(l+2+1);
  -	    aszArgs[n][0]='"';
  -	    strcpy(&aszArgs[n][1],szArg);
  -	    aszArgs[n][l+1]='"';
  -	    aszArgs[n][l+2]='\0';
  -	    }
  -	else
  -	    aszArgs[n]=(char *)szArg;
  +    for (n = 0; szArg=argv[n]; ++n)
  +        if (strchr(szArg, ' ')) {
  +            int l = strlen(szArg);
  +
  +            aszArgs[n] = _alloca(l+2+1);
  +            aszArgs[n][0] = '"';
  +            strcpy(&aszArgs[n][1], szArg);
  +            aszArgs[n][l+1] = '"';
  +            aszArgs[n][l+2] = '\0';
  +        }
  +        else {
  +            aszArgs[n]=(char *)szArg;
  +        }
   
  -    aszArgs[n]=NULL;
  +    aszArgs[n] = NULL;
   
  -    return _spawnve(mode,szCmd,aszArgs,envp);
  -    }
  +    return _spawnve(mode, szCmd, aszArgs, envp);
  +}
   
  -API_EXPORT(int) os_spawnle(int mode,const char *cmdname,...)
  +API_EXPORT(int) os_spawnle(int mode, const char *cmdname,...)
   {
       int n;
       va_list vlist;
  @@ -185,38 +178,38 @@
       char *szCmd;
       char *s;
       
  -    szCmd=_alloca(strlen(cmdname)+1);
  -    strcpy(szCmd,cmdname);
  -    for(s=szCmd ; *s ; ++s)
  -	if(*s == '/')
  -	    *s='\\';
  -
  -    va_start(vlist,cmdname);
  -    for(n=0 ; va_arg(vlist,const char *) ; ++n)
  -	;
  +    szCmd = _alloca(strlen(cmdname)+1);
  +    strcpy(szCmd, cmdname);
  +    for (s = szCmd; *s; ++s)
  +        if(*s == '/')
  +            *s = '\\';
  +
  +    va_start(vlist, cmdname);
  +    for (n = 0; va_arg(vlist, const char *); ++n)
  +        ;
       va_end(vlist);
   
  -    aszArgs=_alloca((n+1)*sizeof(const char *));
  +    aszArgs = _alloca((n+1)*sizeof(const char *));
   
  -    va_start(vlist,cmdname);
  -    for(n=0 ; szArg=va_arg(vlist,const char *) ; ++n)
  -	if(strchr(szArg,' '))
  -	    {
  -	    int l=strlen(szArg);
  -
  -	    aszArgs[n]=_alloca(l+2+1);
  -	    aszArgs[n][0]='"';
  -	    strcpy(&aszArgs[n][1],szArg);
  -	    aszArgs[n][l+1]='"';
  -	    aszArgs[n][l+2]='\0';
  -	    }
  -	else
  -	    aszArgs[n]=(char *)szArg;
  +    va_start(vlist, cmdname);
  +    for (n = 0 ; szArg = va_arg(vlist, const char *) ; ++n)
  +        if (strchr(szArg,' ')) {
  +            int l = strlen(szArg);
  +
  +            aszArgs[n] = _alloca(l+2+1);
  +            aszArgs[n][0] = '"';
  +            strcpy(&aszArgs[n][1],szArg);
  +            aszArgs[n][l+1] = '"';
  +            aszArgs[n][l+2] = '\0';
  +        }
  +        else {
  +            aszArgs[n]=(char *)szArg;
  +        }
   
  -    aszArgs[n]=NULL;
  +    aszArgs[n] = NULL;
   
  -    aszEnv=va_arg(vlist,const char *const *);
  +    aszEnv = va_arg(vlist, const char *const *);
       va_end(vlist);
  -
  -    return _spawnve(mode,szCmd,aszArgs,aszEnv);
  -    }
  +    
  +    return _spawnve(mode, szCmd, aszArgs, aszEnv);
  +}
  
  
  

Mime
View raw message