HP85 GPIB Disk Emulator  1.0
HP85GPIBDiskEmulator
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
posix_tests.c
Go to the documentation of this file.
1 
26 #include "user_config.h"
27 
28 #include "fatfs.h"
29 
30 #ifdef AVR
31 //#include <stdio.h>
32 #include <stdlib.h>
33 #endif
34 #include "time.h"
35 #include "stringsup.h"
36 #include "mathio.h"
37 #include "posix.h"
38 #include "posix_tests.h"
39 
40 #ifdef ESP8266
41 #define BUFSIZE 4096
42 #else
43 #define BUFSIZE 512
44 #endif
46 void posix_help(int full)
47 {
48  printf("posix help\n");
49  if(full)
50  {
51  printf(
52  "Note: posix prefix is optional\n"
53  #ifdef POSIX_EXTENDED_TESTS
54  "posix chmod file NNN\n"
55  #endif
56  "posix cat file [-p]\n"
57  "posix cd dir\n"
58  "posix copy file1 file2\n"
59  #ifdef POSIX_EXTENDED_TESTS
60  "posix hexdump file [-p]\n"
61  "posix log str\n"
62  #endif
63  "posix ls dir [-l]\n"
64  "posix mkdir dir\n"
65  #ifdef POSIX_EXTENDED_TESTS
66  "posix mkfs\n"
67  #endif
68  "posix page NN - used for cat -p\n"
69  "posix pwd\n"
70  #ifdef POSIX_EXTENDED_TESTS
71  "posix stat file\n"
72  "posix sum file\n"
73  #endif
74  "posix rm file\n"
75  "posix rmdir dir\n"
76  "posix rename old new\n"
77  #ifdef POSIX_EXTENDED_TESTS
78  "posix upload file\n"
79  #endif
80  "\n" );
81  }
82 }
83 
84 
93 int posix_tests(int argc,char *argv[])
94 {
95  char *ptr;
96  int ind = 0;
97 
98  if(argc < 1)
99  return(0);
100 
101  ptr = argv[ind++];
102 
103 #if 0
104 int i;
105 printf("posix\n");
106 for(i=0;i<argc;++i)
107 {
108  printf("argv[%d]=%s\n",(int)i, argv[i]);
109 }
110 #endif
111 
112 
113  if(!ptr)
114  return(0); // nothing no match
115 
116  if( MATCH(ptr,"posix") )
117  {
118  ptr = argv[ind++];
119  if ( !ptr || MATCH(ptr,"help") )
120  {
121  posix_help(1);
122  return(1);
123  }
124  }
125 
126  if (MATCHARGS(ptr,"cat", (ind + 1), argc))
127  {
128  int i;
129  int page = 0;
130  for(i=ind;i<argc;++i)
131  {
132  if(MATCH(argv[i],"-p"))
133  page = 1;
134  }
135  for(i=ind;i<argc;++i)
136  {
137  if(!MATCH(argv[i],"-p"))
138  {
139  // displays its own errors
140  cat(argv[ind], page);
141  }
142  }
143  return(1);
144  }
145 
146 #ifdef POSIX_EXTENDED_TESTS
147  else if (MATCHARGS(ptr,"chmod",(ind+2),argc))
148  {
149  if( chmod( argv[ind],strtol(argv[ind+1],NULL,8) < 0 )
150  {
151  printf("chmod: %s %s - FAILED\n",argv[ind],argv[ind+1]);
152  return(-1);
153  }
154  return(1);
155  }
156 #endif
157 
158  else if (MATCHARGS(ptr,"copy", (ind + 2), argc))
159  {
160  if( copy(argv[ind],argv[ind+1]) < 0)
161  return(-1);
162  return(1);
163  }
164 
165  else if (MATCHARGS(ptr,"cd", (ind + 1), argc))
166  {
167  if ( chdir(argv[ind]) != 0)
168  {
169  printf("chdir %s failed\n", argv[ind]);
170  return(-1);
171  }
172  return(1);
173  }
174 
175 #ifdef POSIX_EXTENDED_TESTS
176  else if (MATCHARGS(ptr,"hexdump", (ind + 1), argc))
177  {
178  int i;
179  int page = 0;
180  for(i=ind;i<argc;++i)
181  {
182  if(MATCH(argv[i],"-p"))
183  page = 1;
184  }
185  for(i=ind;i<argc;++i)
186  {
187  if(!MATCH(argv[i],"-p"))
188  {
189  if( hexdump(argv[ind], page) ==0 )
190  {
191  printf("hexdump failed\n");
192  return(-1);;
193  }
194  }
195  }
196  return(1);
197  }
198 
199  else if (MATCHARGS(ptr,"log", (ind + 2), argc))
200  {
201  if( logfile(argv[ind],argv[ind+1]) < 0)
202  return(-1);
203  return(1);
204  }
205 #endif
206 
207  else if (MATCHI(ptr,"ls") )
208  {
209  int i;
210  int args = 0;
211  for(i=ind;i<argc;++i)
212  {
213  if(!argv[i])
214  {
215  printf("ls: null argument # %d\n", i);
216  continue;
217  }
218  if(MATCH(argv[i],"-l")) // skip long format test - we always use long format
219  continue;
220  if( ls(argv[i],1) < 0)
221  {
222  return(-1);
223  };
224  ++args;
225  }
226  if(!args)
227  {
228  if( ls("",1) < 0)
229  {
230  return(-1);
231  };
232  }
233  return(1);
234  }
235 
236 #ifdef POSIX_EXTENDED_TESTS
237  else if (MATCHARGS(ptr,"mkfs", (ind + 1), argc))
238  {
239 
240  if ( mkfs(argv[ind]) == 0)
241  {
242  printf("mkfs %s FAILED\n");
243  return(-1);
244  }
245  return(1);
246  }
247 #endif
248 
249  else if (MATCHARGS(ptr,"mkdir", (ind + 1), argc))
250  {
251  int mode = 0777;
252  if((ind+2) <= argc)
253  {
254  mode = strtol(argv[ind+1],NULL,8);
255  }
256  if ( mkdir(argv[ind],mode) != 0 )
257  {
258  printf("mkdir %s failed\n", argv[ind]);
259  return(-1);
260  }
261  return(1);
262  }
263 
264  else if (MATCHARGS(ptr,"page", (ind + 1), argc))
265  {
266  setpage(atoi(argv[ind]));
267  return(1);
268  }
269 
270  else if (MATCHARGS(ptr,"pwd", (ind + 0), argc))
271  {
272  char path[MAX_NAME_LEN+1];
273  char *ptr = getcwd(path, sizeof(path)-2);
274  if(ptr == NULL)
275  {
276  printf("pwd FAILED\n");
277  return(-1);
278  }
279  printf("%s\n", ptr);
280  return(1);
281  }
282 
283  else if (MATCHARGS(ptr,"rename", (ind + 2), argc))
284  {
285  if( rename(argv[ind],argv[ind+1]) != 0)
286  {
287  printf("rename %s to %s\n", argv[ind], argv[ind+1]);
288  return(-1);
289  }
290  return(1);
291  }
292 
293  else if (MATCHARGS(ptr,"rm", (ind + 1), argc))
294  {
295  if ( unlink(argv[ind]) != 0)
296  {
297  printf("rm %s failed\n", argv[ind]);
298  return(-1);
299  }
300  return(1);
301  }
302 
303 #ifdef POSIX_EXTENDED_TESTS
304  else if (MATCHARGS(ptr,"sum", (ind + 1), argc))
305  {
306  if( sum(argv[ind]) < 0)
307  {
308  printf("sum %s FAILED\n",argv[ind]);
309  return(-1);
310  }
311  return(1);
312  }
313 
314  else if (MATCHARGS(ptr,"stat", (ind + 1), argc))
315  {
316  struct stat p;
317  // POSIX test
318  if( stat(argv[ind], &p) < 0)
319  {
320  printf("stat %s FAILED\n", argv[ind]);
321  return(-1);
322  }
323  dump_stat(&p);
324  return(1);
325  }
326 #endif
327 
328  else if (MATCHARGS(ptr,"rmdir", (ind + 1), argc))
329  {
330  if ( rmdir(argv[ind]) != 0)
331  {
332  printf("rmdir %s failed\n", argv[ind]);
333  return(-1);
334  }
335  return(1);
336  }
337 
338 #ifdef POSIX_EXTENDED_TESTS
339  else if (MATCHARGS(ptr,"upload", (ind + 1), argc))
340  {
341  upload(argv[ind]);
342  return(1);
343  }
344 #endif
345 
346  return(0);
347 }
348 
349 
354 MEMSPACE
355 long cat(char *name, int dopage)
356 {
357  FILE *fp;
358  int count = 0;
359  int size = 0;
360  char line[256];
361 
362  fp = fopen(name,"rb");
363  if (!fp)
364  {
365  printf("Can't open: %s\n", name);
366  return(-1);
367  }
368  while(fgets(line,sizeof(line)-2,fp) != NULL)
369  {
370  trim_tail(line);
371  size += strlen(line);
372  puts(line);
373  if(dopage)
374  {
375  count = testpage(++count);
376  if(count < 0)
377  break;
378  }
379 
380 #ifdef ESP8266
381  optimistic_yield(1000);
382  wdt_reset();
383 #endif
384  }
385  printf("\n");
386  fclose(fp);
387  printf("%ld bytes\n", (long)size);
388  return(size);
389 }
390 
391 
397 MEMSPACE
398 long copy(char *from,char *to)
399 {
400  FILE *fi,*fo;
401  char *buf;
402  long size = 0;
403  int len;
404 
405  printf("Opening %s\n", from);
406 
407  fi = fopen(from,"rb");
408  if (fi == NULL)
409  {
410  printf("Can't open: %s\n", from);
411  return(-1);
412  }
413 
414  printf("Creating %s\n", to);
415  fo = fopen(to,"wb");
416  if (fo == NULL)
417  {
418  printf("Can't open: %s\n", to);
419  fclose(fo);
420  return(-1);
421  }
422 
423  buf = safecalloc(BUFSIZE,1);
424  if(!buf)
425  {
426  fclose(fi);
427  fclose(fo);
428  return(-1);
429  }
430 
431  printf("\nCopying...\n");
432  while( ( len = fread(buf,1,BUFSIZE,fi) ) > 0)
433  {
434  if( (int) fwrite(buf,1,len,fo) < len)
435  {
436  printf("Write error\n");
437  break;
438  }
439  size += len;
440  printf("Copied: %08ld\r", size);
441 #ifdef ESP8266
442  optimistic_yield(1000);
443  wdt_reset();
444 #endif
445  }
446  printf("%lu bytes copied.\n", size);
447  safefree(buf);
448  fclose(fi);
449  fclose(fo);
450  return(size);
451 }
452 
453 
454 #ifdef POSIX_EXTENDED_TESTS
455 MEMSPACE
459 int hexdump(char *name, int dopage)
460 {
461  long addr;
462  int i,len,count;
463 
464  FILE *fi;
465  char buf[0x20];
466 
467  fi=fopen(name,"rb");
468  if(fi == NULL)
469  {
470  printf("Can' open: %s\n", name);
471  return(0);
472  }
473 
474  count = 0;
475  addr = 0;
476  while( (len = fread(buf,1, 16, fi)) > 0)
477  {
478  printf("%08lx : ", addr);
479 
480  for(i=0;i<len;++i)
481  printf("%02x ",0xff & buf[i]);
482  for(;i<16;++i)
483  printf(" ");
484 
485  printf(" : ");
486 
487  for(i=0;i<len;++i)
488  {
489  if(buf[i] >= 0x20 && buf[i] <= 0x7e)
490  putchar(buf[i]);
491  else
492  putchar('.');
493  }
494  for(;i<16;++i)
495  putchar('.');
496 
497  printf("\n");
498  addr += len;
499  if(dopage)
500  {
501  count = testpage(++count);
502  if(count < 0)
503  break;
504  }
505 #ifdef ESP8266
506  optimistic_yield(1000);
507  wdt_reset();
508 #endif
509  }
510  printf("\n");
511  fclose(fi);
512  return(1);
513 }
514 #endif
515 
519 static int _pagesize = 25;
520 MEMSPACE
521 int setpage(int count)
522 {
523  _pagesize = count;
524  return(_pagesize);
525 }
526 
527 
531 MEMSPACE
532 int testpage(int count)
533 {
534  int c;
535  if(count >= _pagesize)
536  {
537  printf("More..");
538 #ifdef ESP8266
539  while (!kbhit(0))
540  {
541  optimistic_yield(1000);
542  wdt_reset();
543  }
544 #endif
545  c = getchar();
546  printf("\r");
547  if(c == 'q')
548  return(-1); // quit
549  if(c == '\n')
550  return(_pagesize-1); // single line
551  return(0); // new page
552  }
553  return (count);
554 }
555 
556 
561 MEMSPACE
562 int ls_info(char *name, int verbose)
563 {
564  int i;
565  struct stat sp;
566  uint16_t mask;
567  char *cm = "rwx";
568  char attr[12], *p;
569 
570  if(stat(name, &sp) == -1)
571  {
572  printf("can not stat: %s\n", name);
573  return(0);
574  }
575 
576  if(!verbose)
577  {
578  printf("%s\n",basename(name));
579  return(1);
580  }
581 
582  p = attr;
583  if(S_ISDIR(sp.st_mode))
584  *p++ = 'd';
585  else
586  *p++ = '-';
587 
588  mask = 4 << 6;
589  for(i=0;i<9;++i)
590  {
591 // User
592  if( sp.st_mode & mask)
593  *p++ = cm[ i % 3];
594  else
595  *p++ = '-';
596  mask >>= 1;
597  }
598  *p = 0;
599 
600  printf("%s none none %12ld %s %s\n",
601  attr,
602  (long) sp.st_size,
603  mctime((time_t)sp.st_mtime),
604  basename(name));
605  return(1);
606 }
607 
608 
613 MEMSPACE
614 int ls(char *name, int verbose)
615 {
616  struct stat st;
617  DIR *dirp;
618  int files = 0;
619  int len,len2;
620  dirent_t *de;
621  char fullpath[MAX_NAME_LEN+1];
622 
623  fullpath[0] = 0;
624  if(!name || !*name || MATCH(name,".") )
625  {
626  if( !getcwd(fullpath, sizeof(fullpath)-2) )
627  {
628  printf("ls: Can't get current directory\n");
629  return(-1);
630 
631  }
632  }
633  else
634  {
635  strcpy(fullpath,name);
636  }
637  len = strlen(fullpath);
638 
639 
640  if (stat(fullpath, &st))
641  {
642  printf("ls: cannot stat [%s]\n", fullpath);
643  return(-1);
644  }
645  printf("Listing:[%s]\n",fullpath);
646 
647  switch (st.st_mode & S_IFMT)
648  {
649  case S_IFREG:
650  files = ls_info(fullpath,verbose);
651  break;
652  case S_IFDIR:
653  dirp = opendir(fullpath);
654  if(!dirp)
655  {
656  printf("opendir failed\n");
657  return(-1);
658  }
659  while ( (de = readdir(dirp)) )
660  {
661  if(de->d_name[0] == 0)
662  break;
663 // FIXME neeed beetter string length tests here
664  len2 = strlen(de->d_name);
665  if(len + len2 >= MAX_NAME_LEN)
666  {
667  printf("name:[%s] too long with full path\n",de->d_name);
668  continue;
669  }
670  if(!MATCH(fullpath,"/") )
671  {
672  strcat(fullpath,"/");
673  }
674  strcat(fullpath,de->d_name);
675  files +=ls_info(fullpath,verbose);
676 // restore path
677  fullpath[len] = 0;
678 #ifdef ESP8266
679  optimistic_yield(1000);
680  wdt_reset();
681 #endif
682  }
683  closedir(dirp);
684  break;
685  }
686  printf("Files: %d\n", (int)files);
687  return(files);
688 }
689 
690 
691 #ifdef POSIX_EXTENDED_TESTS
692 MEMSPACE
697 long logfile(char *name, char *str)
698 {
699  long size = 0;
700  FILE *fo;
701 
702  fo = fopen(name,"ab");
703  if (fo)
704  {
705  printf("Can't open: %s\n", name);
706  return(-1);
707  }
708 
709  size = strlen(str);
710  if( fwrite(str, 1, size, fo) < size)
711  {
712  printf("Write error\n");
713  return(0);
714  }
715  fclose(fo);
716  return(size);
717 }
718 #endif
719 
720 #ifdef POSIX_EXTENDED_TESTS
721 MEMSPACE
725 uint16_t sum(char *name)
726 {
727 
728  FILE *fi;
729  uint16_t sum;
730  int i,len;
731  uint8_t buffer[256];
732 
733  fi=fopen(name,"rb");
734  if(fi == NULL)
735  {
736  printf("Can' open: %s\n", name);
737  return(-1);
738  }
739  sum = 0;
740  while( (len = fread(buffer,1, 256, fi)) > 0)
741  {
742  for(i=0;i<len;++i)
743  sum += (0xff & buffer[i]);
744 #ifdef ESP8266
745  optimistic_yield(1000);
746  wdt_reset();
747 #endif
748  }
749  fclose(fi);
750  printf("Sum: %04Xh, %5u\n", (int) sum, (unsigned int) sum);
751  return(sum);
752 }
753 #endif
754 #ifdef POSIX_EXTENDED_TESTS
755 
761 MEMSPACE
762 long upload(char *name)
763 {
764  int len,len2;
765  long size = 0;
766  FILE *fp;
767  char buffer[256];
768 
769  fp = fopen(name, "wb");
770  if( fp == NULL)
771  {
772  printf("Can' open: %s\n", name);
773  return(0);
774  }
775 
776  while(1)
777  {
778  if(fgets(buffer,254,stdin) == NULL)
779  break;
780  len = strlen(buffer);
781  if(len < 1)
782  break;
783  strcat(buffer,"\n");
784  len = strlen(buffer);
785  len2 = fwrite(buffer, 1, len,fp);
786  if(len != len2)
787  break;
788  size += len;
789  }
790 
791  fclose(fp);
792  sync();
793  return(size);
794 }
795 #endif
fatfs.h
stat::st_size
off_t st_size
Definition: posix.h:114
fopen
MEMSPACE FILE * fopen(const char *path, const char *mode)
POSIX Open a file with path name and ascii file mode string.
Definition: posix.c:801
MAX_NAME_LEN
#define MAX_NAME_LEN
Definition: posix.h:133
stat
POSIX stat structure.
Definition: posix.h:105
BUFSIZE
#define BUFSIZE
Definition: posix_tests.c:43
chdir
MEMSPACE int chdir(const char *pathname)
POSIX change directory.
Definition: posix.c:1512
stat::st_mtime
time_t st_mtime
Definition: posix.h:118
S_ISDIR
#define S_ISDIR(mode)
Definition: posix.h:219
printf
MEMSPACE int printf(const char *format,...)
stdin
#define stdin
define stdin, stdout and stderr
Definition: posix.h:273
dump_stat
MEMSPACE void dump_stat(struct stat *sp)
Display struct stat, from POSIX stat(0 or fstat(), in ASCII. NOT POSIX.
Definition: posix.c:1283
hexdump
MEMSPACE int hexdump(char *name, int dopage)
mctime
MEMSPACE char * mctime(time_t timev)
Display Ascii formatted time from timev seconds NOT POSIX.
Definition: posix.c:1346
MATCH
MEMSPACE int MATCH(char *str, char *pat)
Compare two strings.
Definition: parsing.c:143
MATCHI
MEMSPACE int MATCHI(char *str, char *pat)
Compare two strings without case.
Definition: parsing.c:183
sync
MEMSPACE void sync(void)
POSIX Sync all pending file changes and metadata on ALL files.
Definition: posix.c:1091
mkfs
int mkfs(char *name)
Formt SD card.
Definition: posix.c:1960
MEMSPACE
#define MEMSPACE
Definition: user_config.h:17
strcat
MEMSPACE WEAK_ATR char * strcat(char *dest, const char *src)
Append string.
Definition: stringsup.c:199
safecalloc
void * safecalloc(int size, int elements)
Safe Alloc - Display Error message if Calloc fails.
Definition: ram.c:122
ls
MEMSPACE int ls(char *name, int verbose)
Directory listing.
Definition: posix_tests.c:614
fgets
MEMSPACE char * fgets(char *str, int size, FILE *stream)
get a string from stdin See fdevopen() sets stream->put get for TTY devices
Definition: posix.c:432
closedir
int closedir(DIR *dirp)
POSIX closedir.
Definition: posix.c:1748
putchar
int putchar(int c)
put a character to stdout See fdevopen() sets stream->put get for TTY devices
Definition: posix.c:363
strtol
MEMSPACE long strtol(const char *nptr, char **endptr, int base)
Convert ASCII string to number in a given base.
Definition: mathio.c:139
chmod
MEMSPACE int chmod(const char *pathname, mode_t mode)
POSIX chmod function - change file access permission Unfortunately file f_open modes and f_chmod mode...
Definition: posix.c:1538
stringsup.h
Various string and character functions.
S_IFMT
#define S_IFMT
POSIX File types, see fstat and stat.
Definition: posix.h:205
rename
MEMSPACE int rename(const char *oldpath, const char *newpath)
POSIX rename a file by name.
Definition: posix.c:1677
upload
MEMSPACE long upload(char *name)
fwrite
MEMSPACE size_t fwrite(const void *ptr, size_t size, size_t nmemb, FILE *stream)
POSIX write nmemb elements from buf, size bytes each, to the stream fd.
Definition: posix.c:890
safefree
void safefree(void *p)
Safe free - Only free a pointer if it is in malloc memory range.
Definition: ram.c:158
cat
MEMSPACE long cat(char *name, int dopage)
Display the contents of a file.
Definition: posix_tests.c:355
logfile
MEMSPACE long logfile(char *name, char *str)
rmdir
MEMSPACE int rmdir(const char *pathname)
POSIX delete a directory.
Definition: posix.c:1701
trim_tail
MEMSPACE void trim_tail(char *str)
Trim White space and control characters from end of string.
Definition: parsing.c:49
testpage
MEMSPACE int testpage(int count)
Used to page output of functions like cat, hexdump, etc.
Definition: posix_tests.c:532
posix_tests.h
POSIX wrapper for FatFS.
_pagesize
static int _pagesize
Used to page output of functions like cat, hexdump, etc.
Definition: posix_tests.c:519
stat
MEMSPACE int stat(char *name, struct stat *buf)
POSIX stat - get file status of named file.
Definition: posix.c:1368
sum
MEMSPACE uint16_t sum(char *name)
getchar
MEMSPACE int getchar()
functions normally defined as macros
Definition: posix.c:347
S_IFREG
#define S_IFREG
Definition: posix.h:209
readdir
dirent_t * readdir(DIR *dirp)
Definition: posix.c:1788
strcpy
MEMSPACE WEAK_ATR char * strcpy(char *dest, const char *src)
copy a string
Definition: stringsup.c:160
posix_help
MEMSPACE void posix_help(int full)
Definition: posix_tests.c:46
dirent::d_name
char d_name[MAX_NAME_LEN]
Definition: posix.h:146
NULL
#define NULL
Definition: user_config.h:85
ls_info
MEMSPACE int ls_info(char *name, int verbose)
list one file
Definition: posix_tests.c:562
__file
FILE type structure.
Definition: posix.h:158
strlen
MEMSPACE size_t WEAK_ATR strlen(const char *str)
String Length.
Definition: stringsup.c:144
dirent
Definition: posix.h:136
time.h
Common Linux/POSIX time functions.
basename
MEMSPACE char * basename(char *str)
POSIX Basename of filename.
Definition: posix.c:1469
setpage
MEMSPACE int setpage(int count)
Definition: posix_tests.c:521
opendir
DIR * opendir(const char *pathdir)
Definition: posix.c:1768
fclose
MEMSPACE int fclose(FILE *stream)
POSIX close a file stream.
Definition: posix.c:1261
atoi
MEMSPACE int atoi(const char *str)
Convert ASCII string to number in base 10.
Definition: mathio.c:284
stat::st_mode
mode_t st_mode
Definition: posix.h:109
kbhit
#define kbhit(uart)
Definition: rs232.h:45
mkdir
MEMSPACE int mkdir(const char *pathname, mode_t mode)
POSIX make a directory.
Definition: posix.c:1647
MATCHARGS
MEMSPACE int MATCHARGS(char *str, char *pat, int min, int argc)
Match two strings and compare argument index Display message if the number of arguments is too few.
Definition: parsing.c:161
copy
MEMSPACE long copy(char *from, char *to)
Copy a file.
Definition: posix_tests.c:398
DIR
Definition: ff.h:228
getcwd
MEMSPACE char * getcwd(char *pathname, int len)
POSIX get current working directory.
Definition: posix.c:1623
S_IFDIR
#define S_IFDIR
Definition: posix.h:206
time_t
uint32_t time_t
type of EPOCH result.
Definition: time.h:34
unlink
MEMSPACE int unlink(const char *pathname)
POSIX delete a file.
Definition: posix.c:1723
mathio.h
Math IO functions, and verious conversion code with floating point support.
fread
MEMSPACE size_t fread(void *ptr, size_t size, size_t nmemb, FILE *stream)
POSIX read nmemb elements from buf, size bytes each, to the stream fd.
Definition: posix.c:823
posix_tests
MEMSPACE int posix_tests(int argc, char *argv[])
POSIX tests.
Definition: posix_tests.c:93
posix.h
POSIX wrapper for FatFS.
puts
MEMSPACE int puts(const char *str)
put a string to stdout See fdevopen() sets stream->put get for TTY devices
Definition: posix.c:493