/* This function is an inintended consequence of constraints in ltable.c rotable_findentry(). The file list generates a ROTable in LFS and the rule for ROTables is that metavalue entries must be at the head of the ROTableentry list so argv file names with basenames starting with "__" must be head of the list. This is a botch. Sorry.  */
static void reorderfiles(lua_State *L, int argc, char **list, char **argv)
/* This function is an inintended consequence of constraints in ltable.c rotable_findentry(). The file list generates a ROTable in LFS and the rule for ROTables is that metavalue entries must be at the head of the ROTableentry list so argv file names with basenames starting with "__" must be head of the list. This is a botch. Sorry.  */
static void reorderfiles(lua_State *L, int argc, char **list, char **argv)
{
    TString *file = luaS_new(L,argv[i]);
    if (strcmp("__", corename(L, file, NULL))) {
      list[i] = argv[i];
    } else {
      for (j = 0; j < i; j++)
        list[j+1] = list[j];
      list[0] = argv[i];
    }
  }
}