Changeset 0a7278e in rtems


Ignore:
Timestamp:
Nov 29, 2009, 1:20:53 PM (9 years ago)
Author:
Ralf Corsepius <ralf.corsepius@…>
Branches:
4.10, 4.11, master
Children:
18daff9
Parents:
0893220
Message:

Whitespace removal.

Location:
cpukit
Files:
60 edited

Legend:

Unmodified
Added
Removed
  • cpukit/httpd/asp.c

    r0893220 r0a7278e  
    1212
    1313/*
    14  *      The ASP module processes ASP pages and executes embedded scripts. It 
    15  *      support an open scripting architecture with in-built support for 
     14 *      The ASP module processes ASP pages and executes embedded scripts. It
     15 *      support an open scripting architecture with in-built support for
    1616 *      Ejscript(TM).
    1717 */
     
    7070/*
    7171 *      Process ASP requests and expand all scripting commands. We read the
    72  *      entire ASP page into memory and then process. If you have really big 
     72 *      entire ASP page into memory and then process. If you have really big
    7373 *      documents, it is better to make them plain HTML files rather than ASPs.
    7474 */
     
    195195                                        if (websValid(wp)) {
    196196                                                if (result) {
    197                                                         websWrite(wp, T("<h2><b>ASP Error: %s</b></h2>\n"), 
     197                                                        websWrite(wp, T("<h2><b>ASP Error: %s</b></h2>\n"),
    198198                                                                result);
    199199                                                        websWrite(wp, T("<pre>%s</pre>"), nextp);
     
    244244 */
    245245
    246 int websAspDefine(char_t *name, 
     246int websAspDefine(char_t *name,
    247247        int (*fn)(int ejid, webs_t wp, int argc, char_t **argv))
    248248{
    249         return ejSetGlobalFunctionDirect(websAspFunctions, name, 
     249        return ejSetGlobalFunctionDirect(websAspFunctions, name,
    250250                (int (*)(int, void*, int, char_t**)) fn);
    251251}
     
    261261
    262262        a_assert(websValid(wp));
    263        
     263
    264264        for (i = 0; i < argc; ) {
    265265                a_assert(argv);
     
    306306 */
    307307
    308 static char_t *skipWhite(char_t *s) 
     308static char_t *skipWhite(char_t *s)
    309309{
    310310        a_assert(s);
  • cpukit/httpd/balloc.c

    r0893220 r0a7278e  
    1414 *      This module implements a very fast block allocation scheme suitable for
    1515 *      ROMed environments. It maintains block class queues for rapid allocation
    16  *      and minimal fragmentation. This module does not coalesce blocks. The 
    17  *      storage space may be populated statically or via the traditional malloc 
    18  *      mechanisms. Large blocks greater than the maximum class size may be 
    19  *      allocated from the O/S or run-time system via malloc. To permit the use 
     16 *      and minimal fragmentation. This module does not coalesce blocks. The
     17 *      storage space may be populated statically or via the traditional malloc
     18 *      mechanisms. Large blocks greater than the maximum class size may be
     19 *      allocated from the O/S or run-time system via malloc. To permit the use
    2020 *      of malloc, call bopen with flags set to B_USE_MALLOC (this is the default).
    21  *      It is recommended that bopen be called first thing in the application. 
    22  *      If it is not, it will be called with default values on the first call to 
     21 *      It is recommended that bopen be called first thing in the application.
     22 *      If it is not, it will be called with default values on the first call to
    2323 *      balloc(). Note that this code is not designed for multi-threading purposes
    2424 *      and it depends on newly declared variables being initialized to zero.
    25  */ 
     25 */
    2626
    2727/********************************* Includes ***********************************/
     
    8686
    8787/*
    88  *      ROUNDUP4(size) returns the next higher integer value of size that is 
     88 *      ROUNDUP4(size) returns the next higher integer value of size that is
    8989 *      divisible by 4, or the value of size if size is divisible by 4.
    9090 *      ROUNDUP4() is used in aligning memory allocations on 4-byte boundaries.
     
    132132/*
    133133 *      Initialize the balloc module. bopen should be called the very first thing
    134  *      after the application starts and bclose should be called the last thing 
    135  *      before exiting. If bopen is not called, it will be called on the first 
    136  *      allocation with default values. "buf" points to memory to use of size 
    137  *      "bufsize". If buf is NULL, memory is allocated using malloc. flags may 
     134 *      after the application starts and bclose should be called the last thing
     135 *      before exiting. If bopen is not called, it will be called on the first
     136 *      allocation with default values. "buf" points to memory to use of size
     137 *      "bufsize". If buf is NULL, memory is allocated using malloc. flags may
    138138 *      be set to B_USE_MALLOC if using malloc is okay. This routine will allocate
    139139 *      an initial buffer of size bufsize for use by the application.
     
    206206/******************************************************************************/
    207207/*
    208  *      Allocate a block of the requested size. First check the block 
     208 *      Allocate a block of the requested size. First check the block
    209209 *      queues for a suitable one.
    210210 */
     
    290290                if (bFreeLeft > memSize) {
    291291/*
    292  *                      The q was empty, and the free list has spare memory so 
     292 *                      The q was empty, and the free list has spare memory so
    293293 *                      create a new block out of the primary free block
    294294 */
     
    391391                return;
    392392        }
    393                
     393
    394394#ifdef B_VERIFY_CAUSES_SEVERE_OVERHEAD
    395395        bFillBlock(bp, memSize);
     
    443443 *      Duplicate an ascii string, allow NULL pointers and then dup an empty string.
    444444 *      If UNICODE, bstrdup above works with wide chars, so we need this routine
    445  *      for ascii strings. 
     445 *      for ascii strings.
    446446 */
    447447
     
    464464/*
    465465 *      Reallocate a block. Allow NULL pointers and just do a malloc.
    466  *      Note: if the realloc fails, we return NULL and the previous buffer is 
     466 *      Note: if the realloc fails, we return NULL and the previous buffer is
    467467 *      preserved.
    468468 */
     
    495495/******************************************************************************/
    496496/*
    497  *      Find the size of the block to be balloc'ed.  It takes in a size, finds the 
     497 *      Find the size of the block to be balloc'ed.  It takes in a size, finds the
    498498 *      smallest binary block it fits into, adds an overhead amount and returns.
    499499 *      q is the binary size used to keep track of block sizes in use.  Called
     
    527527#ifdef B_STATS
    528528/*
    529  *      Statistics. Do output via calling the writefn callback function with 
    530  *      "handle" as the output file handle. 
     529 *      Statistics. Do output via calling the writefn callback function with
     530 *      "handle" as the output file handle.
    531531 */
    532532
     
    569569                mem = count * (1 << (q + B_SHIFT));
    570570                total += mem;
    571                 (*writefn)(handle, 
     571                (*writefn)(handle,
    572572                        T("%2d %5d   %4d %6d  %4d %5d   %4d\n"),
    573                         q, 1 << (q + B_SHIFT), count, mem, bStats[q].inuse, 
     573                        q, 1 << (q + B_SHIFT), count, mem, bStats[q].inuse,
    574574                        bStats[q].inuse * (1 << (q + B_SHIFT)), bStats[q].alloc);
    575575        }
     
    582582 *      bFreeSize                       Initial memory reserved with bopen call
    583583 *      bStatsMemMalloc         memory from calls to system MALLOC
    584  *      bStatsMemMax           
     584 *      bStatsMemMax
    585585 *      bStatsBallocMax         largest amount of memory from balloc calls
    586586 *      bStatsMemInUse
     
    600600        (*writefn)(handle, T("Memory currently balloced %7d\n"), bStatsBallocInUse);
    601601        (*writefn)(handle, T("Max blocks allocated      %7d\n"), bStatsBlksMax);
    602         (*writefn)(handle, T("Maximum stack used        %7d\n"), 
     602        (*writefn)(handle, T("Maximum stack used        %7d\n"),
    603603                (int) bStackStart - (int) bStackMin);
    604604
     
    619619        memcpy(files, bStatsFiles, len);
    620620        qsort(files, bStatsFilesMax, sizeof(bStatsFileType), bStatsFileSort);
    621        
     621
    622622        (*writefn)(handle, T("\nMemory Currently Allocated\n"));
    623623        total = 0;
    624         (*writefn)(handle, 
     624        (*writefn)(handle,
    625625                T("                      bytes, blocks in use, total times,")
    626626                T("largest,   q\n"));
     
    629629                if (fp->file[0]) {
    630630                        (*writefn)(handle, T("%18s, %7d,         %5d,      %6d, %7d,%4d\n"),
    631                                 fp->file, fp->allocated, fp->count, fp->times, fp->largest, 
     631                                fp->file, fp->allocated, fp->count, fp->times, fp->largest,
    632632                                fp->q);
    633633                        total += fp->allocated;
     
    645645                        fp = blkp->who;
    646646                        if (gisalnum(*cp)) {
    647                                 (*writefn)(handle, T("%-50s allocated by %s\n"), cp, 
     647                                (*writefn)(handle, T("%-50s allocated by %s\n"), cp,
    648648                                        fp->file);
    649649                        }
     
    775775
    776776/*
    777  *      Update the per block stats. Try from the end first 
     777 *      Update the per block stats. Try from the end first
    778778 */
    779779        for (bp = &bStatsBlks[bStatsBlksMax - 1]; bp >= bStatsBlks; bp--) {
     
    833833/*
    834834 *      verifyUsedBlock verifies that a block which was previously allocated is
    835  *      still uncorrupted. 
     835 *      still uncorrupted.
    836836 */
    837837
     
    886886 *      First verify all the free blocks.
    887887 */
    888         for (q = 0; q < B_MAX_CLASS; q++) {     
     888        for (q = 0; q < B_MAX_CLASS; q++) {
    889889                for (bp = bQhead[q]; bp != NULL; bp = bp->u.next) {
    890890                        verifyFreeBlock(bp, q);
  • cpukit/httpd/cgi.c

    r0893220 r0a7278e  
    1212/*
    1313 *      This module implements the /cgi-bin handler. CGI processing differs from
    14  *      goforms processing in that each CGI request is executed as a separate 
     14 *      goforms processing in that each CGI request is executed as a separate
    1515 *      process, rather than within the webserver process. For each CGI request the
    1616 *      environment of the new process must be set to include all the CGI variables
     
    4646 *      Process a form request. Returns 1 always to indicate it handled the URL
    4747 */
    48 int websCgiHandler(webs_t wp, char_t *urlPrefix, char_t *webDir, int arg, 
     48int websCgiHandler(webs_t wp, char_t *urlPrefix, char_t *webDir, int arg,
    4949                char_t *url, char_t *path, char_t* query)
    5050{
     
    101101#endif /* ! VXWORKS */
    102102
    103          
     103
    104104/*
    105105 *      Get the CWD for resetting after launching the child process CGI
     
    117117 *      Build command line arguments.  Only used if there is no non-encoded
    118118 *      = character.  This is indicative of a ISINDEX query.  POST separators
    119  *      are & and others are +.  argp will point to a balloc'd array of 
     119 *      are & and others are +.  argp will point to a balloc'd array of
    120120 *      pointers.  Each pointer will point to substring within the
    121  *      query string.  This array of string pointers is how the spawn or 
    122  *      exec routines expect command line arguments to be passed.  Since 
     121 *      query string.  This array of string pointers is how the spawn or
     122 *      exec routines expect command line arguments to be passed.  Since
    123123 *      we don't know ahead of time how many individual items there are in
    124  *      the query string, the for loop includes logic to grow the array 
     124 *      the query string, the for loop includes logic to grow the array
    125125 *      size via brealloc.
    126126 */
     
    144144/*
    145145 *      Add all CGI variables to the environment strings to be passed
    146  *      to the spawned CGI process.  This includes a few we don't 
     146 *      to the spawned CGI process.  This includes a few we don't
    147147 *      already have in the symbol table, plus all those that are in
    148  *      the cgiVars symbol table.  envp will point to a balloc'd array of 
     148 *      the cgiVars symbol table.  envp will point to a balloc'd array of
    149149 *      pointers.  Each pointer will point to a balloc'd string containing
    150150 *      the keyword value pair in the form keyword=value.  Since we don't
     
    184184        if (wp->cgiStdin == NULL) {
    185185                wp->cgiStdin = websGetCgiCommName();
    186         } 
     186        }
    187187        stdIn = wp->cgiStdin;
    188188        stdOut = websGetCgiCommName();
     
    191191 *      If successful, the cleanup will be done after the process completes.
    192192 */
    193         if ((pHandle = websLaunchCgiProc(cgiPath, argp, envp, stdIn, stdOut)) 
     193        if ((pHandle = websLaunchCgiProc(cgiPath, argp, envp, stdIn, stdOut))
    194194                == -1) {
    195195                websError(wp, 200, T("failed to spawn CGI task"));
     
    235235        gstat_t sbuf;
    236236        char_t  cgiBuf[FNAMESIZE];
    237         if ((gstat(cgip->stdOut, &sbuf) == 0) && 
     237        if ((gstat(cgip->stdOut, &sbuf) == 0) &&
    238238                (sbuf.st_size > cgip->fplacemark)) {
    239239                int fdout;
     
    284284 */
    285285                                nTries = 0;
    286 /*                             
     286/*
    287287 *                              Make sure we didn't miss something during a task switch.
    288288 *                              Maximum wait is 100 times 10 msecs (1 second).
     
    290290                                while ((cgip->fplacemark == 0) && (nTries < 100)) {
    291291                                        websCgiGatherOutput(cgip);
    292 /*                                     
    293  *                                      There are some cases when we detect app exit 
    294  *                                      before the file is ready. 
     292/*
     293 *                                      There are some cases when we detect app exit
     294 *                                      before the file is ready.
    295295 */
    296296                                        if (cgip->fplacemark == 0) {
  • cpukit/httpd/default.c

    r0893220 r0a7278e  
    3636 *      Process a default URL request. This will validate the URL and handle "../"
    3737 *      and will provide support for Active Server Pages. As the handler is the
    38  *      last handler to run, it always indicates that it has handled the URL 
    39  *      by returning 1. 
     38 *      last handler to run, it always indicates that it has handled the URL
     39 *      by returning 1.
    4040 */
    4141
     
    8585 *      Open the document. Stat for later use.
    8686 */
    87         if (websPageOpen(wp, lpath, path, SOCKET_RDONLY | SOCKET_BINARY, 
     87        if (websPageOpen(wp, lpath, path, SOCKET_RDONLY | SOCKET_BINARY,
    8888                0666) < 0) {
    8989                websError(wp, 400, T("Cannot open URL <b>%s</b>"), url);
    9090                return 1;
    91         } 
     91        }
    9292
    9393        if (websPageStat(wp, lpath, path, &sbuf) < 0) {
     
    235235    *
    236236    *  GoAhead is vulnerable to a directory traversal bug. A request such as
    237     * 
     237    *
    238238    *  GoAhead-server/../../../../../../../ results in an error message
    239239    *  'Cannot open URL'.
     
    243243    *  web root and read arbitrary files from the server.
    244244    *  Hence a request like:
    245     * 
     245    *
    246246    *  GoAhead-server/..%5C..%5C..%5C..%5C..%5C..%5C/winnt/win.ini returns the
    247247    *  contents of the win.ini file.
     
    258258      token = gstrchr(token, '\\');
    259259   }
    260    
     260
    261261        token = gstrtok(path, T("/"));
    262262
    263263/*
    264264 *      Look at each directory segment and process "." and ".." segments
    265  *      Don't allow the browser to pop outside the root web. 
     265 *      Don't allow the browser to pop outside the root web.
    266266 */
    267267        while (token != NULL) {
     
    364364
    365365/******************************************************************************/
    366 /* 
     366/*
    367367 *      Closing down. Free resources.
    368368 */
  • cpukit/httpd/ej.h

    r0893220 r0a7278e  
    1 /* 
     1/*
    22 *      ej.h -- Ejscript(TM) header
    33 *
     
    1414/******************************** Description *********************************/
    1515
    16 /* 
     16/*
    1717 *      GoAhead Ejscript(TM) header. This defines the Ejscript API and internal
    1818 *      structures.
     
    3636extern int              ejOpenEngine(sym_fd_t variables, sym_fd_t functions);
    3737extern void             ejCloseEngine(int eid);
    38 extern int              ejSetGlobalFunction(int eid, char_t *name, 
     38extern int              ejSetGlobalFunction(int eid, char_t *name,
    3939                                        int (*fn)(int eid, void *handle, int argc, char_t **argv));
    4040extern void             ejSetVar(int eid, char_t *var, char_t *value);
  • cpukit/httpd/ejIntrn.h

    r0893220 r0a7278e  
    1 /* 
     1/*
    22 *      ejIntrn.h -- Ejscript(TM) header
    33 *
     
    1414/******************************** Description *********************************/
    1515
    16 /* 
     16/*
    1717 *      GoAhead Ejscript(TM) header. This defines the Ejscript API and internal
    1818 *      structures.
     
    194194extern int              ejRemoveGlobalFunction(int eid, char_t *name);
    195195extern void             *ejGetGlobalFunction(int eid, char_t *name);
    196 extern int              ejSetGlobalFunctionDirect(sym_fd_t functions, char_t *name, 
     196extern int              ejSetGlobalFunctionDirect(sym_fd_t functions, char_t *name,
    197197                                        int (*fn)(int eid, void *handle, int argc, char_t **argv));
    198198extern void     ejError(ej_t* ep, char_t* fmt, ...);
  • cpukit/httpd/ejlex.c

    r0893220 r0a7278e  
    1212
    1313/*
    14  *      Ejscript lexical analyser. This implementes a lexical analyser for a 
     14 *      Ejscript lexical analyser. This implementes a lexical analyser for a
    1515 *      a subset of the JavaScript language.
    1616 */
     
    509509                        return TOK_LITERAL;
    510510
    511                 case '0': case '1': case '2': case '3': case '4': 
     511                case '0': case '1': case '2': case '3': case '4':
    512512                case '5': case '6': case '7': case '8': case '9':
    513513                        do {
     
    541541                                }
    542542                        }
    543                         if (! gisalpha(*tokq->servp) && *tokq->servp != '$' && 
     543                        if (! gisalpha(*tokq->servp) && *tokq->servp != '$' &&
    544544                                        *tokq->servp != '_') {
    545545                                ejError(ep, T("Invalid identifier %s"), tokq->servp);
     
    567567                        }
    568568
    569 /* 
     569/*
    570570 *                      Skip white space after token to find out whether this is
    571571 *                      a function or not.
    572  */ 
     572 */
    573573                        while (c == ' ' || c == '\t' || c == '\r' || c == '\n') {
    574574                                if ((c = inputGetc(ep)) < 0)
     
    683683/******************************************************************************/
    684684/*
    685  *      Convert a hex or octal character back to binary, return original char if 
     685 *      Convert a hex or octal character back to binary, return original char if
    686686 *      not a hex digit
    687687 */
  • cpukit/httpd/ejparse.c

    r0893220 r0a7278e  
    175175                return NULL;
    176176        }
    177        
     177
    178178        if (gstat(path, &sbuf) < 0) {
    179179                gclose(fd);
     
    181181                return NULL;
    182182        }
    183        
     183
    184184        if ((fileBuf = balloc(B_L, sbuf.st_size + 1)) == NULL) {
    185185                gclose(fd);
     
    187187                return NULL;
    188188        }
    189        
     189
    190190        if (gread(fd, fileBuf, sbuf.st_size) != (int)sbuf.st_size) {
    191191                gclose(fd);
     
    194194                return NULL;
    195195        }
    196        
     196
    197197        fileBuf[sbuf.st_size] = '\0';
    198198        gclose(fd);
     
    293293        void    *endlessLoopTest;
    294294        int             loopCounter;
    295        
    296        
     295
     296
    297297        a_assert(script);
    298298
    299299        if (emsg) {
    300300                *emsg = NULL;
    301         } 
     301        }
    302302
    303303        if ((ep = ejPtr(eid)) == NULL) {
  • cpukit/httpd/emfdb.c

    r0893220 r0a7278e  
    3030 */
    3131
    32 static char_t   *basicProdDir = NULL;           
     32static char_t   *basicProdDir = NULL;
    3333static char_t   *basicDefaultDir = T("."); /* Default set to current */
    3434
    3535/*
    36  * hAlloc chain list of table schemas to be closed 
     36 * hAlloc chain list of table schemas to be closed
    3737 */
    3838
     
    4747
    4848/******************************************************************************/
    49 /* 
    50  *      Add a schema to the module-internal schema database 
     49/*
     50 *      Add a schema to the module-internal schema database
    5151 */
    5252
     
    5858        a_assert(pTableRegister);
    5959
    60         trace(4, T("DB: Registering database table <%s>\n"), 
     60        trace(4, T("DB: Registering database table <%s>\n"),
    6161                pTableRegister->name);
    6262
     
    6464 *      Bump up the size of the table array
    6565 */
    66         tid = hAllocEntry((void*) &dbListTables, 
    67                 &dbMaxTables, sizeof(dbTable_t));       
     66        tid = hAllocEntry((void*) &dbListTables,
     67                &dbMaxTables, sizeof(dbTable_t));
    6868
    6969/*
     
    9393
    9494                for (i = 0; (i < pTableRegister->nColumns); i++) {
    95                         pTable->columnNames[i] = 
     95                        pTable->columnNames[i] =
    9696                                bstrdup(B_L, pTableRegister->columnNames[i]);
    9797                        pTable->columnTypes[i] = pTableRegister->columnTypes[i];
     
    118118 */
    119119
    120 int dbOpen(char_t *tablename, char_t *filename, 
     120int dbOpen(char_t *tablename, char_t *filename,
    121121                   int (*gettime)(int did), int flags)
    122122{
    123         basicProdDir = NULL;           
     123        basicProdDir = NULL;
    124124        basicDefaultDir = T(".");
    125125        dbMaxTables = 0;
     
    235235 */
    236236
    237 int dbSearchStr(int did, char_t *tablename, 
     237int dbSearchStr(int did, char_t *tablename,
    238238        char_t *colName, char_t *value, int flags)
    239239{
     
    253253                return DB_ERR_TABLE_NOT_FOUND;
    254254        }
    255        
     255
    256256        nColumns = pTable->nColumns;
    257257        nRows = pTable->nRows;
     
    270270                        pRow = pTable->rows[row];
    271271                        if (pRow) {
    272                                 compareVal = (char_t *)(pRow[column]); 
     272                                compareVal = (char_t *)(pRow[column]);
    273273                                if (compareVal && (gstrcmp(compareVal, value) == 0)) {
    274274                                        return row;
     
    281281 *              Return -2 if search column was not found
    282282 */
    283                 trace(3, T("DB: Unable to find column <%s> in table <%s>\n"), 
     283                trace(3, T("DB: Unable to find column <%s> in table <%s>\n"),
    284284                        colName, tablename);
    285285                return DB_ERR_COL_NOT_FOUND;
     
    317317                size = pTable->nColumns * max(sizeof(int), sizeof(char_t *));
    318318                return hAllocEntry((void***) &(pTable->rows), &(pTable->nRows), size);
    319         } 
     319        }
    320320
    321321        return -1;
     
    324324/******************************************************************************/
    325325/*
    326  *      Delete a row in the table. 
     326 *      Delete a row in the table.
    327327 */
    328328
     
    354354 */
    355355                        while (column < nColumns) {
    356                                 if (pRow[column] && 
     356                                if (pRow[column] &&
    357357                                        (pTable->columnTypes[column] == T_STRING)) {
    358358                                        bfree(B_L, (char_t *)pRow[column]);
     
    368368                        bfreeSafe(B_L, pRow);
    369369                        pTable->nRows = hFree((void ***)&pTable->rows, row);
    370                         trace(5, T("DB: Deleted row <%d> from table <%s>\n"), 
     370                        trace(5, T("DB: Deleted row <%d> from table <%s>\n"),
    371371                                row, tablename);
    372372                }
    373373                return 0;
    374374        } else {
    375                 trace(3, T("DB: Unable to delete row <%d> from table <%s>\n"), 
     375                trace(3, T("DB: Unable to delete row <%d> from table <%s>\n"),
    376376                        row, tablename);
    377377        }
    378        
     378
    379379        return -1;
    380380}
     
    382382/*****************************************************************************/
    383383/*
    384  *      Grow the rows in the table to the nominated size. 
     384 *      Grow the rows in the table to the nominated size.
    385385 */
    386386
     
    409409
    410410                if (nRows >= nNewRows) {
    411 /*             
     411/*
    412412 *              If number of rows already allocated exceeds requested number, do nothing
    413413 */
     
    415415                                nNewRows, tablename);
    416416                } else {
    417                         trace(4, T("DB: Setting rows to <%d> in table <%s>\n"), 
     417                        trace(4, T("DB: Setting rows to <%d> in table <%s>\n"),
    418418                                nNewRows, tablename);
    419419                        while (pTable->nRows < nNewRows) {
     
    423423                        }
    424424                }
    425         } 
     425        }
    426426
    427427        return nRet;
     
    436436{
    437437        int tid;
    438        
     438
    439439        a_assert(tablename);
    440440        tid = dbGetTableId(did, tablename);
     
    456456        int                     colIndex, *pRow, tid;
    457457        dbTable_t       *pTable;
    458        
     458
    459459        a_assert(table);
    460460        a_assert(column);
     
    490490                                *returnValue = pRow[colIndex];
    491491                                return 0;
    492                         } 
     492                        }
    493493                        return DB_ERR_ROW_DELETED;
    494494                }
     
    513513/*
    514514 *      The dbWriteInt function writes a value into a table at a given row and
    515  *      column.  The existence of the row and column is verified before the 
     515 *      column.  The existence of the row and column is verified before the
    516516 *      write.  0 is returned on succes, -1 is returned on error.
    517517 */
     
    536536
    537537        pTable = dbListTables[tid];
    538        
     538
    539539        if (pTable) {
    540540/*
     
    566566/******************************************************************************/
    567567/*
    568  *      The dbWriteStr function writes a string value into a table at a given row 
    569  *      and column.  The existence of the row and column is verified before the 
     568 *      The dbWriteStr function writes a string value into a table at a given row
     569 *      and column.  The existence of the row and column is verified before the
    570570 *      write.  The column is also checked to confirm it is a string field.
    571571 *      0 is returned on succes, -1 is returned on error.
     
    658658        a_assert(key && *key);
    659659        a_assert(value);
    660        
     660
    661661        fmtAlloc(&pLineOut, BUF_MAX, T("%s=%s\n"), key, value);
    662662
     
    697697 */
    698698        fmtAlloc(&tmpFile, FNAMESIZE, T("%s/data.tmp"), basicGetProductDir());
    699         if ((fd = gopen(tmpFile, 
     699        if ((fd = gopen(tmpFile,
    700700                O_CREAT | O_TRUNC | O_WRONLY | O_BINARY, 0666)) < 0) {
    701701                trace(1, T("WARNING: Failed to open file %s\n"), tmpFile);
     
    724724 *                              write it out.
    725725 */
    726                                 if ((pRow == NULL) || (pRow[0] == '\0') || 
     726                                if ((pRow == NULL) || (pRow[0] == '\0') ||
    727727                                        (*(char_t *)(pRow[0]) == '\0')) {
    728728                                        continue;
     
    731731 *                              Print the ROW=rowNumber directive to the file
    732732 */
    733                                 fmtAlloc(&tmpNum, 20, T("%d"), row);           
     733                                fmtAlloc(&tmpNum, 20, T("%d"), row);
    734734                                rc = dbWriteKeyValue(fd, KEYWORD_ROW, tmpNum);
    735735                                bfreeSafe(B_L, tmpNum);
     
    740740 *                              Print the key-value pairs (COLUMN=value) for data cells
    741741 */
    742                                 for (column = 0; (column < nColumns) && (rc >= 0); 
     742                                for (column = 0; (column < nColumns) && (rc >= 0);
    743743                                        column++, colNames++, colTypes++) {
    744744                                        if (*colTypes == T_STRING) {
    745                                                 rc = dbWriteKeyValue(fd, *colNames, 
     745                                                rc = dbWriteKeyValue(fd, *colNames,
    746746                                                        (char_t *)(pRow[column]));
    747747                                        } else {
    748                                                 fmtAlloc(&tmpNum, 20, T("%d"), pRow[column]);           
     748                                                fmtAlloc(&tmpNum, 20, T("%d"), pRow[column]);
    749749                                                rc = dbWriteKeyValue(fd, *colNames, tmpNum);
    750750                                                bfreeSafe(B_L, tmpNum);
     
    753753
    754754                                if (rc < 0) {
    755                                         trace(1, T("WARNING: Failed to write to file %s\n"), 
     755                                        trace(1, T("WARNING: Failed to write to file %s\n"),
    756756                                                tmpFile);
    757757                                        nRet = -1;
     
    813813/******************************************************************************/
    814814/*
    815  *      Parse the file. These files consist of key-value pairs, separated by the 
     815 *      Parse the file. These files consist of key-value pairs, separated by the
    816816 *  "=" sign. Parsing of tables starts with the "TABLE=value" pair, and rows
    817817 *      are parsed starting with the "ROW=value" pair.
     
    956956                }
    957957        }
    958        
     958
    959959        return -1;
    960960}
    961961
    962962/******************************************************************************/
    963 /*     
     963/*
    964964 *      Return a pointer to the table name, given its ID
    965965 */
     
    992992 */
    993993
    994 static int GetColumnIndex(int tid, char_t *colName) 
     994static int GetColumnIndex(int tid, char_t *colName)
    995995{
    996996        int                     column;
     
    10201020        int len;
    10211021
    1022         if (basicProdDir != NULL) {     
     1022        if (basicProdDir != NULL) {
    10231023      bfree(B_L, basicProdDir);
    10241024        }
    1025    
     1025
    10261026        basicProdDir = bstrdup(B_L, proddir);
    10271027/*
  • cpukit/httpd/form.c

    r0893220 r0a7278e  
    1414 *      This module implements the /goform handler. It emulates CGI processing
    1515 *      but performs this in-process and not as an external process. This enables
    16  *      a very high performance implementation with easy parsing and decoding 
     16 *      a very high performance implementation with easy parsing and decoding
    1717 *      of query strings and posted data.
    1818 */
     
    3131 */
    3232
    33 int websFormHandler(webs_t wp, char_t *urlPrefix, char_t *webDir, int arg, 
     33int websFormHandler(webs_t wp, char_t *urlPrefix, char_t *webDir, int arg,
    3434        char_t *url, char_t *path, char_t *query)
    3535{
     
    5959
    6060/*
    61  *      Lookup the C form function first and then try tcl (no javascript support 
     61 *      Lookup the C form function first and then try tcl (no javascript support
    6262 *      yet).
    6363 */
     
    9393 */
    9494
    95 int websFormDefine(char_t *name, void (*fn)(webs_t wp, char_t *path, 
     95int websFormDefine(char_t *name, void (*fn)(webs_t wp, char_t *path,
    9696        char_t *query))
    9797{
  • cpukit/httpd/handler.c

    r0893220 r0a7278e  
    2929
    3030static int              websUrlHandlerSort(const void *p1, const void *p2);
    31 static int              websPublishHandler(webs_t wp, char_t *urlPrefix, char_t *webDir, 
     31static int              websPublishHandler(webs_t wp, char_t *urlPrefix, char_t *webDir,
    3232                                int sid, char_t *url, char_t *path, char_t *query);
    3333static char_t   *websCondenseMultipleChars(char_t *strToCondense, char_t cCondense);
     
    7373/******************************************************************************/
    7474/*
    75  *      Define a new URL handler. urlPrefix is the URL prefix to match. webDir is 
     75 *      Define a new URL handler. urlPrefix is the URL prefix to match. webDir is
    7676 *      an optional root directory path for a web directory. arg is an optional
    7777 *      arg to pass to the URL handler. flags defines the matching order. Valid
    78  *      flags include WEBS_HANDLER_LAST, WEBS_HANDLER_FIRST. If multiple users 
    79  *      specify last or first, their order is defined alphabetically by the 
     78 *      flags include WEBS_HANDLER_LAST, WEBS_HANDLER_FIRST. If multiple users
     79 *      specify last or first, their order is defined alphabetically by the
    8080 *      urlPrefix.
    8181 */
    8282
    8383int websUrlHandlerDefine(char_t *urlPrefix, char_t *webDir, int arg,
    84                 int (*handler)(webs_t wp, char_t *urlPrefix, char_t *webdir, int arg, 
     84                int (*handler)(webs_t wp, char_t *urlPrefix, char_t *webdir, int arg,
    8585                char_t *url, char_t *path, char_t *query), int flags)
    8686{
     
    115115 *      Sort in decreasing URL length order observing the flags for first and last
    116116 */
    117         qsort(websUrlHandler, websUrlHandlerMax, sizeof(websUrlHandlerType), 
     117        qsort(websUrlHandler, websUrlHandlerMax, sizeof(websUrlHandlerType),
    118118                websUrlHandlerSort);
    119119        return 0;
     
    122122/******************************************************************************/
    123123/*
    124  *      Delete an existing URL handler. We don't reclaim the space of the old 
     124 *      Delete an existing URL handler. We don't reclaim the space of the old
    125125 *      handler, just NULL the entry. Return -1 if handler is not found.
    126126 */
    127127
    128 int websUrlHandlerDelete(int (*handler)(webs_t wp, char_t *urlPrefix, 
     128int websUrlHandlerDelete(int (*handler)(webs_t wp, char_t *urlPrefix,
    129129        char_t *webDir, int arg, char_t *url, char_t *path, char_t *query))
    130130{
     
    173173                }
    174174        }
    175         return -rc; 
     175        return -rc;
    176176}
    177177
     
    217217 */
    218218
    219 static int websPublishHandler(webs_t wp, char_t *urlPrefix, char_t *webDir, 
     219static int websPublishHandler(webs_t wp, char_t *urlPrefix, char_t *webDir,
    220220        int sid, char_t *url, char_t *path, char_t *query)
    221221{
     
    226226
    227227/*
    228  *      Trim the urlPrefix off the path and set the webdirectory. Add one to step 
     228 *      Trim the urlPrefix off the path and set the webdirectory. Add one to step
    229229 *      over the trailing '/'
    230230 */
     
    237237/*
    238238 *      See if any valid handlers are defined for this request. If so, call them
    239  *      and continue calling valid handlers until one accepts the request. 
     239 *      and continue calling valid handlers until one accepts the request.
    240240 *      Return true if a handler was invoked, else return FALSE.
    241241 */
     
    256256        wp->state = WEBS_PROCESSING;
    257257        websStats.handlerHits++;
    258        
     258
    259259        websSetRequestPath(wp, websGetDefaultDir(), NULL);
    260260
     
    266266
    267267/*
    268  *      We loop over each handler in order till one accepts the request. 
     268 *      We loop over each handler in order till one accepts the request.
    269269 *      The security handler will handle the request if access is NOT allowed.
    270270 */
     
    277277                                first = 0;
    278278                        }
    279                         if ((*sp->handler)(wp, sp->urlPrefix, sp->webDir, sp->arg, 
     279                        if ((*sp->handler)(wp, sp->urlPrefix, sp->webDir, sp->arg,
    280280                                        wp->url, wp->path, wp->query)) {
    281281                                return 1;
    282282                        }
    283283                        if (!websValid(wp)) {
    284                                 trace(0, 
     284                                trace(0,
    285285                                T("webs: handler %s called websDone, but didn't return 1\n"),
    286286                                        sp->urlPrefix);
     
    290290        }
    291291/*
    292  *      If no handler processed the request, then return an error. Note: It is 
     292 *      If no handler processed the request, then return an error. Note: It is
    293293 *      the handlers responsibility to call websDone
    294294 */
     
    327327/*
    328328 *      Look at each directory segment and process "." and ".." segments
    329  *      Don't allow the browser to pop outside the root web. 
     329 *      Don't allow the browser to pop outside the root web.
    330330 */
    331331        while (token != NULL) {
     
    394394                                *pStr = *pScan;
    395395                        }
    396                        
     396
    397397                        pScan++;
    398398                        pStr++;
  • cpukit/httpd/md5c.c

    r0893220 r0a7278e  
    33 * $Id$
    44 */
    5  
     5
    66/* Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All
    77rights reserved.
  • cpukit/httpd/misc.c

    r0893220 r0a7278e  
    106106
    107107#if (defined (WIN) || defined (NW))
    108         if ((cp = gstrrchr(name, '/')) == NULL && 
     108        if ((cp = gstrrchr(name, '/')) == NULL &&
    109109                (cp = gstrrchr(name, '\\')) == NULL)
    110110#else
     
    260260                        int prec = -1;
    261261                        for ( ; c != '\0'; c = *fmt++) {
    262                                 if (c == '-') { 
    263                                         f |= flag_minus; 
    264                                 } else if (c == '+') { 
    265                                         f |= flag_plus; 
    266                                 } else if (c == ' ') { 
    267                                         f |= flag_space; 
    268                                 } else if (c == '#') { 
    269                                         f |= flag_hash; 
    270                                 } else if (c == '0') { 
    271                                         f |= flag_zero; 
     262                                if (c == '-') {
     263                                        f |= flag_minus;
     264                                } else if (c == '+') {
     265                                        f |= flag_plus;
     266                                } else if (c == ' ') {
     267                                        f |= flag_space;
     268                                } else if (c == '#') {
     269                                        f |= flag_hash;
     270                                } else if (c == '0') {
     271                                        f |= flag_zero;
    272272                                } else {
    273273                                        break;
     
    342342                                        if (f & flag_hash && value != 0) {
    343343                                                if (c == 'x') {
    344                                                         put_ulong(&buf, value, 16, 0, T("0x"), width, 
     344                                                        put_ulong(&buf, value, 16, 0, T("0x"), width,
    345345                                                                prec, f);
    346346                                                } else {
    347                                                         put_ulong(&buf, value, 16, 1, T("0X"), width, 
     347                                                        put_ulong(&buf, value, 16, 1, T("0X"), width,
    348348                                                                prec, f);
    349349                                                }
     
    472472        int             i;
    473473
    474         if (len < 0) { 
    475                 len = strnlen(s, prec >= 0 ? prec : ULONG_MAX); 
    476         } else if (prec >= 0 && prec < len) { 
    477                 len = prec; 
     474        if (len < 0) {
     475                len = strnlen(s, prec >= 0 ? prec : ULONG_MAX);
     476        } else if (prec >= 0 && prec < len) {
     477                len = prec;
    478478        }
    479479        if (width > len && !(f & flag_minus)) {
    480                 for (i = len; i < width; ++i) { 
    481                         put_char(buf, ' '); 
    482                 }
    483         }
    484         for (i = 0; i < len; ++i) { 
    485                 put_char(buf, s[i]); 
     480                for (i = len; i < width; ++i) {
     481                        put_char(buf, ' ');
     482                }
     483        }
     484        for (i = 0; i < len; ++i) {
     485                put_char(buf, s[i]);
    486486        }
    487487        if (width > len && f & flag_minus) {
    488                 for (i = len; i < width; ++i) { 
    489                         put_char(buf, ' '); 
     488                for (i = len; i < width; ++i) {
     489                        put_char(buf, ' ');
    490490                }
    491491        }
     
    505505        for (len = 1, x = 1; x < ULONG_MAX / base; ++len, x = x2) {
    506506                x2 = x * base;
    507                 if (x2 > value) { 
    508                         break; 
     507                if (x2 > value) {
     508                        break;
    509509                }
    510510        }
    511511        zeros = (prec > len) ? prec - len : 0;
    512512        width -= zeros + len;
    513         if (prefix != NULL) { 
    514                 width -= strnlen(prefix, ULONG_MAX); 
     513        if (prefix != NULL) {
     514                width -= strnlen(prefix, ULONG_MAX);
    515515        }
    516516        if (!(f & flag_minus)) {
    517517                if (f & flag_zero) {
    518                         for (i = 0; i < width; ++i) { 
    519                                 put_char(buf, '0'); 
     518                        for (i = 0; i < width; ++i) {
     519                                put_char(buf, '0');
    520520                        }
    521521                } else {
    522                         for (i = 0; i < width; ++i) { 
    523                                 put_char(buf, ' '); 
     522                        for (i = 0; i < width; ++i) {
     523                                put_char(buf, ' ');
    524524                        }
    525525                }
    526526        }
    527         if (prefix != NULL) { 
    528                 put_string(buf, prefix, -1, 0, -1, flag_none); 
    529         }
    530         for (i = 0; i < zeros; ++i) { 
    531                 put_char(buf, '0'); 
     527        if (prefix != NULL) {
     528                put_string(buf, prefix, -1, 0, -1, flag_none);
     529        }
     530        for (i = 0; i < zeros; ++i) {
     531                put_char(buf, '0');
    532532        }
    533533        for ( ; x > 0; x /= base) {
     
    537537        }
    538538        if (f & flag_minus) {
    539                 for (i = 0; i < width; ++i) { 
    540                         put_char(buf, ' '); 
     539                for (i = 0; i < width; ++i) {
     540                        put_char(buf, ' ');
    541541                }
    542542        }
  • cpukit/httpd/ringq.c

    r0893220 r0a7278e  
    3737 *    |                           |                       |               |
    3838 *  rq->buf                    rq->servp               rq->endp      rq->enduf
    39  *     
     39 *
    4040 *      The queue is empty when servp == endp.  This means that the queue will hold
    4141 *      at most rq->buflen -1 bytes.  It is the filler's responsibility to ensure
     
    7878 *      ringq should it need to grow to accomodate data being added. "maxsize" is
    7979 *      an upper limit (sanity level) beyond which the q must not grow. Set maxsize
    80  *      to -1 to imply no upper limit. The buffer for the ringq is always 
     80 *      to -1 to imply no upper limit. The buffer for the ringq is always
    8181 *      dynamically allocated. Set maxsize
    8282 */
     
    124124/******************************************************************************/
    125125/*
    126  *      Return the length of the data in the ringq. Users must fill the queue to 
     126 *      Return the length of the data in the ringq. Users must fill the queue to
    127127 *      a high water mark of at most one less than the queue size.
    128128 */
     
    168168/******************************************************************************/
    169169/*
    170  *      Add a char to the queue. Note if being used to store wide strings 
     170 *      Add a char to the queue. Note if being used to store wide strings
    171171 *      this does not add a trailing '\0'. Grow the q as required.
    172172 */
     
    414414/******************************************************************************/
    415415/*
    416  *      Return the maximum number of bytes the ring q can accept via a single 
     416 *      Return the maximum number of bytes the ring q can accept via a single
    417417 *      block copy. Useful if the user is doing their own data insertion.
    418418 */
     
    424424        a_assert(rq);
    425425        a_assert(rq->buflen == (rq->endbuf - rq->buf));
    426        
     426
    427427        space = rq->buflen - RINGQ_LEN(rq) - 1;
    428428        in_a_line = rq->endbuf - rq->endp;
     
    433433/******************************************************************************/
    434434/*
    435  *      Return the maximum number of bytes the ring q can provide via a single 
     435 *      Return the maximum number of bytes the ring q can provide via a single
    436436 *      block copy. Useful if the user is doing their own data retrieval.
    437437 */
  • cpukit/httpd/security.c

    r0893220 r0a7278e  
    2525/********************************** Defines ***********************************/
    2626/*
    27  *      The following #defines change the behaviour of security in the absence 
     27 *      The following #defines change the behaviour of security in the absence
    2828 *      of User Management.
    2929 *      Note that use of User management functions require prior calling of
     
    5454 */
    5555
    56 int websSecurityHandler(webs_t wp, char_t *urlPrefix, char_t *webDir, int arg, 
     56int websSecurityHandler(webs_t wp, char_t *urlPrefix, char_t *webDir, int arg,
    5757                                                char_t *url, char_t *path, char_t *query)
    5858{
     
    7878                return 0;
    7979        }
    80                  
     80
    8181/*
    8282 *      Check to see if URL must be encrypted
     
    117117                        websStats.access++;
    118118                        websError(wp, 401, T("Access Denied\nUnknown User"));
    119                         trace(3, T("SEC: Unknown user <%s> attempted to access <%s>\n"), 
     119                        trace(3, T("SEC: Unknown user <%s> attempted to access <%s>\n"),
    120120                                userid, path);
    121121                        nRet = 1;
     
    154154                        a_assert(wp->nonce);
    155155                        a_assert(wp->password);
    156                                                          
     156
    157157                        digestCalc = websCalcDigest(wp);
    158158                        a_assert(digestCalc);
     
    176176#endif
    177177                        websStats.errors++;
    178                         websError(wp, 401, 
     178                        websError(wp, 401,
    179179                                T("Access to this document requires a password"));
    180180                        nRet = 1;
     
    212212/******************************************************************************/
    213213/*
    214  *      Store the new password, expect a decoded password. Store in websPassword in 
     214 *      Store the new password, expect a decoded password. Store in websPassword in
    215215 *      the decoded form.
    216216 */
  • cpukit/httpd/sock.c

    r0893220 r0a7278e  
    1010
    1111/*
    12  *      Posix Socket Module.  This supports blocking and non-blocking buffered 
     12 *      Posix Socket Module.  This supports blocking and non-blocking buffered
    1313 *      socket I/O.
    1414 */
     
    4242/*********************************** Code *************************************/
    4343/*
    44  *      Write to a socket. Absorb as much data as the socket can buffer. Block if 
    45  *      the socket is in blocking mode. Returns -1 on error, otherwise the number 
     44 *      Write to a socket. Absorb as much data as the socket can buffer. Block if
     45 *      the socket is in blocking mode. Returns -1 on error, otherwise the number
    4646 *      of bytes written.
    4747 */
     
    6161
    6262/*
    63  *      Loop adding as much data to the output ringq as we can absorb. Initiate a 
     63 *      Loop adding as much data to the output ringq as we can absorb. Initiate a
    6464 *      flush when the ringq is too full and continue. Block in socketFlush if the
    6565 *      socket is in blocking mode.
     
    105105        char    *byteBuf;
    106106        int             r, len;
    107  
     107
    108108        len = gstrlen(buf);
    109109        byteBuf = ballocUniToAsc(buf, len);
     
    120120 *      Read from a socket. Return the number of bytes read if successful. This
    121121 *      may be less than the requested "bufsize" and may be zero. Return -1 for
    122  *      errors. Return 0 for EOF. Otherwise return the number of bytes read. 
     122 *      errors. Return 0 for EOF. Otherwise return the number of bytes read.
    123123 *      If this routine returns zero it indicates an EOF condition.
    124124 *  which can be verified with socketEof()
    125  
     125
    126126 *      Note: this ignores the line buffer, so a previous socketGets
    127  *      which read a partial line may cause a subsequent socketRead to miss some 
     127 *      which read a partial line may cause a subsequent socketRead to miss some
    128128 *      data. This routine may block if the socket is in blocking mode.
    129129 *
     
    162162 *                      This flush is critical for readers of datagram packets. If the
    163163 *                      buffer is not big enough to read the whole datagram in one hit,
    164  *                      the recvfrom call will fail. 
     164 *                      the recvfrom call will fail.
    165165 */
    166166                        ringqFlush(rq);
     
    182182/*
    183183 *                              If bytesRead is 0, this is EOF since socketRead should never
    184  *                              be called unless there is data yet to be read.  Set the flag. 
     184 *                              be called unless there is data yet to be read.  Set the flag.
    185185 *                              Then pass back the number of bytes read.
    186186 */
     
    205205 *      Get a string from a socket. This returns data in *buf in a malloced string
    206206 *      after trimming the '\n'. If there is zero bytes returned, *buf will be set
    207  *      to NULL. If doing non-blocking I/O, it returns -1 for error, EOF or when 
     207 *      to NULL. If doing non-blocking I/O, it returns -1 for error, EOF or when
    208208 *      no complete line yet read. If doing blocking I/O, it will block until an
    209  *      entire line is read. If a partial line is read socketInputBuffered or 
    210  *      socketEof can be used to distinguish between EOF and partial line still 
     209 *      entire line is read. If a partial line is read socketInputBuffered or
     210 *      socketEof can be used to distinguish between EOF and partial line still
    211211 *      buffered. This routine eats and ignores carriage returns.
    212212 */
     
    232232                        return rc;
    233233                }
    234                
     234
    235235                if (rc == 0) {
    236236/*
     
    309309                                        }
    310310                                        continue;
    311                                 } 
     311                                }
    312312#endif
    313313/*
     
    318318                                if (sp->saveMask < 0 ) {
    319319                                        sp->saveMask = sp->handlerMask;
    320                                         socketRegisterInterest(sp, 
     320                                        socketRegisterInterest(sp,
    321321                                        sp->handlerMask | SOCKET_WRITABLE);
    322322                                }
     
    434434 */
    435435
    436 void socketCreateHandler(int sid, int handlerMask, socketHandler_t handler, 
     436void socketCreateHandler(int sid, int handlerMask, socketHandler_t handler,
    437437                int data)
    438438{
     
    536536 */
    537537#ifndef UEMF
    538 #ifdef WIN 
     538#ifdef WIN
    539539        if (sp->interestEvents & FD_WRITE) {
    540540                emfTime_t blockTime = { 0, 0 };
     
    548548/******************************************************************************/
    549549/*
    550  *              If the sendto failed, swap the first two bytes in the 
     550 *              If the sendto failed, swap the first two bytes in the
    551551 *              sockaddr structure.  This is a kludge due to a change in
    552  *              VxWorks between versions 5.3 and 5.4, but we want the 
     552 *              VxWorks between versions 5.3 and 5.4, but we want the
    553553 *              product to run on either.
    554554 */
     
    662662                if ((sp = socketList[i]) == NULL) {
    663663                        continue;
    664                 } 
     664                }
    665665                socketHighestFd = max(socketHighestFd, sp->sock);
    666666        }
  • cpukit/httpd/sockGen.c

    r0893220 r0a7278e  
    1111
    1212/*
    13  *      Posix Socket Module.  This supports blocking and non-blocking buffered 
     13 *      Posix Socket Module.  This supports blocking and non-blocking buffered
    1414 *      socket I/O.
    1515 */
     
    164164                        hostent = gethostbyname(host);
    165165                        if (hostent != NULL) {
    166                                 memcpy((char *) &sockaddr.sin_addr, 
     166                                memcpy((char *) &sockaddr.sin_addr,
    167167                                        (char *) hostent->h_addr_list[0],
    168168                                        (size_t) hostent->h_length);
     
    222222        if (host) {
    223223/*
    224  *              Connect to the remote server in blocking mode, then go into 
     224 *              Connect to the remote server in blocking mode, then go into
    225225 *              non-blocking mode if desired.
    226226 */
     
    251251                        }
    252252                        if ((rc = connect(sp->sock, (struct sockaddr *) &sockaddr,
    253                                 sizeof(sockaddr))) < 0 && 
     253                                sizeof(sockaddr))) < 0 &&
    254254                                (rc = tryAlternateConnect(sp->sock,
    255255                                (struct sockaddr *) &sockaddr)) < 0) {
     
    273273                rc = 1;
    274274                setsockopt(sp->sock, SOL_SOCKET, SO_REUSEADDR, (char *)&rc, sizeof(rc));
    275                 if (bind(sp->sock, (struct sockaddr *) &sockaddr, 
     275                if (bind(sp->sock, (struct sockaddr *) &sockaddr,
    276276                                sizeof(sockaddr)) < 0) {
    277277                        socketFree(sid);
     
    309309/******************************************************************************/
    310310/*
    311  *      If the connection failed, swap the first two bytes in the 
     311 *      If the connection failed, swap the first two bytes in the
    312312 *      sockaddr structure.  This is a kludge due to a change in
    313  *      VxWorks between versions 5.3 and 5.4, but we want the 
     313 *      VxWorks between versions 5.3 and 5.4, but we want the
    314314 *      product to run on either.
    315315 */
     
    452452                bytesRead = recv(sp->sock, buf, toRead, 0);
    453453        }
    454    
     454
    455455   /*
    456     * BUG 01865 -- CPU utilization hangs on Windows. The original code used 
     456    * BUG 01865 -- CPU utilization hangs on Windows. The original code used
    457457    * the 'errno' global variable, which is not set by the winsock functions
    458458    * as it is under *nix platforms. We use the platform independent
    459     * socketGetError() function instead, which does handle Windows correctly. 
     459    * socketGetError() function instead, which does handle Windows correctly.
    460460    * Other, *nix compatible platforms should work as well, since on those
    461461    * platforms, socketGetError() just returns the value of errno.
    462462    * Thanks to Jonathan Burgoyne for the fix.
    463463    */
    464    if (bytesRead < 0) 
     464   if (bytesRead < 0)
    465465   {
    466466      *errCode = socketGetError();
    467       if (*errCode == ECONNRESET) 
     467      if (*errCode == ECONNRESET)
    468468      {
    469469         sp->flags |= SOCKET_CONNRESET;
     
    600600                                continue;
    601601                        }
    602                 } 
     602                }
    603603                if (sp->flags & SOCKET_CONNRESET) {
    604604                        socketCloseConnection(sid);
     
    624624/******************************************************************************/
    625625/*
    626  *      Wait for a handle to become readable or writable and return a number of 
     626 *      Wait for a handle to become readable or writable and return a number of
    627627 *      noticed events. Timeout is in milliseconds.
    628628 */
     
    774774                index = sp->sock / (NBBY * sizeof(fd_mask));
    775775                bit = 1 << (sp->sock % (NBBY * sizeof(fd_mask)));
    776                
     776
    777777/*
    778778 *              Set the appropriate bit in the ready masks for the sp->sock.
     
    894894        sid = sp->sid;
    895895        if (sp->currentEvents & SOCKET_READABLE) {
    896                 if (sp->flags & SOCKET_LISTENING) { 
     896                if (sp->flags & SOCKET_LISTENING) {
    897897                        socketAccept(sp);
    898898                        sp->currentEvents = 0;
    899899                        return 1;
    900                 } 
     900                }
    901901
    902902        } else {
     
    930930 */
    931931        if (sp->handler && (sp->handlerMask & sp->currentEvents)) {
    932                 (sp->handler)(sid, sp->handlerMask & sp->currentEvents, 
     932                (sp->handler)(sid, sp->handlerMask & sp->currentEvents,
    933933                        sp->handler_data);
    934934/*
    935935 *              Make sure socket pointer is still valid, then reset the currentEvents.
    936  */ 
     936 */
    937937                if (socketList && sid < socketMax && socketList[sid] == sp) {
    938938                        sp->currentEvents = 0;
     
    10091009
    10101010        for (i = 0; i < socketMax; i++) {
    1011                 if ((sp = socketList[i]) == NULL || 
     1011                if ((sp = socketList[i]) == NULL ||
    10121012                                (sp->handlerMask & SOCKET_READABLE) == 0) {
    10131013                        continue;
  • cpukit/httpd/socket.c

    r0893220 r0a7278e  
    99
    1010/*
    11  *      Posix Socket Module.  This supports blocking and non-blocking buffered 
     11 *      Posix Socket Module.  This supports blocking and non-blocking buffered
    1212 *      socket I/O.
    1313 */
     
    163163                        hostent = gethostbyname(host);
    164164                        if (hostent != NULL) {
    165                                 memcpy((char *) &sockaddr.sin_addr, 
     165                                memcpy((char *) &sockaddr.sin_addr,
    166166                                        (char *) hostent->h_addr_list[0],
    167167                                        (size_t) hostent->h_length);
     
    221221        if (host) {
    222222/*
    223  *              Connect to the remote server in blocking mode, then go into 
     223 *              Connect to the remote server in blocking mode, then go into
    224224 *              non-blocking mode if desired.
    225225 */
     
    250250                        }
    251251                        if ((rc = connect(sp->sock, (struct sockaddr *) &sockaddr,
    252                                 sizeof(sockaddr))) < 0 && 
     252                                sizeof(sockaddr))) < 0 &&
    253253                                (rc = tryAlternateConnect(sp->sock,
    254254                                (struct sockaddr *) &sockaddr)) < 0) {
     
    272272                rc = 1;
    273273                setsockopt(sp->sock, SOL_SOCKET, SO_REUSEADDR, (char *)&rc, sizeof(rc));
    274                 if (bind(sp->sock, (struct sockaddr *) &sockaddr, 
     274                if (bind(sp->sock, (struct sockaddr *) &sockaddr,
    275275                                sizeof(sockaddr)) < 0) {
    276276                        socketFree(sid);
     
    307307/******************************************************************************/
    308308/*
    309  *      If the connection failed, swap the first two bytes in the 
     309 *      If the connection failed, swap the first two bytes in the
    310310 *      sockaddr structure.  This is a kludge due to a change in
    311  *      VxWorks between versions 5.3 and 5.4, but we want the 
     311 *      VxWorks between versions 5.3 and 5.4, but we want the
    312312 *      product to run on either.
    313313 */
     
    585585                                continue;
    586586                        }
    587                 } 
     587                }
    588588                if (sp->currentEvents & sp->handlerMask) {
    589589                        return 1;
     
    605605/******************************************************************************/
    606606/*
    607  *      Wait for a handle to become readable or writable and return a number of 
     607 *      Wait for a handle to become readable or writable and return a number of
    608608 *      noticed events. Timeout is in milliseconds.
    609609 */
     
    755755                index = sp->sock / (NBBY * sizeof(fd_mask));
    756756                bit = 1 << (sp->sock % (NBBY * sizeof(fd_mask)));
    757                
     757
    758758/*
    759759 *              Set the appropriate bit in the ready masks for the sp->sock.
     
    875875    sid = sp->sid;
    876876        if (sp->currentEvents & SOCKET_READABLE) {
    877                 if (sp->flags & SOCKET_LISTENING) { 
     877                if (sp->flags & SOCKET_LISTENING) {
    878878                        socketAccept(sp);
    879879                        sp->currentEvents = 0;
    880880                        return 1;
    881                 } 
     881                }
    882882
    883883        } else {
     
    911911 */
    912912        if (sp->handler && (sp->handlerMask & sp->currentEvents)) {
    913                 (sp->handler)(sid, sp->handlerMask & sp->currentEvents, 
     913                (sp->handler)(sid, sp->handlerMask & sp->currentEvents,
    914914                        sp->handler_data);
    915915/*
    916916 *              Make sure socket pointer is still valid, then reset the currentEvents.
    917  */ 
     917 */
    918918                if (socketList && sid < socketMax && socketList[sid] == sp) {
    919919                        sp->currentEvents = 0;
     
    990990
    991991        for (i = 0; i < socketMax; i++) {
    992                 if ((sp = socketList[i]) == NULL || 
     992                if ((sp = socketList[i]) == NULL ||
    993993                                (sp->handlerMask & SOCKET_READABLE) == 0) {
    994994                        continue;
  • cpukit/httpd/uemf.c

    r0893220 r0a7278e  
    5151/*#ifdef DEV*/
    5252        } else if (etype == E_ASSERT) {
    53                 fmtAlloc(&buf, E_MAX_ERROR, 
    54                         T("Assertion %s, failed at %s %d\n"), fmtBuf, E_ARGS); 
     53                fmtAlloc(&buf, E_MAX_ERROR,
     54                        T("Assertion %s, failed at %s %d\n"), fmtBuf, E_ARGS);
    5555/*#endif*/
    5656        } else if (etype == E_USER) {
     
    6161    * bfreeSafe(B_L, buf) below will fail, because 'buf' is randomly
    6262    * initialized. To be nice, we format a message saying that this is an
    63     * unknown message type, and in doing so give buf a valid value. Thanks 
     63    * unknown message type, and in doing so give buf a valid value. Thanks
    6464    * to Simon Byholm.
    6565    */
     
    130130 */
    131131
    132 void (*traceSetHandler(void (*function)(int level, char_t *buf))) 
     132void (*traceSetHandler(void (*function)(int level, char_t *buf)))
    133133        (int level, char *buf)
    134134{
     
    189189
    190190/******************************************************************************/
    191 /* 
     191/*
    192192 *      Convert a string to upper case
    193193 */
     
    216216/*
    217217 *      Convert integer to ascii string. Allow a NULL string in which case we
    218  *      allocate a dynamic buffer. 
     218 *      allocate a dynamic buffer.
    219219 */
    220220
  • cpukit/httpd/uemf.h

    r0893220 r0a7278e  
    1414/******************************** Description *********************************/
    1515
    16 /* 
     16/*
    1717 *      GoAhead Web Server header. This defines the Web public APIs
    1818 */
     
    7272#endif /* NW */
    7373
    74 #ifdef SCOV5 
     74#ifdef SCOV5
    7575        #include        <sys/types.h>
    7676        #include        <stdio.h>
     
    280280
    281281/********************************** Unicode ***********************************/
    282 /* 
    283  *      Constants and limits. Also FNAMESIZE and PATHSIZE are currently defined 
     282/*
     283 *      Constants and limits. Also FNAMESIZE and PATHSIZE are currently defined
    284284 *      in param.h to be 128 and 512
    285285 */
     
    313313
    314314/*
    315  *      Text size of buffer macro. A buffer bytes will hold (size / char size) 
    316  *      characters. 
     315 *      Text size of buffer macro. A buffer bytes will hold (size / char size)
     316 *      characters.
    317317 */
    318318#define TSZ(x)                          (sizeof(x) / sizeof(char_t))
     
    654654
    655655/*
    656  *      Allocation flags 
     656 *      Allocation flags
    657657 */
    658658#define VALUE_ALLOCATE          0x1
     
    692692 *    |                           |                       |               |
    693693 *  rq->buf                    rq->servp               rq->endp      rq->enduf
    694  *     
     694 *
    695695 *      The queue is empty when servp == endp.  This means that the queue will hold
    696696 *      at most rq->buflen -1 bytes.  It is the fillers responsibility to ensure
     
    728728
    729729/*
    730  *      Block classes are: 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 
    731  *                                         16384, 32768, 65536 
     730 *      Block classes are: 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192,
     731 *                                         16384, 32768, 65536
    732732 */
    733733typedef struct {
     
    811811/******************************************************************************/
    812812/*
    813  *      Socket flags 
     813 *      Socket flags
    814814 */
    815815
     
    847847 *      Handler event masks
    848848 */
    849 #define SOCKET_READABLE                 0x2             /* Make socket readable */ 
     849#define SOCKET_READABLE                 0x2             /* Make socket readable */
    850850#define SOCKET_WRITABLE                 0x4             /* Make socket writable */
    851851#define SOCKET_EXCEPTION                0x8             /* Interested in exceptions */
     
    859859
    860860typedef void    (*socketHandler_t)(int sid, int mask, int data);
    861 typedef int             (*socketAccept_t)(int sid, char *ipaddr, int port, 
     861typedef int             (*socketAccept_t)(int sid, char *ipaddr, int port,
    862862                                        int listenSid);
    863863typedef struct {
     
    10261026extern void             socketClose(void);
    10271027extern void             socketCloseConnection(int sid);
    1028 extern void             socketCreateHandler(int sid, int mask, socketHandler_t 
     1028extern void             socketCreateHandler(int sid, int mask, socketHandler_t
    10291029                                        handler, int arg);
    10301030extern void             socketDeleteHandler(int sid);
     
    10371037extern int              socketInputBuffered(int sid);
    10381038extern int              socketOpen(void);
    1039 extern int              socketOpenConnection(char *host, int port, 
     1039extern int              socketOpenConnection(char *host, int port,
    10401040                                        socketAccept_t accept, int flags);
    10411041extern void     socketProcess(int hid);
     
    10481048extern int              socketSetBlock(int sid, int flags);
    10491049extern int              socketGetBlock(int sid);
    1050 extern int              socketAlloc(char *host, int port, socketAccept_t accept, 
     1050extern int              socketAlloc(char *host, int port, socketAccept_t accept,
    10511051                                        int flags);
    10521052extern void     socketFree(int sid);
     
    10751075extern void             trace(int lev, char_t *fmt, ...);
    10761076extern void             traceRaw(char_t *buf);
    1077 extern void             (*traceSetHandler(void (*function)(int level, char_t *buf))) 
     1077extern void             (*traceSetHandler(void (*function)(int level, char_t *buf)))
    10781078                                        (int level, char_t *buf);
    1079  
     1079
    10801080extern value_t  valueInteger(long value);
    10811081extern value_t  valueString(char_t *value, int flags);
  • cpukit/httpd/um.c

    r0893220 r0a7278e  
    129129#endif  /* #ifdef UEMF */
    130130
    131 /* 
     131/*
    132132 *      Database Identifier returned from dbOpen()
    133133 */
    134 static int              didUM = -1;     
    135 
    136 /* 
     134static int              didUM = -1;
     135
     136/*
    137137 *      Configuration database persist filename
    138138 */
     
    147147/*********************************** Code *************************************/
    148148/*
    149  *      umOpen() registers the UM tables in the fake emf-database 
     149 *      umOpen() registers the UM tables in the fake emf-database
    150150 */
    151151
     
    176176/******************************************************************************/
    177177/*
    178  *      umClose() frees up the UM tables in the fake emf-database 
     178 *      umClose() frees up the UM tables in the fake emf-database
    179179 */
    180180
     
    214214
    215215        a_assert (saveFilename && *saveFilename);
    216         trace(3, T("UM: Writing User Configuration to file <%s>\n"), 
     216        trace(3, T("UM: Writing User Configuration to file <%s>\n"),
    217217                saveFilename);
    218218
     
    237237        a_assert(saveFilename && *saveFilename);
    238238
    239         trace(3, T("UM: Loading User Configuration from file <%s>\n"), 
     239        trace(3, T("UM: Loading User Configuration from file <%s>\n"),
    240240                saveFilename);
    241241
     
    249249/******************************************************************************/
    250250/*
    251  *      Encrypt/Decrypt a text string. 
     251 *      Encrypt/Decrypt a text string.
    252252 *              Returns the number of characters encrypted.
    253253 */
     
    270270 *                      Simply use existing character.
    271271 */
    272                 if (enChar && !gisspace(enChar)) 
     272                if (enChar && !gisspace(enChar))
    273273                        *textString = enChar;
    274274/*
     
    306306        row = 0;
    307307/*
    308  *      Move through table until we retrieve the first row with non-null 
     308 *      Move through table until we retrieve the first row with non-null
    309309 *      column data.
    310310 */
    311311        columnData = NULL;
    312         while ((check = dbReadStr(didUM, tableName, columnName, row++, 
     312        while ((check = dbReadStr(didUM, tableName, columnName, row++,
    313313                &columnData)) == 0 || (check == DB_ERR_ROW_DELETED)) {
    314314                if (columnData && *columnData) {
     
    322322/******************************************************************************/
    323323/*
    324  *      umGetNextRowData() -    return a pointer to the first non-blank 
     324 *      umGetNextRowData() -    return a pointer to the first non-blank
    325325 *                                              key value following the given one.
    326326 */
    327327
    328 static char_t *umGetNextRowData(char_t *tableName, char_t *columnName, 
     328static char_t *umGetNextRowData(char_t *tableName, char_t *columnName,
    329329                                                                char_t *keyLast)
    330330{
     
    342342        key = NULL;
    343343
    344         while ((((check = dbReadStr(didUM, tableName, columnName, row++, 
     344        while ((((check = dbReadStr(didUM, tableName, columnName, row++,
    345345                &key)) == 0) || (check == DB_ERR_ROW_DELETED)) &&
    346346                ((key == NULL) || (gstrcmp(key, keyLast) != 0))) {
     
    355355 *      Move through table until we retrieve the next row with a non-null key
    356356 */
    357         while (((check = dbReadStr(didUM, tableName, columnName, row++, &key)) 
     357        while (((check = dbReadStr(didUM, tableName, columnName, row++, &key))
    358358                == 0) || (check == DB_ERR_ROW_DELETED)) {
    359359                if (key && *key && (gstrcmp(key, keyLast) != 0)) {
     
    370370 */
    371371
    372 int     umAddUser(char_t *user, char_t *pass, char_t *group, 
     372int     umAddUser(char_t *user, char_t *pass, char_t *group,
    373373                          bool_t prot, bool_t disabled)
    374374{
     
    425425        bfree(B_L, password);
    426426        dbWriteStr(didUM, UM_USER_TABLENAME, UM_GROUP, row, group);
    427         dbWriteInt(didUM, UM_USER_TABLENAME, UM_PROT, row, prot); 
     427        dbWriteInt(didUM, UM_USER_TABLENAME, UM_PROT, row, prot);
    428428        dbWriteInt(didUM, UM_USER_TABLENAME, UM_DISABLE, row, disabled);
    429429
     
    447447        if (umGetUserProtected(user)) {
    448448                return UM_ERR_PROTECTED;
    449         } 
     449        }
    450450
    451451/*
     
    454454        if ((row = dbSearchStr(didUM, UM_USER_TABLENAME, UM_NAME, user, 0)) >= 0) {
    455455                return dbDeleteRow(didUM, UM_USER_TABLENAME, row);
    456         } 
     456        }
    457457
    458458        return UM_ERR_NOT_FOUND;
     
    473473/*
    474474 *      umGetNextUser() Returns the next user found in the "users" table after
    475  *                                      the given user.         
     475 *                                      the given user.
    476476 */
    477477
     
    698698 */
    699699
    700 int     umAddGroup(char_t *group, short priv, accessMeth_t am, 
     700int     umAddGroup(char_t *group, short priv, accessMeth_t am,
    701701                           bool_t prot, bool_t disabled)
    702702{
     
    705705        a_assert(group && *group);
    706706        trace(3, T("UM: Adding group <%s>\n"), group);
    707        
     707
    708708/*
    709709 *      Do not allow duplicates
     
    762762        if (umGetGroupInUse(group)) {
    763763                return UM_ERR_IN_USE;
    764         } 
     764        }
    765765
    766766/*
     
    769769        if (umGetGroupProtected(group)) {
    770770                return UM_ERR_PROTECTED;
    771         } 
     771        }
    772772
    773773/*
     
    813813        if (dbSearchStr(didUM, UM_USER_TABLENAME, UM_GROUP, group, 0) >= 0) {
    814814                return TRUE;
    815         } 
     815        }
    816816
    817817/*
     
    820820        if (dbSearchStr(didUM, UM_ACCESS_TABLENAME, UM_GROUP, group, 0) >= 0) {
    821821                return TRUE;
    822         } 
     822        }
    823823
    824824        return FALSE;
     
    920920
    921921        if (row >= 0) {
    922                 return dbWriteInt(didUM, UM_GROUP_TABLENAME, UM_PRIVILEGE, row, 
     922                return dbWriteInt(didUM, UM_GROUP_TABLENAME, UM_PRIVILEGE, row,
    923923                        (int)privilege);
    924924        } else {
     
    961961
    962962        if (row >= 0) {
    963                 return dbWriteInt(didUM, UM_GROUP_TABLENAME, UM_DISABLE, row, 
     963                return dbWriteInt(didUM, UM_GROUP_TABLENAME, UM_DISABLE, row,
    964964                        (int) !enabled);
    965965        } else {
     
    10021002
    10031003        if (row >= 0) {
    1004                 return dbWriteInt(didUM, UM_GROUP_TABLENAME, UM_PROT, row, 
     1004                return dbWriteInt(didUM, UM_GROUP_TABLENAME, UM_PROT, row,
    10051005                        (int) protect);
    10061006        } else {
     
    10861086/******************************************************************************/
    10871087/*
    1088  *      umGetNextAccessLimit() -        return a pointer to the first non-blank 
     1088 *      umGetNextAccessLimit() -        return a pointer to the first non-blank
    10891089 *                                                              access limit following the given one
    10901090 */
     
    11251125        if (row >= 0) {
    11261126                dbReadInt(didUM, UM_ACCESS_TABLENAME, UM_METHOD, row, &am);
    1127         } 
     1127        }
    11281128
    11291129        return (accessMeth_t) am;
     
    11821182
    11831183        if (row >= 0) {
    1184                 return dbWriteInt(didUM, UM_ACCESS_TABLENAME, UM_SECURE, row, 
     1184                return dbWriteInt(didUM, UM_ACCESS_TABLENAME, UM_SECURE, row,
    11851185                        (int)secure);
    11861186        } else {
     
    12391239        char_t  *urlRet, *urlCheck, *lastChar;
    12401240        int             len;
    1241        
     1241
    12421242        a_assert(url && *url);
    12431243        urlRet = NULL;
     
    12581258                        lastChar--;
    12591259
    1260                         while ((lastChar >= urlCheck) && ((*lastChar == '/') || 
     1260                        while ((lastChar >= urlCheck) && ((*lastChar == '/') ||
    12611261                                (*lastChar == '\\'))) {
    12621262                                *lastChar = 0;
     
    12641264                        }
    12651265
    1266                         while ((lastChar >= urlCheck) && (*lastChar != '/') && 
     1266                        while ((lastChar >= urlCheck) && (*lastChar != '/') &&
    12671267                                (*lastChar != '\\')) {
    12681268                                *lastChar = 0;
     
    12871287        accessMeth_t    amRet;
    12881288        char_t                  *urlHavingLimit, *group;
    1289        
     1289
    12901290        urlHavingLimit = umGetAccessLimit(url);
    12911291        if (urlHavingLimit) {
     
    13161316        char_t                  *group, *usergroup, *urlHavingLimit;
    13171317        short                   priv;
    1318        
     1318
    13191319        a_assert(user && *user);
    13201320        a_assert(url && *url);
     
    13731373
    13741374/*
    1375  *      If the access method for the URL is AM_NONE then 
     1375 *      If the access method for the URL is AM_NONE then
    13761376 *      the file "doesn't exist".
    13771377 */
    13781378        if (amURL == AM_NONE) {
    13791379                return FALSE;
    1380         } 
    1381        
    1382 /*
    1383  *      If Access Limit has a group specified, then the user must be a 
     1380        }
     1381
     1382/*
     1383 *      If Access Limit has a group specified, then the user must be a
    13841384 *      member of that group
    13851385 */
     
    14001400                }
    14011401#endif
    1402         } 
    1403 
    1404 /*
    1405  *      Otherwise, user can access the URL 
     1402        }
     1403
     1404/*
     1405 *      Otherwise, user can access the URL
    14061406 */
    14071407        return TRUE;
  • cpukit/httpd/umui.c

    r0893220 r0a7278e  
    3131static void             formDeleteUser(webs_t wp, char_t *path, char_t *query);
    3232static void             formDisplayUser(webs_t wp, char_t *path, char_t *query);
    33 static int              aspGenerateUserList(int eid, webs_t wp, 
     33static int              aspGenerateUserList(int eid, webs_t wp,
    3434                                                                        int argc, char_t **argv);
    3535
    3636static void             formAddGroup(webs_t wp, char_t *path, char_t *query);
    3737static void             formDeleteGroup(webs_t wp, char_t *path, char_t *query);
    38 static int              aspGenerateGroupList(int eid, webs_t wp, 
     38static int              aspGenerateGroupList(int eid, webs_t wp,
    3939                                                                         int argc, char_t **argv);
    4040
    4141static void             formAddAccessLimit(webs_t wp, char_t *path, char_t *query);
    4242static void             formDeleteAccessLimit(webs_t wp, char_t *path, char_t *query);
    43 static int              aspGenerateAccessLimitList(int eid, webs_t wp, 
     43static int              aspGenerateAccessLimitList(int eid, webs_t wp,
    4444                                                                                   int argc, char_t **argv);
    4545
    46 static int              aspGenerateAccessMethodList(int eid, webs_t wp, 
     46static int              aspGenerateAccessMethodList(int eid, webs_t wp,
    4747                                                                                        int argc, char_t **argv);
    48 static int              aspGeneratePrivilegeList(int eid, webs_t wp, 
     48static int              aspGeneratePrivilegeList(int eid, webs_t wp,
    4949                                                                                 int argc, char_t **argv);
    5050
     
    9393        a_assert(wp);
    9494
    95         userid = websGetVar(wp, T("user"), T("")); 
    96         pass1 = websGetVar(wp, T("password"), T("")); 
    97         pass2 = websGetVar(wp, T("passconf"), T("")); 
    98         group = websGetVar(wp, T("group"), T("")); 
    99         enabled = websGetVar(wp, T("enabled"), T("")); 
    100         ok = websGetVar(wp, T("ok"), T("")); 
     95        userid = websGetVar(wp, T("user"), T(""));
     96        pass1 = websGetVar(wp, T("password"), T(""));
     97        pass2 = websGetVar(wp, T("passconf"), T(""));
     98        group = websGetVar(wp, T("group"), T(""));
     99        enabled = websGetVar(wp, T("enabled"), T(""));
     100        ok = websGetVar(wp, T("ok"), T(""));
    101101
    102102        websHeader(wp);
     
    164164        a_assert(wp);
    165165
    166         userid = websGetVar(wp, T("user"), T("")); 
    167         ok = websGetVar(wp, T("ok"), T("")); 
     166        userid = websGetVar(wp, T("user"), T(""));
     167        ok = websGetVar(wp, T("ok"), T(""));
    168168
    169169        websHeader(wp);
     
    199199        a_assert(wp);
    200200
    201         userid = websGetVar(wp, T("user"), T("")); 
    202         ok = websGetVar(wp, T("ok"), T("")); 
     201        userid = websGetVar(wp, T("user"), T(""));
     202        ok = websGetVar(wp, T("ok"), T(""));
    203203
    204204        websHeader(wp);
     
    235235        a_assert(wp);
    236236
    237         nBytes = websWrite(wp, 
     237        nBytes = websWrite(wp,
    238238                T("<SELECT NAME=\"user\" SIZE=\"3\" TITLE=\"Select a User\">"));
    239239        row = 0;
     
    242242
    243243        while (userid && (nBytes > 0)) {
    244                 nBytes = websWrite(wp, T("<OPTION VALUE=\"%s\">%s\n"), 
     244                nBytes = websWrite(wp, T("<OPTION VALUE=\"%s\">%s\n"),
    245245                        userid, userid);
    246246                userid = umGetNextUser(userid);
     
    268268        a_assert(wp);
    269269
    270         group = websGetVar(wp, T("group"), T("")); 
    271         method = websGetVar(wp, T("method"), T("")); 
    272         enabled = websGetVar(wp, T("enabled"), T("")); 
    273         privilege = websGetVar(wp, T("privilege"), T("")); 
    274         ok = websGetVar(wp, T("ok"), T("")); 
     270        group = websGetVar(wp, T("group"), T(""));
     271        method = websGetVar(wp, T("method"), T(""));
     272        enabled = websGetVar(wp, T("enabled"), T(""));
     273        privilege = websGetVar(wp, T("privilege"), T(""));
     274        ok = websGetVar(wp, T("ok"), T(""));
    275275
    276276        websHeader(wp);
     
    320320                                group, nCheck);
    321321                } else {
    322                         websWrite(wp, T("Group, \"%s\" was successfully added."), 
     322                        websWrite(wp, T("Group, \"%s\" was successfully added."),
    323323                                group);
    324324                }
     
    341341        a_assert(wp);
    342342
    343         group = websGetVar(wp, T("group"), T("")); 
    344         ok = websGetVar(wp, T("ok"), T("")); 
     343        group = websGetVar(wp, T("group"), T(""));
     344        ok = websGetVar(wp, T("ok"), T(""));
    345345
    346346        websHeader(wp);
     
    380380        row = 0;
    381381        nBytesSent = 0;
    382         nBytes = websWrite(wp, 
     382        nBytes = websWrite(wp,
    383383                T("<SELECT NAME=\"group\" SIZE=\"3\" TITLE=\"Select a Group\">"));
    384384/*
     
    413413        a_assert(wp);
    414414
    415         url = websGetVar(wp, T("url"), T("")); 
    416         group = websGetVar(wp, T("group"), T("")); 
    417         method = websGetVar(wp, T("method"), T("")); 
    418         secure = websGetVar(wp, T("secure"), T("")); 
    419         ok = websGetVar(wp, T("ok"), T("")); 
     415        url = websGetVar(wp, T("url"), T(""));
     416        group = websGetVar(wp, T("group"), T(""));
     417        method = websGetVar(wp, T("method"), T(""));
     418        secure = websGetVar(wp, T("secure"), T(""));
     419        ok = websGetVar(wp, T("ok"), T(""));
    420420
    421421        websHeader(wp);
     
    467467        a_assert(wp);
    468468
    469         url = websGetVar(wp, T("url"), T("")); 
    470         ok = websGetVar(wp, T("ok"), T("")); 
     469        url = websGetVar(wp, T("url"), T(""));
     470        ok = websGetVar(wp, T("ok"), T(""));
    471471
    472472        websHeader(wp);
     
    476476                websWrite(wp, T("Delete Access Limit Cancelled"));
    477477        } else if (umDeleteAccessLimit(url) != 0) {
    478                 websWrite(wp, T("ERROR: Unable to delete Access Limit for [%s]"), 
     478                websWrite(wp, T("ERROR: Unable to delete Access Limit for [%s]"),
    479479                        url);
    480480        } else {
    481                 websWrite(wp, T("Access Limit for [%s], was successfully deleted."), 
     481                websWrite(wp, T("Access Limit for [%s], was successfully deleted."),
    482482                        url);
    483483        }
     
    493493 */
    494494
    495 static int aspGenerateAccessLimitList(int eid, webs_t wp, 
     495static int aspGenerateAccessLimitList(int eid, webs_t wp,
    496496                                                                          int argc, char_t **argv)
    497497{
     
    503503        row = nBytesSent = 0;
    504504        url = umGetFirstAccessLimit();
    505         nBytes = websWrite(wp, 
     505        nBytes = websWrite(wp,
    506506                T("<SELECT NAME=\"url\" SIZE=\"3\" TITLE=\"Select a URL\">"));
    507507
     
    522522 */
    523523
    524 static int aspGenerateAccessMethodList(int eid, webs_t wp, 
     524static int aspGenerateAccessMethodList(int eid, webs_t wp,
    525525                                                                           int argc, char_t **argv)
    526526{
     
    529529        a_assert(wp);
    530530
    531         nBytes = websWrite(wp, 
     531        nBytes = websWrite(wp,
    532532                T("<SELECT NAME=\"method\" SIZE=\"3\" TITLE=\"Select a Method\">"));
    533         nBytes += websWrite(wp, T("<OPTION VALUE=\"%d\">FULL ACCESS\n"), 
     533        nBytes += websWrite(wp, T("<OPTION VALUE=\"%d\">FULL ACCESS\n"),
    534534                AM_FULL);
    535         nBytes += websWrite(wp, T("<OPTION VALUE=\"%d\">BASIC ACCESS\n"), 
     535        nBytes += websWrite(wp, T("<OPTION VALUE=\"%d\">BASIC ACCESS\n"),
    536536                AM_BASIC);
    537         nBytes += websWrite(wp, T("<OPTION VALUE=\"%d\" SELECTED>DIGEST ACCESS\n"), 
     537        nBytes += websWrite(wp, T("<OPTION VALUE=\"%d\" SELECTED>DIGEST ACCESS\n"),
    538538                AM_DIGEST);
    539         nBytes += websWrite(wp, T("<OPTION VALUE=\"%d\">NO ACCESS\n"), 
     539        nBytes += websWrite(wp, T("<OPTION VALUE=\"%d\">NO ACCESS\n"),
    540540                AM_NONE);
    541541        nBytes += websWrite(wp, T("</SELECT>"));
     
    548548 */
    549549
    550 static int aspGeneratePrivilegeList(int eid, webs_t wp, 
     550static int aspGeneratePrivilegeList(int eid, webs_t wp,
    551551                                                                        int argc, char_t **argv)
    552552{
     
    559559        nBytes += websWrite(wp, T("<OPTION VALUE=\"%d\">READ\n"), PRIV_READ);
    560560        nBytes += websWrite(wp, T("<OPTION VALUE=\"%d\">EXECUTE\n"), PRIV_WRITE);
    561         nBytes += websWrite(wp, T("<OPTION VALUE=\"%d\">ADMINISTRATE\n"), 
     561        nBytes += websWrite(wp, T("<OPTION VALUE=\"%d\">ADMINISTRATE\n"),
    562562                PRIV_ADMIN);
    563563        nBytes += websWrite(wp, T("</SELECT>"));
     
    577577        a_assert(wp);
    578578
    579         ok = websGetVar(wp, T("ok"), T("")); 
     579        ok = websGetVar(wp, T("ok"), T(""));
    580580
    581581        websHeader(wp);
     
    606606        a_assert(wp);
    607607
    608         ok = websGetVar(wp, T("ok"), T("")); 
     608        ok = websGetVar(wp, T("ok"), T(""));
    609609
    610610        websHeader(wp);
  • cpukit/httpd/url.c

    r0893220 r0a7278e  
    4848                return buf;
    4949        }
    50         if (websUrlParse(url, &parsebuf, NULL, NULL, NULL, NULL, NULL, 
     50        if (websUrlParse(url, &parsebuf, NULL, NULL, NULL, NULL, NULL,
    5151                        NULL, &ext) < 0) {
    5252                gstrcpy(buf, T("text/plain"));
     
    7373 */
    7474
    75 int websUrlParse(char_t *url, char_t **pbuf, char_t **phost, char_t **ppath, 
    76         char_t **pport, char_t **pquery, char_t **pproto, char_t **ptag, 
     75int websUrlParse(char_t *url, char_t **pbuf, char_t **phost, char_t **ppath,
     76        char_t **pport, char_t **pquery, char_t **pproto, char_t **ptag,
    7777        char_t **pext)
    7878{
     
    129129                if ((cp = gstrchr(tok, '/')) != NULL) {
    130130/*
    131  *                      If a full URL is supplied, we need to copy the host and port 
     131 *                      If a full URL is supplied, we need to copy the host and port
    132132 *                      portions into static buffers.
    133133 */
     
    156156                path = tok;
    157157                tok = query;
    158         } 
     158        }
    159159
    160160/*
  • cpukit/httpd/wbase64.c

    r0893220 r0a7278e  
    3030        52, 53, 54, 55, 56, 57, 58, 59, 60, 61, -1, -1, -1, -1, -1, -1,
    3131        -1,  0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 14,
    32     15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -1, -1, -1, -1, -1, 
     32    15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -1, -1, -1, -1, -1,
    3333        -1, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
    3434    41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, -1, -1, -1, -1, -1,
     
    8484                                        c, i);
    8585                                return -1;
    86                         } 
     86                        }
    8787                        shiftbuf = shiftbuf | (c << shift);
    8888                        shift -= 6;
  • cpukit/httpd/webcomp.c

    r0893220 r0a7278e  
    8989        time(&now);
    9090        fprintf(stdout, "/*\n * webrom.c -- Compiled Web Pages\n *\n");
    91         fprintf(stdout, " * Compiled by GoAhead WebCompile: %s */\n\n", 
     91        fprintf(stdout, " * Compiled by GoAhead WebCompile: %s */\n\n",
    9292                gctime(&now));
    9393        fprintf(stdout, "#include \"wsIntrn.h\"\n\n");
     
    110110                if (gstat(file, &sbuf) == 0 && sbuf.st_mode & S_IFDIR) {
    111111                        continue;
    112                 } 
     112                }
    113113                if ((fd = gopen(file, O_RDONLY | O_BINARY)) < 0) {
    114114                        fprintf(stderr, "Can't open file %s\n", file);
     
    171171                        continue;
    172172                }
    173                 fprintf(stdout, "    { T(\"/%s\"), page_%d, %d },\n", cp, nFile, 
     173                fprintf(stdout, "    { T(\"/%s\"), page_%d, %d },\n", cp, nFile,
    174174                        sbuf.st_size);
    175175                nFile++;
    176176        }
    177         fclose(lp); 
    178        
     177        fclose(lp);
     178
    179179        fprintf(stdout, "    { 0, 0, 0 },\n");
    180180        fprintf(stdout, "};\n");
  • cpukit/httpd/webmain.c

    r0893220 r0a7278e  
    5858/* The following holds the pointer to an allocated websTimer_t structure .
    5959 * Using this method only one timer can be active at a time, but
    60  * for the WebServer, this should be OK. 
     60 * for the WebServer, this should be OK.
    6161 */
    6262websTimer_t *tp;
     
    7676static timer_t timer_id;
    7777static void rtems_httpd_daemon(rtems_task_argument args);
    78  
     78
    7979/*********************************** Code *************************************/
    8080/*
     
    9191   **********************************************************************/
    9292  priority = 40;
    93  
     93
    9494  sc = rtems_task_create(rtems_build_name('H', 'T', 'P', 'D'),
    9595                         priority, 8*1024,
     
    107107   {
    108108      return(RTEMS_UNSATISFIED);
    109    }   
     109   }
    110110
    111111   return(RTEMS_SUCCESSFUL);
     
    117117{
    118118/*
    119  *      Initialize the memory allocator. Allow use of malloc and start with a 
     119 *      Initialize the memory allocator. Allow use of malloc and start with a
    120120 *      10K heap.
    121121 */
     
    186186
    187187/*
    188  *      Define the local Ip address, host name, default home page and the 
     188 *      Define the local Ip address, host name, default home page and the
    189189 *      root web directory.
    190190 */
     
    193193                return -1;
    194194                }
    195        
     195
    196196/*      intaddr.s_addr = (unsigned long) hostGetByName(host); */
    197197        if ((hp = gethostbyname(host)) == NULL) {
     
    229229        websSetPassword(password);
    230230
    231 /* 
     231/*
    232232 *      Open the web server on the given port. If that port is taken, try
    233233 *      the next sequential port for up to "retries" attempts.
     
    237237/*
    238238 *      First create the URL handlers. Note: handlers are called in sorted order
    239  *      with the longest path handler examined first. Here we define the security 
     239 *      with the longest path handler examined first. Here we define the security
    240240 *      handler, forms handler and the default web page handler.
    241241 */
    242         websUrlHandlerDefine(T(""), NULL, 0, websSecurityHandler, 
     242        websUrlHandlerDefine(T(""), NULL, 0, websSecurityHandler,
    243243                WEBS_HANDLER_FIRST);
    244244        websUrlHandlerDefine(T("/goform"), NULL, 0, websFormHandler, 0);
    245         websUrlHandlerDefine(T(""), NULL, 0, websDefaultHandler, 
    246                 WEBS_HANDLER_LAST); 
     245        websUrlHandlerDefine(T(""), NULL, 0, websDefaultHandler,
     246                WEBS_HANDLER_LAST);
    247247
    248248/*
     
    256256 *      Create a handler for the default home page
    257257 */
    258         websUrlHandlerDefine(T("/"), NULL, 0, websHomePageHandler, 0); 
     258        websUrlHandlerDefine(T("/"), NULL, 0, websHomePageHandler, 0);
    259259        return 0;
    260260}
     
    263263/*
    264264 *      Test Javascript binding for ASP. This will be invoked when "aspTest" is
    265  *      embedded in an ASP page. See web/asp.asp for usage. Set browser to 
     265 *      embedded in an ASP page. See web/asp.asp for usage. Set browser to
    266266 *      "localhost/asp.asp" to test.
    267267 */
     
    287287        char_t  *name, *address;
    288288
    289         name = websGetVar(wp, T("name"), T("Joe Smith")); 
    290         address = websGetVar(wp, T("address"), T("1212 Milky Way Ave.")); 
     289        name = websGetVar(wp, T("name"), T("Joe Smith"));
     290        address = websGetVar(wp, T("address"), T("1212 Milky Way Ave."));
    291291
    292292        websHeader(wp);
     
    343343                return NULL;
    344344        }
    345        
     345
    346346#if 0
    347347        act.sa_flags = 0;
     
    388388
    389389/* Copy the timer structure to a local first and delete it before calling
    390  * the function, since the function could create another timer.  In this 
     390 * the function, since the function could create another timer.  In this
    391391 * implementation, only one timer can be allocated at a time.
    392392 */
     
    421421
    422422#if B_STATS
    423 static void memLeaks() 
     423static void memLeaks()
    424424{
    425425        int             fd=1;
  • cpukit/httpd/webs.c

    r0893220 r0a7278e  
    128128 *      Optional request log support
    129129 */
    130         websLogFd = gopen(websLogname, O_CREAT | O_TRUNC | O_APPEND | O_WRONLY, 
     130        websLogFd = gopen(websLogname, O_CREAT | O_TRUNC | O_APPEND | O_WRONLY,
    131131                0666);
    132132        a_assert(websLogFd >= 0);
    133133#endif
    134        
     134
    135135        return websOpenListen(port, retries);
    136136}
     
    155155        websCloseListen();
    156156
    157 /* 
     157/*
    158158 *      Close each open browser connection and free all resources
    159159 */
     
    208208                        orig, port - 1);
    209209                return -1;
    210         } 
     210        }
    211211
    212212/*
     
    223223        } else {
    224224                fmtAlloc(&websHostUrl, WEBS_MAX_URL + 80, T("%s:%d"), websHost, port);
    225                 fmtAlloc(&websIpaddrUrl, WEBS_MAX_URL + 80, T("%s:%d"), 
     225                fmtAlloc(&websIpaddrUrl, WEBS_MAX_URL + 80, T("%s:%d"),
    226226                        websIpaddr, port);
    227227        }
     
    279279 *      to know for permitting administrative operations only for local access
    280280 */
    281         if (gstrcmp(wp->ipaddr, T("127.0.0.1")) == 0 || 
    282                         gstrcmp(wp->ipaddr, websIpaddr) == 0 || 
     281        if (gstrcmp(wp->ipaddr, T("127.0.0.1")) == 0 ||
     282                        gstrcmp(wp->ipaddr, websIpaddr) == 0 ||
    283283                        gstrcmp(wp->ipaddr, websHost) == 0) {
    284284                wp->flags |= WEBS_LOCAL_REQUEST;
     
    318318        if (mask & SOCKET_READABLE) {
    319319                websReadEvent(wp);
    320         } 
     320        }
    321321        if (mask & SOCKET_WRITABLE) {
    322322                if (websValid(wp) && wp->writeSocket) {
    323323                        (*wp->writeSocket)(wp);
    324324                }
    325         } 
     325        }
    326326}
    327327
     
    329329/*
    330330 *      The webs read handler. This is the primary read event loop. It uses a
    331  *      state machine to track progress while parsing the HTTP request. 
     331 *      state machine to track progress while parsing the HTTP request.
    332332 *      Note: we never block as the socket is always in non-blocking mode.
    333333 */
     
    357357/*
    358358 *              Get more input into "text". Returns 0, if more data is needed
    359  *              to continue, -1 if finished with the request, or 1 if all 
     359 *              to continue, -1 if finished with the request, or 1 if all
    360360 *              required data is available for current state.
    361361 */
     
    372372
    373373/*
    374  *              This is the state machine for the web server. 
     374 *              This is the state machine for the web server.
    375375 */
    376376                switch(wp->state) {
     
    385385                        wp->state = WEBS_HEADER;
    386386                        break;
    387                
     387
    388388                case WEBS_HEADER:
    389389/*
     
    423423                                nbytes += 1;
    424424 */
    425                         } else 
     425                        } else
    426426#endif
    427427                        if (wp->query) {
    428428                                if (wp->query[0] && !(wp->flags & WEBS_POST_DATA)) {
    429429/*
    430  *                                      Special case where the POST request also had query data 
     430 *                                      Special case where the POST request also had query data
    431431 *                                      specified in the URL, ie. url?query_data. In this case
    432432 *                                      the URL query data is separated by a '&' from the posted
     
    534534/******************************************************************************/
    535535/*
    536  *      Get input from the browser. Return TRUE (!0) if the request has been 
    537  *      handled. Return -1 on errors or if the request has been processed, 
     536 *      Get input from the browser. Return TRUE (!0) if the request has been
     537 *      handled. Return -1 on errors or if the request has been processed,
    538538 *      1 if input read, and 0 to instruct the caller to call again for more input.
    539539 *
    540540 *      Note: socketRead will Return the number of bytes read if successful. This
    541541 *      may be less than the requested "bufsize" and may be zero. It returns -1 for
    542  *      errors. It returns 0 for EOF. Otherwise it returns the number of bytes 
    543  *      read. Since this may be zero, callers should use socketEof() to 
     542 *      errors. It returns 0 for EOF. Otherwise it returns the number of bytes
     543 *      read. Since this may be zero, callers should use socketEof() to
    544544 *      distinguish between this and EOF.
    545545 */
    546546
    547 static int websGetInput(webs_t wp, char_t **ptext, int *pnbytes) 
     547static int websGetInput(webs_t wp, char_t **ptext, int *pnbytes)
    548548{
    549549        char_t  *text;
     
    593593                } else {                                                                /* Valid data */
    594594/*
    595  *                      Convert to UNICODE if necessary.  First be sure the string 
     595 *                      Convert to UNICODE if necessary.  First be sure the string
    596596 *                      is NULL terminated.
    597597 */
     
    622622                        if (wp->flags & WEBS_SECURE) {
    623623/*
    624  *                              If state is WEBS_BEGIN and the request is secure, a -1 will 
     624 *                              If state is WEBS_BEGIN and the request is secure, a -1 will
    625625 *                              usually indicate SSL negotiation
    626626 */
     
    639639                        if (eof) {
    640640/*
    641  *                              If this is a post request without content length, process 
    642  *                              the request as we now have all the data. Otherwise just 
     641 *                              If this is a post request without content length, process
     642 *                              the request as we now have all the data. Otherwise just
    643643 *                              close the connection.
    644644 */
     
    667667 *                      this code assumes we were only expecting a one line header, which
    668668 *                      is not necessarily the case. So we weren't processing the whole
    669  *                      header and weren't fufilling requests properly. 
     669 *                      header and weren't fufilling requests properly.
    670670 */
    671671#ifdef UNUSED
     
    766766 */
    767767        host = path = port = proto = query = ext = NULL;
    768         if (websUrlParse(url, &buf, &host, &path, &port, &query, &proto, 
     768        if (websUrlParse(url, &buf, &host, &path, &port, &query, &proto,
    769769                        NULL, &ext) < 0) {
    770770                websError(wp, 400, T("Bad URL format"));
     
    788788        wp->protocol = bstrdup(B_L, proto);
    789789        wp->protoVersion = bstrdup(B_L, protoVer);
    790        
     790
    791791        if ((testPort = socketGetPort(wp->listenSid)) >= 0) {
    792792                wp->port = testPort;
     
    804804#ifdef WEBS_PROXY_SUPPORT
    805805/*
    806  *      Determine if this is a request for local webs data. If it is not a proxied 
     806 *      Determine if this is a request for local webs data. If it is not a proxied
    807807 *      request from the browser, we won't see the "http://" or the system name, so
    808808 *      we assume it must be talking to us directly for local webs data.
    809809 *      Note: not fully implemented yet.
    810810 */
    811         if (gstrstr(wp->url, T("http://")) == NULL || 
    812                 ((gstrcmp(wp->host, T("localhost")) == 0 || 
     811        if (gstrstr(wp->url, T("http://")) == NULL ||
     812                ((gstrcmp(wp->host, T("localhost")) == 0 ||
    813813                        gstrcmp(wp->host, websHost) == 0) && (wp->port == websPort))) {
    814814                wp->flags |= WEBS_LOCAL_PAGE;
     
    842842        websSetVar(wp, T("HTTP_AUTHORIZATION"), T(""));
    843843
    844 /* 
     844/*
    845845 *      Parse the header and create the Http header keyword variables
    846846 *      We rewrite the header as we go for non-local requests.  NOTE: this
     
    894894                        authType = bstrdup (B_L, value);
    895895                        a_assert (authType);
    896 /*                     
     896/*
    897897 *                      Truncate authType at the next non-alpha character
    898898 */
     
    10561056         if (wp->clen > 0)
    10571057         {
    1058                            wp->flags |= WEBS_CLEN;                     
     1058                           wp->flags |= WEBS_CLEN;
    10591059                           websSetVar(wp, T("CONTENT_LENGTH"), value);
    10601060         }
     
    11731173                if (*keyword) {
    11741174/*
    1175  *                      If keyword has already been set, append the new value to what has 
     1175 *                      If keyword has already been set, append the new value to what has
    11761176 *                      been stored.
    11771177 */
     
    11981198/*
    11991199 *      Define a webs (CGI) variable for this connection. Also create in relevant
    1200  *      scripting engines. Note: the incoming value may be volatile. 
     1200 *      scripting engines. Note: the incoming value may be volatile.
    12011201 */
    12021202
     
    12511251        a_assert(websValid(wp));
    12521252        a_assert(var && *var);
    1253  
     1253
    12541254        if ((sp = symLookup(wp->cgiVars, var)) != NULL) {
    12551255                a_assert(sp->content.type == string);
     
    12721272        a_assert(websValid(wp));
    12731273        a_assert(var && *var);
    1274  
     1274
    12751275        if (gstrcmp(value, websGetVar(wp, var, T(" __UNDEF__ "))) == 0) {
    12761276                return 1;
     
    12961296/******************************************************************************/
    12971297/*
    1298  *      Output a HTTP response back to the browser. If redirect is set to a 
     1298 *      Output a HTTP response back to the browser. If redirect is set to a
    12991299 *      URL, the browser will be sent to this location.
    13001300 */
     
    13251325                }
    13261326
    1327 /*             
     1327/*
    13281328 *              By license terms the following line of code must not be modified.
    13291329 */
    13301330                websWrite(wp, T("Server: %s\r\n"), WEBS_NAME);
    13311331
    1332 /*             
     1332/*
    13331333 *              Timestamp/Date is usually the next to go
    13341334 */
     
    13421342                if (code == 401) {
    13431343                        if (!(wp->flags & WEBS_AUTH_DIGEST)) {
    1344                                 websWrite(wp, T("WWW-Authenticate: Basic realm=\"%s\"\r\n"), 
     1344                                websWrite(wp, T("WWW-Authenticate: Basic realm=\"%s\"\r\n"),
    13451345                                        websGetRealm());
    13461346#ifdef DIGEST_ACCESS_SUPPORT
     
    13491349
    13501350            /* $$$ before... (note commas instead of semicolons...)
    1351                                 nonce = websCalcNonce(wp), 
    1352                                 opaque = websCalcOpaque(wp), 
     1351                                nonce = websCalcNonce(wp),
     1352                                opaque = websCalcOpaque(wp),
    13531353            $$$ after */
    13541354                                nonce = websCalcNonce(wp);
    1355                                 opaque = websCalcOpaque(wp); 
     1355                                opaque = websCalcOpaque(wp);
    13561356            /* ...$$$ end */
    1357                                 websWrite(wp, 
     1357                                websWrite(wp,
    13581358                                        T("WWW-Authenticate: Digest realm=\"%s\", domain=\"%s\",")
    13591359                                        T("qop=\"%s\", nonce=\"%s\", opaque=\"%s\",")
    1360                                         T("algorithm=\"%s\", stale=\"%s\"\r\n"), 
     1360                                        T("algorithm=\"%s\", stale=\"%s\"\r\n"),
    13611361                                        websGetRealm(),
    13621362                                        websGetHostUrl(),
     
    13771377                websWrite(wp, T("Content-Type: text/html\r\n"));
    13781378/*
    1379  *              We don't do a string length here as the message may be multi-line. 
    1380  *              Ie. <CR><LF> will count as only one and we will have a content-length 
     1379 *              We don't do a string length here as the message may be multi-line.
     1380 *              Ie. <CR><LF> will count as only one and we will have a content-length
    13811381 *              that is too short.
    13821382 *
     
    14371437 *      Add human readable message for completeness. Should not be required.
    14381438 */
    1439         fmtAlloc(&msgbuf, WEBS_MAX_URL + 80, 
     1439        fmtAlloc(&msgbuf, WEBS_MAX_URL + 80,
    14401440                T("<html><head></head><body>\r\n\
    14411441                This document has moved to a new <a href=\"%s\">location</a>.\r\n\
     
    14501450
    14511451/******************************************************************************/
    1452 /*     
     1452/*
    14531453 *      Output an error message and cleanup
    14541454 */
     
    14791479   if (!reEntry)
    14801480   {
    1481       /* 
     1481      /*
    14821482       * The dmfRichError function that we're about to call may very well call
    14831483       * websError() as part of its work. If that happens, we do NOT want to
     
    15071507 */
    15081508        buf = NULL;
    1509         fmtAlloc(&buf, WEBS_BUFSIZE, msg, websErrorMsg(code), 
     1509        fmtAlloc(&buf, WEBS_BUFSIZE, msg, websErrorMsg(code),
    15101510                websErrorMsg(code), wp->url, userMsg);
    15111511
     
    15451545        char_t          *buf;
    15461546        int                      rc;
    1547        
     1547
    15481548        a_assert(websValid(wp));
    15491549
     
    15561556                trace(0, T("webs: websWrite lost data, buffer overflow\n"));
    15571557        }
    1558    
     1558
    15591559        va_end(vargs);
    15601560        a_assert(buf);
     
    15691569/*
    15701570 *      Write a block of data of length "nChars" to the user's browser. Public
    1571  *      write block procedure.  If unicode is turned on this function expects 
     1571 *      write block procedure.  If unicode is turned on this function expects
    15721572 *      buf to be a unicode string and it converts it to ASCII before writing.
    1573  *      See websWriteDataNonBlock to always write binary or ASCII data with no 
     1573 *      See websWriteDataNonBlock to always write binary or ASCII data with no
    15741574 *      unicode conversion.  This returns the number of char_t's processed.
    15751575 *      It spins until nChars are flushed to the socket.  For non-blocking
     
    15951595        pBuf = asciiBuf = ballocUniToAsc(buf, nChars);
    15961596
    1597         while (nChars > 0) { 
     1597        while (nChars > 0) {
    15981598#ifdef WEBS_SSL_SUPPORT
    15991599                if (wp->flags & WEBS_SECURE) {
     
    16701670        char_t  *ip,  *op;
    16711671        int             num, i, c;
    1672        
     1672
    16731673        a_assert(decoded);
    16741674        a_assert(token);
     
    17321732      *newLine = '\0';
    17331733   }
    1734    fmtAlloc(&buf, WEBS_MAX_URL + 80, T("%s\t%s\t%s\tcode = %d\n"), 
     1734   fmtAlloc(&buf, WEBS_MAX_URL + 80, T("%s\t%s\t%s\tcode = %d\n"),
    17351735      timeStr, wp->ipaddr, wp->url, code);
    17361736#else
    1737         fmtAlloc(&buf, WEBS_MAX_URL + 80, T("%d %s %d %d\n"), time(0), 
     1737        fmtAlloc(&buf, WEBS_MAX_URL + 80, T("%d %s %d %d\n"), time(0),
    17381738                wp->url, code, wp->written);
    17391739#endif
     
    18291829/*
    18301830 *      If using Keep Alive (HTTP/1.1) we keep the socket open for a period
    1831  *      while waiting for another request on the socket. 
     1831 *      while waiting for another request on the socket.
    18321832 */
    18331833        if (wp->flags & WEBS_KEEP_ALIVE) {
     
    18381838                                ringqFlush(&wp->header);
    18391839                        }
    1840                         socketCreateHandler(wp->sid, SOCKET_READABLE, websSocketEvent, 
     1840                        socketCreateHandler(wp->sid, SOCKET_READABLE, websSocketEvent,
    18411841                                (int) wp);
    18421842                        websTimeoutCancel(wp);
     
    22432243        a_assert(websValid(wp));
    22442244
    2245         if (dir) { 
     2245        if (dir) {
    22462246                tmp = wp->dir;
    22472247                wp->dir = bstrdup(B_L, dir);
     
    23732373#ifdef WEBS_IF_MODIFIED_SUPPORT
    23742374/******************************************************************************/
    2375 /*     
    2376  *      These functions are intended to closely mirror the syntax for HTTP-date 
     2375/*
     2376 *      These functions are intended to closely mirror the syntax for HTTP-date
    23772377 *      from RFC 2616 (HTTP/1.1 spec).  This code was submitted by Pete Bergstrom.
    23782378 */
    23792379
    2380 /*     
     2380/*
    23812381 *      RFC1123Date     = wkday "," SP date1 SP time SP "GMT"
    23822382 *      RFC850Date      = weekday "," SP date2 SP time SP "GMT"
    23832383 *      ASCTimeDate     = wkday SP date3 SP time SP 4DIGIT
    23842384 *
    2385  *      Each of these functions tries to parse the value and update the index to 
     2385 *      Each of these functions tries to parse the value and update the index to
    23862386 *      the point it leaves off parsing.
    23872387 */
     
    23912391
    23922392/******************************************************************************/
    2393 /*     
     2393/*
    23942394 *      Parse an N-digit value
    23952395 */
    23962396
    2397 static int parseNDIGIT(char_t *buf, int digits, int *index) 
     2397static int parseNDIGIT(char_t *buf, int digits, int *index)
    23982398{
    23992399        int tmpIndex, returnValue;
     
    24072407        }
    24082408        *index = tmpIndex;
    2409        
     2409
    24102410        return returnValue;
    24112411}
     
    24162416 */
    24172417
    2418 static int parseMonth(char_t *buf, int *index) 
    2419 {
    2420 /*     
    2421  *      "Jan" | "Feb" | "Mar" | "Apr" | "May" | "Jun" | 
     2418static int parseMonth(char_t *buf, int *index)
     2419{
     2420/*
     2421 *      "Jan" | "Feb" | "Mar" | "Apr" | "May" | "Jun" |
    24222422 *      "Jul" | "Aug" | "Sep" | "Oct" | "Nov" | "Dec"
    24232423 */
     
    24942494
    24952495/******************************************************************************/
    2496 /* 
     2496/*
    24972497 *      Parse a year value (either 2 or 4 digits)
    24982498 */
    24992499
    2500 static int parseYear(char_t *buf, int *index) 
     2500static int parseYear(char_t *buf, int *index)
    25012501{
    25022502        int tmpIndex, returnValue;
     
    25112511                if (returnValue >= 0) {
    25122512/*
    2513  *                      Assume that any year earlier than the start of the 
     2513 *                      Assume that any year earlier than the start of the
    25142514 *                      epoch for time_t (1970) specifies 20xx
    25152515 */
     
    25282528
    25292529/******************************************************************************/
    2530 /* 
    2531  *      The formulas used to build these functions are from "Calendrical Calculations", 
     2530/*
     2531 *      The formulas used to build these functions are from "Calendrical Calculations",
    25322532 *      by Nachum Dershowitz, Edward M. Reingold, Cambridge University Press, 1997.
    25332533 */
     
    25422542 */
    25432543
    2544 int GregorianLeapYearP(long year) 
     2544int GregorianLeapYearP(long year)
    25452545{
    25462546        int             result;
    25472547        long    tmp;
    2548        
     2548
    25492549        tmp = year % 400;
    25502550
     
    25662566 */
    25672567
    2568 long FixedFromGregorian(long month, long day, long year) 
     2568long FixedFromGregorian(long month, long day, long year)
    25692569{
    25702570        long fixedDate;
    25712571
    2572         fixedDate = (long)(GregorianEpoch - 1 + 365 * (year - 1) + 
     2572        fixedDate = (long)(GregorianEpoch - 1 + 365 * (year - 1) +
    25732573                floor((year - 1) / 4.0) -
    2574                 floor((double)(year - 1) / 100.0) + 
    2575                 floor((double)(year - 1) / 400.0) + 
     2574                floor((double)(year - 1) / 100.0) +
     2575                floor((double)(year - 1) / 400.0) +
    25762576                floor((367.0 * ((double)month) - 362.0) / 12.0));
    25772577
     
    25942594 */
    25952595
    2596 long GregorianYearFromFixed(long fixedDate) 
     2596long GregorianYearFromFixed(long fixedDate)
    25972597{
    25982598        long result, d0, n400, d1, n100, d2, n4, d3, n1, d4, year;
     
    26192619
    26202620/******************************************************************************/
    2621 /* 
     2621/*
    26222622 *      Returns the Gregorian date from a fixed date
    26232623 *      (not needed for this use, but included for completeness
     
    26252625
    26262626#if 0
    2627 GregorianFromFixed(long fixedDate, long *month, long *day, long *year) 
     2627GregorianFromFixed(long fixedDate, long *month, long *day, long *year)
    26282628{
    26292629        long priorDays, correction;
     
    26462646
    26472647/******************************************************************************/
    2648 /* 
     2648/*
    26492649 *      Returns the difference between two Gregorian dates
    26502650 */
    26512651
    26522652long GregorianDateDifference(   long month1, long day1, long year1,
    2653                                                                 long month2, long day2, long year2) 
    2654 {
    2655         return FixedFromGregorian(month2, day2, year2) - 
     2653                                                                long month2, long day2, long year2)
     2654{
     2655        return FixedFromGregorian(month2, day2, year2) -
    26562656                FixedFromGregorian(month1, day1, year1);
    26572657}
     
    26652665#define SECONDS_PER_DAY 24*60*60
    26662666
    2667 static int parseTime(char_t *buf, int *index) 
    2668 {
    2669 /*     
     2667static int parseTime(char_t *buf, int *index)
     2668{
     2669/*
    26702670 *      Format of buf is - 2DIGIT ":" 2DIGIT ":" 2DIGIT
    26712671 */
     
    27022702 */
    27032703
    2704 static time_t dateToTimet(int year, int month, int day) 
     2704static time_t dateToTimet(int year, int month, int day)
    27052705{
    27062706        long dayDifference;
    27072707
    2708      /* 
    2709       * Bug fix by Jeff Reeder (Jun 14, 2002): The 'month' parameter is 
    2710       * numbered from  0 (Jan == 0), but FixedFromGregorian() takes 
    2711       * months numbered from 1 (January == 1). We need to add 1 
    2712       * to the month 
     2708     /*
     2709      * Bug fix by Jeff Reeder (Jun 14, 2002): The 'month' parameter is
     2710      * numbered from  0 (Jan == 0), but FixedFromGregorian() takes
     2711      * months numbered from 1 (January == 1). We need to add 1
     2712      * to the month
    27132713      */
    2714         dayDifference = FixedFromGregorian(month + 1, day, year) - 
     2714        dayDifference = FixedFromGregorian(month + 1, day, year) -
    27152715                FixedFromGregorian(1, 1, 1970);
    27162716
     
    27242724 */
    27252725
    2726 static time_t parseDate1or2(char_t *buf, int *index) 
    2727 {
    2728 /*     
     2726static time_t parseDate1or2(char_t *buf, int *index)
     2727{
     2728/*
    27292729 *      Format of buf is either
    27302730 *      2DIGIT SP month SP 4DIGIT
     
    27412741
    27422742        if (buf[tmpIndex] == T(',')) {
    2743 /* 
    2744  *              Skip over the ", " 
    2745  */
    2746                 tmpIndex += 2; 
     2743/*
     2744 *              Skip over the ", "
     2745 */
     2746                tmpIndex += 2;
    27472747
    27482748                dayValue = parseNDIGIT(buf, 2, &tmpIndex);
     
    27512751 *                      Skip over the space or hyphen
    27522752 */
    2753                         tmpIndex++; 
     2753                        tmpIndex++;
    27542754                        monthValue = parseMonth(buf, &tmpIndex);
    27552755                        if (monthValue >= 0) {
     
    27572757 *                              Skip over the space or hyphen
    27582758 */
    2759                                 tmpIndex++; 
     2759                                tmpIndex++;
    27602760                                yearValue = parseYear(buf, &tmpIndex);
    27612761                        }
     
    27662766                        (yearValue >= 0)) {
    27672767                        if (yearValue < 1970) {
    2768 /*                             
    2769  *                              Allow for Microsoft IE's year 1601 dates 
    2770  */
    2771                                 returnValue = 0; 
     2768/*
     2769 *                              Allow for Microsoft IE's year 1601 dates
     2770 */
     2771                                returnValue = 0;
    27722772                        } else {
    27732773                                returnValue = dateToTimet(yearValue, monthValue, dayValue);
     
    27762776                }
    27772777        }
    2778        
     2778
    27792779        return returnValue;
    27802780}
     
    27852785 */
    27862786
    2787 static time_t parseDate3Time(char_t *buf, int *index) 
     2787static time_t parseDate3Time(char_t *buf, int *index)
    27882788{
    27892789/*
     
    28002800        monthValue = parseMonth(buf, &tmpIndex);
    28012801        if (monthValue >= 0) {
    2802 /*             
    2803  *              Skip over the space 
    2804  */
    2805                 tmpIndex++; 
     2802/*
     2803 *              Skip over the space
     2804 */
     2805                tmpIndex++;
    28062806                if (buf[tmpIndex] == T(' ')) {
    28072807/*
    2808  *                      Skip over this space too 
    2809  */
    2810                         tmpIndex++; 
     2808 *                      Skip over this space too
     2809 */
     2810                        tmpIndex++;
    28112811                        dayValue = parseNDIGIT(buf, 1, &tmpIndex);
    28122812                } else {
    28132813                        dayValue = parseNDIGIT(buf, 2, &tmpIndex);
    28142814                }
    2815 /*             
     2815/*
    28162816 *              Now get the time and time SP 4DIGIT
    28172817 */
    28182818                timeValue = parseTime(buf, &tmpIndex);
    28192819                if (timeValue >= 0) {
    2820 /*                     
     2820/*
    28212821 *                      Now grab the 4DIGIT year value
    28222822 */
     
    28322832                *index = tmpIndex;
    28332833        }
    2834        
     2834
    28352835        return returnValue;
    28362836}
     
    28412841 *      Although this looks like a trivial function, I found I was replicating the implementation
    28422842 *      seven times in the parseWeekday function. In the interests of minimizing code size
    2843  *      and redundancy, it is broken out into a separate function. The cost of an extra 
     2843 *      and redundancy, it is broken out into a separate function. The cost of an extra
    28442844 *      function call I can live with given that it should only be called once per HTTP request.
    28452845 */
    28462846
    2847 static int bufferIndexIncrementGivenNTest(char_t *buf, int testIndex, char_t testChar, 
    2848                                                                                   int foundIncrement, int notfoundIncrement) 
     2847static int bufferIndexIncrementGivenNTest(char_t *buf, int testIndex, char_t testChar,
     2848                                                                                  int foundIncrement, int notfoundIncrement)
    28492849{
    28502850        if (buf[testIndex] == testChar) {
     
    28602860 */
    28612861
    2862 static int parseWeekday(char_t *buf, int *index) 
    2863 {
    2864 /*     
     2862static int parseWeekday(char_t *buf, int *index)
     2863{
     2864/*
    28652865 *      Format of buf is either
    28662866 *      "Mon" | "Tue" | "Wed" | "Thu" | "Fri" | "Sat" | "Sun"
     
    29402940                        timeValue = parseTime(cmd, &index);
    29412941                        if (timeValue >= 0) {
    2942 /*                             
     2942/*
    29432943 *                              Now match up that "GMT" string for completeness
    29442944 *                              Compute the final value if there were no problems in the parse
     
    29512951                        }
    29522952                } else {
    2953 /* 
     2953/*
    29542954 *                      Try the other form - wkday SP date3 SP time SP 4DIGIT
    29552955 */
  • cpukit/httpd/webs.h

    r0893220 r0a7278e  
    1 /* 
     1/*
    22 *      webs.h -- GoAhead Web public header
    33 *
     
    1414/******************************** Description *********************************/
    1515
    16 /* 
     16/*
    1717 *      GoAhead Web Server header. This defines the Web public APIs.
    1818 *      Include this header for files that contain ASP or Form procedures.
     
    4646#define CGI_BIN                                 T("cgi-bin")
    4747
    48 /* 
     48/*
    4949 *      Request flags. Also returned by websGetRequestFlags().
    5050 */
    51 #define WEBS_LOCAL_PAGE                 0x1                     /* Request for local webs page */ 
     51#define WEBS_LOCAL_PAGE                 0x1                     /* Request for local webs page */
    5252#define WEBS_KEEP_ALIVE                 0x2                     /* HTTP/1.1 keep alive */
    5353#define WEBS_DONT_USE_CACHE             0x4                     /* Not implemented cache support */
     
    5656#define WEBS_POST_REQUEST               0x20            /* Post request operation */
    5757#define WEBS_LOCAL_REQUEST              0x40            /* Request from this system */
    58 #define WEBS_HOME_PAGE                  0x80            /* Request for the home page */ 
    59 #define WEBS_ASP                                0x100           /* ASP request */ 
     58#define WEBS_HOME_PAGE                  0x80            /* Request for the home page */
     59#define WEBS_ASP                                0x100           /* ASP request */
    6060#define WEBS_HEAD_REQUEST               0x200           /* Head request */
    6161#define WEBS_CLEN                               0x400           /* Request had a content length */
     
    7575#define WEBS_HANDLER_LAST       0x2                     /* Process this handler last */
    7676
    77 /* 
     77/*
    7878 *      Per socket connection webs structure
    7979 */
     
    134134/******************************** Prototypes **********************************/
    135135extern int               websAccept(int sid, char *ipaddr, int port, int listenSid);
    136 extern int               websAspDefine(char_t *name, 
     136extern int               websAspDefine(char_t *name,
    137137                                        int (*fn)(int ejid, webs_t wp, int argc, char_t **argv));
    138138extern int               websAspRequest(webs_t wp, char_t *lpath);
     
    146146extern char_t   *websErrorMsg(int code);
    147147extern void      websFooter(webs_t wp);
    148 extern int               websFormDefine(char_t *name, void (*fn)(webs_t wp, 
     148extern int               websFormDefine(char_t *name, void (*fn)(webs_t wp,
    149149                                        char_t *path, char_t *query));
    150150extern char_t   *websGetDefaultDir(void);
     
    175175extern void              websRedirect(webs_t wp, char_t *url);
    176176extern void      websSecurityDelete(void);
    177 extern int               websSecurityHandler(webs_t wp, char_t *urlPrefix, 
    178                                         char_t *webDir, int arg, char_t *url, char_t *path, 
     177extern int               websSecurityHandler(webs_t wp, char_t *urlPrefix,
     178                                        char_t *webDir, int arg, char_t *url, char_t *path,
    179179                                        char_t *query);
    180180extern void      websSetDefaultDir(char_t *dir);
     
    194194extern int               websTestVar(webs_t wp, char_t *var);
    195195extern void              websTimeoutCancel(webs_t wp);
    196 extern int               websUrlHandlerDefine(char_t *urlPrefix, char_t *webDir, 
    197                                         int arg, int (*fn)(webs_t wp, char_t *urlPrefix, 
    198                                         char_t *webDir, int arg, char_t *url, char_t *path, 
     196extern int               websUrlHandlerDefine(char_t *urlPrefix, char_t *webDir,
     197                                        int arg, int (*fn)(webs_t wp, char_t *urlPrefix,
     198                                        char_t *webDir, int arg, char_t *url, char_t *path,
    199199                                        char_t *query), int flags);
    200200extern int               websUrlHandlerDelete(int (*fn)(webs_t wp, char_t *urlPrefix,
    201                                         char_t *webDir, int arg, char_t *url, char_t *path, 
     201                                        char_t *webDir, int arg, char_t *url, char_t *path,
    202202                                        char_t *query));
    203203extern int               websUrlHandlerRequest(webs_t wp);
    204 extern int               websUrlParse(char_t *url, char_t **buf, char_t **host, 
    205                                         char_t **path, char_t **port, char_t **query, 
     204extern int               websUrlParse(char_t *url, char_t **buf, char_t **host,
     205                                        char_t **path, char_t **port, char_t **query,
    206206                                        char_t **proto, char_t **tag, char_t **ext);
    207207extern char_t   *websUrlType(char_t *webs, char_t *buf, int charCnt);
     
    222222
    223223/*
    224  *      Prototypes for functions available when running as part of the 
     224 *      Prototypes for functions available when running as part of the
    225225 *      GoAhead Embedded Management Framework (EMF)
    226226 */
  • cpukit/httpd/websSSL.c

    r0893220 r0a7278e  
    6666/*************************** Forward Declarations *****************************/
    6767
    68 static int              websSSLSetCertStuff(SSL_CTX *ctx, 
    69                                                                         char *cert_file, 
     68static int              websSSLSetCertStuff(SSL_CTX *ctx,
     69                                                                        char *cert_file,
    7070                                                                        char *key_file);
    7171static int              websSSLVerifyCallback(int ok, X509_STORE_CTX *ctx);
     
    9292        char            *certFile, *keyFile, *CApath, *CAfile;
    9393        SSL_METHOD      *meth;
    94        
     94
    9595/*
    9696 *      Install and initialize the SSL library
    9797 */
    9898        apps_startup();
    99         trace(7, T("SSL: Initializing SSL\n")); 
     99        trace(7, T("SSL: Initializing SSL\n"));
    100100
    101101#ifdef SSLC
     
    118118
    119119        if (sslctx == NULL) {
    120                 trace(2, T("SSL: Unable to create SSL context!\n")); 
     120                trace(2, T("SSL: Unable to create SSL context!\n"));
    121121                return -1;
    122122        }
     
    136136        if ((!SSL_CTX_load_verify_locations(sslctx, CAfile, CApath)) ||
    137137                (!SSL_CTX_set_default_verify_paths(sslctx))) {
    138                 trace(2, T("SSL: Unable to set cert verification locations!\n")); 
     138                trace(2, T("SSL: Unable to set cert verification locations!\n"));
    139139                websSSLClose();
    140140                return -1;
     
    169169 *      Open the socket
    170170 */
    171         sslListenSock = socketOpenConnection(NULL, SSL_PORT, 
     171        sslListenSock = socketOpenConnection(NULL, SSL_PORT,
    172172                websSSLAccept, SOCKET_BLOCK);
    173173
    174174        if (sslListenSock < 0) {
    175                 trace(2, T("SSL: Unable to open SSL socket on port <%d>!\n"), 
     175                trace(2, T("SSL: Unable to open SSL socket on port <%d>!\n"),
    176176                        SSL_PORT);
    177177                return -1;
     
    198198void websSSLClose()
    199199{
    200         trace(7, T("SSL: Closing SSL\n")); 
     200        trace(7, T("SSL: Closing SSL\n"));
    201201
    202202        if (sslctx != NULL) {
     
    246246 *      to know for permitting administrative operations only for local access
    247247 */
    248         if (gstrcmp(wp->ipaddr, T("127.0.0.1")) == 0 || 
    249                         gstrcmp(wp->ipaddr, websIpaddr) == 0 || 
     248        if (gstrcmp(wp->ipaddr, T("127.0.0.1")) == 0 ||
     249                        gstrcmp(wp->ipaddr, websIpaddr) == 0 ||
    250250                        gstrcmp(wp->ipaddr, websHost) == 0) {
    251251                wp->flags |= WEBS_LOCAL_REQUEST;
     
    289289        if (mask & SOCKET_READABLE) {
    290290                websSSLReadEvent(wp);
    291         } 
     291        }
    292292        if (mask & SOCKET_WRITABLE) {
    293293                if (wp->writeSocket) {
    294294                        (*wp->writeSocket)(wp);
    295295                }
    296         } 
     296        }
    297297}
    298298
     
    433433
    434434        if (certFile != NULL) {
    435                 if (SSL_CTX_use_certificate_file(ctx, certFile, 
     435                if (SSL_CTX_use_certificate_file(ctx, certFile,
    436436                        SSL_FILETYPE_PEM) <= 0) {
    437437                        trace(2, T("SSL: Unable to set certificate file <%s>\n"),
    438                                 certFile); 
     438                                certFile);
    439439                        return -1;
    440440                }
     
    446446                if (SSL_CTX_use_PrivateKey_file(ctx, keyFile, SSL_FILETYPE_PEM) <= 0) {
    447447                        trace(2, T("SSL: Unable to set private key file <%s>\n"),
    448                                 keyFile); 
     448                                keyFile);
    449449                        return -1;
    450450                }
    451451
    452 /*             
     452/*
    453453 *              Now we know that a key and cert have been set against
    454  *              the SSL context 
     454 *              the SSL context
    455455 */
    456456                if (!SSL_CTX_check_private_key(ctx)) {
    457457                        trace(2, T("SSL: Check of private key file <%s> FAILED!\n"),
    458                                 keyFile); 
     458                                keyFile);
    459459                        return -1;
    460460                }
     
    478478        }
    479479
    480         if (SSL_CTX_use_certificate_file(sslctx, certFile, 
     480        if (SSL_CTX_use_certificate_file(sslctx, certFile,
    481481                SSL_FILETYPE_PEM) <= 0) {
    482482                return -1;
    483483        }
    484 /*             
     484/*
    485485 *      Confirm that the certificate and the private key jive.
    486486 */
     
    509509                return -1;
    510510        }
    511 /*             
     511/*
    512512 *      Confirm that the certificate and the private key jive.
    513513 */
     
    549549/******************************************************************************/
    550550/*
    551  *      Free SSL resources 
     551 *      Free SSL resources
    552552 */
    553553
     
    558558        }
    559559
    560 /* 
     560/*
    561561 *      Make sure we re-use sessions
    562562 */
     
    585585        if ((wsp == NULL) || (wsp->bio == NULL)) {
    586586                return -1;
    587         } 
     587        }
    588588
    589589        return BIO_eof(wsp->bio);
     
    602602        if ((wsp == NULL) || (wsp->bio == NULL)) {
    603603                return -1;
    604         } 
     604        }
    605605
    606606        return BIO_read(wsp->bio, buf, len);
     
    627627        if ((wsp == NULL) || (wsp->bio == NULL)) {
    628628                return -1;
    629         } 
     629        }
    630630
    631631        while (1) {
     
    634634                        return rc;
    635635                }
    636                
     636
    637637                if (rc == 0) {
    638638/*
     
    656656                } else if (c == '\r') {
    657657                        continue;
    658                 } 
     658                }
    659659/*
    660660 *              Append character to buf
     
    683683        if ((wsp == NULL) || (wsp->bio == NULL)) {
    684684                return -1;
    685         } 
     685        }
    686686
    687687        return BIO_write(wsp->bio, buf, len);
     
    699699        if ((wsp == NULL) || (wsp->bio == NULL)) {
    700700                return -1;
    701         } 
     701        }
    702702
    703703        return BIO_flush(wsp->bio);
  • cpukit/httpd/websSSL.h

    r0893220 r0a7278e  
    1 /* 
     1/*
    22 *      websSSL.h -- SSL Patch header
    33 *
     
    1414/******************************** Description *********************************/
    1515
    16 /* 
    17  *      Header file for the GoAhead Patch for SSL. This defines the interface to 
     16/*
     17 *      Header file for the GoAhead Patch for SSL. This defines the interface to
    1818 *      integrate SSL into the GoAhead Webserver.
    1919 */
  • cpukit/httpd/websda.c

    r0893220 r0a7278e  
    7575/*****************************************************************************/
    7676/*
    77  *      Convenience call to websMD5binary 
     77 *      Convenience call to websMD5binary
    7878 *      (Performs char_t to char conversion and back)
    7979 */
     
    116116/******************************************************************************/
    117117/*
    118  *      Get a Nonce value for passing along to the client.  This function 
    119  *      composes the string "RANDOMKEY:timestamp:myrealm" and 
    120  *      calculates the MD5 digest placing it in output. 
     118 *      Get a Nonce value for passing along to the client.  This function
     119 *      composes the string "RANDOMKEY:timestamp:myrealm" and
     120 *      calculates the MD5 digest placing it in output.
    121121 */
    122122
     
    142142#ifdef DIGEST_ACCESS_SUPPORT
    143143        fmtAlloc(&prenonce, 256, T("%s:%s:%s"), RANDOMKEY, gasctime(newtime),
    144                 wp->realm); 
     144                wp->realm);
    145145#else
    146         fmtAlloc(&prenonce, 256, T("%s:%s:%s"), RANDOMKEY, gasctime(newtime), 
    147                 RANDOMKEY); 
     146        fmtAlloc(&prenonce, 256, T("%s:%s:%s"), RANDOMKEY, gasctime(newtime),
     147                RANDOMKEY);
    148148#endif
    149149        a_assert(prenonce);
     
    219219                fmtAlloc(&preDigest, 255, T("%s:%s:%s"), a1prime, wp->nonce, a2prime);
    220220        } else {
    221                 fmtAlloc(&preDigest, 255, T("%s:%s:%s:%s:%s:%s"), 
    222                         a1prime, 
     221                fmtAlloc(&preDigest, 255, T("%s:%s:%s:%s:%s:%s"),
     222                        a1prime,
    223223                        wp->nonce,
    224224                        wp->nc,
  • cpukit/httpd/websda.h

    r0893220 r0a7278e  
    1 /* 
     1/*
    22 *      websda.h -- GoAhead Digest Access Authentication public header
    33 *
     
    1414/******************************** Description *********************************/
    1515
    16 /* 
    17  *      GoAhead Digest Access Authentication header. This defines the Digest 
    18  *      access authentication public APIs.  Include this header for files that 
     16/*
     17 *      GoAhead Digest Access Authentication header. This defines the Digest
     18 *      access authentication public APIs.  Include this header for files that
    1919 *      use DAA functions
    2020 */
  • cpukit/httpd/websuemf.c

    r0893220 r0a7278e  
    148148        sched_t *s;
    149149
    150         if (sched == NULL || schedid == -1 || schedid >= schedMax || 
     150        if (sched == NULL || schedid == -1 || schedid >= schedMax ||
    151151                (s = sched[schedid]) == NULL) {
    152152                return;
     
    161161        sched_t *s;
    162162
    163         if (sched == NULL || schedid == -1 || schedid >= schedMax || 
     163        if (sched == NULL || schedid == -1 || schedid >= schedMax ||
    164164                (s = sched[schedid]) == NULL) {
    165165                return;
     
    178178        sched_t         *s;
    179179        int                     schedid;
    180         static int      next = 0;       
     180        static int      next = 0;
    181181
    182182/*
     
    207207                if (schedid == next) {
    208208/*
    209  *                      We've gone all the way through the queue without finding 
     209 *                      We've gone all the way through the queue without finding
    210210 *                      anything to do so just return.
    211211 */
  • cpukit/httpd/wsIntrn.h

    r0893220 r0a7278e  
    1 /* 
     1/*
    22 *      wsIntrn.h -- Internal GoAhead Web server header
    33 *
     
    88 * $Id$
    99 */
    10  
     10
    1111#ifndef _h_WEBS_INTERNAL
    1212#define _h_WEBS_INTERNAL 1
     
    1414/******************************** Description *********************************/
    1515
    16 /* 
     16/*
    1717 *      Internal GoAhead Web Server header. This defines the Web private APIs
    1818 *      Include this header when you want to create URL handlers.
     
    2222
    2323/*
    24  *      Define this to enable logging of web accesses to a file 
     24 *      Define this to enable logging of web accesses to a file
    2525 *              #define WEBS_LOG_SUPPORT 1
    2626 *
     
    130130
    131131/********************************** Defines ***********************************/
    132 /* 
     132/*
    133133 *      Read handler flags and state
    134134 */
     
    148148 *      URL handler structure. Stores the leading URL path and the handler
    149149 *      function to call when the URL path is seen.
    150  */ 
    151 typedef struct {
    152         int             (*handler)(webs_t wp, char_t *urlPrefix, char_t *webDir, int arg, 
    153                         char_t *url, char_t *path, 
     150 */
     151typedef struct {
     152        int             (*handler)(webs_t wp, char_t *urlPrefix, char_t *webDir, int arg,
     153                        char_t *url, char_t *path,
    154154                        char_t *query);                                 /* Callback URL handler function */
    155155        char_t  *webDir;                                                /* Web directory if required */
     
    160160} websUrlHandlerType;
    161161
    162 /* 
     162/*
    163163 *      Webs statistics
    164164 */
     
    180180extern websStatsType websStats;                         /* Web access stats */
    181181
    182 /* 
     182/*
    183183 *      Error code list
    184184 */
     
    188188} websErrorType;
    189189
    190 /* 
     190/*
    191191 *      Mime type list
    192192 */
     
    245245extern int               websAspWrite(int ejid, webs_t wp, int argc, char_t **argv);
    246246extern void      websDefaultClose(void);
    247 extern int               websDefaultHandler(webs_t wp, char_t *urlPrefix, 
    248                                         char_t *webDir, int arg, char_t *url, char_t *path, 
     247extern int               websDefaultHandler(webs_t wp, char_t *urlPrefix,
     248                                        char_t *webDir, int arg, char_t *url, char_t *path,
    249249                                        char_t *query);
    250250extern int               websFormHandler(webs_t wp, char_t *urlPrefix, char_t *webDir,
     
    259259                                        char_t **envp, char_t *stdIn, char_t *stdOut);
    260260extern int               websOpen(int sid);
    261 extern void      websResponse(webs_t wp, int code, char_t *msg, 
     261extern void      websResponse(webs_t wp, int code, char_t *msg,
    262262                                        char_t *redirect);
    263263extern int               websJavaScriptEval(webs_t wp, char_t *script);
     
    277277extern int               websRomPageStat(char_t *path, websStatType *sbuf);
    278278extern long              websRomPageSeek(webs_t wp, long offset, int origin);
    279 extern void      websSetRequestSocketHandler(webs_t wp, int mask, 
     279extern void      websSetRequestSocketHandler(webs_t wp, int mask,
    280280                                        void (*fn)(webs_t wp));
    281281extern int               websSolutionHandler(webs_t wp, char_t *urlPrefix,
    282                                         char_t *webDir, int arg, char_t *url, char_t *path, 
     282                                        char_t *webDir, int arg, char_t *url, char_t *path,
    283283                                        char_t *query);
    284284extern void      websUrlHandlerClose(void);
     
    291291
    292292/*
    293  *      Prototypes for functions available when running as part of the 
     293 *      Prototypes for functions available when running as part of the
    294294 *      GoAhead Embedded Management Framework (EMF)
    295295 */
  • cpukit/libfs/src/devfs/devfs.h

    r0893220 r0a7278e  
    1 /** 
     1/**
    22*  @file  libfs/devfs/devfs.h
    33*
     
    1919 */
    2020
    21 typedef struct 
     21typedef struct
    2222{
    2323  /** This member points to device name which is a null-terminated string */
     
    4545/**
    4646 *  The following defines the device table size. This values
    47  *  is configured during application configuration time by 
     47 *  is configured during application configuration time by
    4848 *  the user. The default value is set to 4.
    4949 */
     
    5757 */
    5858
    59 extern rtems_filesystem_operations_table devFS_ops; 
     59extern rtems_filesystem_operations_table devFS_ops;
    6060
    6161/**
     
    6464 */
    6565
    66 extern rtems_filesystem_file_handlers_r  devFS_file_handlers; 
     66extern rtems_filesystem_file_handlers_r  devFS_file_handlers;
    6767
    6868
     
    7070 *  This handler maps open operation to rtems_io_open.
    7171 *  @param iop This is the RTEMS's internal representation of file.
    72  *  @param pathname a null-terminated string that starts with /dev. 
     72 *  @param pathname a null-terminated string that starts with /dev.
    7373 *  @param flag access flags
    7474 *  @param mode access mode
     
    167167/**
    168168 *  This routine is invoked upon determination of a node type.
    169  *  Since this is a device-only filesystem, so there is only 
     169 *  Since this is a device-only filesystem, so there is only
    170170 *  one node type in the system.
    171  * 
    172  *  @param pathloc contains filesytem access information, this 
     171 *
     172 *  @param pathloc contains filesytem access information, this
    173173 *         parameter is ignored
    174174 *  @retval always returns RTEMS_FILESYSTEM_DEVICE
     
    183183/**
    184184 *  This routine is invoked to determine if 'pathname' exists.
    185  *  This routine first check access flags, then it searches 
     185 *  This routine first check access flags, then it searches
    186186 *  the device table to get the information.
    187  * 
     187 *
    188188 *  @param pathname device name to be searched
    189189 *  @param flags access flags
    190190 *  @param pathloc contains filesystem access information
    191  *  @retval upon success(pathname exists), this routines 
    192  *  returns 0; if 'flag' is invalid, it returns -1 and errno 
     191 *  @retval upon success(pathname exists), this routines
     192 *  returns 0; if 'flag' is invalid, it returns -1 and errno
    193193 *  is set to EIO; otherwise, it returns -1 and errno is set to ENOENT
    194194 */
     
    203203
    204204/**
    205  *  This routine is given a path to evaluate and a valid start 
     205 *  This routine is given a path to evaluate and a valid start
    206206 *  location. It is responsible for finding the parent node for
    207207 *  a requested make command, setting pathloc information to
    208  *  identify the parent node, and setting the name pointer to 
    209  *  the first character of the name of the new node. In device 
     208 *  identify the parent node, and setting the name pointer to
     209 *  the first character of the name of the new node. In device
    210210 *  only filesystem, devices do not has a tree hierarchy, there
    211  *  are no parent-child relationship. So this routine is rather 
     211 *  are no parent-child relationship. So this routine is rather
    212212 *  simple, it just set *name to path and returns
    213213 *
    214214 *  @param path device path to be evaluated
    215  *  @param pathloc contains filesystem access information, this 
     215 *  @param pathloc contains filesystem access information, this
    216216 *         parameter is ignored
    217  *  @param name 
     217 *  @param name
    218218 *  @retval always returns 0
    219219 */
     
    229229/**
    230230 *  This routine is invoked upon registration of a new device
    231  *  file. It is responsible for creating a item in the main 
    232  *  device table. This routine searches the device table in 
    233  *  sequential order, when found a empty slot, it fills the slot 
     231 *  file. It is responsible for creating a item in the main
     232 *  device table. This routine searches the device table in
     233 *  sequential order, when found a empty slot, it fills the slot
    234234 *  with proper values.
    235235 *
     
    240240 *  @retval upon success, this routine returns 0; if 'path'
    241241 *  already exist, it returns -1 and errno is set to EEXIST;
    242  *  if device table is full, it returns -1 and errno is set 
     242 *  if device table is full, it returns -1 and errno is set
    243243 *  to ENOMEM
    244244 */
     
    246246extern int devFS_mknod(
    247247   const char                        *path,
    248    mode_t                             mode, 
    249    dev_t                              dev, 
    250    rtems_filesystem_location_info_t  *pathloc 
     248   mode_t                             mode,
     249   dev_t                              dev,
     250   rtems_filesystem_location_info_t  *pathloc
    251251);
    252252
     
    257257 *  initializing it to a known state, and set device file operation
    258258 *  handlers. After this, the device-only filesytem is ready for use
    259  * 
     259 *
    260260 *  @param  temp_mt_entry
    261261 *  @retval upon success, this routine returns 0; otherwise it returns
    262  *  -1 and errno is set to proper value. The only error is when malloc 
     262 *  -1 and errno is set to proper value. The only error is when malloc
    263263 *  failed, and errno is set to NOMEM.
    264264 */
     
    273273 *  prints out their detail information. For example, on one system,
    274274 *  devFS_show will print out following message:
    275  * 
     275 *
    276276 *  /dev/console     0  0
    277277 *  /dev/clock       1  0
    278278 *  /dev/tty0        0  0
    279279 *  /flash           2  0
    280  * 
    281  *  This routine is intended for debugging, and can be used by shell 
     280 *
     281 *  This routine is intended for debugging, and can be used by shell
    282282 *  program to provide user with the system information.
    283  * 
     283 *
    284284 *  @param  none
    285285 *  @retval 0
  • cpukit/libfs/src/devfs/devfs_init.c

    r0893220 r0a7278e  
    1717#include "devfs.h"
    1818
    19 rtems_filesystem_operations_table devFS_ops = 
     19rtems_filesystem_operations_table devFS_ops =
    2020{
    2121    devFS_evaluate_path,
     
    3939
    4040
    41 rtems_filesystem_file_handlers_r devFS_file_handlers = 
     41rtems_filesystem_file_handlers_r devFS_file_handlers =
    4242{
    4343    devFS_open,
     
    7575
    7676  memset(
    77     device_name_table, 0, 
     77    device_name_table, 0,
    7878    sizeof( rtems_device_name_t ) * ( rtems_device_table_size )
    7979    );
  • cpukit/libfs/src/devfs/devfs_mknod.c

    r0893220 r0a7278e  
    2323int devFS_mknod(
    2424  const char                        *path,
    25   mode_t                             mode, 
    26   dev_t                              dev, 
    27   rtems_filesystem_location_info_t  *pathloc 
     25  mode_t                             mode,
     26  dev_t                              dev,
     27  rtems_filesystem_location_info_t  *pathloc
    2828)
    2929{
     
    3636
    3737  /*
    38    * This is a special case. In rtems_filesystem_initialize, 
    39    * a special device '/dev' will be created. We check this 
    40    * condition and do not create the '/dev' and the 'path' 
     38   * This is a special case. In rtems_filesystem_initialize,
     39   * a special device '/dev' will be created. We check this
     40   * condition and do not create the '/dev' and the 'path'
    4141   * actually passed in is 'dev', not '/dev'. Just return 0 to
    4242   * indicate we are OK.
    4343   */
    4444
    45   if ((path[0] == 'd') && (path[1] == 'e') && 
     45  if ((path[0] == 'd') && (path[1] == 'e') &&
    4646      (path[2] == 'v') && (path[3] == '\0'))
    4747      return 0;
  • cpukit/libfs/src/devfs/devfs_node_type.c

    r0893220 r0a7278e  
    1818{
    1919  /*
    20    * There is only one type of node: device 
     20   * There is only one type of node: device
    2121   */
    2222
  • cpukit/libfs/src/devfs/devfs_show.c

    r0893220 r0a7278e  
    2727  for (i = 0; i < rtems_device_table_size; i++){
    2828    if (device_name_table[i].device_name){
    29         printk("/%s %d %d\n", device_name_table[i].device_name, 
     29        printk("/%s %d %d\n", device_name_table[i].device_name,
    3030            device_name_table[i].major, device_name_table[i].minor);
    3131    }
  • cpukit/libfs/src/dosfs/dosfs.h

    r0893220 r0a7278e  
    44 *  Application interface to MSDOS filesystem.
    55 */
    6  
     6
    77/*
    88 *  Copyright (C) 2001 OKTET Ltd., St.-Petersburg, Russia
     
    1515 *  @(#) $Id$
    1616 */
    17  
     17
    1818#ifndef _RTEMS_DOSFS_H
    1919#define _RTEMS_DOSFS_H
  • cpukit/libfs/src/dosfs/fat.c

    r0893220 r0a7278e  
    282282    return fat_buf_release(fs_info);
    283283}
    284    
     284
    285285/* fat_cluster_read --
    286286 *     wrapper for reading a whole cluster at once
     
    399399    /* Evaluate boot record */
    400400    vol->bps = FAT_GET_BR_BYTES_PER_SECTOR(boot_rec);
    401  
    402     if ( (vol->bps != 512)  && 
    403          (vol->bps != 1024) && 
     401
     402    if ( (vol->bps != 512)  &&
     403         (vol->bps != 1024) &&
    404404         (vol->bps != 2048) &&
    405405         (vol->bps != 4096))
     
    444444
    445445    vol->rdir_entrs = FAT_GET_BR_FILES_PER_ROOT_DIR(boot_rec);
    446    
     446
    447447    /* calculate the count of sectors occupied by the root directory */
    448448    vol->rdir_secs = ((vol->rdir_entrs * FAT_DIRENTRY_SIZE) + (vol->bps - 1)) /
     
    455455    else
    456456        vol->fat_length = FAT_GET_BR_SECTORS_PER_FAT32(boot_rec);
    457  
    458     vol->data_fsec = vol->fat_loc + vol->fats * vol->fat_length + 
     457
     458    vol->data_fsec = vol->fat_loc + vol->fats * vol->fat_length +
    459459                     vol->rdir_secs;
    460460
    461461    /* for  FAT12/16 root dir starts at(sector) */
    462462    vol->rdir_loc = vol->fat_loc + vol->fats * vol->fat_length;
    463  
     463
    464464    if ( (FAT_GET_BR_TOTAL_SECTORS_NUM16(boot_rec)) != 0)
    465465        vol->tot_secs = FAT_GET_BR_TOTAL_SECTORS_NUM16(boot_rec);
    466466    else
    467467        vol->tot_secs = FAT_GET_BR_TOTAL_SECTORS_NUM32(boot_rec);
    468  
     468
    469469    data_secs = vol->tot_secs - vol->data_fsec;
    470470
     
    497497    {
    498498        vol->rdir_cl = FAT_GET_BR_FAT32_ROOT_CLUSTER(boot_rec);
    499      
     499
    500500        vol->mirror = FAT_GET_BR_EXT_FLAGS(boot_rec) & FAT_BR_EXT_FLAGS_MIRROR;
    501501        if (vol->mirror)
     
    518518                rtems_disk_release(vol->dd);
    519519                return -1;
    520             }   
    521      
    522             if (FAT_GET_FSINFO_LEAD_SIGNATURE(fs_info_sector) != 
     520            }
     521
     522            if (FAT_GET_FSINFO_LEAD_SIGNATURE(fs_info_sector) !=
    523523                FAT_FSINFO_LEAD_SIGNATURE_VALUE)
    524524            {
     
    536536                    rtems_disk_release(vol->dd);
    537537                    return -1;
    538                 }   
    539                    
     538                }
     539
    540540                vol->free_cls = FAT_GET_FSINFO_FREE_CLUSTER_COUNT(fs_info_sector);
    541541                vol->next_cl = FAT_GET_FSINFO_NEXT_FREE_CLUSTER(fs_info_sector);
    542                 rc = fat_fat32_update_fsinfo_sector(mt_entry, 0xFFFFFFFF, 
     542                rc = fat_fat32_update_fsinfo_sector(mt_entry, 0xFFFFFFFF,
    543543                                                    0xFFFFFFFF);
    544544                if ( rc != RC_OK )
  • cpukit/libfs/src/dosfs/fat.h

    r0893220 r0a7278e  
    5151#    define CT_LE_W(v) CPU_swap_u16((uint16_t)(v))
    5252#    define CT_LE_L(v) CPU_swap_u32((uint32_t)(v))
    53 #else 
     53#else
    5454#    define CF_LE_W(v) (v)
    5555#    define CF_LE_L(v) (v)
     
    104104#define FAT_GET_ADDR(x, ofs)       ((uint8_t *)(x) + (ofs))
    105105
    106 #define FAT_GET_VAL8(x, ofs)       (uint8_t)(*((uint8_t *)(x) + (ofs))) 
     106#define FAT_GET_VAL8(x, ofs)       (uint8_t)(*((uint8_t *)(x) + (ofs)))
    107107
    108108#define FAT_GET_VAL16(x, ofs)                               \
     
    115115                  ((uint32_t)(*((uint8_t *)(x) + (ofs) + 2)) << 16) | \
    116116                  ((uint32_t)(*((uint8_t *)(x) + (ofs) + 3)) << 24) )
    117                    
     117
    118118#define FAT_SET_VAL8(x, ofs,val)                    \
    119119                 (*((uint8_t *)(x)+(ofs))=(uint8_t)(val))
    120  
     120
    121121#define FAT_SET_VAL16(x, ofs,val) do {              \
    122122                 FAT_SET_VAL8((x),(ofs),(val));     \
     
    140140#define FAT_SET_BR_BYTES_PER_SECTOR(x,val)   FAT_SET_VAL16(x, 11,val)
    141141
    142 #define FAT_GET_BR_SECTORS_PER_CLUSTER(x)    FAT_GET_VAL8( x, 13) 
    143 #define FAT_SET_BR_SECTORS_PER_CLUSTER(x,val)FAT_SET_VAL8( x, 13,val) 
     142#define FAT_GET_BR_SECTORS_PER_CLUSTER(x)    FAT_GET_VAL8( x, 13)
     143#define FAT_SET_BR_SECTORS_PER_CLUSTER(x,val)FAT_SET_VAL8( x, 13,val)
    144144
    145145#define FAT_GET_BR_RESERVED_SECTORS_NUM(x)   FAT_GET_VAL16(x, 14)
     
    155155#define FAT_SET_BR_TOTAL_SECTORS_NUM16(x,val)FAT_SET_VAL16(x, 19,val)
    156156
    157 #define FAT_GET_BR_MEDIA(x)                  FAT_GET_VAL8( x, 21) 
    158 #define FAT_SET_BR_MEDIA(x,val)              FAT_SET_VAL8( x, 21,val) 
     157#define FAT_GET_BR_MEDIA(x)                  FAT_GET_VAL8( x, 21)
     158#define FAT_SET_BR_MEDIA(x,val)              FAT_SET_VAL8( x, 21,val)
    159159
    160160#define FAT_GET_BR_SECTORS_PER_FAT(x)        FAT_GET_VAL16(x, 22)
     
    252252#define FAT_SET_FSINFO_TRAIL_SIGNATURE(x,val) FAT_SET_VAL32(x,508,val)
    253253#define FAT_FSINFO_TRAIL_SIGNATURE_VALUE  (0xAA550000)
    254 /* 
    255  * I read FSInfo sector from offset 484 to access the information, so offsets 
     254/*
     255 * I read FSInfo sector from offset 484 to access the information, so offsets
    256256 * of these fields a relative
    257257 */
  • cpukit/libfs/src/dosfs/fat_file.c

    r0893220 r0a7278e  
    116116
    117117    memset(lfat_fd, 0, sizeof(fat_file_fd_t));
    118    
     118
    119119    lfat_fd->links_num = 1;
    120120    lfat_fd->flags &= ~FAT_FILE_REMOVED;
     
    585585
    586586    fat_fd->fat_file_size = new_length;
    587    
     587
    588588    return RC_OK;
    589589}
  • cpukit/libfs/src/dosfs/msdos_conv.c

    r0893220 r0a7278e  
    275275                unlen--;
    276276        }
    277  
     277
    278278        /*
    279279         * Copy the unix filename into the dos filename string upto the end
  • cpukit/libfs/src/dosfs/msdos_create.c

    r0893220 r0a7278e  
    8181
    8282    fat_dir_pos_init(&dir_pos);
    83    
     83
    8484    memset(short_node, 0, MSDOS_DIRECTORY_ENTRY_STRUCT_SIZE);
    8585    memset(dot_dotdot, 0, MSDOS_DIRECTORY_ENTRY_STRUCT_SIZE * 2);
  • cpukit/libfs/src/dosfs/msdos_dir.c

    r0893220 r0a7278e  
    1515#endif
    1616
    17 #include <ctype.h> 
     17#include <ctype.h>
    1818#include <stdlib.h>
    1919#include <unistd.h>
     
    259259        {
    260260            char* entry = (char*) fs_info->cl_buf + i;
    261            
     261
    262262            /*
    263263             * Is this directory from here on empty ?
     
    289289                char* p;
    290290                int   q;
    291                
     291
    292292                /*
    293293                 * Is this is the first entry of a LFN ?
     
    307307                    lfn_start =
    308308                      ((j * bts2rd) + i) / MSDOS_DIRECTORY_ENTRY_STRUCT_SIZE;
    309                    
     309
    310310                    /*
    311311                     * Get the number of entries so we can count down and
     
    331331                    continue;
    332332                }
    333              
     333
    334334                /*
    335335                 * Extract the file name into the directory entry. The data is
     
    341341                 * fit in the directory entry name field.
    342342                 */
    343                
     343
    344344                lfn_entries--;
    345345                p = entry + 1;
    346346                o = lfn_entries * MSDOS_LFN_LEN_PER_ENTRY;
    347                
     347
    348348                for (q = 0; q < MSDOS_LFN_LEN_PER_ENTRY; q++)
    349349                {
    350350                    if (o >= (sizeof(tmp_dirent.d_name) - 1))
    351351                        break;
    352                        
     352
    353353                    tmp_dirent.d_name[o++] = *p;
    354354
     
    373373            {
    374374                fat_dir_pos_t dir_pos;
    375              
     375
    376376                /*
    377377                 * Skip active entries until get the entry to start from.
     
    447447                    tmp_dirent.d_namlen = strlen(tmp_dirent.d_name);
    448448                }
    449                
     449
    450450                memcpy(buffer + cmpltd, &tmp_dirent, sizeof(struct dirent));
    451451
     
    462462                }
    463463            }
    464            
     464
    465465            if (count <= 0)
    466466                break;
  • cpukit/libfs/src/dosfs/msdos_format.c

    r0893220 r0a7278e  
    181181  uint32_t total_sectors = sector_cnt;
    182182  int last_percent = -1;
    183  
     183
    184184  /*
    185185   * allocate and fill buffer
     
    201201   * write to consecutive sectors
    202202   */
    203   while ((ret_val == 0) && 
     203  while ((ret_val == 0) &&
    204204         (sector_cnt > 0)) {
    205205    int percent = (sector_cnt * 100) / total_sectors;
     
    213213    sector_cnt--;
    214214  }
    215  
     215
    216216  msdos_format_printf (rqdata, MSDOS_FMT_INFO_LEVEL_DETAIL, "\n");
    217217
     
    219219    msdos_format_printf (rqdata, MSDOS_FMT_INFO_LEVEL_INFO,
    220220                         "filling error on sector: %d\n", start_sector);
    221  
     221
    222222  /*
    223223   * cleanup
     
    302302    sectors_per_cluster /= 2;
    303303  }
    304  
     304
    305305  do {
    306306    /*
     
    321321    }
    322322
    323     sectors_per_fat = ((fat_capacity 
     323    sectors_per_fat = ((fat_capacity
    324324                        + (bytes_per_sector - 1))
    325325                       / bytes_per_sector);
     
    342342     * when maximum cluster size is exceeded, we have invalid data, abort...
    343343     */
    344     if ((sectors_per_cluster * bytes_per_sector) 
     344    if ((sectors_per_cluster * bytes_per_sector)
    345345        > MS_BYTES_PER_CLUSTER_LIMIT) {
    346346      ret_val = EINVAL;
     
    385385  uint32_t sectors_per_cluster_adj = 0;
    386386  uint64_t total_size = 0;
    387  
     387
    388388  memset(fmt_params,0,sizeof(*fmt_params));
    389   /* 
     389  /*
    390390   * this one is fixed in this implementation.
    391391   * At least one thing we don't have to magically guess...
     
    403403   */
    404404  if (ret_val == 0) {
    405     if ((rqdata == NULL) || 
     405    if ((rqdata == NULL) ||
    406406        (rqdata->fat_num == 0)) {
    407407      fmt_params->fat_num = 2;
     
    414414    }
    415415  }
    416  
     416
    417417  if (ret_val == 0)
    418418    msdos_format_printf (rqdata, MSDOS_FMT_INFO_LEVEL_DETAIL,
    419419                         "number of fats: %d\n", fmt_params->fat_num);
    420  
     420
    421421  /*
    422422   * Now we get sort of a loop when determining things:
    423    * The FAT type (FAT12/16/32) is determined ONLY from the 
     423   * The FAT type (FAT12/16/32) is determined ONLY from the
    424424   * data cluster count:
    425425   * Disks with data cluster count <  4085 are FAT12.
    426426   * Disks with data cluster count < 65525 are FAT16.
    427    * The rest is FAT32 (no FAT128 available yet :-) 
     427   * The rest is FAT32 (no FAT128 available yet :-)
    428428   *
    429    * The number of data clusters is the 
    430    * total capacity 
     429   * The number of data clusters is the
     430   * total capacity
    431431   * minus reserved sectors
    432432   * minus root directory ares
    433433   * minus storage needed for the FAT (and its copy/copies).
    434    * 
     434   *
    435435   * The last item once again depends on the FAT type and the cluster count.
    436    * 
     436   *
    437437   * So here is what we do in this formatter:
    438438   * - If a FAT type is requested from the caller, we try to modify
    439439   * the cluster size, until the data cluster count is in range
    440    * - If no FAT type is given, we estimate a useful FAT type from 
     440   * - If no FAT type is given, we estimate a useful FAT type from
    441441   * the disk capacity and then adapt the cluster size
    442    */ 
     442   */
    443443
    444444  /*
     
    451451  /*
    452452   * determine FAT type and sectors per cluster
    453    * depends on 
     453   * depends on
    454454   */
    455455  if (ret_val == 0) {
    456456    fmt_params->sectors_per_cluster = 1;
    457     if ((rqdata != NULL) && 
     457    if ((rqdata != NULL) &&
    458458        (rqdata->fattype == MSDOS_FMT_FAT12)) {
    459459      fmt_params->fattype = FAT_FAT12;
    460460    }
    461     else if ((rqdata != NULL) && 
     461    else if ((rqdata != NULL) &&
    462462             (rqdata->fattype == MSDOS_FMT_FAT16)) {
    463463      fmt_params->fattype = FAT_FAT16;
    464464    }
    465     else if ((rqdata != NULL) && 
     465    else if ((rqdata != NULL) &&
    466466             (rqdata->fattype == MSDOS_FMT_FAT32)) {
    467467      fmt_params->fattype = FAT_FAT32;
     
    478478       * are a compromise concerning capacity and efficency
    479479       */
    480       if (fmt_params->totl_sector_cnt 
     480      if (fmt_params->totl_sector_cnt
    481481          < ((uint32_t)FAT_FAT12_MAX_CLN)*8) {
    482482        fmt_params->fattype = FAT_FAT12;
    483483        /* start trying with small clusters */
    484         fmt_params->sectors_per_cluster = 2; 
     484        fmt_params->sectors_per_cluster = 2;
    485485      }
    486       else if (fmt_params->totl_sector_cnt 
     486      else if (fmt_params->totl_sector_cnt
    487487               < ((uint32_t)FAT_FAT16_MAX_CLN)*32) {
    488488        fmt_params->fattype = FAT_FAT16;
    489489        /* start trying with small clusters */
    490         fmt_params->sectors_per_cluster = 2; 
     490        fmt_params->sectors_per_cluster = 2;
    491491      }
    492492      else {
     
    505505     * try to use user r