Exemplo n.º 1
0
long _cdecl
sys_f_datime (MetaDOSFile ushort *timeptr, short fd, short wflag)
{
	PROC *p = curproc;
	FILEPTR *f;
	long r;

	TRACE (("%s(%i)", __FUNCTION__, fd));

	r = GETFILEPTR (&p, &fd, &f);
	if (r) return r;

	/* some programs use Fdatime to test for TTY devices */
	if (is_terminal (f))
		return EACCES;

	if (f->fc.fs && f->fc.fs->fsflags & FS_EXT_3)
	{
		ulong t = 0;
		/* long r; */

		if (wflag)
			t = unixtime (timeptr [0], timeptr [1]) + timezone;

		r = xdd_datime (f, (ushort *) &t, wflag);

		if (!r && !wflag)
			*(long *) timeptr = dostime (t - timezone);

		return r;
	}

	return xdd_datime (f, timeptr, wflag);
}
Exemplo n.º 2
0
char *getVolumeLabel(int drive, ulg *vtime, ulg *vmode, time_t* vutim)
  //int drive;    /* drive name: 'A' .. 'Z' or '\0' for current drive */
  //ulg *vtime;   /* volume label creation time (DOS format) */
  //ulg *vmode;   /* volume label file mode */
  //time_t *vutim;/* volume label creationtime (UNIX format) */

/* If a volume label exists for the given drive, return its name and
   pretend to set its time and mode. The returned name is static data. */
{
  char rootpath[4];
  static char vol[14];
  DWORD fnlen, flags;

  *vmode = A_ARCHIVE | A_LABEL;           /* this is what msdos returns */
  *vtime = dostime(1980, 1, 1, 0, 0, 0);  /* no true date info available */
  *vutim = dos2unixtime(*vtime);
  strcpy(rootpath, "x:\\");
  rootpath[0] = (char)drive;
  if (GetVolumeInformation(drive ? rootpath : NULL, vol, 13, NULL,
                           &fnlen, &flags, NULL, 0))
#ifdef __RSXNT__        /* RSXNT/EMX C rtl uses OEM charset */
    return (AnsiToOem(vol, vol), vol);
#else
    return vol;
#endif
  else
    return NULL;