Mercurial > hg > octave-nkf
comparison src/file-io.cc @ 1381:4b01352e52d8
[project @ 1995-09-12 07:10:57 by jwe]
author | jwe |
---|---|
date | Tue, 12 Sep 1995 07:10:57 +0000 |
parents | e29697484908 |
children | 209ec8f4db00 |
comparison
equal
deleted
inserted
replaced
1380:79f80c6229be | 1381:4b01352e52d8 |
---|---|
2456 static Octave_map | 2456 static Octave_map |
2457 mk_stat_map (struct stat& st) | 2457 mk_stat_map (struct stat& st) |
2458 { | 2458 { |
2459 Octave_map m; | 2459 Octave_map m; |
2460 | 2460 |
2461 unsigned mode = st.st_mode; | |
2462 int mode_as_int = 1000 * ((mode & 7000) >> 9) | |
2463 + 100 * ((mode & 0700) >> 6) | |
2464 + 10 * ((mode & 0070) >> 3) | |
2465 + ((mode & 0007) >> 0); | |
2466 | |
2467 char mode_as_string[11]; | 2461 char mode_as_string[11]; |
2468 mode_string (mode, mode_as_string); | 2462 mode_string (st.st_mode, mode_as_string); |
2469 mode_as_string[10] = '\0'; | 2463 mode_as_string[10] = '\0'; |
2470 | 2464 |
2471 m["dev"] = (double) st.st_dev; | 2465 m["dev"] = (double) st.st_dev; |
2472 m["ino"] = (double) st.st_ino; | 2466 m["ino"] = (double) st.st_ino; |
2473 m["mode"] = (double) mode_as_int; | |
2474 m["modestr"] = mode_as_string; | 2467 m["modestr"] = mode_as_string; |
2475 m["nlink"] = (double) st.st_nlink; | 2468 m["nlink"] = (double) st.st_nlink; |
2476 m["uid"] = (double) st.st_uid; | 2469 m["uid"] = (double) st.st_uid; |
2477 m["gid"] = (double) st.st_gid; | 2470 m["gid"] = (double) st.st_gid; |
2478 #if defined (HAVE_ST_RDEV) | 2471 #if defined (HAVE_ST_RDEV) |
2498 Given the name of a file, return a structure with the following | 2491 Given the name of a file, return a structure with the following |
2499 elements:\n\ | 2492 elements:\n\ |
2500 \n\ | 2493 \n\ |
2501 dev : id of device containing a directory entry for this file\n\ | 2494 dev : id of device containing a directory entry for this file\n\ |
2502 ino : file number of the file\n\ | 2495 ino : file number of the file\n\ |
2503 mode : file mode, as an integer\n\ | 2496 modestr : file mode, as a string of ten letters or dashes as in ls -l\n\ |
2504 nlink : number of links\n\ | 2497 nlink : number of links\n\ |
2505 uid : user id of file's owner\n\ | 2498 uid : user id of file's owner\n\ |
2506 gid : group id of file's group \n\ | 2499 gid : group id of file's group \n\ |
2507 rdev : id of device for block or character special files\n\ | 2500 rdev : id of device for block or character special files\n\ |
2508 size : size in bytes\n\ | 2501 size : size in bytes\n\ |