Compare commits
No commits in common. "rawhide" and "f28" have entirely different histories.
2 changed files with 17 additions and 239 deletions
|
|
@ -1,154 +0,0 @@
|
|||
From 0b77330ccb9c5a819acd7ebd8efcbc9338b5f63e Mon Sep 17 00:00:00 2001
|
||||
From: Terje Rosten <terje.rosten@ntnu.no>
|
||||
Date: Sat, 1 Feb 2020 12:02:30 +0100
|
||||
Subject: [PATCH] Fix usage of global variables
|
||||
|
||||
---
|
||||
src/freq.c | 14 ++++++++------
|
||||
src/freq.h | 13 +++++--------
|
||||
src/main.c | 9 +++++----
|
||||
3 files changed, 18 insertions(+), 18 deletions(-)
|
||||
|
||||
diff --git a/src/freq.c b/src/freq.c
|
||||
index 271af9d..2d68650 100644
|
||||
--- a/src/freq.c
|
||||
+++ b/src/freq.c
|
||||
@@ -19,6 +19,8 @@
|
||||
#include <stdlib.h>
|
||||
#include "freq.h"
|
||||
|
||||
+Wordlist * wordhash[NHASH];
|
||||
+
|
||||
/*
|
||||
* Since wf is not managing character sets using somehting like libiconv to an
|
||||
* internal representation (it assumes ISO-LATIN-1) it is necessary to handle
|
||||
@@ -86,7 +88,7 @@ addword_source(Wordsource *w, char *orig)
|
||||
}
|
||||
|
||||
int
|
||||
-addword (char *orig, char *name)
|
||||
+addword (char *orig, char *name, struct opttable opt)
|
||||
{
|
||||
int h;
|
||||
char * text;
|
||||
@@ -129,20 +131,20 @@ worddump_source(Wordsource *w)
|
||||
}
|
||||
|
||||
void
|
||||
-worddump (void)
|
||||
+worddump (struct opttable opt)
|
||||
{
|
||||
Wordlist *w;
|
||||
int h;
|
||||
|
||||
for (h = 0; h < NHASH; h++)
|
||||
for (w = wordhash[h]; w != NULL; w = w->next) {
|
||||
- do_output(w);
|
||||
+ do_output(w, opt);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
void
|
||||
-wordsort (int amount)
|
||||
+wordsort (int amount, struct opttable opt)
|
||||
{
|
||||
Wordlist *w, *r;
|
||||
Wordlist **u,**t;
|
||||
@@ -164,14 +166,14 @@ wordsort (int amount)
|
||||
for (h = 0; h < amount; h++)
|
||||
{
|
||||
r = t[h];
|
||||
- do_output(r);
|
||||
+ do_output(r, opt);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void
|
||||
-do_output (Wordlist *w)
|
||||
+do_output (Wordlist *w, struct opttable opt)
|
||||
{
|
||||
if (w->count < opt.min_count)
|
||||
return;
|
||||
diff --git a/src/freq.h b/src/freq.h
|
||||
index 8666930..38938ee 100644
|
||||
--- a/src/freq.h
|
||||
+++ b/src/freq.h
|
||||
@@ -8,7 +8,7 @@ struct opttable {
|
||||
int per_word;
|
||||
int min_length;
|
||||
char *fname;
|
||||
-} opt;
|
||||
+};
|
||||
|
||||
/*
|
||||
* ISO-8858 Interest character table
|
||||
@@ -108,17 +108,14 @@ struct Wordlist {
|
||||
Wordsource *source;
|
||||
};
|
||||
|
||||
-Wordlist * wordhash[NHASH];
|
||||
-Wordsource * wordhash_orig[NHASH];
|
||||
-
|
||||
/* freq.c */
|
||||
int wf_isalpha(unsigned char c);
|
||||
int wf_tolower(unsigned char c);
|
||||
void str_tolower(char *);
|
||||
unsigned int hash(char *);
|
||||
-int addword(char *, char *);
|
||||
+int addword(char *, char *, struct opttable opt);
|
||||
int cmpword(const void *, const void *);
|
||||
-void worddump(void);
|
||||
-void wordsort(int);
|
||||
-void do_output(Wordlist *w);
|
||||
+void worddump(struct opttable opt);
|
||||
+void wordsort(int, struct opttable opt);
|
||||
+void do_output(Wordlist *w, struct opttable opt);
|
||||
|
||||
diff --git a/src/main.c b/src/main.c
|
||||
index 7b4bcb9..b6b163d 100644
|
||||
--- a/src/main.c
|
||||
+++ b/src/main.c
|
||||
@@ -28,7 +28,6 @@
|
||||
#define GT(str) gettext(str)
|
||||
|
||||
/* Default Options */
|
||||
-struct opttable opt = { 0, 0, 0, 0, 0, 0, 0, NULL };
|
||||
|
||||
struct option long_options[] =
|
||||
{
|
||||
@@ -62,6 +61,8 @@ int
|
||||
main (int argc, char *argv[])
|
||||
{
|
||||
/* Option parsing */
|
||||
+ struct opttable opt = { 0, 0, 0, 0, 0, 0, 0, NULL };
|
||||
+
|
||||
int c;
|
||||
int digit_optind = 0;
|
||||
int i;
|
||||
@@ -178,7 +179,7 @@ main (int argc, char *argv[])
|
||||
str_tolower(buf);
|
||||
|
||||
if (c >= opt.min_length) {
|
||||
- if (addword(buf_orig, buf))
|
||||
+ if (addword(buf_orig, buf, opt))
|
||||
wcount++;
|
||||
}
|
||||
|
||||
@@ -196,9 +197,9 @@ main (int argc, char *argv[])
|
||||
|
||||
/* Output result with choosen ordering option */
|
||||
if (opt.sort)
|
||||
- wordsort(wcount);
|
||||
+ wordsort(wcount, opt);
|
||||
else
|
||||
- worddump();
|
||||
+ worddump(opt);
|
||||
|
||||
fprintf(stderr, "Total words: %d\n",wcount);
|
||||
|
||||
--
|
||||
2.24.1
|
||||
|
||||
102
wf.spec
102
wf.spec
|
|
@ -1,102 +1,34 @@
|
|||
Summary: Simple word frequency counter
|
||||
Name: wf
|
||||
Version: 0.41
|
||||
Release: 39%{?dist}
|
||||
# Automatically converted from old format: GPLv2 - review is highly recommended.
|
||||
License: GPL-2.0-only
|
||||
URL: http://www.async.com.br/~marcelo/wf/
|
||||
Source0: http://www.async.com.br/~marcelo/wf/wf-%{version}.tar.bz2
|
||||
Patch0: 0001-Fix-usage-of-global-variables.patch
|
||||
BuildRequires: make
|
||||
BuildRequires: gcc
|
||||
Summary: Simple word frequency counter
|
||||
Name: wf
|
||||
Version: 0.41
|
||||
Release: 17%{?dist}
|
||||
License: GPLv2
|
||||
Group: Applications/Text
|
||||
URL: http://www.async.com.br/~marcelo/%{name}/
|
||||
Source0: http://www.async.com.br/~marcelo/%{name}/%{name}-%{version}.tar.bz2
|
||||
|
||||
%description
|
||||
wf scans a text file and counts the frequency of words through the
|
||||
whole text.
|
||||
|
||||
%prep
|
||||
%autosetup -p1
|
||||
%setup -q
|
||||
|
||||
%build
|
||||
%configure
|
||||
%make_build
|
||||
%{__make} %{?_smp_mflags}
|
||||
|
||||
%install
|
||||
%make_install
|
||||
%{__rm} -rf %{buildroot}
|
||||
%{__make} DESTDIR=%{buildroot} INSTALL="%{__install} -p" install
|
||||
|
||||
%files
|
||||
%license COPYING
|
||||
%doc AUTHORS ChangeLog NEWS README TODO
|
||||
%{_bindir}/wf
|
||||
%{_mandir}/man1/wf.1*
|
||||
%defattr(-, root, root, -)
|
||||
%doc AUTHORS ChangeLog COPYING NEWS README TODO
|
||||
%{_bindir}/%{name}
|
||||
%{_mandir}/man1/%{name}.1*
|
||||
|
||||
%changelog
|
||||
* Fri Jul 17 2026 Fedora Release Engineering <releng@fedoraproject.org> - 0.41-39
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_45_Mass_Rebuild
|
||||
|
||||
* Sat Jan 17 2026 Fedora Release Engineering <releng@fedoraproject.org> - 0.41-38
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_44_Mass_Rebuild
|
||||
|
||||
* Fri Jul 25 2025 Fedora Release Engineering <releng@fedoraproject.org> - 0.41-37
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild
|
||||
|
||||
* Sun Jan 19 2025 Fedora Release Engineering <releng@fedoraproject.org> - 0.41-36
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild
|
||||
|
||||
* Mon Jul 29 2024 Miroslav Suchý <msuchy@redhat.com> - 0.41-35
|
||||
- convert license to SPDX
|
||||
|
||||
* Sat Jul 20 2024 Fedora Release Engineering <releng@fedoraproject.org> - 0.41-34
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild
|
||||
|
||||
* Sun Jun 30 2024 Terje Rosten <terje.rosten@ntnu.no> - 0.41-33
|
||||
- Use autosetup macro
|
||||
|
||||
* Sat Jan 27 2024 Fedora Release Engineering <releng@fedoraproject.org> - 0.41-32
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
|
||||
|
||||
* Sat Jul 22 2023 Fedora Release Engineering <releng@fedoraproject.org> - 0.41-31
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild
|
||||
|
||||
* Sat Jan 21 2023 Fedora Release Engineering <releng@fedoraproject.org> - 0.41-30
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild
|
||||
|
||||
* Sat Jul 23 2022 Fedora Release Engineering <releng@fedoraproject.org> - 0.41-29
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild
|
||||
|
||||
* Sat Jan 22 2022 Fedora Release Engineering <releng@fedoraproject.org> - 0.41-28
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild
|
||||
|
||||
* Fri Jul 23 2021 Fedora Release Engineering <releng@fedoraproject.org> - 0.41-27
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild
|
||||
|
||||
* Wed Jan 27 2021 Fedora Release Engineering <releng@fedoraproject.org> - 0.41-26
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
|
||||
|
||||
* Wed Jul 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 0.41-25
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
|
||||
|
||||
* Tue Jul 14 2020 Tom Stellard <tstellar@redhat.com> - 0.41-24
|
||||
- Use make macros
|
||||
- https://fedoraproject.org/wiki/Changes/UseMakeBuildInstallMacro
|
||||
|
||||
* Sat Feb 01 2020 Terje Rosten <terje.rosten@ntnu.no> - 0.41-23
|
||||
- Fix GCC 10 ftbfs
|
||||
|
||||
* Fri Jan 31 2020 Fedora Release Engineering <releng@fedoraproject.org> - 0.41-22
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
|
||||
|
||||
* Sat Jul 27 2019 Fedora Release Engineering <releng@fedoraproject.org> - 0.41-21
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
|
||||
|
||||
* Sun Feb 03 2019 Fedora Release Engineering <releng@fedoraproject.org> - 0.41-20
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
|
||||
|
||||
* Mon Jul 16 2018 Terje Rosten <terje.rosten@ntnu.no> - 0.41-19
|
||||
- Add C compiler
|
||||
|
||||
* Sat Jul 14 2018 Fedora Release Engineering <releng@fedoraproject.org> - 0.41-18
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
|
||||
|
||||
* Fri Feb 09 2018 Fedora Release Engineering <releng@fedoraproject.org> - 0.41-17
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue