Quizzer
view release on metacpan or search on metacpan
exercises/compile-tcsh/tcsh-6.10.00/sh.file.c view on Meta::CPAN
unsigned char beep_ch = CTL_ESC('\007');
(void) write(SHOUT, &beep_ch, 1);
}
#endif
}
/*
* Erase that silly ^[ and
* print the recognized part of the string
*/
static void
print_recognized_stuff(recognized_part)
Char *recognized_part;
{
/* An optimized erasing of that silly ^[ */
(void) putraw('\b');
(void) putraw('\b');
switch (Strlen(recognized_part)) {
case 0: /* erase two Characters: ^[ */
(void) putraw(' ');
(void) putraw(' ');
(void) putraw('\b');
(void) putraw('\b');
break;
case 1: /* overstrike the ^, erase the [ */
xprintf("%S", recognized_part);
(void) putraw(' ');
(void) putraw('\b');
break;
default: /* overstrike both Characters ^[ */
xprintf("%S", recognized_part);
break;
}
flush();
}
/*
* Parse full path in file into 2 parts: directory and file names
* Should leave final slash (/) at end of dir.
*/
static void
extract_dir_and_name(path, dir, name)
Char *path, *dir, *name;
{
register Char *p;
p = Strrchr(path, '/');
if (p == NULL) {
copyn(name, path, MAXNAMLEN);
dir[0] = '\0';
}
else {
copyn(name, ++p, MAXNAMLEN);
copyn(dir, path, p - path);
}
}
/* atp vmsposix - I need to remove all the setpwent
* getpwent endpwent stuff. VMS_POSIX has getpwnam getpwuid
* and getlogin. This needs fixing. (There is no access to
* pw->passwd in VMS - a secure system benefit :-| )
*/
static Char *
getitem(dir_fd, looking_for_lognames)
DIR *dir_fd;
int looking_for_lognames;
{
register struct passwd *pw;
register struct dirent *dirp;
if (looking_for_lognames) {
#ifdef _VMS_POSIX
return (NULL);
#else
if ((pw = getpwent()) == NULL)
return (NULL);
return (str2short(pw->pw_name));
#endif /* atp vmsposix */
}
if (dirp = readdir(dir_fd))
return (str2short(dirp->d_name));
return (NULL);
}
static void
free_items(items)
register Char **items;
{
register int i;
for (i = 0; items[i]; i++)
xfree((ptr_t) items[i]);
xfree((ptr_t) items);
}
#ifdef BSDSIGS
# define FREE_ITEMS(items) { \
sigmask_t omask;\
\
omask = sigblock(sigmask(SIGINT));\
free_items(items);\
items = NULL;\
(void) sigsetmask(omask);\
}
#else
# define FREE_ITEMS(items) { \
(void) sighold(SIGINT);\
free_items(items);\
items = NULL;\
(void) sigrelse(SIGINT);\
}
#endif /* BSDSIGS */
/*
* Perform a RECOGNIZE or LIST command on string "word".
*/
static int
tsearch(word, command, max_word_length)
Char *word;
( run in 2.037 seconds using v1.01-cache-2.11-cpan-5c0b1e786e0 )