Changeset 5c5117c in mainline


Ignore:
Timestamp:
2011-06-20T02:42:01Z (13 years ago)
Author:
Petr Koupy <petr.koupy@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
79506d6
Parents:
f3a605be (diff), b4d6252 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge libposix changes.

Location:
uspace/lib/posix
Files:
7 added
14 edited
1 moved

Legend:

Unmodified
Added
Removed
  • uspace/lib/posix/Makefile

    rf3a605be r5c5117c  
    4343        stdio.c \
    4444        stdlib.c \
     45        stdlib/strtold.c \
    4546        string.c \
    4647        strings.c \
  • uspace/lib/posix/fcntl.c

    rf3a605be r5c5117c  
    3535#define LIBPOSIX_INTERNAL
    3636
    37 #include "common.h"
     37#include "internal/common.h"
    3838#include "fcntl.h"
    3939
  • uspace/lib/posix/fnmatch.c

    rf3a605be r5c5117c  
    3535#define LIBPOSIX_INTERNAL
    3636
    37 #include "common.h"
     37#include "internal/common.h"
    3838#include "fnmatch.h"
    3939
  • uspace/lib/posix/getopt.c

    rf3a605be r5c5117c  
    3535#define LIBPOSIX_INTERNAL
    3636
    37 #include "common.h"
     37#include "internal/common.h"
    3838#include "getopt.h"
    3939
  • uspace/lib/posix/stdio.c

    rf3a605be r5c5117c  
    3939#include <errno.h>
    4040
    41 #include "common.h"
     41#include "internal/common.h"
    4242#include "stdio.h"
    4343#include "string.h"
  • uspace/lib/posix/stdlib.c

    rf3a605be r5c5117c  
    3737
    3838#include "stdlib.h"
    39 #include "common.h"
     39#include "internal/common.h"
    4040
    4141/**
     
    7777
    7878/**
    79  *
     79 * Converts a string representation of a floating-point number to
     80 * its native representation. See posix_strtold().
     81 *
    8082 * @param nptr
    8183 * @param endptr
     
    8486float posix_strtof(const char *restrict nptr, char **restrict endptr)
    8587{
    86         // TODO
    87         not_implemented();
     88        return (float) posix_strtold(nptr, endptr);
    8889}
    8990
    9091/**
    91  *
     92 * Converts a string representation of a floating-point number to
     93 * its native representation. See posix_strtold().
     94 *
    9295 * @param nptr
    9396 * @param endptr
     
    9699double posix_strtod(const char *restrict nptr, char **restrict endptr)
    97100{
    98         // TODO
    99         not_implemented();
    100 }
    101 
    102 /**
    103  *
    104  * @param nptr
    105  * @param endptr
    106  * @return
    107  */
    108 long double posix_strtold(const char *restrict nptr, char **restrict endptr)
    109 {
    110         // TODO
    111         not_implemented();
     101        return (double) posix_strtold(nptr, endptr);
    112102}
    113103
  • uspace/lib/posix/string.h

    rf3a605be r5c5117c  
    102102extern size_t posix_strnlen(const char *s, size_t n);
    103103
     104/* Legacy declarations */
     105extern int posix_ffs(int i);
     106
    104107#ifndef LIBPOSIX_INTERNAL
    105108        #define strcpy posix_strcpy
     
    134137        #define strlen posix_strlen
    135138        #define strnlen posix_strnlen
     139
     140        #define ffs posix_ffs
    136141#endif
    137142
  • uspace/lib/posix/strings.c

    rf3a605be r5c5117c  
    3636#define LIBPOSIX_INTERNAL
    3737
    38 #include "common.h"
     38#include "internal/common.h"
    3939#include "strings.h"
    4040#include "string.h"
     41#include "ctype.h"
    4142
    4243/**
     
    5960int posix_strcasecmp(const char *s1, const char *s2)
    6061{
    61         // TODO
    62         not_implemented();
     62        return posix_strncasecmp(s1, s2, STR_NO_LIMIT);
    6363}
    6464
     
    7272int posix_strncasecmp(const char *s1, const char *s2, size_t n)
    7373{
    74         // TODO
    75         not_implemented();
     74        for (size_t i = 0; i < n; ++i) {
     75                int cmp = tolower(s1[i]) - tolower(s2[i]);
     76                if (cmp != 0) {
     77                        return cmp;
     78                }
     79               
     80                if (s1[i] == 0) {
     81                        return 0;
     82                }
     83        }
     84       
     85        return 0;
    7686}
    7787
  • uspace/lib/posix/sys/stat.c

    rf3a605be r5c5117c  
    3737
    3838#include "stat.h"
    39 #include "../common.h"
     39#include "../internal/common.h"
    4040#include <mem.h>
    4141
  • uspace/lib/posix/sys/stat.h

    rf3a605be r5c5117c  
    4040#include "types.h"
    4141#include "../time.h"
     42#include <ipc/devmap.h>
     43#include <task.h>
     44
     45typedef devmap_handle_t posix_dev_t;
     46typedef task_id_t posix_pid_t;
    4247
    4348/* values are the same as on Linux */
     
    134139
    135140#ifndef LIBPOSIX_INTERNAL
     141        #define dev_t posix_dev_t
     142        #define pid_t posix_pid_t
    136143        #define fstat posix_fstat
    137144        #define lstat posix_lstat
  • uspace/lib/posix/sys/types.h

    rf3a605be r5c5117c  
    3838
    3939#include "../libc/sys/types.h"
    40 #include <ipc/devmap.h>
    41 #include <task.h>
    4240
    43 typedef task_id_t posix_pid_t;
    44 typedef devmap_handle_t posix_dev_t;
    4541typedef unsigned int posix_ino_t;
    4642typedef unsigned int posix_nlink_t;
     
    5248
    5349#ifndef LIBPOSIX_INTERNAL
    54         #define pid_t posix_pid_t
    55         #define dev_t posix_dev_t
     50        #define ino_t posix_ino_t
    5651        #define nlink_t posix_nlink_t
    5752        #define uid_t posix_uid_t
  • uspace/lib/posix/time.c

    rf3a605be r5c5117c  
    3636#define LIBPOSIX_INTERNAL
    3737
    38 #include "common.h"
     38#include "internal/common.h"
    3939#include "time.h"
    4040
  • uspace/lib/posix/unistd.c

    rf3a605be r5c5117c  
    3636#define LIBPOSIX_INTERNAL
    3737
    38 #include "common.h"
     38#include "internal/common.h"
    3939#include "unistd.h"
     40
     41/* Array of environment variable strings (NAME=VALUE). */
     42char **environ = NULL;
    4043
    4144/**
  • uspace/lib/posix/unistd.h

    rf3a605be r5c5117c  
    4848extern int getopt(int, char * const [], const char *);
    4949
     50/* Environmental Variables */
     51extern char **posix_environ;
     52
    5053/* Identifying Terminals */
    5154extern int posix_isatty(int fd);
     
    8588
    8689#ifndef LIBPOSIX_INTERNAL
     90        #define environ posix_environ
     91
    8792        #define isatty posix_isatty
    8893
Note: See TracChangeset for help on using the changeset viewer.