Changeset bc417660 in mainline
- Timestamp:
- 2019-02-23T16:28:16Z (6 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- ab87db5
- Parents:
- 098e16a5 (diff), 76ec309b (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. - Location:
- uspace
- Files:
-
- 7 added
- 7 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/df/df.c
r098e16a5 rbc417660 70 70 71 71 /* Parse command-line options */ 72 while ((optres = getopt(argc, argv, " :ubh")) != -1) {72 while ((optres = getopt(argc, argv, "ubh")) != -1) { 73 73 switch (optres) { 74 74 case 'h': … … 78 78 case 'b': 79 79 display_blocks = true; 80 break;81 82 case ':':83 fprintf(stderr, "Option -%c requires an operand\n",84 optopt);85 errflg++;86 80 break; 87 81 -
uspace/lib/c/Makefile
r098e16a5 rbc417660 190 190 TEST_SOURCES = \ 191 191 test/adt/circ_buf.c \ 192 test/adt/odict.c \ 193 test/cap.c \ 192 194 test/casting.c \ 195 test/double_to_str.c \ 193 196 test/fibril/timer.c \ 197 test/getopt.c \ 198 test/gsort.c \ 199 test/ieee_double.c \ 200 test/imath.c \ 201 test/inttypes.c \ 202 test/io/table.c \ 194 203 test/main.c \ 195 204 test/mem.c \ 196 test/inttypes.c \197 test/io/table.c \198 test/stdio/scanf.c \199 test/odict.c \200 205 test/perf.c \ 201 206 test/perm.c \ 202 207 test/qsort.c \ 203 208 test/sprintf.c \ 209 test/stdio/scanf.c \ 204 210 test/stdio.c \ 205 211 test/stdlib.c \ 206 212 test/str.c \ 207 test/string.c 213 test/string.c \ 214 test/uuid.c 208 215 209 216 include $(USPACE_PREFIX)/Makefile.common -
uspace/lib/c/generic/gsort.c
r098e16a5 rbc417660 33 33 /** 34 34 * @file 35 * @brief Sorting functions.35 * @brief Gnome Sort. 36 36 * 37 * This files contains functions implementing several sorting 38 * algorithms (e.g. quick sort and gnome sort). 37 * This file contains an implementation of gnome sort 39 38 * 40 39 */ -
uspace/lib/c/generic/imath.c
r098e16a5 rbc417660 50 50 errno_t ipow10_u64(unsigned exp, uint64_t *res) 51 51 { 52 u nsigneda;52 uint64_t a; 53 53 uint64_t r; 54 54 -
uspace/lib/c/generic/uuid.c
r098e16a5 rbc417660 39 39 #include <stddef.h> 40 40 #include <str.h> 41 #include <stdio.h> 41 42 42 43 /** Generate UUID. … … 67 68 uuid->b[8] = (uuid->b[8] & 0x3f) | 0x80; 68 69 69 return EOK;70 70 error: 71 71 rndgen_destroy(rndgen); … … 139 139 140 140 rc = str_uint64_t(str + 24, &eptr, 16, false, &node); 141 if (rc != EOK || eptr != str + 36 || *eptr != '\0')141 if (rc != EOK || eptr != str + 36) 142 142 return EINVAL; 143 143 … … 176 176 * @return EOK on success, ENOMEM if out of memory 177 177 */ 178 errno_t uuid_format(uuid_t *uuid, char **rstr )178 errno_t uuid_format(uuid_t *uuid, char **rstr, bool uppercase) 179 179 { 180 return ENOTSUP; 180 size_t size = 37; 181 char *str = malloc(sizeof(char) * size); 182 if (str == NULL) 183 return ENOMEM; 184 185 const char *format = "%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x"; 186 if (uppercase) 187 format = "%02X%02X%02X%02X-%02X%02X-%02X%02X-%02X%02X-%02X%02X%02X%02X%02X%02X"; 188 189 int ret = snprintf(str, size, format, uuid->b[0], uuid->b[1], uuid->b[2], uuid->b[3], uuid->b[4], uuid->b[5], uuid->b[6], uuid->b[7], uuid->b[8], uuid->b[9], uuid->b[10], uuid->b[11], uuid->b[12], uuid->b[13], uuid->b[14], uuid->b[15]); 190 191 if (ret != 36) 192 return EINVAL; 193 194 *rstr = str; 195 return EOK; 181 196 } 182 197 -
uspace/lib/c/include/uuid.h
r098e16a5 rbc417660 38 38 #include <stdint.h> 39 39 #include <types/uuid.h> 40 #include <stdbool.h> 40 41 41 42 extern errno_t uuid_generate(uuid_t *); … … 43 44 extern void uuid_decode(uint8_t *, uuid_t *); 44 45 extern errno_t uuid_parse(const char *, uuid_t *, const char **); 45 extern errno_t uuid_format(uuid_t *, char ** );46 extern errno_t uuid_format(uuid_t *, char **, bool); 46 47 47 48 #endif -
uspace/lib/c/test/main.c
r098e16a5 rbc417660 32 32 PCUT_INIT; 33 33 34 PCUT_IMPORT(cap); 34 35 PCUT_IMPORT(casting); 35 36 PCUT_IMPORT(circ_buf); 37 PCUT_IMPORT(double_to_str); 36 38 PCUT_IMPORT(fibril_timer); 39 PCUT_IMPORT(getopt); 40 PCUT_IMPORT(gsort); 41 PCUT_IMPORT(ieee_double); 42 PCUT_IMPORT(imath); 37 43 PCUT_IMPORT(inttypes); 38 44 PCUT_IMPORT(mem); … … 48 54 PCUT_IMPORT(string); 49 55 PCUT_IMPORT(table); 56 PCUT_IMPORT(uuid); 50 57 51 58 PCUT_MAIN();
Note:
See TracChangeset
for help on using the changeset viewer.