fixed minor building issues.
renamed sys::getpgrp to sys::getpgid
This commit is contained in:
		| @ -146,7 +146,7 @@ static int fnc_kill (qse_awk_rtx_t* rtx, const qse_awk_fnc_info_t* fi) | ||||
| 	return 0; | ||||
| } | ||||
|  | ||||
| static int fnc_getpgrp (qse_awk_rtx_t* rtx, const qse_awk_fnc_info_t* fi) | ||||
| static int fnc_getpgid (qse_awk_rtx_t* rtx, const qse_awk_fnc_info_t* fi) | ||||
| { | ||||
| 	qse_awk_int_t pid; | ||||
| 	qse_awk_val_t* retv; | ||||
| @ -164,7 +164,14 @@ static int fnc_getpgrp (qse_awk_rtx_t* rtx, const qse_awk_fnc_info_t* fi) | ||||
| 	pid = -1; | ||||
|  | ||||
| #else | ||||
| 	/* TODO: support specifing calling process id other than 0 */ | ||||
| 	#if defined(HAVE_GETPGID) | ||||
| 	pid = getpgid (0); | ||||
| 	#elif defined(HAVE_GETPGRP) | ||||
| 	pid = getpgrp (); | ||||
| 	#else | ||||
| 	pid = -1; | ||||
| 	#endif | ||||
| #endif | ||||
|  | ||||
| 	retv = qse_awk_rtx_makeintval (rtx, pid); | ||||
| @ -679,7 +686,7 @@ static fnctab_t fnctab[] = | ||||
| 	{ QSE_T("geteuid"),    { { 0, 0, QSE_NULL     }, fnc_geteuid,    0  } }, | ||||
| 	{ QSE_T("getgid"),     { { 0, 0, QSE_NULL     }, fnc_getgid,     0  } }, | ||||
| 	{ QSE_T("getnwifcfg"), { { 3, 3, QSE_T("vvr") }, fnc_getnwifcfg, 0  } }, | ||||
| 	{ QSE_T("getpgrp"),    { { 0, 0, QSE_NULL     }, fnc_getpgrp,    0  } }, | ||||
| 	{ QSE_T("getpgid"),    { { 0, 0, QSE_NULL     }, fnc_getpgid,    0  } }, | ||||
| 	{ QSE_T("getpid"),     { { 0, 0, QSE_NULL     }, fnc_getpid,     0  } }, | ||||
| 	{ QSE_T("getppid"),    { { 0, 0, QSE_NULL     }, fnc_getppid,    0  } }, | ||||
| 	{ QSE_T("gettid"),     { { 0, 0, QSE_NULL     }, fnc_gettid,     0  } }, | ||||
|  | ||||
| @ -194,7 +194,7 @@ int qse_fmtfltmaxtombs (qse_mchar_t* buf, qse_size_t bufsize, qse_fltmax_t f, qs | ||||
|   | ||||
| 	if (len + 1 < bufsize) | ||||
| 	{ | ||||
| 		buf[len++] = point;  // add decimal point to string | ||||
| 		buf[len++] = point;  /* add decimal point to string */ | ||||
| 		buf[len] = QSE_MT('\0'); | ||||
| 	} | ||||
|          | ||||
|  | ||||
| @ -237,7 +237,7 @@ static int copy_file_in_fs (qse_fs_t* fs, cpfile_t* cpfile) | ||||
|  | ||||
| 		if (cpfile->flags & QSE_FS_CPFILE_PRESERVE) | ||||
| 		{ | ||||
| 		#if defined(HAVE_FUTIMENS) | ||||
| 		#if defined(HAVE_FUTIMENS) && defined(HAVE_STRUCT_TIMESPEC) | ||||
| 			struct timespec ts[2]; | ||||
| 		#elif defined(HAVE_FUTIMES) | ||||
| 			struct timeval tv[2]; | ||||
| @ -254,7 +254,7 @@ static int copy_file_in_fs (qse_fs_t* fs, cpfile_t* cpfile) | ||||
| 				goto oops; | ||||
| 			} | ||||
|  | ||||
| 		#if defined(HAVE_FUTIMENS) | ||||
| 		#if defined(HAVE_FUTIMENS) && defined(HAVE_STRUCT_TIMESPEC) | ||||
|  | ||||
| 			QSE_MEMSET (&ts, 0, QSE_SIZEOF(ts)); | ||||
| 			ts[0].tv_sec = cpfile->src_attr.atime.sec; | ||||
|  | ||||
| @ -645,7 +645,7 @@ qse_fs_ent_t* qse_fs_read (qse_fs_t* fs, int flags) | ||||
|  | ||||
| 	if (flags & QSE_FS_ENT_TYPE) | ||||
| 	{ | ||||
| 	#if defined(HAVE_STRUCT_DIRENT_D_TYPE) | ||||
| 	#if defined(HAVE_STRUCT_DIRENT_D_TYPE) && defined(DT_DIR) && defined(DT_REG) /* and more */ | ||||
| 		switch (ent->d_type) | ||||
| 		{ | ||||
| 			case DT_DIR: | ||||
| @ -678,18 +678,26 @@ qse_fs_ent_t* qse_fs_read (qse_fs_t* fs, int flags) | ||||
| 			default: | ||||
| 				fs->ent.type = QSE_FS_ENT_UNKNOWN; | ||||
| 				break; | ||||
| 		}	 | ||||
| 		} | ||||
|  | ||||
| 	#else | ||||
| 		#if defined(__S_IFMT) && !defined(S_IFMT) | ||||
| 		#	define S_IFMT __S_IFMT | ||||
| 		#endif | ||||
| 		#if defined(__S_IFDIR) && !defined(S_IFDIR) | ||||
| 		#	define S_IFDIR __S_IFDIR | ||||
| 		#endif | ||||
| 		#define IS_TYPE(st,type) ((st.st_mode & S_IFMT) == S_IFDIR) | ||||
| 		fs->ent.type = IS_TYPE(st,S_IFDIR)?  QSE_FS_ENT_SUBDIR: | ||||
| 		                IS_TYPE(st,S_IFREG)?  QSE_FS_ENT_REGULAR: | ||||
| 		                IS_TYPE(st,S_IFLNK)?  QSE_FS_ENT_SYMLINK: | ||||
| 		                IS_TYPE(st,S_IFCHR)?  QSE_FS_ENT_CHRDEV: | ||||
| 		                IS_TYPE(st,S_IFBLK)?  QSE_FS_ENT_BLKDEV: | ||||
| 		                IS_TYPE(st,S_IFIFO)?  QSE_FS_ENT_PIPE: | ||||
| 		                IS_TYPE(st,S_IFSOCK)? QSE_FS_ENT_PIPE: | ||||
| 		                                      QSE_FS_ENT_UNKNOWN; | ||||
| 		               IS_TYPE(st,S_IFREG)?  QSE_FS_ENT_REGULAR: | ||||
| 		               IS_TYPE(st,S_IFLNK)?  QSE_FS_ENT_SYMLINK: | ||||
| 		               IS_TYPE(st,S_IFCHR)?  QSE_FS_ENT_CHRDEV: | ||||
| 		               IS_TYPE(st,S_IFBLK)?  QSE_FS_ENT_BLKDEV: | ||||
| 		               IS_TYPE(st,S_IFIFO)?  QSE_FS_ENT_PIPE: | ||||
| 		#if defined(S_IFSOCK) | ||||
| 		               IS_TYPE(st,S_IFSOCK)? QSE_FS_ENT_PIPE: | ||||
| 		#endif | ||||
| 		                                     QSE_FS_ENT_UNKNOWN; | ||||
| 		#undef IS_TYPE | ||||
| 	#endif | ||||
| 		fs->ent.flags |= QSE_FS_ENT_TYPE; | ||||
|  | ||||
		Reference in New Issue
	
	Block a user