Exemple #1
0
/*
 *  Count up to a maximum of NUM_ACCS desk accessories, saving
 *  their names in acc_name[].
 */
static WORD count_accs(void)
{
    WORD i, rc;

    /* if Control is held down, skip loading of accessories */
    if ((Kbshift(-1) & MODE_CTRL))
        return 0;

    strcpy(D.g_work,"*.ACC");
    dos_sdta(&D.g_dta);

    for (i = 0; i < NUM_ACCS; i++)
    {
        rc = (i==0) ? dos_sfirst(D.g_work,F_RDONLY) : dos_snext();
        if (rc < 0)
            break;
        strlcpy(acc_name[i],D.g_dta.d_fname,LEN_ZFNAME);
    }

    return i;
}
Exemple #2
0
/*
*       Routine to load in desk accessories.  Files by the name of *.ACC
*       will be loaded.
*/
static void ldaccs(void)
{
        register WORD   i;
        WORD            ret;

        strcpy(&D.g_dir[0], "*.ACC");
        dos_sdta((LONG)D.g_dta);

        /* if Control is held down then skip loading of accs */
        if ((kbshift(-1) & (1<<2)))
          return;

        ret = TRUE;
        for(i=0; (i<NUM_ACCS) && (ret); i++)
        {

          ret = (i==0) ? dos_sfirst(D.g_dir, F_RDONLY) : dos_snext();
          if (ret)
            sndcli(&gl_dta[30]);
        }
}
Exemple #3
0
static WORD fs_active(BYTE *ppath, BYTE *pspec, WORD *pcount)
{
        WORD            ret;
        LONG            thefile, fs_index, temp;
        register WORD   i, j, gap;
        BYTE            *fname, allpath[LEN_ZPATH+1];
        
        gsx_mfset(ad_hgmice);

        thefile = 0L;
        fs_index = 0L;

        strcpy(allpath, ppath);               /* 'allpath' gets all files */
        fname = fs_back(allpath,NULL);
        strcpy(fname+1,"*.*");

        dos_sdta((LONG)D.g_dta);
        ret = dos_sfirst(allpath, F_SUBDIR);
        while ( ret )
        {
                                                /* if it is a real file */
                                                /*   or directory then  */
                                                /*   save it and set    */
                                                /*   first byte to tell */
                                                /*   which              */
          if (D.g_dta[30] != '.')
          {
            D.g_dta[29] = (D.g_dta[21] & F_SUBDIR) ? 0x07 : ' ';
            if ( (D.g_dta[29] == 0x07) ||
                 (wildcmp(pspec, &D.g_dta[30])) )
            {
              fs_index = fs_add(thefile, fs_index);
              thefile++;
            }
          }
          ret = dos_snext();

          if (thefile >= nm_files)
          {
            ret = FALSE;
            sound(TRUE, 660, 4);
          }
        }
        *pcount = thefile;
                                                /* sort files using shell*/
                                                /*   sort on page 108 of */
                                                /*   K&R C Prog. Lang.  */
        for(gap = thefile/2; gap > 0; gap /= 2)
        {
          for(i = gap; i < thefile; i++)
          {
            for (j = i-gap; j >= 0; j -= gap)
            {
              if ( fs_comp(ad_fsnames+g_fslist[j],ad_fsnames+g_fslist[j+gap]) <= 0 )
                break;
              temp = g_fslist[j];
              g_fslist[j] = g_fslist[j+gap];
              g_fslist[j+gap] = temp;
            }
          }
        }

        gsx_mfset( ad_armice );
        return(TRUE);
}